Freeswitch-branches
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
May 2008
- 2 participants
- 12 discussions
Author: sphere
Date: Thu May 29 09:44:27 2008
New Revision: 8717
Added:
freeswitch/branches/justine/
Log:
1
0
[commit] r8702 - freeswitch/branches/lukedashjr/syslibs/freeswitch/htdocs
by Freeswitch SVN 27 May '08
by Freeswitch SVN 27 May '08
27 May '08
Author: lukedashjr
Date: Tue May 27 16:47:06 2008
New Revision: 8702
Added:
freeswitch/branches/lukedashjr/syslibs/freeswitch/htdocs/slimtest.htm
- copied unchanged from r8701, /freeswitch/tags/1.0.0/htdocs/slimtest.htm
Log:
Not sure why I was missing that
1
0
Author: lukedashjr
Date: Tue May 27 07:24:06 2008
New Revision: 8692
Added:
freeswitch/branches/lukedashjr/syslibs/freeswitch/build/gen_indent.pl
- copied unchanged from r8691, /freeswitch/tags/1.0.0/build/gen_indent.pl
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/API.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/Event.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/IVRMenu.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_t.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_event_t.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_priority_t.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_priority_t.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_size_t.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_size_t.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_stream_handle_t.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/SWIGTYPE_p_switch_stream_handle_t.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/Stream.java
- copied unchanged from r8691, /freeswitch/tags/1.0.0/src/mod/languages/mod_java/src/org/freeswitch/swig/Stream.java
Removed:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_rsa/
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/build/indent_options.sh
freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/Doxygen.conf
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/SimpleGlob.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/expreval.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprfunc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprinit.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprmem.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprobj.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprpars.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprutil.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprval.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_skel/mod_skel.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax-mutex.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax2-parser.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/jitterbuf.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/md5.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/lib_api.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/ss7boost_client.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/testapp.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_test/mod_event_test.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_extra.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_extra.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/perlxsi.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_swig.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c
freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/src/lpc10_decode.c
Log:
MERGE to: http://svn.freeswitch.org/svn/freeswitch/tags/1.0.0
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/indent_options.sh
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/indent_options.sh (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/indent_options.sh Tue May 27 07:24:06 2008
@@ -1,4 +1,5 @@
#!/bin/bash
echo -n "-brs -npsl -di0 -br -ce -d0 -cli0 -npcs -nfc1 -ut -i4 -ts4 -l155 -cs -T size_t " > ./.indent.pro
-grep typedef ./src/include/*.h | grep switch_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
+grep typedef `find ./src/include/ -name \*.h` | grep apr_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
+grep typedef `find ./src/include/ -name \*.h` | grep switch_ | grep -v "\*\|{" | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
grep "} switch_" ./src/include/*.h | perl -ne '@l = split; $l[1] =~ s/;//g ; print " -T $l[1] "' >> ./.indent.pro
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in Tue May 27 07:24:06 2008
@@ -3,12 +3,12 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.0.pre4], BUG-REPORT-ADDRESS)
+AC_INIT([freeswitch], [1.0.0], BUG-REPORT-ADDRESS)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0])
-AC_SUBST(SWITCH_VERSION_MICRO, [pre4])
-#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
-AC_SUBST(SOUNDS_VERSION, [1.0.1])
+AC_SUBST(SWITCH_VERSION_MICRO, [0])
+AC_SUBST(SWITCH_VERSION_REVISION, [8691])
+AC_SUBST(SOUNDS_VERSION, [1.0.2])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog Tue May 27 07:24:06 2008
@@ -1,3 +1,33 @@
+freeswitch (1.0.0-1) unstable; urgency=low
+
+ * Enhanced sofia sip nat handling
+ * Many fixes found by Klockwork (www.klocwork.com)
+ * Added disable_app_log variable
+ * Fixed mod_local_stream with rates on windows
+ * Fixed finding of files in rate dirs on windows
+ * Fixed memory corruption from sofia_contact function
+ * Added sofia profile param NDLB-received-in-nat-reg-contact
+ * Added sofia profile param aggressive-nat-detection
+ * Fixed video sip calls in proxy media mode
+ * Added bridge_terminate_key var
+ * Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc
+ * Enhanced nat handling in proxy media mode in sip
+ * Add progress media to timetable so you can calculate pdd
+ * Fixed seg when using unicast on socket when call has no read_codec
+ * Fixed missed log events on busy box
+ * Added -bleg to intercept
+ * Enhance configure detection of python
+ * Fixed build on solaris and freebsd for several modules
+ * Added param "vm-email-only" to make voicemail sent by email only (previously default behavior)
+ * Added param "vm-mailto-notify" to allow sending a notification email
+ * Fixed mod_java build
+ * Fixed mwi failures for some devices that don't subscribe
+ * Removed fsapi functions (killchan, transfer, session_displace, reject)
+ * Removed fsapi functions (session_record, broadcast, hold, media)
+ * Many updates to sofia-sip library including over 100 fixes
+
+ -- Michael Jerris <mike(a)jerris.com> Tue, 27 May 2008 01:30:00 -0400
+
freeswitch (1.0~rc6-1) unstable; urgency=low
* Changed to not allow pass_2833 on transcoded calls
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog Tue May 27 07:24:06 2008
@@ -1,4 +1,33 @@
+freeswitch (1.0.0)
+
+ Enhanced sofia sip nat handling
+ Many fixes found by Klockwork (www.klocwork.com)
+ Added disable_app_log variable
+ Fixed mod_local_stream with rates on windows
+ Fixed finding of files in rate dirs on windows
+ Fixed memory corruption from sofia_contact function
+ Added sofia profile param NDLB-received-in-nat-reg-contact
+ Added sofia profile param aggressive-nat-detection
+ Fixed video sip calls in proxy media mode
+ Added bridge_terminate_key var
+ Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc
+ Enhanced nat handling in proxy media mode in sip
+ Add progress media to timetable so you can calculate pdd
+ Fixed seg when using unicast on socket when call has no read_codec
+ Fixed missed log events on busy box
+ Added -bleg to intercept
+ Enhance configure detection of python
+ Fixed build on solaris and freebsd for several modules
+ Added param "vm-email-only" to make voicemail sent by email only (previously default behavior)
+ Added param "vm-mailto-notify" to allow sending a notification email
+ Fixed mod_java build
+ Fixed mwi failures for some devices that don't subscribe
+ Removed fsapi functions (killchan, transfer, session_displace, reject)
+ Removed fsapi functions (session_record, broadcast, hold, media)
+ Many updates to sofia-sip library including over 100 fixes
+
freeswitch (1.0.rc6)
+
Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
Enhanced sofia sip nat handling
Fix libedit build on solaris
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/Doxygen.conf
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/Doxygen.conf (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/Doxygen.conf Tue May 27 07:24:06 2008
@@ -3,8 +3,8 @@
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-PROJECT_NAME = FreeSwitch
-PROJECT_NUMBER =
+PROJECT_NAME = FreeSWITCH
+PROJECT_NUMBER = 1.0.0
OUTPUT_DIRECTORY = .
CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
@@ -30,7 +30,7 @@
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
+DETAILS_AT_TOP = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 8
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/SimpleGlob.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/SimpleGlob.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/SimpleGlob.h Tue May 27 07:24:06 2008
@@ -123,23 +123,23 @@
Do not return the "." or ".." special directories.
*/
enum SG_Flags {
- SG_GLOB_ERR = 1 << 0,
- SG_GLOB_MARK = 1 << 1,
- SG_GLOB_NOSORT = 1 << 2,
- SG_GLOB_NOCHECK = 1 << 3,
- SG_GLOB_TILDE = 1 << 4,
- SG_GLOB_ONLYDIR = 1 << 5,
- SG_GLOB_ONLYFILE = 1 << 6,
- SG_GLOB_NODOT = 1 << 7,
- SG_GLOB_FULLSORT = 1 << 8
+ SG_GLOB_ERR = 1 << 0,
+ SG_GLOB_MARK = 1 << 1,
+ SG_GLOB_NOSORT = 1 << 2,
+ SG_GLOB_NOCHECK = 1 << 3,
+ SG_GLOB_TILDE = 1 << 4,
+ SG_GLOB_ONLYDIR = 1 << 5,
+ SG_GLOB_ONLYFILE = 1 << 6,
+ SG_GLOB_NODOT = 1 << 7,
+ SG_GLOB_FULLSORT = 1 << 8
};
/*! @brief Error return codes */
enum SG_Error {
- SG_SUCCESS = 0,
- SG_ERR_NOMATCH = 1,
- SG_ERR_MEMORY = -1,
- SG_ERR_FAILURE = -2
+ SG_SUCCESS = 0,
+ SG_ERR_NOMATCH = 1,
+ SG_ERR_MEMORY = -1,
+ SG_ERR_FAILURE = -2
};
// ----------------------------------------------------------------------------
@@ -196,61 +196,63 @@
#endif
/*! @brief String manipulation functions. */
-class SimpleGlobUtil
-{
-public:
- static const char * strchr(const char *s, char c) {
- return (char *) sg_strchr((const SOCHAR_T *)s, c);
- }
- static const wchar_t * strchr(const wchar_t *s, wchar_t c) {
- return ::wcschr(s, c);
- }
-
- static const char * strrchr(const char *s, char c) {
- return (char *) sg_strrchr((const SOCHAR_T *)s, c);
- }
- static const wchar_t * strrchr(const wchar_t *s, wchar_t c) {
- return ::wcsrchr(s, c);
- }
-
- // Note: char strlen returns number of bytes, not characters
- static size_t strlen(const char *s) { return ::strlen(s); }
- static size_t strlen(const wchar_t *s) { return ::wcslen(s); }
-
- static void strcpy_s(char *dst, size_t n, const char *src) {
- (void) n;
- sg_strcpy_s((SOCHAR_T *)dst, n, (const SOCHAR_T *)src);
- }
- static void strcpy_s(wchar_t *dst, size_t n, const wchar_t *src) {
+class SimpleGlobUtil {
+ public:
+ static const char *strchr(const char *s, char c) {
+ return (char *) sg_strchr((const SOCHAR_T *) s, c);
+ } static const wchar_t *strchr(const wchar_t *s, wchar_t c) {
+ return::wcschr(s, c);
+ }
+
+ static const char *strrchr(const char *s, char c) {
+ return (char *) sg_strrchr((const SOCHAR_T *) s, c);
+ }
+ static const wchar_t *strrchr(const wchar_t *s, wchar_t c) {
+ return::wcsrchr(s, c);
+ }
+
+ // Note: char strlen returns number of bytes, not characters
+ static size_t strlen(const char *s) {
+ return::strlen(s);
+ }
+ static size_t strlen(const wchar_t *s) {
+ return::wcslen(s);
+ }
+
+ static void strcpy_s(char *dst, size_t n, const char *src) {
+ (void) n;
+ sg_strcpy_s((SOCHAR_T *) dst, n, (const SOCHAR_T *) src);
+ }
+ static void strcpy_s(wchar_t *dst, size_t n, const wchar_t *src) {
# if __STDC_WANT_SECURE_LIB__
- ::wcscpy_s(dst, n, src);
+ ::wcscpy_s(dst, n, src);
#else
- (void) n;
- ::wcscpy(dst, src);
+ (void) n;
+ ::wcscpy(dst, src);
#endif
- }
+ }
- static int strcmp(const char *s1, const char *s2) {
- return sg_strcmp((const SOCHAR_T *)s1, (const SOCHAR_T *)s2);
- }
- static int strcmp(const wchar_t *s1, const wchar_t *s2) {
- return ::wcscmp(s1, s2);
- }
-
- static int strcasecmp(const char *s1, const char *s2) {
- return sg_strcasecmp((const SOCHAR_T *)s1, (const SOCHAR_T *)s2);
- }
+ static int strcmp(const char *s1, const char *s2) {
+ return sg_strcmp((const SOCHAR_T *) s1, (const SOCHAR_T *) s2);
+ }
+ static int strcmp(const wchar_t *s1, const wchar_t *s2) {
+ return::wcscmp(s1, s2);
+ }
+
+ static int strcasecmp(const char *s1, const char *s2) {
+ return sg_strcasecmp((const SOCHAR_T *) s1, (const SOCHAR_T *) s2);
+ }
#if _WIN32
- static int strcasecmp(const wchar_t *s1, const wchar_t *s2) {
- return ::_wcsicmp(s1, s2);
- }
+ static int strcasecmp(const wchar_t *s1, const wchar_t *s2) {
+ return::_wcsicmp(s1, s2);
+ }
#endif // _WIN32
};
enum SG_FileType {
- SG_FILETYPE_INVALID,
- SG_FILETYPE_FILE,
- SG_FILETYPE_DIR
+ SG_FILETYPE_INVALID,
+ SG_FILETYPE_FILE,
+ SG_FILETYPE_DIR
};
#ifdef _WIN32
@@ -262,79 +264,70 @@
#define SG_PATH_CHAR '\\'
/*! @brief Windows glob implementation. */
-template<class SOCHAR>
-struct SimpleGlobBase
-{
- SimpleGlobBase() : m_hFind(INVALID_HANDLE_VALUE) { }
-
- int FindFirstFileS(const char * a_pszFileSpec, unsigned int) {
- m_hFind = FindFirstFileA(a_pszFileSpec, &m_oFindDataA);
- if (m_hFind != INVALID_HANDLE_VALUE) {
- return SG_SUCCESS;
- }
- DWORD dwErr = GetLastError();
- if (dwErr == ERROR_FILE_NOT_FOUND) {
- return SG_ERR_NOMATCH;
- }
- return SG_ERR_FAILURE;
- }
- int FindFirstFileS(const wchar_t * a_pszFileSpec, unsigned int) {
- m_hFind = FindFirstFileW(a_pszFileSpec, &m_oFindDataW);
- if (m_hFind != INVALID_HANDLE_VALUE) {
- return SG_SUCCESS;
- }
- DWORD dwErr = GetLastError();
- if (dwErr == ERROR_FILE_NOT_FOUND) {
- return SG_ERR_NOMATCH;
- }
- return SG_ERR_FAILURE;
- }
-
- bool FindNextFileS(char) {
- return FindNextFileA(m_hFind, &m_oFindDataA) != FALSE;
- }
- bool FindNextFileS(wchar_t) {
- return FindNextFileW(m_hFind, &m_oFindDataW) != FALSE;
- }
-
- void FindDone() {
- FindClose(m_hFind);
- }
-
- const char * GetFileNameS(char) const {
- return m_oFindDataA.cFileName;
- }
- const wchar_t * GetFileNameS(wchar_t) const {
- return m_oFindDataW.cFileName;
- }
-
- bool IsDirS(char) const {
- return GetFileTypeS(m_oFindDataA.dwFileAttributes) == SG_FILETYPE_DIR;
- }
- bool IsDirS(wchar_t) const {
- return GetFileTypeS(m_oFindDataW.dwFileAttributes) == SG_FILETYPE_DIR;
- }
-
- SG_FileType GetFileTypeS(const char * a_pszPath) {
- return GetFileTypeS(GetFileAttributesA(a_pszPath));
- }
- SG_FileType GetFileTypeS(const wchar_t * a_pszPath) {
- return GetFileTypeS(GetFileAttributesW(a_pszPath));
- }
- SG_FileType GetFileTypeS(DWORD a_dwAttribs) const {
- if (a_dwAttribs == INVALID_FILE_ATTRIBUTES) {
- return SG_FILETYPE_INVALID;
- }
- if (a_dwAttribs & FILE_ATTRIBUTE_DIRECTORY) {
- return SG_FILETYPE_DIR;
- }
- return SG_FILETYPE_FILE;
- }
-
-private:
- HANDLE m_hFind;
- WIN32_FIND_DATAA m_oFindDataA;
- WIN32_FIND_DATAW m_oFindDataW;
+template < class SOCHAR > struct SimpleGlobBase {
+ SimpleGlobBase():m_hFind(INVALID_HANDLE_VALUE) {
+ } int FindFirstFileS(const char *a_pszFileSpec, unsigned int) {
+ m_hFind = FindFirstFileA(a_pszFileSpec, &m_oFindDataA);
+ if (m_hFind != INVALID_HANDLE_VALUE) {
+ return SG_SUCCESS;
+ }
+ DWORD dwErr = GetLastError();
+ if (dwErr == ERROR_FILE_NOT_FOUND) {
+ return SG_ERR_NOMATCH;
+ }
+ return SG_ERR_FAILURE;
+ }
+ int FindFirstFileS(const wchar_t *a_pszFileSpec, unsigned int) {
+ m_hFind = FindFirstFileW(a_pszFileSpec, &m_oFindDataW);
+ if (m_hFind != INVALID_HANDLE_VALUE) {
+ return SG_SUCCESS;
+ }
+ DWORD dwErr = GetLastError();
+ if (dwErr == ERROR_FILE_NOT_FOUND) {
+ return SG_ERR_NOMATCH;
+ }
+ return SG_ERR_FAILURE;
+ }
+
+ bool FindNextFileS(char) {
+ return FindNextFileA(m_hFind, &m_oFindDataA) != FALSE;
+ }
+ bool FindNextFileS(wchar_t) {
+ return FindNextFileW(m_hFind, &m_oFindDataW) != FALSE;
+ }
+
+ void FindDone() {
+ FindClose(m_hFind);
+ }
+
+ const char *GetFileNameS(char) const {
+ return m_oFindDataA.cFileName;
+ } const wchar_t *GetFileNameS(wchar_t) const {
+ return m_oFindDataW.cFileName;
+ } bool IsDirS(char) const {
+ return GetFileTypeS(m_oFindDataA.dwFileAttributes) == SG_FILETYPE_DIR;
+ } bool IsDirS(wchar_t) const {
+ return GetFileTypeS(m_oFindDataW.dwFileAttributes) == SG_FILETYPE_DIR;
+ } SG_FileType GetFileTypeS(const char *a_pszPath) {
+ return GetFileTypeS(GetFileAttributesA(a_pszPath));
+ }
+ SG_FileType GetFileTypeS(const wchar_t *a_pszPath) {
+ return GetFileTypeS(GetFileAttributesW(a_pszPath));
+ }
+ SG_FileType GetFileTypeS(DWORD a_dwAttribs) const {
+ if (a_dwAttribs == INVALID_FILE_ATTRIBUTES) {
+ return SG_FILETYPE_INVALID;
+ }
+ if (a_dwAttribs & FILE_ATTRIBUTE_DIRECTORY) {
+ return SG_FILETYPE_DIR;
+ }
+ return SG_FILETYPE_FILE;
+ }
+
+ private:
+ HANDLE m_hFind;
+ WIN32_FIND_DATAA m_oFindDataA;
+ WIN32_FIND_DATAW m_oFindDataW;
};
#else // !_WIN32
@@ -342,85 +335,82 @@
#define SG_PATH_CHAR '/'
/*! @brief Unix glob implementation. */
-template<class SOCHAR>
-struct SimpleGlobBase
-{
- SimpleGlobBase() {
- memset(&m_glob, 0, sizeof(m_glob));
- m_uiCurr = (size_t)-1;
- }
-
- ~SimpleGlobBase() {
- globfree(&m_glob);
- }
-
- void FilePrep() {
- m_bIsDir = false;
- size_t len = strlen(m_glob.gl_pathv[m_uiCurr]);
- if (m_glob.gl_pathv[m_uiCurr][len-1] == '/') {
- m_bIsDir = true;
- m_glob.gl_pathv[m_uiCurr][len-1] = 0;
- }
- }
-
- int FindFirstFileS(const char * a_pszFileSpec, unsigned int a_uiFlags) {
- int nFlags = GLOB_MARK | GLOB_NOSORT;
- if (a_uiFlags & SG_GLOB_ERR) nFlags |= GLOB_ERR;
+template < class SOCHAR > struct SimpleGlobBase {
+ SimpleGlobBase() {
+ memset(&m_glob, 0, sizeof(m_glob));
+ m_uiCurr = (size_t) -1;
+ } ~SimpleGlobBase() {
+ globfree(&m_glob);
+ }
+
+ void FilePrep() {
+ m_bIsDir = false;
+ size_t len = strlen(m_glob.gl_pathv[m_uiCurr]);
+ if (m_glob.gl_pathv[m_uiCurr][len - 1] == '/') {
+ m_bIsDir = true;
+ m_glob.gl_pathv[m_uiCurr][len - 1] = 0;
+ }
+ }
+
+ int FindFirstFileS(const char *a_pszFileSpec, unsigned int a_uiFlags) {
+ int nFlags = GLOB_MARK | GLOB_NOSORT;
+ if (a_uiFlags & SG_GLOB_ERR)
+ nFlags |= GLOB_ERR;
#ifdef GLOB_TILDE
- if (a_uiFlags & SG_GLOB_TILDE) nFlags |= GLOB_TILDE;
+ if (a_uiFlags & SG_GLOB_TILDE)
+ nFlags |= GLOB_TILDE;
#endif
- int rc = glob(a_pszFileSpec, nFlags, NULL, &m_glob);
- if (rc == GLOB_NOSPACE) return SG_ERR_MEMORY;
- if (rc == GLOB_ABORTED) return SG_ERR_FAILURE;
- if (rc == GLOB_NOMATCH) return SG_ERR_NOMATCH;
- m_uiCurr = 0;
- FilePrep();
- return SG_SUCCESS;
- }
-
- bool FindNextFileS(char) {
- SG_ASSERT(m_uiCurr != (size_t)-1);
- if (++m_uiCurr >= m_glob.gl_pathc) {
- return false;
- }
- FilePrep();
- return true;
- }
-
- void FindDone() {
- globfree(&m_glob);
- memset(&m_glob, 0, sizeof(m_glob));
- m_uiCurr = (size_t)-1;
- }
-
- const char * GetFileNameS(char) const {
- SG_ASSERT(m_uiCurr != (size_t)-1);
- return m_glob.gl_pathv[m_uiCurr];
- }
-
- bool IsDirS(char) const {
- SG_ASSERT(m_uiCurr != (size_t)-1);
- return m_bIsDir;
- }
-
- SG_FileType GetFileTypeS(const char * a_pszPath) const {
- struct stat sb;
- if (0 != stat(a_pszPath, &sb)) {
- return SG_FILETYPE_INVALID;
- }
- if (S_ISDIR(sb.st_mode)) {
- return SG_FILETYPE_DIR;
- }
- if (S_ISREG(sb.st_mode)) {
- return SG_FILETYPE_FILE;
- }
- return SG_FILETYPE_INVALID;
- }
-
-private:
- glob_t m_glob;
- size_t m_uiCurr;
- bool m_bIsDir;
+ int rc = glob(a_pszFileSpec, nFlags, NULL, &m_glob);
+ if (rc == GLOB_NOSPACE)
+ return SG_ERR_MEMORY;
+ if (rc == GLOB_ABORTED)
+ return SG_ERR_FAILURE;
+ if (rc == GLOB_NOMATCH)
+ return SG_ERR_NOMATCH;
+ m_uiCurr = 0;
+ FilePrep();
+ return SG_SUCCESS;
+ }
+
+ bool FindNextFileS(char) {
+ SG_ASSERT(m_uiCurr != (size_t) -1);
+ if (++m_uiCurr >= m_glob.gl_pathc) {
+ return false;
+ }
+ FilePrep();
+ return true;
+ }
+
+ void FindDone() {
+ globfree(&m_glob);
+ memset(&m_glob, 0, sizeof(m_glob));
+ m_uiCurr = (size_t) -1;
+ }
+
+ const char *GetFileNameS(char) const {
+ SG_ASSERT(m_uiCurr != (size_t) -1);
+ return m_glob.gl_pathv[m_uiCurr];
+ } bool IsDirS(char) const {
+ SG_ASSERT(m_uiCurr != (size_t) -1);
+ return m_bIsDir;
+ } SG_FileType GetFileTypeS(const char *a_pszPath) const {
+ struct stat sb;
+ if (0 != stat(a_pszPath, &sb)) {
+ return SG_FILETYPE_INVALID;
+ }
+ if (S_ISDIR(sb.st_mode)) {
+ return SG_FILETYPE_DIR;
+ }
+ if (S_ISREG(sb.st_mode)) {
+ return SG_FILETYPE_FILE;
+ }
+ return SG_FILETYPE_INVALID;
+ }
+
+ private:
+ glob_t m_glob;
+ size_t m_uiCurr;
+ bool m_bIsDir;
};
#endif // _WIN32
@@ -432,419 +422,366 @@
// ---------------------------------------------------------------------------
/*! @brief Implementation of the SimpleGlob class */
-template<class SOCHAR>
-class CSimpleGlobTempl : private SimpleGlobBase<SOCHAR>
-{
-public:
- /*! @brief Initialize the class.
-
- @param a_uiFlags Combination of SG_GLOB flags.
- @param a_nReservedSlots Number of slots in the argv array that
- should be reserved. In the returned array these slots
- argv[0] ... argv[a_nReservedSlots-1] will be left empty for
- the caller to fill in.
- */
- CSimpleGlobTempl(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
-
- /*! @brief Deallocate all memory buffers. */
- ~CSimpleGlobTempl();
-
- /*! @brief Initialize (or re-initialize) the class in preparation for
- adding new filespecs.
-
- All existing files are cleared. Note that allocated memory is only
- deallocated at object destruction.
-
- @param a_uiFlags Combination of SG_GLOB flags.
- @param a_nReservedSlots Number of slots in the argv array that
- should be reserved. In the returned array these slots
- argv[0] ... argv[a_nReservedSlots-1] will be left empty for
- the caller to fill in.
- */
- int Init(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
-
- /*! @brief Add a new filespec to the glob.
-
- The filesystem will be immediately scanned for all matching files and
- directories and they will be added to the glob.
-
- @param a_pszFileSpec Filespec to add to the glob.
-
- @return SG_SUCCESS Matching files were added to the glob.
- @return SG_ERR_NOMATCH Nothing matched the pattern. To ignore this error
- compare the return value to >= SG_SUCCESS.
- @return SG_ERR_MEMORY Out of memory failure.
- @return SG_ERR_FAILURE General failure.
- */
- int Add(const SOCHAR *a_pszFileSpec);
-
- /*! @brief Add an array of filespec to the glob.
-
- The filesystem will be immediately scanned for all matching files and
- directories in each filespec and they will be added to the glob.
-
- @param a_nCount Number of filespec in the array.
- @param a_rgpszFileSpec Array of filespec to add to the glob.
-
- @return SG_SUCCESS Matching files were added to the glob.
- @return SG_ERR_NOMATCH Nothing matched the pattern. To ignore this error
- compare the return value to >= SG_SUCCESS.
- @return SG_ERR_MEMORY Out of memory failure.
- @return SG_ERR_FAILURE General failure.
- */
- int Add(int a_nCount, const SOCHAR * const * a_rgpszFileSpec);
-
- /*! @brief Return the number of files in the argv array.
- */
- inline int FileCount() const { return m_nArgsLen; }
-
- /*! @brief Return the full argv array. */
- inline SOCHAR ** Files() {
- SetArgvArrayType(POINTERS);
- return m_rgpArgs;
- }
-
- /*! @brief Return the a single file. */
- inline SOCHAR * File(int n) {
- SG_ASSERT(n >= 0 && n < m_nArgsLen);
- return Files()[n];
- }
-
-private:
- /*! @brief The argv array has it's members stored as either an offset into
- the string buffer, or as pointers to their string in the buffer. The offsets
- are used because if the string buffer is dynamically resized, all pointers
- into that buffer would become invalid.
- */
- enum ARG_ARRAY_TYPE { OFFSETS, POINTERS };
-
- /*! @brief Change the type of data stored in the argv array. */
- void SetArgvArrayType(ARG_ARRAY_TYPE a_nNewType);
-
- /*! @brief Add a filename to the array if it passes all requirements. */
- int AppendName(const SOCHAR *a_pszFileName, bool a_bIsDir);
-
- /*! @brief Grow the argv array to the required size. */
- bool GrowArgvArray(int a_nNewLen);
-
- /*! @brief Grow the string buffer to the required size. */
- bool GrowStringBuffer(size_t a_uiMinSize);
-
- /*! @brief Compare two (possible NULL) strings */
- static int fileSortCompare(const void *a1, const void *a2);
-
-private:
- unsigned int m_uiFlags;
- ARG_ARRAY_TYPE m_nArgArrayType; //!< is the argv array storing indexes or pointers
- SOCHAR ** m_rgpArgs; //!< argv array
- int m_nReservedSlots; //!< number of client reserved slots in the argv array
- int m_nArgsSize; //!< allocated size of array
- int m_nArgsLen; //!< used length
- SOCHAR * m_pBuffer; //!< argv string buffer
- size_t m_uiBufferSize; //!< allocated size of buffer
- size_t m_uiBufferLen; //!< used length of buffer
- SOCHAR m_szPathPrefix[MAX_PATH]; //!< path prefix of any wildcard filenames
+template < class SOCHAR > class CSimpleGlobTempl:private SimpleGlobBase < SOCHAR > {
+ public:
+ /*! @brief Initialize the class.
+
+ @param a_uiFlags Combination of SG_GLOB flags.
+ @param a_nReservedSlots Number of slots in the argv array that
+ should be reserved. In the returned array these slots
+ argv[0] ... argv[a_nReservedSlots-1] will be left empty for
+ the caller to fill in.
+ */
+ CSimpleGlobTempl(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
+
+ /*! @brief Deallocate all memory buffers. */
+ ~CSimpleGlobTempl();
+
+ /*! @brief Initialize (or re-initialize) the class in preparation for
+ adding new filespecs.
+
+ All existing files are cleared. Note that allocated memory is only
+ deallocated at object destruction.
+
+ @param a_uiFlags Combination of SG_GLOB flags.
+ @param a_nReservedSlots Number of slots in the argv array that
+ should be reserved. In the returned array these slots
+ argv[0] ... argv[a_nReservedSlots-1] will be left empty for
+ the caller to fill in.
+ */
+ int Init(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
+
+ /*! @brief Add a new filespec to the glob.
+
+ The filesystem will be immediately scanned for all matching files and
+ directories and they will be added to the glob.
+
+ @param a_pszFileSpec Filespec to add to the glob.
+
+ @return SG_SUCCESS Matching files were added to the glob.
+ @return SG_ERR_NOMATCH Nothing matched the pattern. To ignore this error
+ compare the return value to >= SG_SUCCESS.
+ @return SG_ERR_MEMORY Out of memory failure.
+ @return SG_ERR_FAILURE General failure.
+ */
+ int Add(const SOCHAR * a_pszFileSpec);
+
+ /*! @brief Add an array of filespec to the glob.
+
+ The filesystem will be immediately scanned for all matching files and
+ directories in each filespec and they will be added to the glob.
+
+ @param a_nCount Number of filespec in the array.
+ @param a_rgpszFileSpec Array of filespec to add to the glob.
+
+ @return SG_SUCCESS Matching files were added to the glob.
+ @return SG_ERR_NOMATCH Nothing matched the pattern. To ignore this error
+ compare the return value to >= SG_SUCCESS.
+ @return SG_ERR_MEMORY Out of memory failure.
+ @return SG_ERR_FAILURE General failure.
+ */
+ int Add(int a_nCount, const SOCHAR * const *a_rgpszFileSpec);
+
+ /*! @brief Return the number of files in the argv array.
+ */
+ inline int FileCount() const {
+ return m_nArgsLen;
+ }
+ /*! @brief Return the full argv array. */ inline SOCHAR **Files() {
+ SetArgvArrayType(POINTERS);
+ return m_rgpArgs;
+ }
+
+ /*! @brief Return the a single file. */
+ inline SOCHAR *File(int n) {
+ SG_ASSERT(n >= 0 && n < m_nArgsLen);
+ return Files()[n];
+ }
+
+ private:
+ /*! @brief The argv array has it's members stored as either an offset into
+ the string buffer, or as pointers to their string in the buffer. The offsets
+ are used because if the string buffer is dynamically resized, all pointers
+ into that buffer would become invalid.
+ */
+ enum ARG_ARRAY_TYPE { OFFSETS, POINTERS };
+
+ /*! @brief Change the type of data stored in the argv array. */
+ void SetArgvArrayType(ARG_ARRAY_TYPE a_nNewType);
+
+ /*! @brief Add a filename to the array if it passes all requirements. */
+ int AppendName(const SOCHAR * a_pszFileName, bool a_bIsDir);
+
+ /*! @brief Grow the argv array to the required size. */
+ bool GrowArgvArray(int a_nNewLen);
+
+ /*! @brief Grow the string buffer to the required size. */
+ bool GrowStringBuffer(size_t a_uiMinSize);
+
+ /*! @brief Compare two (possible NULL) strings */
+ static int fileSortCompare(const void *a1, const void *a2);
+
+ private:
+ unsigned int m_uiFlags;
+ ARG_ARRAY_TYPE m_nArgArrayType; //!< is the argv array storing indexes or pointers
+ SOCHAR **m_rgpArgs; //!< argv array
+ int m_nReservedSlots; //!< number of client reserved slots in the argv array
+ int m_nArgsSize; //!< allocated size of array
+ int m_nArgsLen; //!< used length
+ SOCHAR *m_pBuffer; //!< argv string buffer
+ size_t m_uiBufferSize; //!< allocated size of buffer
+ size_t m_uiBufferLen; //!< used length of buffer
+ SOCHAR m_szPathPrefix[MAX_PATH]; //!< path prefix of any wildcard filenames
};
// ---------------------------------------------------------------------------
// IMPLEMENTATION
// ---------------------------------------------------------------------------
-template<class SOCHAR>
-CSimpleGlobTempl<SOCHAR>::CSimpleGlobTempl(
- unsigned int a_uiFlags,
- int a_nReservedSlots
- )
+template < class SOCHAR > CSimpleGlobTempl < SOCHAR >::CSimpleGlobTempl(unsigned int a_uiFlags, int a_nReservedSlots)
{
- m_rgpArgs = NULL;
- m_nArgsSize = 0;
- m_pBuffer = NULL;
- m_uiBufferSize = 0;
+ m_rgpArgs = NULL;
+ m_nArgsSize = 0;
+ m_pBuffer = NULL;
+ m_uiBufferSize = 0;
- Init(a_uiFlags, a_nReservedSlots);
+ Init(a_uiFlags, a_nReservedSlots);
}
-template<class SOCHAR>
-CSimpleGlobTempl<SOCHAR>::~CSimpleGlobTempl()
+template < class SOCHAR > CSimpleGlobTempl < SOCHAR >::~CSimpleGlobTempl()
{
- if (m_rgpArgs) free(m_rgpArgs);
- if (m_pBuffer) free(m_pBuffer);
+ if (m_rgpArgs)
+ free(m_rgpArgs);
+ if (m_pBuffer)
+ free(m_pBuffer);
}
-template<class SOCHAR>
-int
-CSimpleGlobTempl<SOCHAR>::Init(
- unsigned int a_uiFlags,
- int a_nReservedSlots
- )
+template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Init(unsigned int a_uiFlags, int a_nReservedSlots)
{
- m_nArgArrayType = POINTERS;
- m_uiFlags = a_uiFlags;
- m_nArgsLen = a_nReservedSlots;
- m_nReservedSlots = a_nReservedSlots;
- m_uiBufferLen = 0;
-
- if (m_nReservedSlots > 0) {
- if (!GrowArgvArray(m_nReservedSlots)) {
- return SG_ERR_MEMORY;
- }
- for (int n = 0; n < m_nReservedSlots; ++n) {
- m_rgpArgs[n] = NULL;
- }
- }
+ m_nArgArrayType = POINTERS;
+ m_uiFlags = a_uiFlags;
+ m_nArgsLen = a_nReservedSlots;
+ m_nReservedSlots = a_nReservedSlots;
+ m_uiBufferLen = 0;
+
+ if (m_nReservedSlots > 0) {
+ if (!GrowArgvArray(m_nReservedSlots)) {
+ return SG_ERR_MEMORY;
+ }
+ for (int n = 0; n < m_nReservedSlots; ++n) {
+ m_rgpArgs[n] = NULL;
+ }
+ }
- return SG_SUCCESS;
+ return SG_SUCCESS;
}
-template<class SOCHAR>
-int
-CSimpleGlobTempl<SOCHAR>::Add(
- const SOCHAR *a_pszFileSpec
- )
+template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Add(const SOCHAR * a_pszFileSpec)
{
#ifdef _WIN32
- // Windows FindFirst/FindNext recognizes forward slash as the same as backward slash
- // and follows the directories. We need to do the same when calculating the prefix
- // and when we have no wildcards.
- SOCHAR szFileSpec[MAX_PATH];
- SimpleGlobUtil::strcpy_s(szFileSpec, MAX_PATH, a_pszFileSpec);
- const SOCHAR * pszPath = SimpleGlobUtil::strchr(szFileSpec, '/');
- while (pszPath) {
- szFileSpec[pszPath - szFileSpec] = SG_PATH_CHAR;
- pszPath = SimpleGlobUtil::strchr(pszPath + 1, '/');
- }
- a_pszFileSpec = szFileSpec;
+ // Windows FindFirst/FindNext recognizes forward slash as the same as backward slash
+ // and follows the directories. We need to do the same when calculating the prefix
+ // and when we have no wildcards.
+ SOCHAR szFileSpec[MAX_PATH];
+ SimpleGlobUtil::strcpy_s(szFileSpec, MAX_PATH, a_pszFileSpec);
+ const SOCHAR *pszPath = SimpleGlobUtil::strchr(szFileSpec, '/');
+ while (pszPath) {
+ szFileSpec[pszPath - szFileSpec] = SG_PATH_CHAR;
+ pszPath = SimpleGlobUtil::strchr(pszPath + 1, '/');
+ }
+ a_pszFileSpec = szFileSpec;
#endif
- // if this doesn't contain wildcards then we can just add it directly
- m_szPathPrefix[0] = 0;
- if (!SimpleGlobUtil::strchr(a_pszFileSpec, '*') &&
- !SimpleGlobUtil::strchr(a_pszFileSpec, '?'))
- {
- SG_FileType nType = GetFileTypeS(a_pszFileSpec);
- if (nType == SG_FILETYPE_INVALID) {
- if (m_uiFlags & SG_GLOB_NOCHECK) {
- return AppendName(a_pszFileSpec, false);
- }
- return SG_ERR_NOMATCH;
- }
- return AppendName(a_pszFileSpec, nType == SG_FILETYPE_DIR);
- }
-
+ // if this doesn't contain wildcards then we can just add it directly
+ m_szPathPrefix[0] = 0;
+ if (!SimpleGlobUtil::strchr(a_pszFileSpec, '*') && !SimpleGlobUtil::strchr(a_pszFileSpec, '?')) {
+ SG_FileType nType = GetFileTypeS(a_pszFileSpec);
+ if (nType == SG_FILETYPE_INVALID) {
+ if (m_uiFlags & SG_GLOB_NOCHECK) {
+ return AppendName(a_pszFileSpec, false);
+ }
+ return SG_ERR_NOMATCH;
+ }
+ return AppendName(a_pszFileSpec, nType == SG_FILETYPE_DIR);
+ }
#ifdef _WIN32
- // Windows doesn't return the directory with the filename, so we need to extract the
- // path from the search string ourselves and prefix it to the filename we get back.
- const SOCHAR * pszFilename = SimpleGlobUtil::strrchr(a_pszFileSpec, SG_PATH_CHAR);
- if (pszFilename) {
- SimpleGlobUtil::strcpy_s(m_szPathPrefix, MAX_PATH, a_pszFileSpec);
- m_szPathPrefix[pszFilename - a_pszFileSpec + 1] = 0;
- }
+ // Windows doesn't return the directory with the filename, so we need to extract the
+ // path from the search string ourselves and prefix it to the filename we get back.
+ const SOCHAR *pszFilename = SimpleGlobUtil::strrchr(a_pszFileSpec, SG_PATH_CHAR);
+ if (pszFilename) {
+ SimpleGlobUtil::strcpy_s(m_szPathPrefix, MAX_PATH, a_pszFileSpec);
+ m_szPathPrefix[pszFilename - a_pszFileSpec + 1] = 0;
+ }
#endif
- // search for the first match on the file
- int rc = FindFirstFileS(a_pszFileSpec, m_uiFlags);
- if (rc != SG_SUCCESS) {
- if (rc == SG_ERR_NOMATCH && (m_uiFlags & SG_GLOB_NOCHECK)) {
- int ok = AppendName(a_pszFileSpec, false);
- if (ok != SG_SUCCESS) rc = ok;
- }
- return rc;
- }
-
- // add it and find all subsequent matches
- int nError, nStartLen = m_nArgsLen;
- bool bSuccess;
- do {
- nError = AppendName(GetFileNameS((SOCHAR)0), IsDirS((SOCHAR)0));
- bSuccess = FindNextFileS((SOCHAR)0);
- }
- while (nError == SG_SUCCESS && bSuccess);
- SimpleGlobBase<SOCHAR>::FindDone();
-
- // sort these files if required
- if (m_nArgsLen > nStartLen && !(m_uiFlags & SG_GLOB_NOSORT)) {
- if (m_uiFlags & SG_GLOB_FULLSORT) {
- nStartLen = m_nReservedSlots;
- }
- SetArgvArrayType(POINTERS);
- qsort(
- m_rgpArgs + nStartLen,
- m_nArgsLen - nStartLen,
- sizeof(m_rgpArgs[0]), fileSortCompare);
- }
+ // search for the first match on the file
+ int rc = FindFirstFileS(a_pszFileSpec, m_uiFlags);
+ if (rc != SG_SUCCESS) {
+ if (rc == SG_ERR_NOMATCH && (m_uiFlags & SG_GLOB_NOCHECK)) {
+ int ok = AppendName(a_pszFileSpec, false);
+ if (ok != SG_SUCCESS)
+ rc = ok;
+ }
+ return rc;
+ }
+ // add it and find all subsequent matches
+ int nError, nStartLen = m_nArgsLen;
+ bool bSuccess;
+ do {
+ nError = AppendName(GetFileNameS((SOCHAR) 0), IsDirS((SOCHAR) 0));
+ bSuccess = FindNextFileS((SOCHAR) 0);
+ }
+ while (nError == SG_SUCCESS && bSuccess);
+ SimpleGlobBase < SOCHAR >::FindDone();
+
+ // sort these files if required
+ if (m_nArgsLen > nStartLen && !(m_uiFlags & SG_GLOB_NOSORT)) {
+ if (m_uiFlags & SG_GLOB_FULLSORT) {
+ nStartLen = m_nReservedSlots;
+ }
+ SetArgvArrayType(POINTERS);
+ qsort(m_rgpArgs + nStartLen, m_nArgsLen - nStartLen, sizeof(m_rgpArgs[0]), fileSortCompare);
+ }
- return nError;
+ return nError;
}
-template<class SOCHAR>
-int
-CSimpleGlobTempl<SOCHAR>::Add(
- int a_nCount,
- const SOCHAR * const * a_rgpszFileSpec
- )
+template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::Add(int a_nCount, const SOCHAR * const *a_rgpszFileSpec)
{
- int nResult;
- for (int n = 0; n < a_nCount; ++n) {
- nResult = Add(a_rgpszFileSpec[n]);
- if (nResult != SG_SUCCESS) {
- return nResult;
- }
- }
- return SG_SUCCESS;
+ int nResult;
+ for (int n = 0; n < a_nCount; ++n) {
+ nResult = Add(a_rgpszFileSpec[n]);
+ if (nResult != SG_SUCCESS) {
+ return nResult;
+ }
+ }
+ return SG_SUCCESS;
}
-template<class SOCHAR>
-int
-CSimpleGlobTempl<SOCHAR>::AppendName(
- const SOCHAR * a_pszFileName,
- bool a_bIsDir
- )
+template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::AppendName(const SOCHAR * a_pszFileName, bool a_bIsDir)
{
- // we need the argv array as offsets in case we resize it
- SetArgvArrayType(OFFSETS);
+ // we need the argv array as offsets in case we resize it
+ SetArgvArrayType(OFFSETS);
- // check for special cases which cause us to ignore this entry
- if ((m_uiFlags & SG_GLOB_ONLYDIR) && !a_bIsDir) {
- return SG_SUCCESS;
- }
- if ((m_uiFlags & SG_GLOB_ONLYFILE) && a_bIsDir) {
- return SG_SUCCESS;
- }
- if ((m_uiFlags & SG_GLOB_NODOT) && a_bIsDir) {
- if (a_pszFileName[0] == '.') {
- if (a_pszFileName[1] == '\0') {
- return SG_SUCCESS;
- }
- if (a_pszFileName[1] == '.' && a_pszFileName[2] == '\0') {
- return SG_SUCCESS;
- }
- }
- }
-
- // ensure that we have enough room in the argv array
- if (!GrowArgvArray(m_nArgsLen + 1)) {
- return SG_ERR_MEMORY;
- }
-
- // ensure that we have enough room in the string buffer
- size_t uiPrefixLen = SimpleGlobUtil::strlen(m_szPathPrefix);
- size_t uiLen = uiPrefixLen + SimpleGlobUtil::strlen(a_pszFileName) + 1; // + null character
- if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
- ++uiLen; // need space for the backslash
- }
- if (!GrowStringBuffer(m_uiBufferLen + uiLen)) {
- return SG_ERR_MEMORY;
- }
-
- // add this entry
- m_rgpArgs[m_nArgsLen++] = (SOCHAR*)m_uiBufferLen; // offset from beginning of buffer
- SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen,
- m_uiBufferSize - m_uiBufferLen, m_szPathPrefix);
- SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen + uiPrefixLen,
- m_uiBufferSize - m_uiBufferLen - uiPrefixLen, a_pszFileName);
- m_uiBufferLen += uiLen;
-
- // add the directory slash if desired
- if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
- const static SOCHAR szDirSlash[] = { SG_PATH_CHAR, 0 };
- SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen - 2,
- m_uiBufferSize - (m_uiBufferLen - 2), szDirSlash);
- }
+ // check for special cases which cause us to ignore this entry
+ if ((m_uiFlags & SG_GLOB_ONLYDIR) && !a_bIsDir) {
+ return SG_SUCCESS;
+ }
+ if ((m_uiFlags & SG_GLOB_ONLYFILE) && a_bIsDir) {
+ return SG_SUCCESS;
+ }
+ if ((m_uiFlags & SG_GLOB_NODOT) && a_bIsDir) {
+ if (a_pszFileName[0] == '.') {
+ if (a_pszFileName[1] == '\0') {
+ return SG_SUCCESS;
+ }
+ if (a_pszFileName[1] == '.' && a_pszFileName[2] == '\0') {
+ return SG_SUCCESS;
+ }
+ }
+ }
+ // ensure that we have enough room in the argv array
+ if (!GrowArgvArray(m_nArgsLen + 1)) {
+ return SG_ERR_MEMORY;
+ }
+ // ensure that we have enough room in the string buffer
+ size_t uiPrefixLen = SimpleGlobUtil::strlen(m_szPathPrefix);
+ size_t uiLen = uiPrefixLen + SimpleGlobUtil::strlen(a_pszFileName) + 1; // + null character
+ if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
+ ++uiLen; // need space for the backslash
+ }
+ if (!GrowStringBuffer(m_uiBufferLen + uiLen)) {
+ return SG_ERR_MEMORY;
+ }
+ // add this entry
+ m_rgpArgs[m_nArgsLen++] = (SOCHAR *) m_uiBufferLen; // offset from beginning of buffer
+ SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen, m_uiBufferSize - m_uiBufferLen, m_szPathPrefix);
+ SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen + uiPrefixLen, m_uiBufferSize - m_uiBufferLen - uiPrefixLen, a_pszFileName);
+ m_uiBufferLen += uiLen;
+
+ // add the directory slash if desired
+ if (a_bIsDir && (m_uiFlags & SG_GLOB_MARK) == SG_GLOB_MARK) {
+ const static SOCHAR szDirSlash[] = { SG_PATH_CHAR, 0 };
+ SimpleGlobUtil::strcpy_s(m_pBuffer + m_uiBufferLen - 2, m_uiBufferSize - (m_uiBufferLen - 2), szDirSlash);
+ }
- return SG_SUCCESS;
+ return SG_SUCCESS;
}
-template<class SOCHAR>
-void
-CSimpleGlobTempl<SOCHAR>::SetArgvArrayType(
- ARG_ARRAY_TYPE a_nNewType
- )
+template < class SOCHAR > void CSimpleGlobTempl < SOCHAR >::SetArgvArrayType(ARG_ARRAY_TYPE a_nNewType)
{
- if (m_nArgArrayType == a_nNewType) return;
- if (a_nNewType == POINTERS) {
- SG_ASSERT(m_nArgArrayType == OFFSETS);
- for (int n = 0; n < m_nArgsLen; ++n) {
- m_rgpArgs[n] = (m_rgpArgs[n] == (SOCHAR*)-1) ?
- NULL : m_pBuffer + (size_t) m_rgpArgs[n];
- }
- }
- else {
- SG_ASSERT(a_nNewType == OFFSETS);
- SG_ASSERT(m_nArgArrayType == POINTERS);
- for (int n = 0; n < m_nArgsLen; ++n) {
- m_rgpArgs[n] = (m_rgpArgs[n] == NULL) ?
- (SOCHAR*) -1 : (SOCHAR*) (m_rgpArgs[n] - m_pBuffer);
- }
- }
- m_nArgArrayType = a_nNewType;
+ if (m_nArgArrayType == a_nNewType)
+ return;
+ if (a_nNewType == POINTERS) {
+ SG_ASSERT(m_nArgArrayType == OFFSETS);
+ for (int n = 0; n < m_nArgsLen; ++n) {
+ m_rgpArgs[n] = (m_rgpArgs[n] == (SOCHAR *) - 1) ? NULL : m_pBuffer + (size_t) m_rgpArgs[n];
+ }
+ } else {
+ SG_ASSERT(a_nNewType == OFFSETS);
+ SG_ASSERT(m_nArgArrayType == POINTERS);
+ for (int n = 0; n < m_nArgsLen; ++n) {
+ m_rgpArgs[n] = (m_rgpArgs[n] == NULL) ? (SOCHAR *) - 1 : (SOCHAR *) (m_rgpArgs[n] - m_pBuffer);
+ }
+ }
+ m_nArgArrayType = a_nNewType;
}
-template<class SOCHAR>
-bool
-CSimpleGlobTempl<SOCHAR>::GrowArgvArray(
- int a_nNewLen
- )
+template < class SOCHAR > bool CSimpleGlobTempl < SOCHAR >::GrowArgvArray(int a_nNewLen)
{
- if (a_nNewLen >= m_nArgsSize) {
- static const int SG_ARGV_INITIAL_SIZE = 32;
- int nNewSize = (m_nArgsSize > 0) ? m_nArgsSize * 2 : SG_ARGV_INITIAL_SIZE;
- while (a_nNewLen >= nNewSize) {
- nNewSize *= 2;
- }
- void * pNewBuffer = realloc(m_rgpArgs, nNewSize * sizeof(SOCHAR*));
- if (!pNewBuffer) return false;
- m_nArgsSize = nNewSize;
- m_rgpArgs = (SOCHAR**) pNewBuffer;
- }
- return true;
+ if (a_nNewLen >= m_nArgsSize) {
+ static const int SG_ARGV_INITIAL_SIZE = 32;
+ int nNewSize = (m_nArgsSize > 0) ? m_nArgsSize * 2 : SG_ARGV_INITIAL_SIZE;
+ while (a_nNewLen >= nNewSize) {
+ nNewSize *= 2;
+ }
+ void *pNewBuffer = realloc(m_rgpArgs, nNewSize * sizeof(SOCHAR *));
+ if (!pNewBuffer)
+ return false;
+ m_nArgsSize = nNewSize;
+ m_rgpArgs = (SOCHAR **) pNewBuffer;
+ }
+ return true;
}
-template<class SOCHAR>
-bool
-CSimpleGlobTempl<SOCHAR>::GrowStringBuffer(
- size_t a_uiMinSize
- )
+template < class SOCHAR > bool CSimpleGlobTempl < SOCHAR >::GrowStringBuffer(size_t a_uiMinSize)
{
- if (a_uiMinSize >= m_uiBufferSize) {
- static const int SG_BUFFER_INITIAL_SIZE = 1024;
- size_t uiNewSize = (m_uiBufferSize > 0) ? m_uiBufferSize * 2 : SG_BUFFER_INITIAL_SIZE;
- while (a_uiMinSize >= uiNewSize) {
- uiNewSize *= 2;
- }
- void * pNewBuffer = realloc(m_pBuffer, uiNewSize * sizeof(SOCHAR));
- if (!pNewBuffer) return false;
- m_uiBufferSize = uiNewSize;
- m_pBuffer = (SOCHAR*) pNewBuffer;
- }
- return true;
+ if (a_uiMinSize >= m_uiBufferSize) {
+ static const int SG_BUFFER_INITIAL_SIZE = 1024;
+ size_t uiNewSize = (m_uiBufferSize > 0) ? m_uiBufferSize * 2 : SG_BUFFER_INITIAL_SIZE;
+ while (a_uiMinSize >= uiNewSize) {
+ uiNewSize *= 2;
+ }
+ void *pNewBuffer = realloc(m_pBuffer, uiNewSize * sizeof(SOCHAR));
+ if (!pNewBuffer)
+ return false;
+ m_uiBufferSize = uiNewSize;
+ m_pBuffer = (SOCHAR *) pNewBuffer;
+ }
+ return true;
}
-template<class SOCHAR>
-int
-CSimpleGlobTempl<SOCHAR>::fileSortCompare(
- const void *a1,
- const void *a2
- )
+template < class SOCHAR > int CSimpleGlobTempl < SOCHAR >::fileSortCompare(const void *a1, const void *a2)
{
- const SOCHAR * s1 = *(const SOCHAR **)a1;
- const SOCHAR * s2 = *(const SOCHAR **)a2;
- if (s1 && s2) {
- return SimpleGlobUtil::strcasecmp(s1, s2);
- }
- // NULL sorts first
- return s1 == s2 ? 0 : (s1 ? 1 : -1);
+ const SOCHAR *s1 = *(const SOCHAR **) a1;
+ const SOCHAR *s2 = *(const SOCHAR **) a2;
+ if (s1 && s2) {
+ return SimpleGlobUtil::strcasecmp(s1, s2);
+ }
+ // NULL sorts first
+ return s1 == s2 ? 0 : (s1 ? 1 : -1);
}
// ---------------------------------------------------------------------------
// TYPE DEFINITIONS
// ---------------------------------------------------------------------------
-typedef CSimpleGlobTempl<char> CSimpleGlobA; /*!< @brief ASCII/MBCS version of CSimpleGlob */
-typedef CSimpleGlobTempl<wchar_t> CSimpleGlobW; /*!< @brief wchar_t version of CSimpleGlob */
+typedef CSimpleGlobTempl < char >CSimpleGlobA; /*!< @brief ASCII/MBCS version of CSimpleGlob */
+typedef CSimpleGlobTempl < wchar_t >CSimpleGlobW; /*!< @brief wchar_t version of CSimpleGlob */
#if defined(_UNICODE)
-# define CSimpleGlob CSimpleGlobW /*!< @brief TCHAR version dependent on if _UNICODE is defined */
+# define CSimpleGlob CSimpleGlobW /*!< @brief TCHAR version dependent on if _UNICODE is defined */
#else
-# define CSimpleGlob CSimpleGlobA /*!< @brief TCHAR version dependent on if _UNICODE is defined */
+# define CSimpleGlob CSimpleGlobA /*!< @brief TCHAR version dependent on if _UNICODE is defined */
#endif
#endif // INCLUDED_SimpleGlob
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h Tue May 27 07:24:06 2008
@@ -50,137 +50,108 @@
#ifndef __inline__
#define __inline__ __inline
#endif
-typedef unsigned __int8 uint8_t;
-typedef __int16 int16_t;
-typedef __int32 int32_t;
-typedef unsigned __int16 uint16_t;
+ typedef unsigned __int8 uint8_t;
+ typedef __int16 int16_t;
+ typedef __int32 int32_t;
+ typedef unsigned __int16 uint16_t;
#endif
#if defined(__i386__)
/*! \brief Find the bit position of the highest set bit in a word
\param bits The word to be searched
\return The bit number of the highest set bit, or -1 if the word is zero. */
-static __inline__ int top_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsrl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
+ static __inline__ int top_bit(unsigned int bits) {
+ int res;
-/*! \brief Find the bit position of the lowest set bit in a word
- \param bits The word to be searched
- \return The bit number of the lowest set bit, or -1 if the word is zero. */
-static __inline__ int bottom_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movl $-1,%%edx;\n"
- " bsfl %%eax,%%edx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
+ __asm__ __volatile__(" movl $-1,%%edx;\n" " bsrl %%eax,%%edx;\n":"=d"(res)
+ :"a" (bits));
+ return res;
+ }
+ /*- End of function --------------------------------------------------------*//*! \brief Find the bit position of the lowest set bit in a word
+ \param bits The word to be searched
+ \return The bit number of the lowest set bit, or -1 if the word is zero. */ static __inline__ int bottom_bit(unsigned int bits) {
+ int res;
+
+ __asm__ __volatile__(" movl $-1,%%edx;\n" " bsfl %%eax,%%edx;\n":"=d"(res)
+ :"a" (bits));
+ return res;
+ }
/*- End of function --------------------------------------------------------*/
#elif defined(__x86_64__)
-static __inline__ int top_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsrq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
-/*- End of function --------------------------------------------------------*/
+ static __inline__ int top_bit(unsigned int bits) {
+ int res;
-static __inline__ int bottom_bit(unsigned int bits)
-{
- int res;
-
- __asm__ __volatile__(" movq $-1,%%rdx;\n"
- " bsfq %%rax,%%rdx;\n"
- : "=d" (res)
- : "a" (bits));
- return res;
-}
+ __asm__ __volatile__(" movq $-1,%%rdx;\n" " bsrq %%rax,%%rdx;\n":"=d"(res)
+ :"a" (bits));
+ return res;
+ }
+/*- End of function --------------------------------------------------------*/ static __inline__ int bottom_bit(unsigned int bits) {
+ int res;
+
+ __asm__ __volatile__(" movq $-1,%%rdx;\n" " bsfq %%rax,%%rdx;\n":"=d"(res)
+ :"a" (bits));
+ return res;
+ }
/*- End of function --------------------------------------------------------*/
#else
-static __inline__ int top_bit(unsigned int bits)
-{
- int i;
-
- if (bits == 0)
- return -1;
- i = 0;
- if (bits & 0xFFFF0000)
- {
- bits &= 0xFFFF0000;
- i += 16;
- }
- if (bits & 0xFF00FF00)
- {
- bits &= 0xFF00FF00;
- i += 8;
- }
- if (bits & 0xF0F0F0F0)
- {
- bits &= 0xF0F0F0F0;
- i += 4;
- }
- if (bits & 0xCCCCCCCC)
- {
- bits &= 0xCCCCCCCC;
- i += 2;
- }
- if (bits & 0xAAAAAAAA)
- {
- bits &= 0xAAAAAAAA;
- i += 1;
- }
- return i;
-}
+ static __inline__ int top_bit(unsigned int bits) {
+ int i;
+
+ if (bits == 0)
+ return -1;
+ i = 0;
+ if (bits & 0xFFFF0000) {
+ bits &= 0xFFFF0000;
+ i += 16;
+ }
+ if (bits & 0xFF00FF00) {
+ bits &= 0xFF00FF00;
+ i += 8;
+ }
+ if (bits & 0xF0F0F0F0) {
+ bits &= 0xF0F0F0F0;
+ i += 4;
+ }
+ if (bits & 0xCCCCCCCC) {
+ bits &= 0xCCCCCCCC;
+ i += 2;
+ }
+ if (bits & 0xAAAAAAAA) {
+ bits &= 0xAAAAAAAA;
+ i += 1;
+ }
+ return i;
+ }
/*- End of function --------------------------------------------------------*/
-static __inline__ int bottom_bit(unsigned int bits)
-{
- int i;
-
- if (bits == 0)
- return -1;
- i = 32;
- if (bits & 0x0000FFFF)
- {
- bits &= 0x0000FFFF;
- i -= 16;
- }
- if (bits & 0x00FF00FF)
- {
- bits &= 0x00FF00FF;
- i -= 8;
- }
- if (bits & 0x0F0F0F0F)
- {
- bits &= 0x0F0F0F0F;
- i -= 4;
- }
- if (bits & 0x33333333)
- {
- bits &= 0x33333333;
- i -= 2;
- }
- if (bits & 0x55555555)
- {
- bits &= 0x55555555;
- i -= 1;
- }
- return i;
-}
+ static __inline__ int bottom_bit(unsigned int bits) {
+ int i;
+
+ if (bits == 0)
+ return -1;
+ i = 32;
+ if (bits & 0x0000FFFF) {
+ bits &= 0x0000FFFF;
+ i -= 16;
+ }
+ if (bits & 0x00FF00FF) {
+ bits &= 0x00FF00FF;
+ i -= 8;
+ }
+ if (bits & 0x0F0F0F0F) {
+ bits &= 0x0F0F0F0F;
+ i -= 4;
+ }
+ if (bits & 0x33333333) {
+ bits &= 0x33333333;
+ i -= 2;
+ }
+ if (bits & 0x55555555) {
+ bits &= 0x55555555;
+ i -= 1;
+ }
+ return i;
+ }
/*- End of function --------------------------------------------------------*/
#endif
@@ -194,7 +165,7 @@
* segment, but a little inline assembly can fix that on an i386, x86_64 and
* many other modern processors.
*/
-
+
/*
* Mu-law is basically as follows:
*
@@ -222,66 +193,61 @@
*/
//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */
-#define ULAW_BIAS 0x84 /* Bias for linear code. */
+#define ULAW_BIAS 0x84 /* Bias for linear code. */
/*! \brief Encode a linear sample to u-law
\param linear The sample to encode.
\return The u-law value.
*/
-static __inline__ uint8_t linear_to_ulaw(int linear)
-{
- uint8_t u_val;
- int mask;
- int seg;
-
- /* Get the sign and the magnitude of the value. */
- if (linear < 0)
- {
- linear = ULAW_BIAS - linear;
- mask = 0x7F;
- }
- else
- {
- linear = ULAW_BIAS + linear;
- mask = 0xFF;
- }
-
- seg = top_bit(linear | 0xFF) - 7;
-
- /*
- * Combine the sign, segment, quantization bits,
- * and complement the code word.
- */
- if (seg >= 8)
- u_val = (uint8_t) (0x7F ^ mask);
- else
- u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
+ static __inline__ uint8_t linear_to_ulaw(int linear) {
+ uint8_t u_val;
+ int mask;
+ int seg;
+
+ /* Get the sign and the magnitude of the value. */
+ if (linear < 0) {
+ linear = ULAW_BIAS - linear;
+ mask = 0x7F;
+ } else {
+ linear = ULAW_BIAS + linear;
+ mask = 0xFF;
+ }
+
+ seg = top_bit(linear | 0xFF) - 7;
+
+ /*
+ * Combine the sign, segment, quantization bits,
+ * and complement the code word.
+ */
+ if (seg >= 8)
+ u_val = (uint8_t) (0x7F ^ mask);
+ else
+ u_val = (uint8_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask);
#ifdef ULAW_ZEROTRAP
- /* Optional ITU trap */
- if (u_val == 0)
- u_val = 0x02;
+ /* Optional ITU trap */
+ if (u_val == 0)
+ u_val = 0x02;
#endif
- return u_val;
-}
+ return u_val;
+ }
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an u-law sample to a linear value.
\param ulaw The u-law sample to decode.
\return The linear value.
*/
-static __inline__ int16_t ulaw_to_linear(uint8_t ulaw)
-{
- int t;
-
- /* Complement to obtain normal u-law value. */
- ulaw = ~ulaw;
- /*
- * Extract and bias the quantization bits. Then
- * shift up by the segment number and subtract out the bias.
- */
- t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
- return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
-}
+ static __inline__ int16_t ulaw_to_linear(uint8_t ulaw) {
+ int t;
+
+ /* Complement to obtain normal u-law value. */
+ ulaw = ~ulaw;
+ /*
+ * Extract and bias the quantization bits. Then
+ * shift up by the segment number and subtract out the bias.
+ */
+ t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4);
+ return (int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS));
+ }
/*- End of function --------------------------------------------------------*/
/*
@@ -308,71 +274,64 @@
\param linear The sample to encode.
\return The A-law value.
*/
-static __inline__ uint8_t linear_to_alaw(int linear)
-{
- int mask;
- int seg;
-
- if (linear >= 0)
- {
- /* Sign (bit 7) bit = 1 */
- mask = ALAW_AMI_MASK | 0x80;
- }
- else
- {
- /* Sign (bit 7) bit = 0 */
- mask = ALAW_AMI_MASK;
- linear = -linear - 8;
- }
-
- /* Convert the scaled magnitude to segment number. */
- seg = top_bit(linear | 0xFF) - 7;
- if (seg >= 8)
- {
- if (linear >= 0)
- {
- /* Out of range. Return maximum value. */
- return (uint8_t) (0x7F ^ mask);
- }
- /* We must be just a tiny step below zero */
- return (uint8_t) (0x00 ^ mask);
- }
- /* Combine the sign, segment, and quantization bits. */
- return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
-}
+ static __inline__ uint8_t linear_to_alaw(int linear) {
+ int mask;
+ int seg;
+
+ if (linear >= 0) {
+ /* Sign (bit 7) bit = 1 */
+ mask = ALAW_AMI_MASK | 0x80;
+ } else {
+ /* Sign (bit 7) bit = 0 */
+ mask = ALAW_AMI_MASK;
+ linear = -linear - 8;
+ }
+
+ /* Convert the scaled magnitude to segment number. */
+ seg = top_bit(linear | 0xFF) - 7;
+ if (seg >= 8) {
+ if (linear >= 0) {
+ /* Out of range. Return maximum value. */
+ return (uint8_t) (0x7F ^ mask);
+ }
+ /* We must be just a tiny step below zero */
+ return (uint8_t) (0x00 ^ mask);
+ }
+ /* Combine the sign, segment, and quantization bits. */
+ return (uint8_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask);
+ }
/*- End of function --------------------------------------------------------*/
/*! \brief Decode an A-law sample to a linear value.
\param alaw The A-law sample to decode.
\return The linear value.
*/
-static __inline__ int16_t alaw_to_linear(uint8_t alaw)
-{
- int i;
- int seg;
-
- alaw ^= ALAW_AMI_MASK;
- i = ((alaw & 0x0F) << 4);
- seg = (((int) alaw & 0x70) >> 4);
- if (seg)
- i = (i + 0x108) << (seg - 1);
- else
- i += 8;
- return (int16_t) ((alaw & 0x80) ? i : -i);
-}
+ static __inline__ int16_t alaw_to_linear(uint8_t alaw) {
+ int i;
+ int seg;
+
+ alaw ^= ALAW_AMI_MASK;
+ i = ((alaw & 0x0F) << 4);
+ seg = (((int) alaw & 0x70) >> 4);
+ if (seg)
+ i = (i + 0x108) << (seg - 1);
+ else
+ i += 8;
+ return (int16_t) ((alaw & 0x80) ? i : -i);
+ }
/*- End of function --------------------------------------------------------*/
/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711.
\param alaw The A-law sample to transcode.
\return The best matching u-law value.
*/
-uint8_t alaw_to_ulaw(uint8_t alaw);
+ uint8_t alaw_to_ulaw(uint8_t alaw);
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
\param ulaw The u-law sample to transcode.
\return The best matching A-law value.
*/
-uint8_t ulaw_to_alaw(uint8_t ulaw);
+ uint8_t ulaw_to_alaw(uint8_t ulaw);
#ifdef __cplusplus
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_apr.h Tue May 27 07:24:06 2008
@@ -56,8 +56,6 @@
*/
/** The fundamental pool type */
/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/
-
-
/**
* Clear all memory in the pool and run all the cleanups. This also destroys all
* subpools.
@@ -93,13 +91,13 @@
* @bug We aught to provide an alternative to RTLD_GLOBAL, which
* is the only supported method of loading DSOs today.
*/
-SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx);
+SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx);
/**
* Close a DSO library.
* @param handle handle to close.
*/
-SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle);
+SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle);
/**
* Load a symbol from a DSO handle.
@@ -107,7 +105,7 @@
* @param handle handle to load the symbol from.
* @param symname Name of the symbol to load.
*/
-SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym, switch_dso_handle_t * handle, const char *symname);
+SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, switch_dso_handle_t *handle, const char *symname);
/**
* Report more information when a DSO function fails.
@@ -115,7 +113,7 @@
* @param buf Location to store the dso error
* @param bufsize The size of the provided buffer
*/
-SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *buf, size_t bufsize);
+SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize);
/** @} */
@@ -125,11 +123,13 @@
* @{
*/
-SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
+SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len)
+ char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format, ...);
SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap);
-SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
+SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size)
+ char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size);
/** @} */
@@ -164,7 +164,7 @@
* progress at the same time.
*/
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t * ht);
+SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(switch_memory_pool_t *p, switch_hash_t *ht);
/**
* Continue iterating over the entries in a hash table.
@@ -172,7 +172,7 @@
* @return a pointer to the updated iteration state. NULL if there are no more
* entries.
*/
-SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t * ht);
+SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(switch_hash_index_t *ht);
/**
* Get the current entry's details from the iteration state.
@@ -183,11 +183,11 @@
* @remark The return pointers should point to a variable that will be set to the
* corresponding data, or they may be NULL if the data isn't interesting.
*/
-SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t * hi, const void **key, switch_ssize_t *klen, void **val);
+SWITCH_DECLARE(void) switch_hash_this(switch_hash_index_t *hi, const void **key, switch_ssize_t *klen, void **val);
-SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t * ht);
+SWITCH_DECLARE(switch_memory_pool_t *) switch_hash_pool_get(switch_hash_t *ht);
/** @} */
@@ -258,7 +258,7 @@
* @param result the resulting imploded time
* @param input the input exploded time
*/
-SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input);
+SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input);
/**
* formats the exploded time according to the format specified
@@ -268,7 +268,7 @@
* @param format The format for the time string
* @param tm The time to convert
*/
-SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t * tm);
+SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm);
/**
* switch_rfc822_date formats dates in the RFC822
@@ -285,7 +285,7 @@
* @param result the exploded time
* @param input the time to explode
*/
-SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result, switch_time_t input);
+SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input);
/**
* Convert time value from human readable format to a numeric apr_time_t
@@ -293,14 +293,14 @@
* @param result the resulting imploded time
* @param input the input exploded time
*/
-SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t * result, switch_time_exp_t * input);
+SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input);
/**
* convert a time to its human readable components in local timezone
* @param result the exploded time
* @param input the time to explode
*/
-SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t * result, switch_time_t input);
+SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input);
/**
* Sleep for the specified number of micro-seconds.
@@ -341,27 +341,27 @@
* it will behave as either a nested or an unnested lock.
*
*/
-SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool);
/**
* Destroy the mutex and free the memory associated with the lock.
* @param lock the mutex to destroy.
*/
-SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t * lock);
+SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock);
/**
* Acquire the lock for the given mutex. If the mutex is already locked,
* the current thread will be put to sleep until the lock becomes available.
* @param lock the mutex on which to acquire the lock.
*/
-SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t * lock);
+SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock);
/**
* Release the lock for the given mutex.
* @param lock the mutex from which to release the lock.
*/
-SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock);
+SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock);
/**
* Attempt to acquire the lock for the given mutex. If the mutex has already
@@ -370,7 +370,7 @@
* if the return value was APR_EBUSY, for portability reasons.
* @param lock the mutex on which to attempt the lock acquiring.
*/
-SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock);
+SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock);
/** @} */
@@ -383,14 +383,14 @@
/** Opaque structure used for the rwlock */
typedef struct apr_thread_rwlock_t switch_thread_rwlock_t;
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t * rwlock);
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t * rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock);
/** @} */
@@ -416,7 +416,7 @@
* will be stored.
* @param pool the pool from which to allocate the mutex.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool);
/**
* Put the active calling thread to sleep until signaled to wake up. Each
@@ -430,7 +430,7 @@
* is released while the thread is asleep, and is again acquired before
* returning from this function.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * cond, switch_mutex_t * mutex);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex);
/**
* Put the active calling thread to sleep until signaled to wake up or
@@ -448,7 +448,7 @@
* will wake up before this time, otherwise the error APR_TIMEUP
* is returned.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t * cond, switch_mutex_t * mutex, switch_interval_time_t timeout);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout);
/**
* Signals a single thread, if one exists, that is blocking on the given
@@ -457,7 +457,7 @@
* is desired, that mutex must be locked while calling this function.
* @param cond the condition variable on which to produce the signal.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t * cond);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond);
/**
* Signals all threads blocking on the given condition variable.
@@ -465,13 +465,13 @@
* the associated mutex. This will happen in a serialized manner.
* @param cond the condition variable on which to produce the broadcast.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t * cond);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond);
/**
* Destroy the condition variable and free the associated memory.
* @param cond the condition variable to destroy.
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t * cond);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond);
/** @} */
@@ -498,20 +498,20 @@
* the formatted UUID and a null terminator
* @param uuid The UUID to format
*/
-SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t * uuid);
+SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid);
/**
* Generate and return a (new) UUID
* @param uuid The resulting UUID
*/
-SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t * uuid);
+SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid);
/**
* Parse a standard-format string into a UUID
* @param uuid The resulting UUID
* @param uuid_str The formatted UUID
*/
-SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const char *uuid_str);
+SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str);
/** @} */
@@ -530,7 +530,7 @@
* @param queue_capacity maximum size of the queue
* @param pool a pool to allocate queue from
*/
-SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
/**
* pop/get an object from the queue, blocking if the queue is already empty
@@ -541,7 +541,7 @@
* @returns APR_EOF if the queue has been terminated
* @returns APR_SUCCESS on a successfull pop
*/
-SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **data);
+SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data);
/**
* push/add a object to the queue, blocking if the queue is already full
@@ -552,7 +552,7 @@
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
-SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *data);
+SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data);
/**
* returns the size of the queue.
@@ -562,7 +562,7 @@
* @param queue the queue
* @returns the size of the queue
*/
-SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue);
+SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue);
/**
* pop/get an object to the queue, returning immediatly if the queue is empty
@@ -574,7 +574,7 @@
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
-SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void **data);
+SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data);
/**
* push/add a object to the queue, returning immediatly if the queue is full
@@ -586,7 +586,7 @@
* @returns APR_EOF the queue has been terminated
* @returns APR_SUCCESS on a successfull push
*/
-SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, void *data);
+SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data);
/** @} */
@@ -650,13 +650,13 @@
* @{
*/
-#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
+#define SWITCH_FLOCK_SHARED 1 /**< Shared lock. More than one process
or thread can hold a shared lock
at any given time. Essentially,
this is a "read lock", preventing
writers from establishing an
exclusive lock. */
-#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
+#define SWITCH_FLOCK_EXCLUSIVE 2 /**< Exclusive lock. Only one process
may hold an exclusive lock at any
given time. This is analogous to
a "write lock". */
@@ -722,19 +722,19 @@
* @remark If perm is SWITCH_FPROT_OS_DEFAULT and the file is being created,
* appropriate default permissions will be used.
*/
-SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
+SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm,
switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t * thefile, switch_seek_where_t where, int64_t *offset);
+SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset);
/**
* Close the specified file.
* @param thefile The file descriptor to close.
*/
-SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t * thefile);
+SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile);
-SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t * thefile, int type);
+SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type);
/**
* Delete the specified file.
@@ -764,7 +764,7 @@
* @remark It is not possible for both bytes to be read and an APR_EOF
* or other error to be returned. APR_EINTR is never returned.
*/
-SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *buf, switch_size_t *nbytes);
+SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes);
/**
* Write data to the specified file.
@@ -781,7 +781,7 @@
* @remark It is possible for both bytes to be written and an error to
* be returned. APR_EINTR is never returned.
*/
-SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t * thefile, const void *buf, switch_size_t *nbytes);
+SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes);
SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...);
SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool);
@@ -798,8 +798,7 @@
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
*/
-SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
- switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
/** Creates a new directory on the file system, but behaves like
* 'mkdir -p'. Creates intermediate directories as required. No error
@@ -808,24 +807,23 @@
* @param perm Permissions for the new direcoty.
* @param pool the pool to use.
*/
-SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm,
- switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool);
-typedef struct switch_dir switch_dir_t;
+ typedef struct switch_dir switch_dir_t;
-struct switch_array_header_t {
- /** The pool the array is allocated out of */
- switch_memory_pool_t *pool;
- /** The amount of memory allocated for each element of the array */
- int elt_size;
- /** The number of active elements in the array */
- int nelts;
- /** The number of elements allocated in the array */
- int nalloc;
- /** The elements in the array */
- char *elts;
-};
-typedef struct switch_array_header_t switch_array_header_t;
+ struct switch_array_header_t {
+ /** The pool the array is allocated out of */
+ switch_memory_pool_t *pool;
+ /** The amount of memory allocated for each element of the array */
+ int elt_size;
+ /** The number of active elements in the array */
+ int nelts;
+ /** The number of elements allocated in the array */
+ int nalloc;
+ /** The elements in the array */
+ char *elts;
+ };
+ typedef struct switch_array_header_t switch_array_header_t;
SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir);
@@ -852,7 +850,7 @@
typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *);
//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize)
-SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t * attr, switch_size_t stacksize);
+SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize);
SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_increase(switch_threadattr_t *attr);
@@ -862,14 +860,14 @@
* @param new_attr The newly created threadattr.
* @param pool The pool to use
*/
-SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool);
/**
* Set if newly created threads should be created in detached state.
* @param attr The threadattr to affect
* @param on Non-zero if detached threads should be created.
*/
-SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t * attr, int32_t on);
+SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on);
/**
* Create a new thread of execution
@@ -879,7 +877,7 @@
* @param data Any data to be passed to the starting function
* @param cont The pool to use
*/
-SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t * attr,
+SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr,
switch_thread_start_t func, void *data, switch_memory_pool_t *cont);
/** @} */
@@ -946,7 +944,7 @@
* @param protocol The protocol of the socket (e.g., SWITCH_PROTO_TCP).
* @param pool The pool to use
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
/**
* Shutdown either reading, writing, or both sides of a socket.
@@ -961,13 +959,13 @@
* @remark This does not actually close the socket descriptor, it just
* controls which calls are still valid on the socket.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t * sock, switch_shutdown_how_e how);
+SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how);
/**
* Close a socket.
* @param sock The socket to close
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock);
+SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock);
/**
* Bind the socket to its associated port
@@ -976,7 +974,7 @@
* @remark This may be where we will find out if there is any other process
* using the selected port.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switch_sockaddr_t * sa);
+SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa);
/**
* Listen to a bound socket for connections.
@@ -985,7 +983,7 @@
* listen queue. If this value is less than zero, the listen
* queue size is set to zero.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int32_t backlog);
+SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog);
/**
* Accept a new connection request
@@ -995,7 +993,7 @@
* @param sock The socket we are listening on.
* @param pool The pool for the new socket.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t * sock, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
/**
* Issue a connection request to a socket either on the same machine
@@ -1003,12 +1001,12 @@
* @param sock The socket we wish to use for our side of the connection
* @param sa The address of the machine we wish to connect to.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t * sock, switch_sockaddr_t * sa);
+SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa);
-SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa);
-SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t * in);
-SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t * sa);
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t * sa);
+SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa);
+SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in);
+SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa);
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa);
/**
@@ -1034,7 +1032,7 @@
* </PRE>
* @param pool The pool for the apr_sockaddr_t and associated storage.
*/
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname,
int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool);
/**
@@ -1054,7 +1052,7 @@
* APR_EINTR is never returned.
* </PRE>
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len);
/**
* @param sock The socket to send from
@@ -1063,8 +1061,7 @@
* @param buf The data to send
* @param len The length of the data to send
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf,
- switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len);
/**
* @param from The apr_sockaddr_t to fill in the recipient info
@@ -1074,7 +1071,7 @@
* @param len The length of the available buffer
*
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from, switch_socket_t * sock, int32_t flags, char *buf, size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len);
/**
@@ -1096,7 +1093,7 @@
* APR_EINTR is never returned.
* </PRE>
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char *buf, switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len);
/**
* Setup socket options for the specified socket
@@ -1120,7 +1117,7 @@
* </PRE>
* @param on Value for the option.
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on);
+SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on);
/**
* Setup socket timeout for the specified socket
@@ -1133,7 +1130,7 @@
* t < 0 -- read and write calls block
* </PRE>
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock, switch_interval_time_t t);
+SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t);
/**
* Join a Multicast Group
@@ -1144,7 +1141,7 @@
* @param source Source Address to accept transmissions from (non-NULL
* implies Source-Specific Multicast)
*/
-SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch_sockaddr_t * join, switch_sockaddr_t * iface, switch_sockaddr_t * source);
+SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source);
@@ -1185,7 +1182,7 @@
* platforms; the apr_pollset_create() call will fail with
* APR_ENOTIMPL on platforms where it is not supported.
*/
-SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
+SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
/**
* Add a socket or file descriptor to a pollset
@@ -1204,7 +1201,7 @@
* allowed for implementations where option (1) is impossible
* or impractical.
*/
-SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, const switch_pollfd_t * descriptor);
+SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor);
/**
* Poll the sockets in the poll structure
@@ -1219,7 +1216,7 @@
* This is a blocking call, and it will not return until either a
* socket has been signalled, or the timeout has expired.
*/
-SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
+SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout);
/*!
\brief Create a set of file descriptors to poll
@@ -1229,7 +1226,7 @@
\param pool the memory pool to use
\return SWITCH_STATUS_SUCCESS when successful
*/
-SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t * sock, int16_t flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p);
SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_bitpack.h Tue May 27 07:24:06 2008
@@ -106,7 +106,7 @@
pack->cur++;
} else {
switch_byte_t mask = SWITCH_BITS_PER_BYTE - pack->over;
- switch_assert(mask < 8); /* if pack->over this will allways be true */
+ switch_assert(mask < 8); /* if pack->over this will allways be true */
this_byte &= SWITCH_REVERSE_BITPACKED_MASKS[mask];
this_byte >>= mask;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_buffer.h Tue May 27 07:24:06 2008
@@ -122,7 +122,8 @@
* \param datalen amount of data to be written
* \return int amount of buffer used after the write, or 0 if no space available
*/
-SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
+SWITCH_DECLARE(switch_size_t) switch_buffer_write(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
+ const void *data, _In_ switch_size_t datalen);
/*! \brief Remove data from the buffer
* \param buffer any buffer of type switch_buffer_t
@@ -142,7 +143,8 @@
*/
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer);
-SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen) const void *data, _In_ switch_size_t datalen);
+SWITCH_DECLARE(switch_size_t) switch_buffer_zwrite(_In_ switch_buffer_t *buffer, _In_bytecount_(datalen)
+ const void *data, _In_ switch_size_t datalen);
/** @} */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_caller.h Tue May 27 07:24:06 2008
@@ -140,8 +140,7 @@
\return a new extension object allocated from the session's memory pool
*/
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
- _In_z_ const char *extension_name,
- _In_z_ const char *extension_number);
+ _In_z_ const char *extension_name, _In_z_ const char *extension_number);
/*!
\brief Add an application (instruction) to the given extension
@@ -152,8 +151,7 @@
*/
SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_session_t *session,
_In_ switch_caller_extension_t *caller_extension,
- _In_z_ const char *application_name,
- _In_z_ const char *extra_data);
+ _In_z_ const char *application_name, _In_z_ const char *extra_data);
/*!
@@ -162,8 +160,8 @@
\param name the name
\note this function is meant for situations where the name paramater is the contents of the variable
*/
-_Check_return_ _Ret_opt_z_ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(_In_ switch_caller_profile_t *caller_profile,
- _In_z_ const char *name);
+ _Check_return_ _Ret_opt_z_ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(_In_ switch_caller_profile_t *caller_profile,
+ _In_z_ const char *name);
/*!
\brief Create a new caller profile object
@@ -191,8 +189,7 @@
_In_opt_z_ const char *aniii,
_In_opt_z_ const char *rdnis,
_In_opt_z_ const char *source,
- _In_opt_z_ const char *context,
- _In_opt_z_ const char *destination_number);
+ _In_opt_z_ const char *context, _In_opt_z_ const char *destination_number);
/*!
\brief Clone an existing caller profile object
@@ -216,8 +213,7 @@
*/
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(_In_ switch_caller_profile_t *caller_profile,
- _In_opt_z_ const char *prefix,
- _In_ switch_event_t *event);
+ _In_opt_z_ const char *prefix, _In_ switch_event_t *event);
SWITCH_END_EXTERN_C
/** @} */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h Tue May 27 07:24:06 2008
@@ -438,7 +438,8 @@
*/
SWITCH_DECLARE(switch_status_t) switch_channel_dequeue_dtmf(_In_ switch_channel_t *channel, _In_ switch_dtmf_t *dtmf);
SWITCH_DECLARE(void) switch_channel_flush_dtmf(_In_ switch_channel_t *channel);
-SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len) char *dtmf_str, _In_ switch_size_t len);
+SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(_In_ switch_channel_t *channel, _Out_opt_bytecapcount_(len)
+ char *dtmf_str, _In_ switch_size_t len);
/*!
\brief Render the name of the provided state enum
@@ -469,7 +470,8 @@
\note it's necessary to test if the return val is the same as the input and free the string if it is not.
*/
SWITCH_DECLARE(char *) switch_channel_expand_variables(_In_ switch_channel_t *channel, _In_ const char *in);
-SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile, _In_opt_ const char *prefix);
+SWITCH_DECLARE(char *) switch_channel_build_param_string(_In_ switch_channel_t *channel, _In_opt_ switch_caller_profile_t *caller_profile,
+ _In_opt_ const char *prefix);
SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(_In_ switch_channel_t *channel);
#define switch_channel_stop_broadcast(_channel) if (switch_channel_test_flag(_channel, CF_BROADCAST)) switch_channel_set_flag(_channel, CF_BREAK | CF_STOP_BROADCAST)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h Tue May 27 07:24:06 2008
@@ -88,13 +88,13 @@
\param file_path path to the file
\return 1 (true) on success 0 (false) on failure
*/
-SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_path);
+SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_path);
/*!
\brief Close a previously opened configuration file
\param cfg (switch_config_t *) config handle to use
*/
-SWITCH_DECLARE(void) switch_config_close_file(switch_config_t * cfg);
+SWITCH_DECLARE(void) switch_config_close_file(switch_config_t *cfg);
/*!
\brief Retrieve next name/value pair from configuration file
@@ -102,7 +102,7 @@
\param var pointer to aim at the new variable name
\param val pointer to aim at the new value
*/
-SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t * cfg, char **var, char **val);
+SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t *cfg, char **var, char **val);
SWITCH_END_EXTERN_C
/** @} */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h Tue May 27 07:24:06 2008
@@ -52,7 +52,6 @@
s.raw_write_function = switch_console_stream_raw_write; \
s.alloc_len = SWITCH_CMD_CHUNK_LEN; \
s.alloc_chunk = SWITCH_CMD_CHUNK_LEN
-
/*!
\brief A simple comand loop that reads input from the terminal
*/
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h Tue May 27 07:24:06 2008
@@ -43,7 +43,7 @@
SWITCH_BEGIN_EXTERN_C
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_STREAMS 128
-struct switch_core_time_duration {
+ struct switch_core_time_duration {
uint32_t mms;
uint32_t ms;
uint32_t sec;
@@ -132,9 +132,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_session_t *session,
_In_ switch_media_bug_callback_t callback,
_In_opt_ void *user_data,
- _In_ time_t stop_time,
- _In_ switch_media_bug_flag_t flags,
- _Out_ switch_media_bug_t **new_bug);
+ _In_ time_t stop_time, _In_ switch_media_bug_flag_t flags, _Out_ switch_media_bug_t **new_bug);
/*!
\brief Obtain private data from a media bug
\param bug the bug to get the data from
@@ -220,9 +218,8 @@
\return SWITCH_STATUS_SUCCESS if the operation was a success
*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
- _In_ switch_port_t end,
- _In_ switch_port_flag_t flags,
- _Out_ switch_core_port_allocator_t **new_allocator);
+ _In_ switch_port_t end,
+ _In_ switch_port_flag_t flags, _Out_ switch_core_port_allocator_t **new_allocator);
/*!
\brief Get a port from the port allocator
@@ -395,59 +392,74 @@
*/
SWITCH_DECLARE(unsigned int) switch_core_session_running(_In_ switch_core_session_t *session);
+SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
+
/*!
\brief Allocate memory from the main pool with no intention of returning it
- \param memory the number of bytes to allocate
+ \param _memory the number of bytes to allocate
\return a void pointer to the allocated memory
\note this memory never goes out of scope until the core is destroyed
*/
-SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(_In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-#define switch_core_permanent_alloc(m) switch_core_perform_permanent_alloc(m, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_permanent_alloc(_memory) switch_core_perform_permanent_alloc(_memory, __FILE__, __SWITCH_FUNC__, __LINE__)
+
+
+SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file,
+ _In_z_ const char *func, _In_ int line);
/*!
\brief Allocate memory directly from a memory pool
- \param pool the memory pool to allocate from
- \param memory the number of bytes to allocate
+ \param _pool the memory pool to allocate from
+ \param _mem the number of bytes to allocate
\return a void pointer to the allocated memory
*/
-SWITCH_DECLARE(void *) switch_core_perform_alloc(_In_ switch_memory_pool_t *pool, _In_ switch_size_t memory, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-#define switch_core_alloc(p, m) switch_core_perform_alloc(p, m, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_alloc(_pool, _mem) switch_core_perform_alloc(_pool, _mem, __FILE__, __SWITCH_FUNC__, __LINE__)
+
+ _Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file,
+ const char *func, int line);
+
/*!
\brief Allocate memory from a session's pool
- \param session the session to request memory from
- \param memory the amount of memory to allocate
+ \param _session the session to request memory from
+ \param _memory the amount of memory to allocate
\return a void pointer to the newly allocated memory
\note the memory will be in scope as long as the session exists
*/
-_Ret_ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(_In_ switch_core_session_t *session, _In_ switch_size_t memory, const char *file, const char *func, int line);
-#define switch_core_session_alloc(s, m) switch_core_perform_session_alloc(s, m, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_session_alloc(_session, _memory) switch_core_perform_session_alloc(_session, _memory, __FILE__, __SWITCH_FUNC__, __LINE__)
+
+SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
+
/*!
\brief Copy a string using permanent memory allocation
- \param todup the string to duplicate
+ \param _todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(_In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-#define switch_core_permanent_strdup(t) switch_core_perform_permanent_strdup(t, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_permanent_strdup(_todup) switch_core_perform_permanent_strdup(_todup, __FILE__, __SWITCH_FUNC__, __LINE__)
+
+
+SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file,
+ _In_z_ const char *func, _In_ int line);
/*!
\brief Copy a string using memory allocation from a session's pool
- \param session a session to use for allocation
- \param todup the string to duplicate
+ \param _session a session to use for allocation
+ \param _todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_perform_session_strdup(_In_ switch_core_session_t *session, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-#define switch_core_session_strdup(s, t) switch_core_perform_session_strdup(s, t, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_session_strdup(_session, _todup) switch_core_perform_session_strdup(_session, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
+
+
+SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file,
+ _In_z_ const char *func, _In_ int line);
/*!
\brief Copy a string using memory allocation from a given pool
- \param pool the pool to use for allocation
- \param todup the string to duplicate
+ \param _pool the pool to use for allocation
+ \param _todup the string to duplicate
\return a pointer to the newly duplicated string
*/
-SWITCH_DECLARE(char *) switch_core_perform_strdup(_In_ switch_memory_pool_t *pool, _In_z_ const char *todup, _In_z_ const char *file, _In_z_ const char *func, _In_ int line);
-#define switch_core_strdup(p, t) switch_core_perform_strdup(p, t, __FILE__, __SWITCH_FUNC__, __LINE__)
+#define switch_core_strdup(_pool, _todup) switch_core_perform_strdup(_pool, _todup, __FILE__, __SWITCH_FUNC__, __LINE__)
/*!
\brief printf-style style printing routine. The data is output to a string allocated from the session
@@ -531,7 +543,7 @@
\param session the session to retrieve from
\return a pointer to the channel object
*/
-_Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
+ _Ret_ SWITCH_DECLARE(switch_channel_t *) switch_core_session_get_channel(_In_ switch_core_session_t *session);
/*!
\brief Signal a session's state machine thread that a state change has occured
@@ -609,7 +621,8 @@
\param indication the indication message to pass
\return SWITCH_STATUS_SUCCESS if the message was passed
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
+SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(_In_ switch_core_session_t *session,
+ _In_ switch_core_session_message_types_t indication);
/*!
\brief Queue an indication message on a session
@@ -617,7 +630,8 @@
\param indication the indication message to queue
\return SWITCH_STATUS_SUCCESS if the message was queued
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session, _In_ switch_core_session_message_types_t indication);
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_indication(_In_ switch_core_session_t *session,
+ _In_ switch_core_session_message_types_t indication);
/*!
\brief DE-Queue an message on a given session
@@ -645,17 +659,14 @@
SWITCH_DECLARE(switch_app_log_t *) switch_core_session_get_app_log(_In_ switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_session_t *session,
- _In_ const switch_application_interface_t *application_interface,
- _In_opt_z_ const char *arg);
+ _In_ const switch_application_interface_t *application_interface, _In_opt_z_ const char *arg);
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
- _In_ const char *app,
- _In_opt_z_ const char *arg);
+ _In_ const char *app, _In_opt_z_ const char *arg);
SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(_In_ switch_core_session_t *session,
_In_z_ const char *exten,
- _In_opt_z_ const char *dialplan,
- _In_opt_z_ const char *context);
+ _In_opt_z_ const char *dialplan, _In_opt_z_ const char *context);
/*!
\brief Send an event to a session translating it to it's native message format
@@ -710,8 +721,7 @@
\param obj an arguement
*/
SWITCH_DECLARE(void) switch_core_session_launch_thread(_In_ switch_core_session_t *session,
- _In_ void *(*func) (switch_thread_t *, void *),
- _In_opt_ void *obj);
+ _In_ void *(*func) (switch_thread_t *, void *), _In_opt_ void *obj);
/*!
\brief Signal a thread using a thread session to terminate
@@ -726,13 +736,12 @@
\param thread_session the thread_session to use
*/
SWITCH_DECLARE(void) switch_core_service_session(_In_ switch_core_session_t *session,
- _In_ switch_core_thread_session_t *thread_session,
- _In_ int stream_id);
+ _In_ switch_core_thread_session_t *thread_session, _In_ int stream_id);
/*!
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
\param session the originating session
- \param var_event - NEEDDESC -
+ \param var_event switch_event_t containing paramaters
\param endpoint_name the name of the module to use for the new session
\param caller_profile the originator's caller profile
\param new_session a NULL pointer to aim at the newly created session
@@ -745,13 +754,11 @@
_In_z_ const char *endpoint_name,
_In_ switch_caller_profile_t *caller_profile,
_Inout_ switch_core_session_t **new_session,
- _Inout_ switch_memory_pool_t **pool,
- _In_ switch_originate_flag_t flags);
+ _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags);
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(_In_z_ const char *endpoint_name,
_Inout_ switch_core_session_t **new_session,
- _Inout_ switch_memory_pool_t **pool,
- _In_ void *data);
+ _Inout_ switch_memory_pool_t **pool, _In_ void *data);
/*!
\brief Receive a message on a given session
@@ -822,31 +829,34 @@
\brief Read a frame from a session
\param session the session to read from
\param frame a NULL pointer to a frame to aim at the newly read frame
- \param flags - NEEDDESC -
+ \param flags I/O flags to modify behavior (i.e. non blocking)
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was read
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
+ int stream_id);
/*!
\brief Read a video frame from a session
\param session the session to read from
\param frame a NULL pointer to a frame to aim at the newly read frame
- \param flags - NEEDDESC -
+ \param flags I/O flags to modify behavior (i.e. non blocking)
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a if the frame was read
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
+ int stream_id);
/*!
\brief Write a video frame to a session
\param session the session to write to
\param frame a pointer to a frame to write
- \param flags - NEEDDESC -
+ \param flags I/O flags to modify behavior (i.e. non blocking)
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a if the frame was written
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
+ int stream_id);
/*!
\brief Reset the buffers and resampler on a session
@@ -859,11 +869,12 @@
\brief Write a frame to a session
\param session the session to write to
\param frame the frame to write
- \param flags - NEEDDESC -
+ \param flags I/O flags to modify behavior (i.e. non blocking)
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was written
*/
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
+ int stream_id);
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ switch_core_session_t *session,
@@ -905,7 +916,7 @@
\param pool the pool to use for the new hash
\return SWITCH_STATUS_SUCCESS if the hash is created
*/
-SWITCH_DECLARE(switch_status_t) switch_core_hash_init(_Out_ switch_hash_t ** hash, _In_ switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_init(_Out_ switch_hash_t **hash, _In_ switch_memory_pool_t *pool);
/*!
\brief Destroy an existing hash table
@@ -922,7 +933,7 @@
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data);
/*!
\brief Insert data into a hash
@@ -933,7 +944,8 @@
\return SWITCH_STATUS_SUCCESS if the data is added
\note the string key must be a constant or a dynamic string
*/
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_opt_ const void *data, _In_ switch_mutex_t *mutex);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_opt_ const void *data,
+ _In_ switch_mutex_t *mutex);
/*!
\brief Delete data from a hash based on desired key
@@ -941,7 +953,7 @@
\param key the key from which to delete the data
\return SWITCH_STATUS_SUCCESS if the data is deleted
*/
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t * hash, _In_z_ const char *key);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(_In_ switch_hash_t *hash, _In_z_ const char *key);
/*!
\brief Delete data from a hash based on desired key
@@ -950,7 +962,7 @@
\param mutex optional mutex to lock
\return SWITCH_STATUS_SUCCESS if the data is deleted
*/
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
/*!
\brief Retrieve data from a given hash
@@ -958,7 +970,7 @@
\param key the key to retrieve
\return a pointer to the data held in the key
*/
-SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t * hash, _In_z_ const char *key);
+SWITCH_DECLARE(void *) switch_core_hash_find(_In_ switch_hash_t *hash, _In_z_ const char *key);
/*!
@@ -968,11 +980,12 @@
\param mutex optional mutex to lock
\return a pointer to the data held in the key
*/
-SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t * hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
+SWITCH_DECLARE(void *) switch_core_hash_find_locked(_In_ switch_hash_t *hash, _In_z_ const char *key, _In_ switch_mutex_t *mutex);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_first(char *depricate_me, _In_ switch_hash_t *hash);
SWITCH_DECLARE(switch_hash_index_t *) switch_hash_next(_In_ switch_hash_index_t *hi);
-SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen) const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
+SWITCH_DECLARE(void) switch_hash_this(_In_ switch_hash_index_t *hi, _Out_opt_ptrdiff_cap_(klen)
+ const void **key, _Out_opt_ switch_ssize_t *klen, _Out_ void **val);
///\}
@@ -988,7 +1001,8 @@
\param pool the memory pool to use for allocation
\return
*/
-SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
+ switch_memory_pool_t *pool);
/*!
\brief Wait for one cycle on an existing timer
@@ -1067,7 +1081,7 @@
void *decoded_data,
uint32_t decoded_data_len,
uint32_t decoded_rate,
- void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag);
+ void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
/*!
\brief Decode data using a codec handle
@@ -1088,7 +1102,7 @@
void *encoded_data,
uint32_t encoded_data_len,
uint32_t encoded_rate,
- void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag);
+ void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
/*!
\brief Destroy an initalized codec handle
@@ -1198,24 +1212,24 @@
///\defgroup Media File Functions
///\ingroup core1
///\{
+
+SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, const char *func, int line,
+ _In_ switch_file_handle_t *fh,
+ _In_z_ const char *file_path,
+ _In_ uint8_t channels,
+ _In_ uint32_t rate, _In_ unsigned int flags, _In_opt_ switch_memory_pool_t *pool);
+
/*!
\brief Open a media file using file format modules
- \param fh a file handle to use
- \param file_path the path to the file
- \param channels the number of channels
- \param rate the sample rate
- \param flags read/write flags
- \param pool the pool to use (NULL for new pool)
+ \param _fh a file handle to use
+ \param _file_path the path to the file
+ \param _channels the number of channels
+ \param _rate the sample rate
+ \param _flags read/write flags
+ \param _pool the pool to use (NULL for new pool)
\return SWITCH_STATUS_SUCCESS if the file is opened
\note the loadable module used is chosen based on the file extension
*/
-SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, const char *func, int line,
- _In_ switch_file_handle_t *fh,
- _In_z_ const char *file_path,
- _In_ uint8_t channels,
- _In_ uint32_t rate,
- _In_ unsigned int flags,
- _In_opt_ switch_memory_pool_t *pool);
#define switch_core_file_open(_fh, _file_path, _channels, _rate, _flags, _pool) \
switch_core_perform_file_open(__FILE__, __SWITCH_FUNC__, __LINE__, _fh, _file_path, _channels, _rate, _flags, _pool)
@@ -1290,10 +1304,9 @@
*/
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handle_t *sh,
const char *module_name,
- const char *voice_name,
- _In_ unsigned int rate,
- _In_ unsigned int interval,
- switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
+ const char *voice_name,
+ _In_ unsigned int rate,
+ _In_ unsigned int interval, switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
/*!
\brief Feed text to the TTS module
\param sh the speech handle to feed
@@ -1343,7 +1356,7 @@
\return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
*/
SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
- void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags);
+ void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
/*!
\brief Close an open speech handle
\param sh the speech handle to close
@@ -1366,11 +1379,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
const char *module_name,
- const char *codec,
- int rate,
- const char *dest,
- switch_asr_flag_t *flags,
- switch_memory_pool_t *pool);
+ const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool);
/*!
\brief Close an asr handle
@@ -1574,7 +1583,7 @@
\param val the command arguement (if needed)
\return 0 on success nonzero on error
*/
-SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t * val);
+SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val);
/*!
\brief Get the output console
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h Tue May 27 07:24:06 2008
@@ -32,8 +32,7 @@
#define SWITCH_EVENT_HOOKS_H
#include <switch.h>
-SWITCH_BEGIN_EXTERN_C
-typedef struct switch_io_event_hooks switch_io_event_hooks_t;
+SWITCH_BEGIN_EXTERN_C typedef struct switch_io_event_hooks switch_io_event_hooks_t;
typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoing_channel_t;
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
@@ -48,7 +47,7 @@
typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t;
typedef switch_status_t (*switch_outgoing_channel_hook_t)
-(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
+ (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -59,7 +58,7 @@
typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *);
-typedef switch_call_cause_t (*switch_resurrect_session_hook_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
+typedef switch_call_cause_t (*switch_resurrect_session_hook_t) (switch_core_session_t **, switch_memory_pool_t **, void *);
/*! \brief Node in which to store custom receive message callback hooks */
struct switch_io_event_hook_outgoing_channel {
@@ -210,7 +209,7 @@
last = ptr; \
} \
return SWITCH_STATUS_FALSE; \
- }
+ }
NEW_HOOK_DECL_ADD_P(outgoing_channel);
@@ -238,7 +237,7 @@
NEW_HOOK_DECL_REM_P(send_dtmf);
NEW_HOOK_DECL_REM_P(recv_dtmf);
NEW_HOOK_DECL_REM_P(resurrect_session);
-///\}
+
SWITCH_END_EXTERN_C
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h Tue May 27 07:24:06 2008
@@ -8,41 +8,28 @@
#ifdef DOH
}
#endif
-
#include <switch.h>
-
#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
-
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
-
-
-//
-// C++ Interface: switch_to_cpp_mempool
-//
-// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t
-//
-// Author: Yossi Neiman <freeswitch(a)cartissolutions.com>, (C) 2007
-//
-// Copyright: See COPYING file that comes with this distribution
-//
-
+//// C++ Interface: switch_to_cpp_mempool//// Description: This class allows for overloading the new operator to allocate from a switch_memory_pool_t//// Author: Yossi Neiman <freeswitch(a)cartissolutions.com>, (C) 2007//// Copyright: See COPYING file that comes with this distribution//
#if 0
#ifndef SWITCHTOMEMPOOL
#define SWITCHTOMEMPOOL
class SwitchToMempool {
- public:
- SwitchToMempool() { }
- SwitchToMempool(switch_memory_pool_t *mem) { memorypool = mem; }
- void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem)
- {
- void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
- return ptr;
- }
- protected:
- switch_memory_pool_t *memorypool;
+ public:
+ SwitchToMempool() {
+ } SwitchToMempool(switch_memory_pool_t *mem) {
+ memorypool = mem;
+ }
+ void *operator new(switch_size_t num_bytes, switch_memory_pool_t *mem) {
+ void *ptr = switch_core_alloc(mem, (switch_size_t) num_bytes);
+ return ptr;
+ }
+ protected:
+ switch_memory_pool_t *memorypool;
};
#endif
#endif
@@ -66,135 +53,130 @@
SWITCH_DECLARE(void) consoleLog(char *level_str, char *msg);
SWITCH_DECLARE(void) consoleCleanLog(char *msg);
-class CoreSession;
-
-class IVRMenu {
- protected:
- switch_ivr_menu_t *menu;
- switch_memory_pool_t *pool;
- public:
- SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu *main,
- const char *name,
- const char *greeting_sound,
- const char *short_greeting_sound,
- const char *invalid_sound,
- const char *exit_sound,
- const char *confirm_macro,
- const char *confirm_key,
- int confirm_attempts,
- int inter_timeout,
- int digit_len,
- int timeout,
- int max_failures
- );
- virtual SWITCH_DECLARE_CONSTRUCTOR ~IVRMenu();
- SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
- SWITCH_DECLARE(void) execute(CoreSession *session, const char *name);
-};
-
-
-class API {
- protected:
- char *last_data;
- public:
- SWITCH_DECLARE_CONSTRUCTOR API(void);
- virtual SWITCH_DECLARE_CONSTRUCTOR ~API();
- SWITCH_DECLARE(char *) execute(const char *command, const char *data);
- SWITCH_DECLARE(char *) executeString(const char *command);
-};
+ class CoreSession;
-
-typedef struct input_callback_state {
- void *function; // pointer to the language specific callback function
- // eg, PyObject *pyfunc
- void *threadState; // pointer to the language specific thread state
- // eg, PyThreadState *threadState
- void *extra; // currently used to store a switch_file_handle_t
- char *funcargs; // extra string that will be passed to callback function
-} input_callback_state_t;
-
-typedef enum {
- S_HUP = (1 << 0),
- S_FREE = (1 << 1),
- S_RDLOCK = (1 << 2)
-} session_flag_t;
-
-class Stream {
- protected:
- switch_stream_handle_t mystream;
- switch_stream_handle_t *stream_p;
- int mine;
- public:
- SWITCH_DECLARE_CONSTRUCTOR Stream(void);
- SWITCH_DECLARE_CONSTRUCTOR Stream(switch_stream_handle_t *);
- virtual SWITCH_DECLARE_CONSTRUCTOR ~Stream();
- SWITCH_DECLARE(void) write(const char *data);
- SWITCH_DECLARE(const char *)get_data(void);
-};
-
-class Event {
- protected:
- public:
- switch_event_t *event;
- char *serialized_string;
- int mine;
-
- SWITCH_DECLARE_CONSTRUCTOR Event(const char *type, const char *subclass_name = NULL);
- SWITCH_DECLARE_CONSTRUCTOR Event(switch_event_t *wrap_me, int free_me=0);
- virtual SWITCH_DECLARE_CONSTRUCTOR ~Event();
- SWITCH_DECLARE(const char *)serialize(const char *format=NULL);
- SWITCH_DECLARE(bool) setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
- SWITCH_DECLARE(char *)getHeader(char *header_name);
- SWITCH_DECLARE(char *)getBody(void);
- SWITCH_DECLARE(const char *)getType(void);
- SWITCH_DECLARE(bool) addBody(const char *value);
- SWITCH_DECLARE(bool) addHeader(const char *header_name, const char *value);
- SWITCH_DECLARE(bool) delHeader(const char *header_name);
- SWITCH_DECLARE(bool) fire(void);
-
-};
-
-
-class CoreSession {
- protected:
- switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
- // which has a language specific callback function
- switch_input_args_t *ap; // ptr to args .. (is this really needed?)
- switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
- // instead set them here first
- char *xml_cdr_text;
- char *uuid;
- char *tts_name;
- char *voice_name;
- void store_file_handle(switch_file_handle_t *fh);
- void *on_hangup; // language specific callback function, cast as void *
- switch_file_handle_t local_fh;
- switch_file_handle_t *fhp;
- char dtmf_buf[512];
-
- public:
- SWITCH_DECLARE_CONSTRUCTOR CoreSession();
- SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
- SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
- SWITCH_DECLARE_CONSTRUCTOR ~CoreSession();
- switch_core_session_t *session;
- switch_channel_t *channel;
- unsigned int flags;
- int allocated;
- input_callback_state cb_state; // callback state, always pointed to by the buf
- // field in this->args
- switch_channel_state_t hook_state; // store hookstate for on_hangup callback
-
- SWITCH_DECLARE(int) answer();
- SWITCH_DECLARE(int) preAnswer();
- SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing");
- SWITCH_DECLARE(void) setVariable(char *var, char *val);
- SWITCH_DECLARE(void) setPrivate(char *var, void *val);
- SWITCH_DECLARE(void *)getPrivate(char *var);
- SWITCH_DECLARE(const char *)getVariable(char *var);
- SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
- SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
- SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
+ class IVRMenu {
+ protected:
+ switch_ivr_menu_t *menu;
+ switch_memory_pool_t *pool;
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR IVRMenu(IVRMenu * main,
+ const char *name,
+ const char *greeting_sound,
+ const char *short_greeting_sound,
+ const char *invalid_sound,
+ const char *exit_sound,
+ const char *confirm_macro,
+ const char *confirm_key,
+ int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures);
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~ IVRMenu();
+ SWITCH_DECLARE(void) bindAction(char *action, const char *arg, const char *bind);
+ SWITCH_DECLARE(void) execute(CoreSession * session, const char *name);
+ };
+
+
+ class API {
+ protected:
+ char *last_data;
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR API(void);
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~ API();
+ SWITCH_DECLARE(const char *) execute(const char *command, const char *data);
+ SWITCH_DECLARE(const char *) executeString(const char *command);
+ };
+
+
+ typedef struct input_callback_state {
+ void *function; // pointer to the language specific callback function
+ // eg, PyObject *pyfunc
+ void *threadState; // pointer to the language specific thread state
+ // eg, PyThreadState *threadState
+ void *extra; // currently used to store a switch_file_handle_t
+ char *funcargs; // extra string that will be passed to callback function
+ } input_callback_state_t;
+
+ typedef enum {
+ S_HUP = (1 << 0),
+ S_FREE = (1 << 1),
+ S_RDLOCK = (1 << 2)
+ } session_flag_t;
+
+ class Stream {
+ protected:
+ switch_stream_handle_t mystream;
+ switch_stream_handle_t *stream_p;
+ int mine;
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR Stream(void);
+ SWITCH_DECLARE_CONSTRUCTOR Stream(switch_stream_handle_t *);
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~ Stream();
+ SWITCH_DECLARE(void) write(const char *data);
+ SWITCH_DECLARE(const char *) get_data(void);
+ };
+
+ class Event {
+ protected:
+ public:
+ switch_event_t *event;
+ char *serialized_string;
+ int mine;
+
+ SWITCH_DECLARE_CONSTRUCTOR Event(const char *type, const char *subclass_name = NULL);
+ SWITCH_DECLARE_CONSTRUCTOR Event(switch_event_t *wrap_me, int free_me = 0);
+ virtual SWITCH_DECLARE_CONSTRUCTOR ~ Event();
+ SWITCH_DECLARE(const char *) serialize(const char *format = NULL);
+ SWITCH_DECLARE(bool) setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
+ SWITCH_DECLARE(const char *) getHeader(char *header_name);
+ SWITCH_DECLARE(char *) getBody(void);
+ SWITCH_DECLARE(const char *) getType(void);
+ SWITCH_DECLARE(bool) addBody(const char *value);
+ SWITCH_DECLARE(bool) addHeader(const char *header_name, const char *value);
+ SWITCH_DECLARE(bool) delHeader(const char *header_name);
+ SWITCH_DECLARE(bool) fire(void);
+
+ };
+
+
+ class CoreSession {
+ protected:
+ switch_input_args_t args; // holds ptr to cb function and input_callback_state struct
+ // which has a language specific callback function
+ switch_input_args_t *ap; // ptr to args .. (is this really needed?)
+ switch_caller_profile_t caller_profile; // avoid passing so many args to originate,
+ // instead set them here first
+ char *xml_cdr_text;
+ char *uuid;
+ char *tts_name;
+ char *voice_name;
+ void store_file_handle(switch_file_handle_t *fh);
+ void *on_hangup; // language specific callback function, cast as void *
+ switch_file_handle_t local_fh;
+ switch_file_handle_t *fhp;
+ char dtmf_buf[512];
+
+ public:
+ SWITCH_DECLARE_CONSTRUCTOR CoreSession();
+ SWITCH_DECLARE_CONSTRUCTOR CoreSession(char *uuid);
+ SWITCH_DECLARE_CONSTRUCTOR CoreSession(switch_core_session_t *new_session);
+ SWITCH_DECLARE_CONSTRUCTOR ~ CoreSession();
+ switch_core_session_t *session;
+ switch_channel_t *channel;
+ unsigned int flags;
+ int allocated;
+ input_callback_state cb_state; // callback state, always pointed to by the buf
+ // field in this->args
+ switch_channel_state_t hook_state; // store hookstate for on_hangup callback
+
+ SWITCH_DECLARE(int) answer();
+ SWITCH_DECLARE(int) preAnswer();
+ SWITCH_DECLARE(void) hangup(char *cause = "normal_clearing");
+ SWITCH_DECLARE(void) setVariable(char *var, char *val);
+ SWITCH_DECLARE(void) setPrivate(char *var, void *val);
+ SWITCH_DECLARE(void *) getPrivate(char *var);
+ SWITCH_DECLARE(const char *) getVariable(char *var);
+ SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
+ SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
+ SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
/** \brief Record to a file
* \param file_name
@@ -203,28 +185,26 @@
* to be considered silence (500 is a good starting point).
* \param <[silence_secs]> seconds of silence to interrupt the record.
*/
- SWITCH_DECLARE(int) recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0);
+ SWITCH_DECLARE(int) recordFile(char *file_name, int max_len = 0, int silence_threshold = 0, int silence_secs = 0);
/** \brief Set attributes of caller data for purposes of outgoing calls
* \param var - the variable name, eg, "caller_id_name"
* \param val - the data to set, eg, "bob"
*/
- SWITCH_DECLARE(void) setCallerData(char *var, char *val);
+ SWITCH_DECLARE(void) setCallerData(char *var, char *val);
/** \brief Originate a call to a destination
*
* \param a_leg_session - the session where the call is originating from
* and also the session in which _this_ session was
* created
- * \param dest - a string representing destination, eg, sofia/mydomain.com/foo@bar.com
+ * \param dest - a string representing destination, eg, sofia/mydomain.com/foo\@bar.com
* \param timeout - time to wait for call to be answered
* \return an int status code indicating success or failure
*
*/
- SWITCH_DECLARE(int) originate(CoreSession *a_leg_session,
- char *dest,
- int timeout=60);
+ SWITCH_DECLARE(int) originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
/** \brief set a DTMF callback function
@@ -235,16 +215,16 @@
* certain other methods are executing.
*
*/
- SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs);
+ SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs);
- SWITCH_DECLARE(int) speak(char *text);
- SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name);
+ SWITCH_DECLARE(int) speak(char *text);
+ SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name);
/**
* For timeout milliseconds, call the dtmf function set previously
* by setDTMFCallback whenever a dtmf or event is received
*/
- SWITCH_DECLARE(int) collectDigits(int timeout);
+ SWITCH_DECLARE(int) collectDigits(int timeout);
/**
* Collect up to maxdigits digits worth of digits
@@ -253,20 +233,13 @@
* (see mod_python.i). This does NOT call any callbacks upon
* receiving dtmf digits. For that, use collectDigits.
*/
- SWITCH_DECLARE(char *) getDigits(
- int maxdigits,
- char *terminators,
- int timeout);
-
- SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
+ SWITCH_DECLARE(char *) getDigits(int maxdigits, char *terminators, int timeout);
+
+ SWITCH_DECLARE(int) transfer(char *extensions, char *dialplan, char *context);
+
+ SWITCH_DECLARE(char *) read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators);
- SWITCH_DECLARE(char *) read(int min_digits,
- int max_digits,
- const char *prompt_audio_file,
- int timeout,
- const char *valid_terminators);
-
/** \brief Play a file into channel and collect dtmfs
*
* See API docs in switch_ivr.h: switch_play_and_get_digits(..)
@@ -275,14 +248,10 @@
* setDTMFCallback(..) as it uses its own internal callback
* handler.
*/
- SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
- int max_digits,
- int max_tries,
- int timeout,
- char *terminators,
- char *audio_files,
- char *bad_input_audio_files,
- char *digits_regex);
+ SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
+ int max_digits,
+ int max_tries,
+ int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex);
/** \brief Play a file that resides on disk into the channel
*
@@ -292,53 +261,56 @@
* \return an int status code indicating success or failure
*
*/
- SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count=0);
+ SWITCH_DECLARE(int) streamFile(char *file, int starting_sample_count = 0);
/** \brief flush any pending events
*/
- SWITCH_DECLARE(int) flushEvents();
+ SWITCH_DECLARE(int) flushEvents();
/** \brief flush any pending digits
*/
- SWITCH_DECLARE(int) flushDigits();
+ SWITCH_DECLARE(int) flushDigits();
- SWITCH_DECLARE(int) setAutoHangup(bool val);
+ SWITCH_DECLARE(int) setAutoHangup(bool val);
/** \brief Set the hangup callback function
* \param hangup_func - language specific function ptr cast into void *
*/
- SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
+ SWITCH_DECLARE(void) setHangupHook(void *hangup_func);
- SWITCH_DECLARE(bool) ready();
+ SWITCH_DECLARE(bool) ready();
- SWITCH_DECLARE(void) execute(char *app, char *data=NULL);
+ SWITCH_DECLARE(void) execute(char *app, char *data = NULL);
- SWITCH_DECLARE(void) sendEvent(Event *sendME);
+ SWITCH_DECLARE(void) sendEvent(Event * sendME);
- SWITCH_DECLARE(void) setEventData(Event *e);
- SWITCH_DECLARE(char *) getXMLCDR();
+ SWITCH_DECLARE(void) setEventData(Event * e);
+ SWITCH_DECLARE(char *) getXMLCDR();
- virtual bool begin_allow_threads() = 0;
- virtual bool end_allow_threads() = 0;
+ virtual bool begin_allow_threads() = 0;
+ virtual bool end_allow_threads() = 0;
/** \brief Get the uuid of this session
* \return the uuid of this session
*/
- char* get_uuid() const { return uuid; };
+ char *get_uuid() const {
+ return uuid;
+ };
/** \brief Get the callback function arguments associated with this session
* \return a const reference to the callback function arguments
*/
- const switch_input_args_t& get_cb_args() const { return args; };
+ const switch_input_args_t &get_cb_args() const {
+ return args;
+ };
/** \brief Callback to the language specific hangup callback
*/
- virtual void check_hangup_hook() = 0;
+ virtual void check_hangup_hook() = 0;
- virtual switch_status_t run_dtmf_callback(void *input,
- switch_input_type_t itype) = 0;
+ virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0;
-};
+ };
/* ---- functions not bound to CoreSession instance ----- */
@@ -351,7 +323,7 @@
* NOTE: the stuff regarding the dtmf callback might be completely
* wrong and has not been reviewed or tested
*/
-SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b);
+SWITCH_DECLARE(void) bridge(CoreSession & session_a, CoreSession & session_b);
/** \brief the actual hangup hook called back by freeswitch core
@@ -360,11 +332,8 @@
*/
SWITCH_DECLARE_NONSTD(switch_status_t) hanguphook(switch_core_session_t *session);
-SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
- void *input,
- switch_input_type_t itype,
- void *buf,
- unsigned int buflen);
+SWITCH_DECLARE_NONSTD(switch_status_t) dtmf_callback(switch_core_session_t *session,
+ void *input, switch_input_type_t itype, void *buf, unsigned int buflen);
#ifdef __cplusplus
@@ -382,4 +351,3 @@
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
*/
-
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h Tue May 27 07:24:06 2008
@@ -156,7 +156,7 @@
\param header_name the name of the header to read
\return the value of the requested header
*/
-_Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
+ _Ret_opt_z_ SWITCH_DECLARE(char *) switch_event_get_header(switch_event_t *event, char *header_name);
#define switch_event_get_header_nil(e, h) switch_str_nil(switch_event_get_header(e,h))
@@ -292,7 +292,7 @@
#endif
SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const char *in);
-SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
+SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
_In_z_ const char *proto, _In_z_ const char *login,
_In_z_ const char *from, _In_z_ const char *from_domain,
_In_z_ const char *status, _In_z_ const char *event_type,
@@ -344,7 +344,7 @@
*/
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data)
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix,switch_hash_t* vars_map);
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map);
///\}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_frame.h Tue May 27 07:24:06 2008
@@ -40,7 +40,7 @@
SWITCH_BEGIN_EXTERN_C
/*! \brief An abstraction of a data frame */
-struct switch_frame {
+ struct switch_frame {
/*! a pointer to the codec information */
switch_codec_t *codec;
/*! the originating source of the frame */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h Tue May 27 07:24:06 2008
@@ -41,9 +41,7 @@
#include <switch.h>
-SWITCH_BEGIN_EXTERN_C
-
-struct switch_unicast_conninfo {
+SWITCH_BEGIN_EXTERN_C struct switch_unicast_conninfo {
switch_core_session_t *session;
switch_codec_t read_codec;
switch_frame_t write_frame;
@@ -73,13 +71,10 @@
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_deactivate_unicast(switch_core_session_t *session);
-SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
+SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
char *local_ip,
switch_port_t local_port,
- char *remote_ip,
- switch_port_t remote_port,
- char *transport,
- char *flags);
+ char *remote_ip, switch_port_t remote_port, char *transport, char *flags);
/*!
\brief Generate an XML CDR report.
@@ -88,7 +83,7 @@
\return SWITCH_STATUS_SUCCESS if successful
\note on success the xml object must be freed
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t * xml_cdr);
+SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr);
SWITCH_DECLARE(int) switch_ivr_set_xml_profile_data(switch_xml_t xml, switch_caller_profile_t *caller_profile, int off);
SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channel_t *channel, int off);
@@ -143,11 +138,9 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf,
switch_size_t buflen,
- switch_size_t maxdigits,
- const char *terminators, char *terminator,
- uint32_t first_timeout,
- uint32_t digit_timeout,
- uint32_t abs_timeout);
+ switch_size_t maxdigits,
+ const char *terminators, char *terminator,
+ uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout);
/*!
\brief Engage background Speech detection on a session
@@ -161,9 +154,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
const char *mod_name,
- const char *grammar,
- const char *path,
- const char *dest, switch_asr_handle_t *ah);
+ const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah);
/*!
\brief Stop background Speech detection on a session
@@ -217,21 +208,19 @@
\brief Eavesdrop on a another session
\param session our session
\param uuid the uuid of the session to spy on
- \param require_group - NEEDDESC -
- \param flags - NEEDDESC -
+ \param require_group group name to use to limit by group
+ \param flags tweak read-mux, write-mux and dtmf
\return SWITCH_STATUS_SUCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
- const char *uuid,
- const char *require_group,
- switch_eavesdrop_flag_t flags);
+SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
+ const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags);
/*!
- \brief - NEEDDESC -
+ \brief displace the media for a session with the audio from a file
\param session the session to displace
- \param file
- \param limit
- \param flags
+ \param file filename
+ \param limit time limit in ms
+ \param flags m (mux) l (loop) or r(read session instead of write session)
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags);
@@ -239,7 +228,7 @@
/*!
\brief Stop displacing a session
\param session the session
- \param file - NEEDDESC -
+ \param file file name from the switch_ivr_displace_session call
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file);
@@ -270,7 +259,7 @@
/*!
\brief Start generating DTMF inband
\param session the session to generate on
- \param read_stream - NEEDDESC -
+ \param read_stream true to use the session we are reading from, false for the session we are writing to.
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_core_session_t *session, switch_bool_t read_stream);
@@ -307,10 +296,9 @@
\param data optional data for appliaction
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
+SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
const char *key, const char *tone_spec,
- const char *flags, time_t timeout,
- const char *app, const char *data);
+ const char *flags, time_t timeout, const char *app, const char *data);
@@ -322,7 +310,8 @@
\param args arguements to pass for callbacks etc
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args);
+SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file,
+ switch_input_args_t *args);
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args);
@@ -337,9 +326,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(_In_ switch_core_session_t *session,
_In_ switch_file_handle_t *fh,
- _In_z_ const char *file,
- _In_opt_ switch_input_args_t *args,
- _In_ uint32_t limit);
+ _In_z_ const char *file, _In_opt_ switch_input_args_t *args, _In_ uint32_t limit);
/*!
@@ -407,8 +394,7 @@
const switch_state_handler_table_t *table,
const char *cid_name_override,
const char *cid_num_override,
- switch_caller_profile_t *caller_profile_override,
- switch_originate_flag_t flags);
+ switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags);
/*!
\brief Bridge Audio from one session to another
@@ -439,7 +425,8 @@
\param dialplan the new dialplan (OPTIONAL, may be NULL)
\param context the new context (OPTIONAL, may be NULL)
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan, const char *context);
+SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(_In_ switch_core_session_t *session, const char *extension, const char *dialplan,
+ const char *context);
/*!
\brief Transfer an existing session to another location in the future
@@ -560,14 +547,14 @@
\param parser a pointer to the object pointer
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser);
/*!
\brief Destroy a digit stream parser object
\param parser a pointer to the parser object
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t * parser);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t *parser);
/*!
\brief Create a new digit stream object
@@ -575,14 +562,14 @@
\param stream a pointer to the stream object pointer
\return NULL if no match found or consumer data that was associated with a given digit string when matched
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t ** stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream);
/*!
\brief Destroys a digit stream object
\param stream a pointer to the stream object
\return NULL if no match found or consumer data that was associated with a given digit string when matched
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t * stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t *stream);
/*!
\brief Set a digit string to action mapping
@@ -591,7 +578,7 @@
\param data consumer data attached to this digit string
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t * parser, char *digits, void *data);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data);
/*!
\brief Delete a string to action mapping
@@ -599,7 +586,7 @@
\param digits the digit string to be removed from the map
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t * parser, char *digits);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t *parser, char *digits);
/*!
\brief Feed digits collected into the stream for event match testing
@@ -608,14 +595,14 @@
\param digit a digit to collect and test against the map of digit strings
\return NULL if no match found or consumer data that was associated with a given digit string when matched
*/
-SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t * stream, char digit);
+SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t *stream, char digit);
/*!
\brief Reset the collected digit stream to nothing
\param stream a pointer to the parser stream object created by switch_ivr_digit_stream_new
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t * stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream);
/*!
\brief Set a digit string terminator
@@ -623,7 +610,7 @@
\param digit the terminator digit
\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t * parser, char digit);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t *parser, char digit);
/******************************************************************************************************/
@@ -655,7 +642,7 @@
SWITCH_IVR_ACTION_NOOP /* No operation */
} switch_ivr_action_t;
struct switch_ivr_menu;
- typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *);
+ typedef switch_ivr_action_t switch_ivr_menu_action_function_t (struct switch_ivr_menu *, char *, char *, size_t, void *);
typedef struct switch_ivr_menu switch_ivr_menu_t;
typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
/******************************************************************************************************/
@@ -669,31 +656,28 @@
*\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
*\param invalid_sound Optional pointer to a sound to play after invalid input.
*\param exit_sound Optional pointer to a sound to play upon exiting the menu.
- *\param confirm_macro - NEEDDESC -
- *\param confirm_key - NEEDDESC -
- *\param confirm_attempts - NEEDDESC -
- *\param inter_timeout - NEEDDESC -
- *\param digit_len - NEEDDESC -
+ *\param confirm_macro phrase macro name to confirm input
+ *\param confirm_key the dtmf key required for positive confirmation
+ *\param confirm_attempts number of times to prompt to confirm input before failure
+ *\param inter_timeout inter-digit timeout
+ *\param digit_len max number of digits
*\param timeout A number of milliseconds to pause before looping.
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
*\param pool memory pool (NULL to create one).
*\return SWITCH_STATUS_SUCCESS if the menu was created.
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
- switch_ivr_menu_t * main,
- const char *name,
- const char *greeting_sound,
- const char *short_greeting_sound,
- const char *invalid_sound,
- const char *exit_sound,
- const char *confirm_macro,
- const char *confirm_key,
- int confirm_attempts,
- int inter_timeout,
- int digit_len,
- int timeout, int max_failures,
- switch_memory_pool_t *pool);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu,
+ switch_ivr_menu_t *main,
+ const char *name,
+ const char *greeting_sound,
+ const char *short_greeting_sound,
+ const char *invalid_sound,
+ const char *exit_sound,
+ const char *confirm_macro,
+ const char *confirm_key,
+ int confirm_attempts,
+ int inter_timeout, int digit_len, int timeout, int max_failures, switch_memory_pool_t *pool);
/*!
*\brief switch_ivr_menu_bind_action: Bind a keystroke to an action.
@@ -703,7 +687,8 @@
*\param bind KeyStrokes to bind the action to.
*\return SWUTCH_STATUS_SUCCESS if the action was binded
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t * menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
+ const char *bind);
/*!
@@ -717,8 +702,8 @@
*\note The function returns an switch_ivr_action_t enum of what you want to do. and looks to your buffer for args.
*\return SWUTCH_STATUS_SUCCESS if the function was binded
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t * menu,
- switch_ivr_menu_action_function_t * function, const char *arg, const char *bind);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu,
+ switch_ivr_menu_action_function_t *function, const char *arg, const char *bind);
/*!
@@ -729,14 +714,14 @@
*\param obj A void pointer to an object you want to make avaliable to your callback functions that you may have binded with switch_ivr_menu_bind_function.
*\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t * stack, char *name, void *obj);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *session, switch_ivr_menu_t *stack, char *name, void *obj);
/*!
*\brief free a stack of menu objects.
*\param stack The top level menu you wish to destroy.
*\return SWITCH_STATUS_SUCCESS if the object was a top level menu and it was freed
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t * stack);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack);
struct switch_ivr_menu_xml_ctx;
typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
@@ -748,10 +733,10 @@
*\param xml_menu The xml Menu source of the menu to be created
*\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
- switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
+ switch_ivr_menu_t **menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
/*!
*\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
@@ -759,46 +744,45 @@
*\param function The menu function callback that will be executed when menu digits are bound to this name
*\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
- const char *name, switch_ivr_menu_action_function_t * function);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
+ const char *name, switch_ivr_menu_action_function_t *function);
/*!
*\param xml_menu_ctx A pointer of a XML menu parser context to be created
*\param pool memory pool (NULL to create one)
*\return SWITCH_STATUS_SUCCESS if all is well
*/
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t ** xml_menu_ctx, switch_memory_pool_t *pool);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t **xml_menu_ctx, switch_memory_pool_t *pool);
-SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
- switch_input_args_t *args);
-SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
-SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
-SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
-SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
-SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
-
-SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
- uint32_t min_digits,
- uint32_t max_digits,
- const char *prompt_audio_file,
- const char *var_name,
- char *digit_buffer,
- switch_size_t digit_buffer_length,
- uint32_t timeout,
- const char *valid_terminators);
-
-SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
- switch_bind_flag_t bind_flags, const char *app);
-SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
-SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
-SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
+ switch_input_args_t *args);
+ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
+ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
+ SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
+
+ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
+ uint32_t min_digits,
+ uint32_t max_digits,
+ const char *prompt_audio_file,
+ const char *var_name,
+ char *digit_buffer,
+ switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
+
+ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
+ switch_bind_flag_t bind_flags, const char *app);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
+ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
+ const char *say_method, switch_input_args_t *args);
-SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
-SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
+ SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name);
+ SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
/** @} */
-SWITCH_END_EXTERN_C
+ SWITCH_END_EXTERN_C
#endif
/* For Emacs:
* Local Variables:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_loadable_module.h Tue May 27 07:24:06 2008
@@ -128,9 +128,8 @@
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
switch_module_load_t switch_module_load,
switch_module_runtime_t switch_module_runtime,
- switch_module_shutdown_t switch_module_shutdown,
- switch_bool_t runtime);
-
+ switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime);
+
/*!
\brief Retrieve the timer interface by it's registered name
@@ -259,7 +258,7 @@
\param filename the path to the module's dll or so file
\return SWITCH_STATUS_SUCCESS on a successful load
*/
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load( switch_loadable_module_interface_t **module_interface, char *filename);
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(switch_loadable_module_interface_t **module_interface, char *filename);
SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void);
/*!
@@ -317,44 +316,43 @@
}
-static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool,
- switch_codec_interface_t *codec_interface,
- /*! enumeration defining the type of the codec */
- const switch_codec_type_t codec_type,
- /*! the IANA code number */
- switch_payload_t ianacode,
- /*! the IANA code name */
- const char *iananame,
- /*! default fmtp to send (can be overridden by the init function) */
- char *fmtp,
- /*! samples transferred per second */
- uint32_t samples_per_second,
- /*! actual samples transferred per second for those who are not moron g722 RFC writers*/
- uint32_t actual_samples_per_second,
- /*! bits transferred per second */
- int bits_per_second,
- /*! number of microseconds that denote one frame */
- int microseconds_per_frame,
- /*! number of samples that denote one frame */
- uint32_t samples_per_frame,
- /*! number of bytes that denote one frame decompressed */
- uint32_t bytes_per_frame,
- /*! number of bytes that denote one frame compressed */
- uint32_t encoded_bytes_per_frame,
- /*! number of channels represented */
- uint8_t number_of_channels,
- /*! number of frames to send in one netowrk packet */
- int pref_frames_per_packet,
- /*! max number of frames to send in one network packet */
- int max_frames_per_packet,
- /*! function to initialize a codec handle using this implementation */
- switch_core_codec_init_func_t init,
- /*! function to encode raw data into encoded data */
- switch_core_codec_encode_func_t encode,
- /*! function to decode encoded data into raw data */
- switch_core_codec_decode_func_t decode,
- /*! deinitalize a codec handle using this implementation */
- switch_core_codec_destroy_func_t destroy)
+ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *pool, switch_codec_interface_t *codec_interface,
+ /*! enumeration defining the type of the codec */
+ const switch_codec_type_t codec_type,
+ /*! the IANA code number */
+ switch_payload_t ianacode,
+ /*! the IANA code name */
+ const char *iananame,
+ /*! default fmtp to send (can be overridden by the init function) */
+ char *fmtp,
+ /*! samples transferred per second */
+ uint32_t samples_per_second,
+ /*! actual samples transferred per second for those who are not moron g722 RFC writers */
+ uint32_t actual_samples_per_second,
+ /*! bits transferred per second */
+ int bits_per_second,
+ /*! number of microseconds that denote one frame */
+ int microseconds_per_frame,
+ /*! number of samples that denote one frame */
+ uint32_t samples_per_frame,
+ /*! number of bytes that denote one frame decompressed */
+ uint32_t bytes_per_frame,
+ /*! number of bytes that denote one frame compressed */
+ uint32_t encoded_bytes_per_frame,
+ /*! number of channels represented */
+ uint8_t number_of_channels,
+ /*! number of frames to send in one netowrk packet */
+ int pref_frames_per_packet,
+ /*! max number of frames to send in one network packet */
+ int max_frames_per_packet,
+ /*! function to initialize a codec handle using this implementation */
+ switch_core_codec_init_func_t init,
+ /*! function to encode raw data into encoded data */
+ switch_core_codec_encode_func_t encode,
+ /*! function to decode encoded data into raw data */
+ switch_core_codec_decode_func_t decode,
+ /*! deinitalize a codec handle using this implementation */
+ switch_core_codec_destroy_func_t destroy)
{
if (codec_type == SWITCH_CODEC_TYPE_VIDEO || SWITCH_ACCEPTABLE_INTERVAL(microseconds_per_frame / 1000)) {
switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl));
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h Tue May 27 07:24:06 2008
@@ -111,7 +111,7 @@
\param level the level
\return the name of the log level
*/
-_Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
+ _Ret_z_ SWITCH_DECLARE(const char *) switch_log_level2str(_In_ switch_log_level_t level);
/*!
\brief Return the level number of the specified log level name
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h Tue May 27 07:24:06 2008
@@ -45,8 +45,7 @@
SWITCH_BEGIN_EXTERN_C
/*! \brief A table of functions to execute at various states
*/
-
-typedef enum {
+ typedef enum {
SWITCH_SHN_ON_INIT,
SWITCH_SHN_ON_ROUTING,
SWITCH_SHN_ON_EXECUTE,
@@ -100,7 +99,31 @@
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
-(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);
@@ -108,9 +131,9 @@
typedef switch_status_t (*switch_io_receive_message_t) (switch_core_session_t *, switch_core_session_message_t *);
typedef switch_status_t (*switch_io_receive_event_t) (switch_core_session_t *, switch_event_t *);
typedef switch_status_t (*switch_io_state_change_t) (switch_core_session_t *);
-typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
+typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_write_video_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
-typedef switch_call_cause_t (*switch_io_resurrect_session_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
+typedef switch_call_cause_t (*switch_io_resurrect_session_t) (switch_core_session_t **, switch_memory_pool_t **, void *);
typedef enum {
SWITCH_IO_OUTGOING_CHANNEL,
@@ -192,7 +215,7 @@
switch_memory_pool_t *memory_pool;
/*! private data for loadable modules to store information */
void *private_info;
- /*! remaining time from last call to _check()*/
+ /*! remaining time from last call to _check() */
switch_size_t diff;
switch_size_t tick;
};
@@ -346,7 +369,7 @@
/*! The Rate */
uint32_t rate;
char *grammar;
- /*! module specific param*/
+ /*! module specific param */
char *param;
/*! the handle's memory pool */
switch_memory_pool_t *memory_pool;
@@ -365,7 +388,7 @@
/*! function to feed audio to the ASR */
switch_status_t (*speech_feed_tts) (switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags);
/*! function to read audio from the TTS */
- switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags);
+ switch_status_t (*speech_read_tts) (switch_speech_handle_t *sh, void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags);
void (*speech_flush_tts) (switch_speech_handle_t *sh);
void (*speech_text_param_tts) (switch_speech_handle_t *sh, char *param, const char *val);
void (*speech_numeric_param_tts) (switch_speech_handle_t *sh, char *param, int val);
@@ -389,7 +412,7 @@
uint32_t samples;
char voice[80];
char *engine;
- /*! module specific param*/
+ /*! module specific param */
char *param;
/*! the handle's memory pool */
switch_memory_pool_t *memory_pool;
@@ -526,7 +549,7 @@
char *fmtp;
/*! samples transferred per second */
uint32_t samples_per_second;
- /*! actual samples transferred per second for those who are not moron g722 RFC writers*/
+ /*! actual samples transferred per second for those who are not moron g722 RFC writers */
uint32_t actual_samples_per_second;
/*! bits transferred per second */
int bits_per_second;
@@ -545,13 +568,13 @@
/*! max number of frames to send in one network packet */
int max_frames_per_packet;
/*! function to initialize a codec handle using this implementation */
- switch_core_codec_init_func_t init;
+ switch_core_codec_init_func_t init;
/*! function to encode raw data into encoded data */
- switch_core_codec_encode_func_t encode;
+ switch_core_codec_encode_func_t encode;
/*! function to decode encoded data into raw data */
- switch_core_codec_decode_func_t decode;
+ switch_core_codec_decode_func_t decode;
/*! deinitalize a codec handle using this implementation */
- switch_core_codec_destroy_func_t destroy;
+ switch_core_codec_destroy_func_t destroy;
uint32_t codec_id;
struct switch_codec_implementation *next;
};
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_odbc.h Tue May 27 07:24:06 2008
@@ -44,9 +44,7 @@
#endif
#include <sqltypes.h>
-SWITCH_BEGIN_EXTERN_C
-
-struct switch_odbc_handle;
+SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
typedef enum {
SWITCH_ODBC_STATE_INIT,
@@ -70,7 +68,6 @@
char *sql, switch_core_db_callback_func_t callback, void *pdata);
SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, SQLHSTMT stmt);
SWITCH_END_EXTERN_C
-
#endif
/* For Emacs:
* Local Variables:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_platform.h Tue May 27 07:24:06 2008
@@ -59,17 +59,13 @@
* C4610: struct can never be instantiated - user defined constructor required
*/
#pragma warning(disable:4100 4200 4204 4706 4819 4132 4510 4512 4610 4996)
-
#define SWITCH_HAVE_ODBC 1
-
#ifdef _MSC_VER
# pragma comment(lib, "odbc32.lib")
#endif
-
#if (_MSC_VER >= 1400) // VC8+
#define switch_assert(expr) assert(expr);__analysis_assume( expr )
#endif
-
#if (_MSC_VER >= 1400) // VC8+
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
@@ -86,7 +82,7 @@
#undef inline
#define inline __inline
#ifndef uint32_t
-typedef unsigned __int8 uint8_t;
+ typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
@@ -183,9 +179,9 @@
#define PRINTF_FUNCTION(fmtstr,vars)
#endif
#ifdef SWITCH_INT32
- typedef SWITCH_INT32 switch_int32_t;
+typedef SWITCH_INT32 switch_int32_t;
#else
- typedef int32_t switch_int32_t;
+typedef int32_t switch_int32_t;
#endif
#ifdef SWITCH_SIZE_T
@@ -294,10 +290,9 @@
#ifndef switch_assert
#define switch_assert(expr) assert(expr)
#endif
-
#ifndef __ATTR_SAL
- /* used for msvc code analysis */
- /* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
+ /* used for msvc code analysis */
+ /* http://msdn2.microsoft.com/en-us/library/ms235402.aspx */
#define _In_
#define _In_z_
#define _In_opt_z_
@@ -320,8 +315,6 @@
#define _Out_ptrdiff_cap_(x)
#define _Out_opt_ptrdiff_cap_(x)
#endif
-
-
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h Tue May 27 07:24:06 2008
@@ -45,9 +45,7 @@
#define SWITCH_RTP_KEY_LEN 30
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
-
-
-typedef enum {
+ typedef enum {
SWITCH_RTP_CRYPTO_SEND,
SWITCH_RTP_CRYPTO_RECV,
SWITCH_RTP_CRYPTO_MAX
@@ -72,16 +70,13 @@
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
switch_rtp_crypto_direction_t direction,
- uint32_t index,
- switch_rtp_crypto_key_type_t type,
- unsigned char *key,
- switch_size_t keylen);
+ uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen);
///\defgroup rtp RTP (RealTime Transport Protocol)
///\ingroup core1
///\{
-typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
- switch_socket_t * sock, void *data, switch_size_t datalen, switch_sockaddr_t * from_addr);
+ typedef void (*switch_rtp_invalid_handler_t) (switch_rtp_t *rtp_session,
+ switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr);
SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len);
@@ -130,10 +125,7 @@
switch_payload_t payload,
uint32_t samples_per_interval,
uint32_t ms_per_packet,
- switch_rtp_flag_t flags,
- char *timer_name,
- const char **err,
- switch_memory_pool_t *pool);
+ switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
/*!
@@ -158,10 +150,7 @@
switch_payload_t payload,
uint32_t samples_per_interval,
uint32_t ms_per_packet,
- switch_rtp_flag_t flags,
- char *timer_name,
- const char **err,
- switch_memory_pool_t *pool);
+ switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool);
/*!
@@ -296,7 +285,7 @@
\param io_flags i/o flags
\return the number of bytes read
*/
-SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t * datalen,
+SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
/*!
@@ -308,7 +297,7 @@
SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
/*!
- \brief Queue RFC2833 DTMF data into an RTP Session - NEEDDESC -
+ \brief Queue RFC2833 DTMF data into an RTP Session
\param rtp_session the rtp session to use
\param dtmf the dtmf digits to queue
\return SWITCH_STATUS_SUCCESS on success
@@ -341,7 +330,8 @@
\return the number of bytes read
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
- void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags);
+ void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
+ switch_io_flag_t io_flags);
/*!
\brief Read data from a given RTP session without copying
@@ -390,9 +380,7 @@
\return the number of bytes written
*/
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
- void *data,
- uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
+ void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags);
/*!
\brief Retrieve the SSRC from a given RTP session
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h Tue May 27 07:24:06 2008
@@ -137,7 +137,7 @@
\param len the length of the data
\return a stun packet pointer to buf to use as an access point
*/
-SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t * buf, uint32_t len);
+SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, uint32_t len);
/*!
\brief Obtain a printable string form of a given value
@@ -155,7 +155,7 @@
\param port the port
\return true or false
*/
-SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t * port);
+SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port);
/*!
\brief Extract a username from a packet attribute
@@ -174,7 +174,7 @@
\param buf a pointer to data to use for the packet
\return a pointer to a ready-to-use stun packet
*/
-SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t * buf);
+SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t *buf);
/*!
\brief Add a username packet attribute
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h Tue May 27 07:24:06 2008
@@ -91,11 +91,9 @@
#define SWITCH_SEQ_CLEARLINE SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINE_CHAR_STR
#define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
#define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
-
#define SWITCH_DEFAULT_DTMF_DURATION 2000
#define SWITCH_MAX_DTMF_DURATION 192000
#define SWITCH_DEFAULT_DIR_PERMS SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE
-
#ifdef WIN32
#define SWITCH_PATH_SEPARATOR "\\"
#else
@@ -144,7 +142,7 @@
#define SWITCH_SPEECH_KEY "speech"
#define SWITCH_UUID_BRIDGE "uuid_bridge"
#define SWITCH_BITS_PER_BYTE 8
-typedef uint8_t switch_byte_t;
+ typedef uint8_t switch_byte_t;
typedef struct {
char digit;
@@ -168,7 +166,7 @@
typedef enum {
SOF_NONE = 0,
SOF_NOBLOCK = (1 << 0),
- SOF_FORKED_DIAL = (1 << 1)
+ SOF_FORKED_DIAL = (1 << 1)
} switch_originate_flag_t;
typedef enum {
@@ -185,7 +183,7 @@
typedef enum {
SCF_NONE = 0,
- SCF_USE_SQL = ( 1 << 0),
+ SCF_USE_SQL = (1 << 0),
SCF_NO_NEW_SESSIONS = (1 << 1),
SCF_SHUTTING_DOWN = (1 << 2),
SCF_CRASH_PROT = (1 << 3)
@@ -320,10 +318,10 @@
#define SWITCH_MAX_STACKS 32
#define SWITCH_THREAD_STACKSIZE 240 * 1024
-#define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
-#define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
+#define SWITCH_MAX_INTERVAL 120 /* we only do up to 120ms */
+#define SWITCH_INTERVAL_PAD 10 /* A little extra buffer space to be safe */
#define SWITCH_MAX_SAMPLE_LEN 32
-#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
+#define SWITCH_BYTES_PER_SAMPLE 2 /* slin is 2 bytes per sample */
#define SWITCH_RECOMMENDED_BUFFER_SIZE (SWITCH_BYTES_PER_SAMPLE * SWITCH_MAX_SAMPLE_LEN * (SWITCH_MAX_INTERVAL + SWITCH_INTERVAL_PAD))
#define SWITCH_MAX_CODECS 30
#define SWITCH_MAX_STATE_HANDLERS 30
@@ -425,29 +423,29 @@
#if __BYTE_ORDER == __BIG_ENDIAN
typedef struct {
- unsigned version:2; /* protocol version */
- unsigned p:1; /* padding flag */
- unsigned x:1; /* header extension flag */
- unsigned cc:4; /* CSRC count */
- unsigned m:1; /* marker bit */
- unsigned pt:7; /* payload type */
- unsigned seq:16; /* sequence number */
- unsigned ts:32; /* timestamp */
- unsigned ssrc:32; /* synchronization source */
+ unsigned version:2; /* protocol version */
+ unsigned p:1; /* padding flag */
+ unsigned x:1; /* header extension flag */
+ unsigned cc:4; /* CSRC count */
+ unsigned m:1; /* marker bit */
+ unsigned pt:7; /* payload type */
+ unsigned seq:16; /* sequence number */
+ unsigned ts:32; /* timestamp */
+ unsigned ssrc:32; /* synchronization source */
} switch_rtp_hdr_t;
#else /* BIG_ENDIAN */
typedef struct {
- unsigned cc:4; /* CSRC count */
- unsigned x:1; /* header extension flag */
- unsigned p:1; /* padding flag */
- unsigned version:2; /* protocol version */
- unsigned pt:7; /* payload type */
- unsigned m:1; /* marker bit */
- unsigned seq:16; /* sequence number */
- unsigned ts:32; /* timestamp */
- unsigned ssrc:32; /* synchronization source */
+ unsigned cc:4; /* CSRC count */
+ unsigned x:1; /* header extension flag */
+ unsigned p:1; /* padding flag */
+ unsigned version:2; /* protocol version */
+ unsigned pt:7; /* payload type */
+ unsigned m:1; /* marker bit */
+ unsigned seq:16; /* sequence number */
+ unsigned ts:32; /* timestamp */
+ unsigned ssrc:32; /* synchronization source */
} switch_rtp_hdr_t;
#endif
@@ -1210,25 +1208,19 @@
typedef switch_status_t (*switch_core_codec_encode_func_t) (switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *decoded_data,
- uint32_t decoded_data_len,
- uint32_t decoded_rate,
- void *encoded_data,
- uint32_t * encoded_data_len,
- uint32_t * encoded_rate,
- unsigned int *flag);
+ switch_codec_t *other_codec,
+ void *decoded_data,
+ uint32_t decoded_data_len,
+ uint32_t decoded_rate,
+ void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag);
typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *encoded_data,
- uint32_t encoded_data_len,
- uint32_t encoded_rate,
- void *decoded_data,
- uint32_t * decoded_data_len,
- uint32_t * decoded_rate,
- unsigned int *flag);
+ switch_codec_t *other_codec,
+ void *encoded_data,
+ uint32_t encoded_data_len,
+ uint32_t encoded_rate,
+ void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag);
typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings);
typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *);
@@ -1255,7 +1247,8 @@
typedef switch_status_t (*switch_stream_handle_write_function_t) (switch_stream_handle_t *handle, const char *fmt, ...);
typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);
-typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream);
+typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session,
+ _In_ switch_stream_handle_t *stream);
#define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream)
@@ -1274,9 +1267,9 @@
char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args);
typedef struct switch_xml *switch_xml_t;
typedef struct switch_core_time_duration switch_core_time_duration_t;
-typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
- const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
- void *user_data);
+typedef switch_xml_t (*switch_xml_search_function_t) (const char *section,
+ const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+ void *user_data);
typedef struct switch_hash switch_hash_t;
struct HashElem;
@@ -1290,9 +1283,9 @@
#define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
#define SWITCH_MODULE_RUNTIME_ARGS (void)
#define SWITCH_MODULE_SHUTDOWN_ARGS (void)
-typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS ;
-typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS ;
-typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS ;
+typedef switch_status_t (*switch_module_load_t) SWITCH_MODULE_LOAD_ARGS;
+typedef switch_status_t (*switch_module_runtime_t) SWITCH_MODULE_RUNTIME_ARGS;
+typedef switch_status_t (*switch_module_shutdown_t) SWITCH_MODULE_SHUTDOWN_ARGS;
#define SWITCH_MODULE_LOAD_FUNCTION(name) switch_status_t name SWITCH_MODULE_LOAD_ARGS
#define SWITCH_MODULE_RUNTIME_FUNCTION(name) switch_status_t name SWITCH_MODULE_RUNTIME_ARGS
#define SWITCH_MODULE_SHUTDOWN_FUNCTION(name) switch_status_t name SWITCH_MODULE_SHUTDOWN_ARGS
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h Tue May 27 07:24:06 2008
@@ -54,15 +54,12 @@
#else
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
#endif
-
/*!
\brief Test for NULL or zero length string
\param s the string to test
\return true value if the string is NULL or zero length
*/
#define switch_strlen_zero(s) (!s || *s == '\0')
-
-
static inline switch_bool_t switch_is_moh(const char *s)
{
if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
@@ -78,9 +75,10 @@
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
-static inline switch_bool_t switch_is_digit_string(const char *s) {
+ static inline switch_bool_t switch_is_digit_string(const char *s)
+{
- while(s && *s) {
+ while (s && *s) {
if (*s < 48 || *s > 57) {
return SWITCH_FALSE;
}
@@ -113,7 +111,8 @@
\param family the address family to return (AF_INET or AF_INET6)
\return SWITCH_STATUS_SUCCESSS for success, otherwise failure
*/
-SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len) char *buf, _In_ int len, _In_ int family);
+SWITCH_DECLARE(switch_status_t) switch_find_local_ip(_Out_opt_bytecapcount_(len)
+ char *buf, _In_ int len, _In_ int family);
/*!
\brief find the char representation of an ip adress
@@ -205,7 +204,7 @@
#define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
-static inline char *switch_clean_string(char *s)
+ static inline char *switch_clean_string(char *s)
{
char *p;
for (p = s; p && *p; p++) {
@@ -247,11 +246,11 @@
}
S = strdup(s);
-
+
assert(S != NULL);
for (p = S; p && *p; p++) {
- *p = (char)toupper(*p);
+ *p = (char) toupper(*p);
}
if (strstr(S, q)) {
@@ -263,9 +262,9 @@
assert(Q != NULL);
for (p = Q; p && *p; p++) {
- *p = (char)toupper(*p);
+ *p = (char) toupper(*p);
}
-
+
if (strstr(s, Q)) {
tf = SWITCH_TRUE;
goto done;
@@ -275,8 +274,8 @@
tf = SWITCH_TRUE;
goto done;
}
-
- done:
+
+ done:
switch_safe_free(S);
switch_safe_free(Q);
@@ -345,7 +344,7 @@
\param ms the number of milliseconds to wait
\return the requested condition
*/
-SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t * poll, int ms);
+SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms);
/*!
\brief Create a pointer to the file name in a given file path eliminating the directory name
@@ -369,7 +368,7 @@
SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip(switch_network_list_t *list, uint32_t ip);
#define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1)
-int switch_inet_pton(int af, const char *src, void *dst);
+ int switch_inet_pton(int af, const char *src, void *dst);
/* malloc or DIE macros */
#ifdef NDEBUG
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h Tue May 27 07:24:06 2008
@@ -184,7 +184,7 @@
///\ Returns NULL if not found.
///\param xml the xml node
///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml,...);
+SWITCH_DECLARE(switch_xml_t) switch_xml_get(switch_xml_t xml, ...);
///\brief Converts an switch_xml structure back to xml. Returns a string of xml data that
///\ must be freed.
@@ -234,7 +234,7 @@
///\param name the name of the tag
///\param off the offset
///\return an xml node or NULL
- SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off);
+SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(switch_xml_t xml, const char *name, switch_size_t off);
///\brief wrapper for switch_xml_add_child() that strdup()s name
///\param xml the xml node
@@ -247,7 +247,7 @@
///\param xml the xml node
///\param txt the text
///\return an xml node or NULL
- SWITCH_DECLARE(switch_xml_t) switch_xml_set_txt(switch_xml_t xml, const char *txt);
+SWITCH_DECLARE(switch_xml_t) switch_xml_set_txt(switch_xml_t xml, const char *txt);
///\brief wrapper for switch_xml_set_txt() that strdup()s txt
///\ sets the character content for the given tag and returns the tag
@@ -324,25 +324,22 @@
///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
const char *tag_name,
- const char *key_name, const char *key_value, switch_xml_t * root, switch_xml_t * node,
+ const char *key_name, const char *key_value, switch_xml_t *root, switch_xml_t *node,
switch_event_t *params);
SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain);
SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
- const char *user_name,
- const char *domain_name,
- const char *ip,
- switch_xml_t *root,
- switch_xml_t *domain,
- switch_xml_t *user,
- switch_event_t *params);
+ const char *user_name,
+ const char *domain_name,
+ const char *ip,
+ switch_xml_t *root, switch_xml_t *domain, switch_xml_t *user, switch_event_t *params);
///\brief open a config in the core registry
///\param file_path the name of the config section e.g. modules.conf
///\param node a pointer to point to the node if it is found
///\param params optional URL formatted params to pass to external gateways
///\return the root xml node associated with the current request or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t * node, switch_event_t *params);
+SWITCH_DECLARE(switch_xml_t) switch_xml_open_cfg(const char *file_path, switch_xml_t *node, switch_event_t *params);
///\brief bind a search function to an external gateway
///\param function the search function to bind
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c Tue May 27 07:24:06 2008
@@ -43,7 +43,7 @@
SWITCH_STANDARD_API(user_data_function)
{
- switch_xml_t x_domain, xml = NULL, x_user = NULL, x_param, x_params;
+ switch_xml_t x_domain, xml = NULL, x_user = NULL, x_param, x_params;
int argc;
char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain;
char delim = ' ';
@@ -94,7 +94,7 @@
}
}
-end:
+ end:
switch_xml_free(xml);
free(mydata);
switch_event_destroy(¶ms);
@@ -115,7 +115,7 @@
const char *err = NULL;
if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
- stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
+ stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
cmd = path_info;
delim = '/';
@@ -151,16 +151,16 @@
goto end;
}
-end:
+ end:
if (session || tf) {
stream->write_function(stream, err ? "false" : "true");
switch_xml_free(xml);
} else {
if (err) {
if (host) {
- stream->write_function(stream, "<error>%s</error>\n", err);
+ stream->write_function(stream, "<error>%s</error>\n", err);
} else {
- stream->write_function(stream, "-Error %s\n", err);
+ stream->write_function(stream, "-Error %s\n", err);
}
}
@@ -168,7 +168,7 @@
xmlstr = switch_xml_toxml(x_user, SWITCH_FALSE);
switch_assert(xmlstr);
- stream->write_function(stream, "%s", xmlstr);
+ stream->write_function(stream, "%s", xmlstr);
free(xmlstr);
switch_xml_free(xml);
}
@@ -201,7 +201,7 @@
const char *err = NULL;
if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
- stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
+ stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
cmd = path_info;
delim = '/';
@@ -243,16 +243,16 @@
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "tag_attr_val", tag_attr_val);
if (switch_xml_locate(section, tag, tag_attr_name, tag_attr_val, &xml, &obj, params) != SWITCH_STATUS_SUCCESS) {
- stream->write_function(stream, "can't find anything\n");
+ stream->write_function(stream, "can't find anything\n");
goto end;
}
-end:
+ end:
if (err) {
if (host) {
- stream->write_function(stream, "<error>%s</error>\n", err);
+ stream->write_function(stream, "<error>%s</error>\n", err);
} else {
- stream->write_function(stream, "-Error %s\n", err);
+ stream->write_function(stream, "-Error %s\n", err);
}
}
@@ -260,7 +260,7 @@
xmlstr = switch_xml_toxml(obj, SWITCH_FALSE);
switch_assert(xmlstr);
- stream->write_function(stream, "%s", xmlstr);
+ stream->write_function(stream, "%s", xmlstr);
free(xmlstr);
switch_xml_free(xml);
@@ -274,11 +274,11 @@
SWITCH_STANDARD_API(reload_acl_function)
{
const char *err;
- switch_xml_t xml_root;
+ switch_xml_t xml_root;
- if (session) {
- return SWITCH_STATUS_FALSE;
- }
+ if (session) {
+ return SWITCH_STATUS_FALSE;
+ }
if (cmd && !strcmp(cmd, "reloadxml")) {
if ((xml_root = switch_xml_open_root(1, &err))) {
@@ -311,15 +311,15 @@
}
if (switch_check_network_list_ip(argv[0], argv[1])) {
- stream->write_function(stream, "true");
+ stream->write_function(stream, "true");
goto ok;
}
-error:
+ error:
- stream->write_function(stream, "false");
+ stream->write_function(stream, "false");
-ok:
+ ok:
switch_safe_free(mydata);
@@ -357,10 +357,10 @@
substituted = malloc(len);
switch_assert(substituted);
memset(substituted, 0, len);
- switch_replace_char(argv[2], '%','$', SWITCH_FALSE);
+ switch_replace_char(argv[2], '%', '$', SWITCH_FALSE);
switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector);
- stream->write_function(stream, "%s", substituted);
+ stream->write_function(stream, "%s", substituted);
free(substituted);
} else {
stream->write_function(stream, "true");
@@ -370,9 +370,9 @@
}
goto ok;
-error:
- stream->write_function(stream, "-ERR");
-ok:
+ error:
+ stream->write_function(stream, "-ERR");
+ ok:
switch_regex_safe_free(re);
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
@@ -426,14 +426,14 @@
o = O_NE;
}
} else if ((expr = strchr(a, '>'))) {
- if (*(expr+1) == '=') {
+ if (*(expr + 1) == '=') {
*expr++ = '\0';
o = O_GE;
} else {
o = O_GT;
}
} else if ((expr = strchr(a, '<'))) {
- if (*(expr+1) == '=') {
+ if (*(expr + 1) == '=') {
*expr++ = '\0';
o = O_LE;
} else {
@@ -493,11 +493,11 @@
switch_safe_free(s_b);
stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]);
goto ok;
- }
+ }
-error:
- stream->write_function(stream, "-ERR");
-ok:
+ error:
+ stream->write_function(stream, "-ERR");
+ ok:
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
@@ -512,7 +512,7 @@
SWITCH_STANDARD_API(status_function)
{
uint8_t html = 0;
- switch_core_time_duration_t duration = {0};
+ switch_core_time_duration_t duration = { 0 };
char *http = NULL;
int sps = 0, last_sps = 0;
@@ -532,13 +532,13 @@
}
stream->write_function(stream,
- "UP %u year%s, %u day%s, %u hour%s, %u minute%s, %u second%s, %u millisecond%s, %u microsecond%s\n",
- duration.yr, duration.yr == 1 ? "" : "s", duration.day, duration.day == 1 ? "" : "s",
- duration.hr, duration.hr == 1 ? "" : "s", duration.min, duration.min == 1 ? "" : "s",
- duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms,
- duration.mms == 1 ? "" : "s");
+ "UP %u year%s, %u day%s, %u hour%s, %u minute%s, %u second%s, %u millisecond%s, %u microsecond%s\n",
+ duration.yr, duration.yr == 1 ? "" : "s", duration.day, duration.day == 1 ? "" : "s",
+ duration.hr, duration.hr == 1 ? "" : "s", duration.min, duration.min == 1 ? "" : "s",
+ duration.sec, duration.sec == 1 ? "" : "s", duration.ms, duration.ms == 1 ? "" : "s", duration.mms,
+ duration.mms == 1 ? "" : "s");
- stream->write_function(stream, "%"SWITCH_SIZE_T_FMT" session(s) since startup\n", switch_core_session_id() - 1 );
+ stream->write_function(stream, "%" SWITCH_SIZE_T_FMT " session(s) since startup\n", switch_core_session_id() - 1);
switch_core_session_ctl(SCSC_LAST_SPS, &last_sps);
switch_core_session_ctl(SCSC_SPS, &sps);
stream->write_function(stream, "%d session(s) %d/%d\n", switch_core_session_count(), last_sps, sps);
@@ -644,10 +644,10 @@
} else {
stream->write_function(stream, "-ERR INVALID COMMAND\nUSAGE: fsctl %s", CTL_SYNTAX);
goto end;
- }
+ }
stream->write_function(stream, "+OK\n");
-end:
+ end:
free(mydata);
} else {
stream->write_function(stream, "-ERR Memory error\n");
@@ -831,7 +831,7 @@
switch_core_session_rwunlock(tsession);
-done:
+ done:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
@@ -866,7 +866,7 @@
if (argv[4]) {
uint32_t mto;
if (*argv[4] == '+') {
- if ((mto = atoi(argv[4]+1)) > 0) {
+ if ((mto = atoi(argv[4] + 1)) > 0) {
to = switch_timestamp(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
@@ -884,7 +884,7 @@
switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, argv[5], argv[6]);
stream->write_function(stream, "+OK Enabling tone detection '%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
-done:
+ done:
free(mydata);
switch_core_session_rwunlock(rsession);
@@ -1246,13 +1246,13 @@
} else {
switch_status_t status;
char *who = NULL;
-
+
if ((status = switch_ivr_uuid_bridge(argv[0], argv[1])) != SWITCH_STATUS_SUCCESS) {
if (argv[2]) {
if ((status = switch_ivr_uuid_bridge(argv[0], argv[2])) == SWITCH_STATUS_SUCCESS) {
who = argv[2];
}
- }
+ }
} else {
who = argv[1];
}
@@ -1317,11 +1317,11 @@
goto done;
-usage:
+ usage:
stream->write_function(stream, "-USAGE: %s\n", SESS_REC_SYNTAX);
switch_safe_free(mycmd);
-done:
+ done:
if (rsession) {
switch_core_session_rwunlock(rsession);
}
@@ -1377,11 +1377,11 @@
goto done;
-usage:
+ usage:
stream->write_function(stream, "-USAGE: %s\n", DISPLACE_SYNTAX);
switch_safe_free(mycmd);
-done:
+ done:
if (rsession) {
switch_core_session_rwunlock(rsession);
}
@@ -1513,7 +1513,8 @@
timeout = atoi(argv[6]);
}
- if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !caller_session) {
+ if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS
+ || !caller_session) {
if (machine) {
stream->write_function(stream, "-ERR %s\n", switch_channel_cause2str(cause));
} else {
@@ -1557,7 +1558,7 @@
switch_core_session_rwunlock(caller_session);
-done:
+ done:
switch_safe_free(mycmd);
return status;
}
@@ -1594,7 +1595,7 @@
int64_t tmp;
tmp = (uint32_t) atoi(cmd);
if (tmp > 0) {
- cnt = switch_scheduler_del_task_id((uint32_t)tmp);
+ cnt = switch_scheduler_del_task_id((uint32_t) tmp);
}
} else {
cnt = switch_scheduler_del_task_group(cmd);
@@ -1643,14 +1644,7 @@
}
}
- stream->write_function(stream,
- "<result>\n"
- " <row id=\"1\">\n"
- " <data>%s</data>\n"
- " </row>\n"
- "</result>\n",
- send ? send : "ERROR"
- );
+ stream->write_function(stream, "<result>\n" " <row id=\"1\">\n" " <data>%s</data>\n" " </row>\n" "</result>\n", send ? send : "ERROR");
switch_safe_free(mystream.data);
switch_safe_free(edata);
free(dcommand);
@@ -1688,12 +1682,12 @@
id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, group, 0, strdup(dcmd), SSHF_FREE_ARG);
stream->write_function(stream, "+OK Added: %u\n", id);
goto good;
- }
+ }
}
stream->write_function(stream, "-ERR Invalid syntax\n");
-good:
+ good:
switch_safe_free(tm);
return SWITCH_STATUS_SUCCESS;
}
@@ -1701,7 +1695,7 @@
struct bg_job {
char *cmd;
char *arg;
- char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
+ char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
switch_memory_pool_t *pool;
};
@@ -1715,7 +1709,8 @@
char *arg;
switch_memory_pool_t *pool;
- if (!job) return NULL;
+ if (!job)
+ return NULL;
pool = job->pool;
@@ -1817,7 +1812,7 @@
switch_xml_set_attr(switch_xml_set_flag(row, SWITCH_XML_DUP), strdup("row_id"), strdup(id));
- for(x = 0; x < argc; x++) {
+ for (x = 0; x < argc; x++) {
char *name = columnNames[x];
char *val = switch_str_nil(argv[x]);
@@ -1896,7 +1891,7 @@
} else {
stream->write_function(stream, "-USAGE: %s\n", COMPLETE_SYNTAX);
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -1912,7 +1907,7 @@
} else {
stream->write_function(stream, "-USAGE: %s\n", ALIAS_SYNTAX);
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -1924,7 +1919,7 @@
switch_core_db_t *db;
struct holder holder = { 0 };
int help = 0;
- char *mydata = NULL, *argv[6] = {0};
+ char *mydata = NULL, *argv[6] = { 0 };
int argc;
char *command = NULL, *as = NULL;
switch_core_flag_t cflags = switch_core_flags();
@@ -1980,7 +1975,8 @@
holder.print_title = 0;
if ((cmdname = strchr(command, ' ')) != 0) {
*cmdname++ = '\0';
- switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s' order by name", cmdname);
+ switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' and name = '%s' order by name",
+ cmdname);
} else {
switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description from interfaces where type = 'api' order by name");
}
@@ -2127,10 +2123,10 @@
stream->write_function(stream, "-USAGE: %s\n", SETVAR_SYNTAX);
-done:
+ done:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
-}
+}
#define GETVAR_SYNTAX "<uuid> <var>"
SWITCH_STANDARD_API(uuid_getvar_function)
@@ -2177,7 +2173,7 @@
stream->write_function(stream, "-USAGE: %s\n", GETVAR_SYNTAX);
-done:
+ done:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
@@ -2224,7 +2220,7 @@
}
switch_assert(buf);
- stream->raw_write_function(stream, (unsigned char *)buf, strlen(buf));
+ stream->raw_write_function(stream, (unsigned char *) buf, strlen(buf));
switch_event_destroy(&event);
free(buf);
} else {
@@ -2242,7 +2238,7 @@
stream->write_function(stream, "-USAGE: %s\n", DUMP_SYNTAX);
-done:
+ done:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
}
@@ -2270,10 +2266,10 @@
stream->write_function(stream, "-USAGE: %s\n", GLOBAL_SETVAR_SYNTAX);
-done:
+ done:
switch_safe_free(mycmd);
return SWITCH_STATUS_SUCCESS;
-}
+}
#define GLOBAL_GETVAR_SYNTAX "<var>"
SWITCH_STANDARD_API(global_getvar_function)
@@ -2285,7 +2281,7 @@
}
stream->write_function(stream, "-USAGE: %s\n", GLOBAL_GETVAR_SYNTAX);
-done:
+ done:
return SWITCH_STATUS_SUCCESS;
}
@@ -2296,14 +2292,12 @@
SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "killchan", "Kill Channel (depricated)", kill_function, KILL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_park", "Park Channel", park_function, PARK_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "[reloadxml]");
SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_function, "");
SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, LOAD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "transfer", "Transfer (depricated)", transfer_function, TRANSFER_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
@@ -2317,23 +2311,20 @@
SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace (depricated)", session_displace_function, DISPLACE_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
- SWITCH_ADD_API(commands_api_interface, "session_record", "session record (depricated)", session_record_function, SESS_REC_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "broadcast", "broadcast (depricated)", uuid_broadcast_function, BROADCAST_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "hold", "hold (depricated)", uuid_hold_function, HOLD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "media", "media (depricated)", uuid_media_function, MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX);
- SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function, SCHED_TRANSFER_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function,
+ SCHED_BROADCAST_SYNTAX);
+ SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a broadcast event to a running call", sched_transfer_function,
+ SCHED_TRANSFER_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, "[+]<time> <group_name> <command_string>");
SWITCH_ADD_API(commands_api_interface, "bgapi", "Execute an api command in a thread", bgapi_function, "<command>[ <arg>]");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c Tue May 27 07:24:06 2008
@@ -137,7 +137,7 @@
MFLAG_WASTE_BANDWIDTH = (1 << 7),
MFLAG_FLUSH_BUFFER = (1 << 8),
MFLAG_ENDCONF = (1 << 9),
- MFLAG_HAS_AUDIO = (1 << 10),
+ MFLAG_HAS_AUDIO = (1 << 10),
MFLAG_TALKING = (1 << 11)
} member_flag_t;
@@ -257,9 +257,9 @@
uint8_t min;
switch_speech_handle_t lsh;
switch_speech_handle_t *sh;
- switch_byte_t *not_talking_buf;
- uint32_t not_talking_buf_len;
- int comfort_noise_level;
+ switch_byte_t *not_talking_buf;
+ uint32_t not_talking_buf_len;
+ int comfort_noise_level;
int video_running;
uint32_t eflags;
} conference_obj_t;
@@ -290,7 +290,7 @@
switch_codec_t write_codec;
char *rec_path;
uint8_t *frame;
- uint32_t frame_size;
+ uint32_t frame_size;
uint8_t *mux_frame;
uint32_t read;
int32_t energy_level;
@@ -298,8 +298,8 @@
int32_t volume_out_level;
uint32_t native_rate;
switch_audio_resampler_t *read_resampler;
- int16_t *resample_out;
- uint32_t resample_out_len;
+ int16_t *resample_out;
+ uint32_t resample_out_len;
conference_file_node_t *fnode;
conference_relationship_t *relationships;
switch_ivr_digit_stream_parser_t *dtmf_parser;
@@ -335,54 +335,54 @@
/* Function Prototypes */
static uint32_t next_member_id(void);
-static conference_relationship_t *member_get_relationship(conference_member_t * member, conference_member_t * other_member);
-static conference_member_t *conference_member_get(conference_obj_t * conference, uint32_t id);
-static conference_relationship_t *member_add_relationship(conference_member_t * member, uint32_t id);
-static switch_status_t member_del_relationship(conference_member_t * member, uint32_t id);
-static switch_status_t conference_add_member(conference_obj_t * conference, conference_member_t * member);
-static switch_status_t conference_del_member(conference_obj_t * conference, conference_member_t * member);
-static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj);
-static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t * thread, void *obj);
-static void conference_loop_output(conference_member_t * member);
-static uint32_t conference_stop_file(conference_obj_t * conference, file_stop_t stop);
-static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async);
-static switch_status_t conference_say(conference_obj_t * conference, const char *text, uint32_t leadin);
-static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim);
+static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member);
+static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id);
+static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id);
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id);
+static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member);
+static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member);
+static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj);
+static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thread, void *obj);
+static void conference_loop_output(conference_member_t *member);
+static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop);
+static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async);
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin);
+static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim);
SWITCH_STANDARD_API(conf_api_main);
-static switch_status_t conference_outcall(conference_obj_t * conference,
+static switch_status_t conference_outcall(conference_obj_t *conference,
char *conference_name,
switch_core_session_t *session,
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause);
-static switch_status_t conference_outcall_bg(conference_obj_t * conference,
+static switch_status_t conference_outcall_bg(conference_obj_t *conference,
char *conference_name,
- switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num);
+ switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
+ const char *cid_num);
SWITCH_STANDARD_APP(conference_function);
-static void launch_conference_thread(conference_obj_t * conference);
-static void launch_conference_video_thread(conference_obj_t * conference);
-static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj);
-static switch_status_t conference_local_play_file(conference_obj_t * conference,
- switch_core_session_t *session, char *path, uint32_t leadin);
-static switch_status_t conference_member_play_file(conference_member_t * member, char *file, uint32_t leadin);
-static switch_status_t conference_member_say(conference_member_t * member, char *text, uint32_t leadin);
-static uint32_t conference_member_stop_file(conference_member_t * member, file_stop_t stop);
+static void launch_conference_thread(conference_obj_t *conference);
+static void launch_conference_video_thread(conference_obj_t *conference);
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin);
+static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
+static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
static switch_status_t chat_send(char *proto, char *from, char *to, char *subject, char *body, char *hint);
-static void launch_conference_record_thread(conference_obj_t * conference, char *path);
+static void launch_conference_record_thread(conference_obj_t *conference, char *path);
typedef switch_status_t (*conf_api_args_cmd_t) (conference_obj_t *, switch_stream_handle_t *, int, char **);
typedef switch_status_t (*conf_api_member_cmd_t) (conference_member_t *, switch_stream_handle_t *, void *);
typedef switch_status_t (*conf_api_text_cmd_t) (conference_obj_t *, switch_stream_handle_t *, const char *);
-static void conference_member_itterator(conference_obj_t * conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data);
-static switch_status_t conf_api_sub_mute(conference_member_t * member, switch_stream_handle_t *stream, void *data);
-static switch_status_t conf_api_sub_unmute(conference_member_t * member, switch_stream_handle_t *stream, void *data);
-static switch_status_t conf_api_sub_deaf(conference_member_t * member, switch_stream_handle_t *stream, void *data);
-static switch_status_t conf_api_sub_undeaf(conference_member_t * member, switch_stream_handle_t *stream, void *data);
-static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event);
-static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event);
+static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data);
+static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data);
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data);
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data);
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data);
+static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event);
+static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event);
-static switch_status_t conference_add_event_data(conference_obj_t * conference, switch_event_t *event)
+static switch_status_t conference_add_event_data(conference_obj_t *conference, switch_event_t *event)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -392,11 +392,12 @@
return status;
}
-static switch_status_t conference_add_event_member_data(conference_member_t * member, switch_event_t *event)
+static switch_status_t conference_add_event_member_data(conference_member_t *member, switch_event_t *event)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- if (!member) return status;
+
+ if (!member)
+ return status;
if (member->session) {
switch_channel_t *channel = switch_core_session_get_channel(member->session);
@@ -426,11 +427,12 @@
}
/* if other_member has a relationship with member, produce it */
-static conference_relationship_t *member_get_relationship(conference_member_t * member, conference_member_t * other_member)
+static conference_relationship_t *member_get_relationship(conference_member_t *member, conference_member_t *other_member)
{
conference_relationship_t *rel = NULL, *global = NULL;
- if (member == NULL || other_member == NULL || member->relationships == NULL) return NULL;
+ if (member == NULL || other_member == NULL || member->relationships == NULL)
+ return NULL;
switch_mutex_lock(member->flag_mutex);
switch_mutex_lock(other_member->flag_mutex);
@@ -453,11 +455,11 @@
}
/* traverse the conference member list for the specified member id and return it's pointer */
-static conference_member_t *conference_member_get(conference_obj_t * conference, uint32_t id)
+static conference_member_t *conference_member_get(conference_obj_t *conference, uint32_t id)
{
conference_member_t *member = NULL;
- switch_assert(conference != NULL);
+ switch_assert(conference != NULL);
if (!id) {
return NULL;
}
@@ -484,7 +486,7 @@
}
/* stop the specified recording */
-static switch_status_t conference_record_stop(conference_obj_t * conference, char *path)
+static switch_status_t conference_record_stop(conference_obj_t *conference, char *path)
{
conference_member_t *member = NULL;
int count = 0;
@@ -502,11 +504,12 @@
}
/* Add a custom relationship to a member */
-static conference_relationship_t *member_add_relationship(conference_member_t * member, uint32_t id)
+static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id)
{
conference_relationship_t *rel = NULL;
- if (member == NULL || id == 0 || !(rel = switch_core_alloc(member->pool, sizeof(*rel)))) return NULL;
+ if (member == NULL || id == 0 || !(rel = switch_core_alloc(member->pool, sizeof(*rel))))
+ return NULL;
rel->id = id;
@@ -519,12 +522,13 @@
}
/* Remove a custom relationship from a member */
-static switch_status_t member_del_relationship(conference_member_t * member, uint32_t id)
+static switch_status_t member_del_relationship(conference_member_t *member, uint32_t id)
{
switch_status_t status = SWITCH_STATUS_FALSE;
conference_relationship_t *rel, *last = NULL;
- if (member == NULL || id == 0) return status;
+ if (member == NULL || id == 0)
+ return status;
switch_mutex_lock(member->flag_mutex);
for (rel = member->relationships; rel; rel = rel->next) {
@@ -546,11 +550,11 @@
}
/* Gain exclusive access and add the member to the list */
-static switch_status_t conference_add_member(conference_obj_t * conference, conference_member_t * member)
+static switch_status_t conference_add_member(conference_obj_t *conference, conference_member_t *member)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_event_t *event;
- char msg[512]; /* conference count anouncement */
+ char msg[512]; /* conference count anouncement */
call_list_t *call_list = NULL;
switch_channel_t *channel;
@@ -600,7 +604,7 @@
channel = switch_core_session_get_channel(member->session);
call_list = (call_list_t *) switch_channel_get_private(channel, "_conference_autocall_list_");
-
+
if (call_list) {
char saymsg[1024];
switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
@@ -613,13 +617,14 @@
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
} else if (conference->count == 1 && !conference->perpetual_sound) {
if (conference->alone_sound) {
- conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 0);
+ conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
+ 0);
} else {
switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
}
}
- }
+ }
}
if (conference->count == 1) {
@@ -650,7 +655,7 @@
}
/* Gain exclusive access and remove the member from the list */
-static switch_status_t conference_del_member(conference_obj_t * conference, conference_member_t * member)
+static switch_status_t conference_del_member(conference_obj_t *conference, conference_member_t *member)
{
switch_status_t status = SWITCH_STATUS_FALSE;
conference_member_t *imember, *last = NULL;
@@ -712,7 +717,7 @@
}
member->conference = NULL;
-
+
if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
conference->count--;
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
@@ -773,7 +778,7 @@
switch_frame_t *vid_frame;
switch_status_t status;
int has_vid = 1, req_iframe = 0;
-
+
conference->video_running = 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video thread started for conference %s\n", conference->name);
@@ -781,17 +786,17 @@
if (!conference->floor_holder) {
switch_yield(100000);
continue;
- }
-
+ }
+
if (switch_channel_test_flag(switch_core_session_get_channel(conference->floor_holder->session), CF_VIDEO)) {
status = switch_core_session_read_video_frame(conference->floor_holder->session, &vid_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
conference->floor_holder = NULL;
req_iframe = 0;
continue;
}
-
+
if (switch_test_flag(vid_frame, SFF_CNG)) {
continue;
}
@@ -810,18 +815,18 @@
req_iframe = 1;
}
#endif
-
- if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */
- iframe = (*((int16_t*)vid_frame->data) >> 12 == 6);
- } else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */
- int y = *((int8_t*)vid_frame->data + 2) & 0xfe;
- iframe = (y == 0x80 || y == 0x82);
- } else if (vid_frame->codec->implementation->ianacode == 99) { /* h.264 */
- iframe = (*((int16_t*)vid_frame->data) >> 5 == 0x11);
- } else { /* we need more defs */
+
+ if (vid_frame->codec->implementation->ianacode == 34) { /* h.263 */
+ iframe = (*((int16_t *) vid_frame->data) >> 12 == 6);
+ } else if (vid_frame->codec->implementation->ianacode == 115) { /* h.263-1998 */
+ int y = *((int8_t *) vid_frame->data + 2) & 0xfe;
+ iframe = (y == 0x80 || y == 0x82);
+ } else if (vid_frame->codec->implementation->ianacode == 99) { /* h.264 */
+ iframe = (*((int16_t *) vid_frame->data) >> 5 == 0x11);
+ } else { /* we need more defs */
iframe = 1;
}
-
+
if (!iframe) {
continue;
}
@@ -830,8 +835,8 @@
}
last_member = conference->floor_holder;
-
- switch_mutex_lock(conference->member_mutex);
+
+ switch_mutex_lock(conference->member_mutex);
has_vid = 0;
for (imember = conference->members; imember; imember = imember->next) {
if (switch_channel_test_flag(switch_core_session_get_channel(imember->session), CF_VIDEO)) {
@@ -849,7 +854,7 @@
}
/* Main monitor thread (1 per distinct conference room) */
-static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *obj)
{
conference_obj_t *conference = (conference_obj_t *) obj;
conference_member_t *imember, *omember;
@@ -860,7 +865,7 @@
switch_event_t *event;
uint8_t *file_frame;
uint8_t *async_file_frame;
-
+
file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -879,7 +884,7 @@
switch_size_t file_sample_len = samples;
switch_size_t file_data_len = samples * 2;
int has_file_data = 0, members_with_video = 0;
-
+
if (conference->perpetual_sound && !conference->async_fnode) {
conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
} else if (conference->moh_sound && conference->count == 1 && !conference->async_fnode) {
@@ -891,7 +896,7 @@
switch_set_flag(conference, CFLAG_DESTRUCT);
break;
}
-
+
switch_mutex_lock(conference->mutex);
has_file_data = ready = total = 0;
@@ -908,11 +913,11 @@
switch_clear_flag_locked(imember, MFLAG_HAS_AUDIO);
switch_mutex_lock(imember->audio_in_mutex);
- if (switch_buffer_inuse(imember->audio_buffer) >= bytes
- && (buf_read = (uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, bytes))) {
- imember->read = buf_read;
- switch_set_flag_locked(imember, MFLAG_HAS_AUDIO);
- ready++;
+ if (switch_buffer_inuse(imember->audio_buffer) >= bytes
+ && (buf_read = (uint32_t) switch_buffer_read(imember->audio_buffer, imember->frame, bytes))) {
+ imember->read = buf_read;
+ switch_set_flag_locked(imember, MFLAG_HAS_AUDIO);
+ ready++;
}
switch_mutex_unlock(imember->audio_in_mutex);
}
@@ -940,15 +945,15 @@
} else if (conference->fnode->type == NODE_TYPE_FILE) {
switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len);
}
-
+
if (file_sample_len <= 0) {
conference->fnode->done++;
} else {
has_file_data = 1;
}
- }
+ }
}
-
+
if (conference->async_fnode) {
/* Lead in time */
if (conference->async_fnode->leadin) {
@@ -984,25 +989,25 @@
if (ready || has_file_data) {
//int nt = 0;
/* Build a muxed frame for every member that contains the mixed audio of everyone else */
-
+
for (omember = conference->members; omember; omember = omember->next) {
if (has_file_data && file_sample_len) {
- uint32_t sample_bytes = file_sample_len * 2;
+ uint32_t sample_bytes = file_sample_len * 2;
memcpy(omember->mux_frame, file_frame, sample_bytes);
- if (sample_bytes < bytes) {
- if (conference->comfort_noise_level) {
- switch_generate_sln_silence((int16_t *)omember->mux_frame + sample_bytes,
- (bytes - sample_bytes) / 2, conference->comfort_noise_level);
- } else {
- memset(omember->mux_frame + sample_bytes, 255, bytes - sample_bytes);
- }
- }
- } else {
- if (conference->comfort_noise_level) {
- switch_generate_sln_silence((int16_t *)omember->mux_frame, bytes / 2, conference->comfort_noise_level);
- } else {
- memset(omember->mux_frame, 255, bytes);
- }
+ if (sample_bytes < bytes) {
+ if (conference->comfort_noise_level) {
+ switch_generate_sln_silence((int16_t *) omember->mux_frame + sample_bytes,
+ (bytes - sample_bytes) / 2, conference->comfort_noise_level);
+ } else {
+ memset(omember->mux_frame + sample_bytes, 255, bytes - sample_bytes);
+ }
+ }
+ } else {
+ if (conference->comfort_noise_level) {
+ switch_generate_sln_silence((int16_t *) omember->mux_frame, bytes / 2, conference->comfort_noise_level);
+ } else {
+ memset(omember->mux_frame, 255, bytes);
+ }
}
for (imember = conference->members; imember; imember = imember->next) {
uint32_t x;
@@ -1022,7 +1027,7 @@
continue;
}
}
- }
+ }
/* If we are not supposed to hear them then don't let it happen */
if (imember->relationships) {
@@ -1168,7 +1173,7 @@
if (conference->video_running == 1) {
conference->video_running = -1;
- while(conference->video_running) {
+ while (conference->video_running) {
switch_yield(1000);
}
}
@@ -1207,9 +1212,10 @@
return NULL;
}
-static void conference_loop_fn_mute_toggle(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_mute_toggle(conference_member_t *member, caller_control_action_t *action)
{
- if (member == NULL) return;
+ if (member == NULL)
+ return;
if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
conf_api_sub_mute(member, NULL, NULL);
@@ -1221,9 +1227,10 @@
}
}
-static void conference_loop_fn_deafmute_toggle(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_deafmute_toggle(conference_member_t *member, caller_control_action_t *action)
{
- if (member == NULL) return;
+ if (member == NULL)
+ return;
if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
conf_api_sub_mute(member, NULL, NULL);
@@ -1238,12 +1245,13 @@
}
}
-static void conference_loop_fn_energy_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_up(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->energy_level += 200;
@@ -1264,12 +1272,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_energy_equ_conf(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_equ_conf(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->energy_level = member->conference->energy_level;
@@ -1287,12 +1296,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_energy_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_energy_dn(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->energy_level -= 100;
@@ -1313,12 +1323,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_talk_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_up(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_out_level++;
@@ -1337,12 +1348,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_talk_zero(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_zero(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_out_level = 0;
@@ -1360,12 +1372,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_talk_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_talk_dn(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_out_level--;
@@ -1384,12 +1397,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_listen_up(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_up(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_in_level++;
@@ -1408,12 +1422,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_listen_zero(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_zero(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_in_level = 0;
@@ -1431,12 +1446,13 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_volume_listen_dn(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_volume_listen_dn(conference_member_t *member, caller_control_action_t *action)
{
char msg[512];
switch_event_t *event;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_mutex_lock(member->flag_mutex);
member->volume_in_level--;
@@ -1455,11 +1471,10 @@
conference_member_say(member, msg, 0);
}
-static void conference_loop_fn_event(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_event(conference_member_t *member, caller_control_action_t *action)
{
switch_event_t *event;
- if (test_eflag(member->conference, EFLAG_DTMF) &&
- switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "dtmf");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Key", "%s", action->binded_dtmf);
@@ -1467,13 +1482,13 @@
}
}
-static void conference_loop_fn_hangup(conference_member_t * member, caller_control_action_t * action)
+static void conference_loop_fn_hangup(conference_member_t *member, caller_control_action_t *action)
{
switch_clear_flag_locked(member, MFLAG_RUNNING);
}
/* marshall frames from the call leg to the conference thread for muxing to other call legs */
-static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj)
{
conference_member_t *member = obj;
switch_channel_t *channel;
@@ -1564,23 +1579,22 @@
switch_event_t *event;
switch_set_flag_locked(member, MFLAG_TALKING);
switch_mutex_lock(member->conference->member_mutex);
- if (!member->conference->floor_holder ||
- !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score >
+ if (!member->conference->floor_holder ||
+ !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || member->score >
member->conference->floor_holder->score + 200) {
if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "floor-change");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d",
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d",
member->conference->floor_holder ? member->conference->floor_holder->id : 0);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d",
- member->conference->floor_holder ? member->id : 0);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->conference->floor_holder ? member->id : 0);
switch_event_fire(&event);
}
member->conference->floor_holder = member;
}
switch_mutex_unlock(member->conference->member_mutex);
-
+
if (test_eflag(member->conference, EFLAG_START_TALKING) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
@@ -1621,11 +1635,9 @@
int len = (int) read_frame->datalen;
read_resampler->from_len = switch_short_to_float(bptr, read_resampler->from, (int) len / 2);
- read_resampler->to_len = switch_resample_process(read_resampler,
+ read_resampler->to_len = switch_resample_process(read_resampler,
read_resampler->from,
- read_resampler->from_len,
- read_resampler->to,
- read_resampler->to_size, 0);
+ read_resampler->from_len, read_resampler->to, read_resampler->to_size, 0);
switch_float_to_short(read_resampler->to, member->resample_out, read_resampler->to_len);
len = read_resampler->to_len * 2;
@@ -1655,12 +1667,13 @@
}
/* launch an input thread for the call leg */
-static void launch_conference_loop_input(conference_member_t * member, switch_memory_pool_t *pool)
+static void launch_conference_loop_input(conference_member_t *member, switch_memory_pool_t *pool)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
- if (member == NULL) return;
+ if (member == NULL)
+ return;
switch_threadattr_create(&thd_attr, pool);
switch_threadattr_detach_set(thd_attr, 1);
@@ -1689,7 +1702,7 @@
/* marshall frames from the conference (or file or tts output) to the call leg */
/* NB. this starts the input thread after some initial setup for the call leg */
-static void conference_loop_output(conference_member_t * member)
+static void conference_loop_output(conference_member_t *member)
{
switch_channel_t *channel = switch_core_session_get_channel(member->session);
switch_frame_t write_frame = { 0 };
@@ -1698,12 +1711,12 @@
switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000;
uint32_t samples = switch_samples_per_frame(member->conference->rate, interval);
- uint32_t csamples = samples;
+ uint32_t csamples = samples;
uint32_t tsamples = member->orig_read_codec->implementation->samples_per_frame;
uint32_t flush_len = 0;
uint32_t low_count = 0, bytes = samples * 2;
call_list_t *call_list = NULL, *cp = NULL;
-
+
switch_assert(member->conference != NULL);
flush_len = switch_samples_per_frame(member->conference->rate, member->conference->interval) * 10;
@@ -1770,8 +1783,8 @@
int use_timer = 0;
switch_size_t file_sample_len = csamples;
switch_size_t file_data_len = file_sample_len * 2;
-
-
+
+
switch_mutex_lock(member->flag_mutex);
@@ -1894,7 +1907,7 @@
switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
switch_core_timer_next(&timer);
-
+
/* forget the conference data we played file node data instead */
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
@@ -1914,9 +1927,9 @@
/* getting behind, clear the buffer */
switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
- }
-
-
+ }
+
+
use_timer = 1;
if (mux_used) {
@@ -1962,7 +1975,7 @@
}
switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
-
+
switch_mutex_unlock(member->flag_mutex);
if (use_timer) {
@@ -1971,7 +1984,7 @@
switch_yield(1000);
}
- } /* Rinse ... Repeat */
+ } /* Rinse ... Repeat */
if (member->digit_stream != NULL) {
switch_ivr_digit_stream_destroy(member->digit_stream);
@@ -1995,7 +2008,7 @@
}
/* Sub-Routine called by a record entity inside a conference */
-static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *thread, void *obj)
{
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_file_handle_t fh = { 0 };
@@ -2029,9 +2042,9 @@
member->id = next_member_id();
member->pool = rec->pool;
- member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
- member->frame = switch_core_alloc(member->pool, member->frame_size);
- member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
+ member->frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
+ member->frame = switch_core_alloc(member->pool, member->frame_size);
+ member->mux_frame = switch_core_alloc(member->pool, member->frame_size);
switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, rec->pool);
@@ -2080,7 +2093,7 @@
while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) {
switch_size_t len;
mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
-
+
if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) {
if (mux_used) {
switch_mutex_lock(member->audio_out_mutex);
@@ -2095,7 +2108,7 @@
/* Flush the output buffer and write all the data (presumably muxed) to the file */
switch_mutex_lock(member->audio_out_mutex);
low_count = 0;
-
+
if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data, sizeof(data)))) {
if (!switch_test_flag((&fh), SWITCH_FILE_PAUSE)) {
len = (switch_size_t) rlen / sizeof(int16_t);
@@ -2117,9 +2130,9 @@
}
switch_core_timer_next(&timer);
- } /* Rinse ... Repeat */
+ } /* Rinse ... Repeat */
- end:
+ end:
switch_core_timer_destroy(&timer);
conference_del_member(conference, member);
@@ -2146,7 +2159,7 @@
}
/* Make files stop playing in a conference either the current one or all of them */
-static uint32_t conference_stop_file(conference_obj_t * conference, file_stop_t stop)
+static uint32_t conference_stop_file(conference_obj_t *conference, file_stop_t stop)
{
uint32_t count = 0;
conference_file_node_t *nptr;
@@ -2182,12 +2195,13 @@
}
/* stop playing a file for the member of the conference */
-static uint32_t conference_member_stop_file(conference_member_t * member, file_stop_t stop)
+static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop)
{
conference_file_node_t *nptr;
uint32_t count = 0;
- if (member == NULL) return count;
+ if (member == NULL)
+ return count;
switch_mutex_lock(member->flag_mutex);
@@ -2209,7 +2223,7 @@
}
/* Play a file in the conference room */
-static switch_status_t conference_play_file(conference_obj_t * conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async)
+static switch_status_t conference_play_file(conference_obj_t *conference, char *file, uint32_t leadin, switch_channel_t *channel, uint8_t async)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
conference_file_node_t *fnode, *nptr = NULL;
@@ -2225,7 +2239,8 @@
switch_mutex_unlock(conference->member_mutex);
switch_mutex_unlock(conference->mutex);
- if (!count) return SWITCH_STATUS_FALSE;
+ if (!count)
+ return SWITCH_STATUS_FALSE;
if (channel) {
if ((expanded = switch_channel_expand_variables(channel, file)) != file) {
@@ -2310,7 +2325,7 @@
switch_mutex_unlock(conference->mutex);
- done:
+ done:
switch_safe_free(expanded);
switch_safe_free(dfile);
@@ -2319,14 +2334,15 @@
}
/* Play a file in the conference room to a member */
-static switch_status_t conference_member_play_file(conference_member_t * member, char *file, uint32_t leadin)
+static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin)
{
switch_status_t status = SWITCH_STATUS_FALSE;
char *dfile = NULL, *expanded = NULL;
conference_file_node_t *fnode, *nptr = NULL;
switch_memory_pool_t *pool;
- if (member == NULL || file == NULL) return status;
+ if (member == NULL || file == NULL)
+ return status;
if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(member->session), file)) != file) {
file = expanded;
@@ -2384,7 +2400,7 @@
switch_mutex_unlock(member->flag_mutex);
status = SWITCH_STATUS_SUCCESS;
- done:
+ done:
switch_safe_free(expanded);
switch_safe_free(dfile);
@@ -2393,7 +2409,7 @@
}
/* Say some thing with TTS in the conference room */
-static switch_status_t conference_member_say(conference_member_t * member, char *text, uint32_t leadin)
+static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin)
{
conference_obj_t *conference = (member != NULL ? member->conference : NULL);
conference_file_node_t *fnode, *nptr;
@@ -2401,7 +2417,8 @@
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
switch_status_t status = SWITCH_STATUS_FALSE;
- if (member == NULL || switch_strlen_zero(text)) return SWITCH_STATUS_FALSE;
+ if (member == NULL || switch_strlen_zero(text))
+ return SWITCH_STATUS_FALSE;
switch_assert(conference != NULL);
@@ -2428,7 +2445,7 @@
if (!member->sh) {
memset(&member->lsh, 0, sizeof(member->lsh));
- if (switch_core_speech_open(&member->lsh, conference->tts_engine, conference->tts_voice,
+ if (switch_core_speech_open(&member->lsh, conference->tts_engine, conference->tts_voice,
conference->rate, conference->interval, &flags, switch_core_session_get_pool(member->session)) !=
SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
@@ -2452,7 +2469,7 @@
switch_sleep(200000);
if (*text == '#') {
- char *tmp = (char *)text + 1;
+ char *tmp = (char *) text + 1;
char *vp = tmp, voice[128] = "";
if ((tmp = strchr(tmp, '#'))) {
text = tmp + 1;
@@ -2472,7 +2489,7 @@
}
/* Say some thing with TTS in the conference room */
-static switch_status_t conference_say(conference_obj_t * conference, const char *text, uint32_t leadin)
+static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin)
{
switch_status_t status = SWITCH_STATUS_FALSE;
conference_file_node_t *fnode, *nptr;
@@ -2514,12 +2531,11 @@
fnode->type = NODE_TYPE_SPEECH;
fnode->leadin = leadin;
-
+
if (!conference->sh) {
memset(&conference->lsh, 0, sizeof(conference->lsh));
- if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice,
- conference->rate, conference->interval, &flags, conference->pool) !=
- SWITCH_STATUS_SUCCESS) {
+ if (switch_core_speech_open(&conference->lsh, conference->tts_engine, conference->tts_voice,
+ conference->rate, conference->interval, &flags, conference->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module [%s]!\n", conference->tts_engine);
return SWITCH_STATUS_FALSE;
}
@@ -2540,7 +2556,7 @@
fnode->sh = conference->sh;
if (*text == '#') {
- char *tmp = (char *)text + 1;
+ char *tmp = (char *) text + 1;
char *vp = tmp, voice[128] = "";
if ((tmp = strchr(tmp, '#'))) {
text = tmp + 1;
@@ -2562,7 +2578,7 @@
}
/* execute a callback for every member of the conference */
-static void conference_member_itterator(conference_obj_t * conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
+static void conference_member_itterator(conference_obj_t *conference, switch_stream_handle_t *stream, conf_api_member_cmd_t pfncallback, void *data)
{
conference_member_t *member = NULL;
@@ -2578,7 +2594,7 @@
}
-static void conference_list_pretty(conference_obj_t * conference, switch_stream_handle_t *stream)
+static void conference_list_pretty(conference_obj_t *conference, switch_stream_handle_t *stream)
{
conference_member_t *member = NULL;
@@ -2603,7 +2619,7 @@
switch_mutex_unlock(conference->member_mutex);
}
-static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim)
+static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim)
{
conference_member_t *member = NULL;
@@ -2663,11 +2679,12 @@
switch_mutex_unlock(conference->member_mutex);
}
-static switch_status_t conf_api_sub_mute(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
if (member->conference->muted_sound) {
@@ -2691,11 +2708,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_unmute(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
switch_set_flag_locked(member, MFLAG_CAN_SPEAK);
if (stream != NULL) {
@@ -2719,11 +2737,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_deaf(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_deaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
switch_clear_flag_locked(member, MFLAG_CAN_HEAR);
if (stream != NULL) {
@@ -2738,11 +2757,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_undeaf(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_undeaf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
-
- if (member == NULL) return SWITCH_STATUS_GENERR;
+
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
switch_set_flag_locked(member, MFLAG_CAN_HEAR);
if (stream != NULL) {
@@ -2757,11 +2777,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_kick(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
switch_mutex_lock(member->flag_mutex);
switch_clear_flag(member, MFLAG_RUNNING);
@@ -2781,11 +2802,11 @@
}
-static switch_status_t conf_api_sub_dtmf(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_dtmf(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
char *dtmf = (char *) data;
-
+
if (member == NULL) {
stream->write_function(stream, "Invalid member!\n");
return SWITCH_STATUS_GENERR;
@@ -2798,7 +2819,7 @@
switch_mutex_lock(member->flag_mutex);
switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK);
- switch_core_session_send_dtmf_string(member->session, (char *)data);
+ switch_core_session_send_dtmf_string(member->session, (char *) data);
switch_mutex_unlock(member->flag_mutex);
if (stream != NULL) {
@@ -2816,11 +2837,12 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_energy(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_energy(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
if (data) {
switch_mutex_lock(member->flag_mutex);
@@ -2831,21 +2853,22 @@
stream->write_function(stream, "Energy %u = %d\n", member->id, member->energy_level);
}
if (test_eflag(member->conference, EFLAG_ENERGY_LEVEL_MEMBER) &&
- data && switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ data && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "energy-level-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level);
- switch_event_fire(& event);
+ switch_event_fire(&event);
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_volume_in(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_in(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
if (data) {
switch_mutex_lock(member->flag_mutex);
@@ -2857,21 +2880,22 @@
stream->write_function(stream, "Volume IN %u = %d\n", member->id, member->volume_in_level);
}
if (test_eflag(member->conference, EFLAG_VOLUME_IN_MEMBER) &&
- data && switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ data && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-in-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_in_level);
- switch_event_fire(& event);
+ switch_event_fire(&event);
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_volume_out(conference_member_t * member, switch_stream_handle_t *stream, void *data)
+static switch_status_t conf_api_sub_volume_out(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{
switch_event_t *event;
- if (member == NULL) return SWITCH_STATUS_GENERR;
+ if (member == NULL)
+ return SWITCH_STATUS_GENERR;
if (data) {
switch_mutex_lock(member->flag_mutex);
@@ -2883,17 +2907,17 @@
stream->write_function(stream, "Volume OUT %u = %d\n", member->id, member->volume_out_level);
}
if (test_eflag(member->conference, EFLAG_VOLUME_OUT_MEMBER) && data &&
- switch_event_create_subclass(& event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_member_data(member, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "volume-out-member");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Volume-Level", "%u", member->volume_out_level);
- switch_event_fire(& event);
+ switch_event_fire(&event);
}
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_list(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
int ret_status = SWITCH_STATUS_GENERR;
int count = 0;
@@ -2955,7 +2979,7 @@
return ret_status;
}
-static switch_status_t conf_api_sub_play(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_play(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
int ret_status = SWITCH_STATUS_GENERR;
switch_event_t *event;
@@ -3009,7 +3033,7 @@
return ret_status;
}
-static switch_status_t conf_api_sub_say(conference_obj_t * conference, switch_stream_handle_t *stream, const char *text)
+static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
{
switch_event_t *event;
@@ -3024,8 +3048,7 @@
}
stream->write_function(stream, "(say) OK\n");
- if (test_eflag(conference, EFLAG_SPEAK_TEXT) &&
- switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ if (test_eflag(conference, EFLAG_SPEAK_TEXT) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_data(conference, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "speak-text");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Text", "%s", text);
@@ -3034,7 +3057,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_saymember(conference_obj_t * conference, switch_stream_handle_t *stream, const char *text)
+static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, switch_stream_handle_t *stream, const char *text)
{
int ret_status = SWITCH_STATUS_GENERR;
char *expanded = NULL;
@@ -3077,10 +3100,10 @@
expanded = NULL;
}
- if (!text || conference_member_say(member, (char*)text, 0) != SWITCH_STATUS_SUCCESS) {
+ if (!text || conference_member_say(member, (char *) text, 0) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "(saymember) Error!");
goto done;
- }
+ }
stream->write_function(stream, "(saymember) OK\n");
if (test_eflag(member->conference, EFLAG_SPEAK_TEXT_MEMBER) &&
@@ -3092,13 +3115,13 @@
}
ret_status = SWITCH_STATUS_SUCCESS;
- done:
+ done:
switch_safe_free(workspace);
switch_safe_free(expanded);
return ret_status;
}
-static switch_status_t conf_api_sub_stop(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_stop(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
uint8_t current = 0, all = 0;
@@ -3112,7 +3135,8 @@
all = 1;
}
- if (!(current || all)) return SWITCH_STATUS_GENERR;
+ if (!(current || all))
+ return SWITCH_STATUS_GENERR;
if (argc == 4) {
uint32_t id = atoi(argv[3]);
@@ -3131,14 +3155,15 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_relate(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_relate(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
uint8_t nospeak = 0, nohear = 0, clear = 0;
switch_assert(conference != NULL);
switch_assert(stream != NULL);
- if (argc <= 4) return SWITCH_STATUS_GENERR;
+ if (argc <= 4)
+ return SWITCH_STATUS_GENERR;
nospeak = strstr(argv[4], "nospeak") ? 1 : 0;
nohear = strstr(argv[4], "nohear") ? 1 : 0;
@@ -3150,7 +3175,7 @@
if (!(clear || nospeak || nohear)) {
return SWITCH_STATUS_GENERR;
}
-
+
if (clear) {
conference_member_t *member = NULL;
uint32_t id = atoi(argv[2]);
@@ -3163,8 +3188,8 @@
stream->write_function(stream, "relationship %u->%u not found", id, oid);
}
return SWITCH_STATUS_SUCCESS;
- }
-
+ }
+
if (nospeak || nohear) {
conference_member_t *member = NULL, *other_member = NULL;
uint32_t id = atoi(argv[2]);
@@ -3199,7 +3224,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_lock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_lock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_event_t *event;
@@ -3212,8 +3237,7 @@
switch_set_flag_locked(conference, CFLAG_LOCKED);
stream->write_function(stream, "OK %s locked\n", argv[0]);
- if (test_eflag(conference, EFLAG_LOCK) &&
- switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_data(conference, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "lock");
switch_event_fire(&event);
@@ -3222,7 +3246,7 @@
return 0;
}
-static switch_status_t conf_api_sub_unlock(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_event_t *event;
@@ -3235,8 +3259,7 @@
switch_clear_flag_locked(conference, CFLAG_LOCKED);
stream->write_function(stream, "OK %s unlocked\n", argv[0]);
- if (test_eflag(conference, EFLAG_UNLOCK) &&
- switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+ if (test_eflag(conference, EFLAG_UNLOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
conference_add_event_data(conference, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
switch_event_fire(&event);
@@ -3245,7 +3268,7 @@
return 0;
}
-static switch_status_t conf_api_sub_dial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_call_cause_t cause;
@@ -3267,7 +3290,7 @@
}
-static switch_status_t conf_api_sub_bgdial(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_assert(stream != NULL);
@@ -3285,7 +3308,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_transfer(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_status_t ret_status = SWITCH_STATUS_SUCCESS;
char *conf_name = NULL, *profile_name;
@@ -3303,7 +3326,7 @@
} else {
profile_name = "default";
}
-
+
for (x = 3; x < argc; x++) {
conference_member_t *member = NULL;
uint32_t id = atoi(argv[x]);
@@ -3393,7 +3416,7 @@
switch_mutex_unlock(new_conference->mutex);
switch_mutex_unlock(member->flag_mutex);
stream->write_function(stream, "OK Members sent to conference %s.\n", argv[2]);
-
+
/* tell them what happened */
if (test_eflag(conference, EFLAG_TRANSFER) &&
switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
@@ -3408,7 +3431,7 @@
ret_status = SWITCH_STATUS_GENERR;
}
- done:
+ done:
if (params) {
switch_event_destroy(¶ms);
}
@@ -3416,26 +3439,28 @@
return ret_status;
}
-static switch_status_t conf_api_sub_record(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_assert(conference != NULL);
switch_assert(stream != NULL);
- if (argc <= 2) return SWITCH_STATUS_GENERR;
+ if (argc <= 2)
+ return SWITCH_STATUS_GENERR;
stream->write_function(stream, "Record file %s\n", argv[2]);
launch_conference_record_thread(conference, argv[2]);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_norecord(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
int all;
switch_assert(conference != NULL);
switch_assert(stream != NULL);
- if (argc <= 2) return SWITCH_STATUS_GENERR;
+ if (argc <= 2)
+ return SWITCH_STATUS_GENERR;
all = (strcasecmp(argv[2], "all") == 0);
stream->write_function(stream, "Stop recording file %s\n", argv[2]);
@@ -3446,7 +3471,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_api_sub_pin(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv)
+static switch_status_t conf_api_sub_pin(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv)
{
switch_assert(conference != NULL);
switch_assert(stream != NULL);
@@ -3493,47 +3518,47 @@
/* API Interface Function sub-commands */
/* Entries in this list should be kept in sync with the enum above */
static api_command_t conf_api_sub_commands[] = {
- {"list", (void_fn_t) & conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
- {"energy", (void_fn_t) & conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
+ {"list", (void_fn_t) &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+ {"energy", (void_fn_t) &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
"<confname> energy <member_id|all|last> [<newval>]"},
- {"volume_in", (void_fn_t) & conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
+ {"volume_in", (void_fn_t) &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
"<confname> volume_in <member_id|all|last> [<newval>]"},
- {"volume_out", (void_fn_t) & conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
+ {"volume_out", (void_fn_t) &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
"<confname> volume_out <member_id|all|last> [<newval>]"},
- {"play", (void_fn_t) & conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
- {"say", (void_fn_t) & conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
- {"saymember", (void_fn_t) & conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
+ {"play", (void_fn_t) &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [<member_id>]"},
+ {"say", (void_fn_t) &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+ {"saymember", (void_fn_t) &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
"<confname> saymember <member_id> <text>"},
- {"stop", (void_fn_t) & conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
+ {"stop", (void_fn_t) &conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
"<confname> stop <[current|all|last]> [<member_id>]"},
- {"dtmf", (void_fn_t) & conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
+ {"dtmf", (void_fn_t) &conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
"<confname> dtmf <[member_id|all|last]> <digits>"},
- {"kick", (void_fn_t) & conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
- {"mute", (void_fn_t) & conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
- {"unmute", (void_fn_t) & conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
+ {"kick", (void_fn_t) &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+ {"mute", (void_fn_t) &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+ {"unmute", (void_fn_t) &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
"<confname> unmute <[member_id|all]|last>"},
- {"deaf", (void_fn_t) & conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
- {"undeaf", (void_fn_t) & conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
+ {"deaf", (void_fn_t) &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+ {"undeaf", (void_fn_t) &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
"<confname> undeaf <[member_id|all]|last>"},
- {"relate", (void_fn_t) & conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
+ {"relate", (void_fn_t) &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
"<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
- {"lock", (void_fn_t) & conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
- {"unlock", (void_fn_t) & conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
- {"dial", (void_fn_t) & conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
+ {"lock", (void_fn_t) &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+ {"unlock", (void_fn_t) &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+ {"dial", (void_fn_t) &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
"<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
- {"bgdial", (void_fn_t) & conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
+ {"bgdial", (void_fn_t) &conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
"<confname> bgdial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
- {"transfer", (void_fn_t) & conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
+ {"transfer", (void_fn_t) &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
"<confname> transfer <conference_name> <member id> [...<member id>]"},
- {"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
- {"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
- {"pin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
- {"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
+ {"record", (void_fn_t) &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+ {"norecord", (void_fn_t) &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+ {"pin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
+ {"nopin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
};
#define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
-switch_status_t conf_api_dispatch(conference_obj_t * conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
+switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv, const char *cmdline, int argn)
{
switch_status_t status = SWITCH_STATUS_FALSE;
uint32_t i, found = 0;
@@ -3719,7 +3744,7 @@
stream->write_function(stream, "No parameters specified.\nTry 'help conference'\n");
}
- done:
+ done:
switch_safe_free(lbuf);
return status;
@@ -3727,7 +3752,7 @@
}
/* generate an outbound call from the conference */
-static switch_status_t conference_outcall(conference_obj_t * conference,
+static switch_status_t conference_outcall(conference_obj_t *conference,
char *conference_name,
switch_core_session_t *session,
char *bridgeto, uint32_t timeout, char *flags, char *cid_name, char *cid_num, switch_call_cause_t *cause)
@@ -3776,21 +3801,19 @@
}
/* establish an outbound call leg */
-
- if (switch_ivr_originate(session,
- &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num,
- NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
+
+ if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause));
if (caller_channel) {
switch_channel_hangup(caller_channel, *cause);
}
goto done;
}
-
+
rdlock = 1;
peer_channel = switch_core_session_get_channel(peer_session);
switch_channel_set_state(peer_channel, CS_SOFT_EXECUTE);
-
+
/* make sure the conference still exists */
if (!switch_test_flag(conference, CFLAG_RUNNING)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
@@ -3805,7 +3828,7 @@
switch_channel_answer(caller_channel);
}
- callup:
+ callup:
/* if the outbound call leg is ready */
if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) {
@@ -3834,7 +3857,7 @@
goto done;
}
- done:
+ done:
if (conference) {
switch_thread_rwlock_unlock(conference->rwlock);
}
@@ -3856,7 +3879,7 @@
char *conference_name;
};
-static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC conference_outcall_run(switch_thread_t *thread, void *obj)
{
struct bg_call *call = (struct bg_call *) obj;
@@ -3864,7 +3887,7 @@
switch_call_cause_t cause;
switch_event_t *event;
- conference_outcall(call->conference, call->conference_name,
+ conference_outcall(call->conference, call->conference_name,
call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
if (test_eflag(call->conference, EFLAG_BGDIAL_RESULT) &&
@@ -3885,15 +3908,17 @@
return NULL;
}
-static switch_status_t conference_outcall_bg(conference_obj_t * conference,
+static switch_status_t conference_outcall_bg(conference_obj_t *conference,
char *conference_name,
- switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name, const char *cid_num)
+ switch_core_session_t *session, char *bridgeto, uint32_t timeout, const char *flags, const char *cid_name,
+ const char *cid_num)
{
struct bg_call *call = NULL;
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
- if (!(call = malloc(sizeof(*call)))) return SWITCH_STATUS_MEMERR;
+ if (!(call = malloc(sizeof(*call))))
+ return SWITCH_STATUS_MEMERR;
memset(call, 0, sizeof(*call));
call->conference = conference;
@@ -3927,8 +3952,7 @@
}
/* Play a file */
-static switch_status_t conference_local_play_file(conference_obj_t * conference,
- switch_core_session_t *session, char *path, uint32_t leadin)
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin)
{
uint32_t x = 0;
switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -3948,7 +3972,7 @@
/* if all is well, really play the file */
if (status == SWITCH_STATUS_SUCCESS) {
char *dpath = NULL;
-
+
channel = switch_core_session_get_channel(session);
if ((expanded = switch_channel_expand_variables(channel, path)) != path) {
path = expanded;
@@ -3977,13 +4001,13 @@
switch_safe_free(dpath);
}
- done:
+ done:
switch_safe_free(expanded);
-
+
return status;
}
-static void set_mflags(char *flags, member_flag_t * f)
+static void set_mflags(char *flags, member_flag_t *f)
{
if (flags) {
if (strstr(flags, "mute")) {
@@ -3999,11 +4023,11 @@
}
-static void clear_eflags(char *events, uint32_t * f)
+static void clear_eflags(char *events, uint32_t *f)
{
char buf[512] = "";
- char* next = NULL;
- char* event = buf;
+ char *next = NULL;
+ char *event = buf;
if (events) {
switch_copy_string(buf, events, sizeof(buf));
@@ -4122,7 +4146,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Channel has no media!\n");
return;
}
-
+
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid arguments\n");
@@ -4176,7 +4200,7 @@
if (0) {
member.dtmf_parser = conference->dtmf_parser;
} else {
-
+
}
#endif
@@ -4245,7 +4269,7 @@
if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, conf_name))) {
/* couldn't find the conference, create one */
conference = conference_new(conf_name, xml_cfg, NULL);
-
+
if (!conference) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
goto done;
@@ -4317,7 +4341,7 @@
goto done;
}
}
-
+
if (conference->special_announce) {
conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN);
}
@@ -4367,7 +4391,7 @@
if (!switch_channel_test_flag(channel, CF_OUTBOUND))
switch_set_flag(conference, CFLAG_ANSWERED);
}
-
+
member.orig_read_codec = read_codec;
member.native_rate = read_codec->implementation->samples_per_second;
member.pool = switch_core_session_get_pool(session);
@@ -4375,9 +4399,7 @@
/* Setup a Signed Linear codec for reading audio. */
if (switch_core_codec_init(&member.read_codec,
"L16",
- NULL,
- read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ NULL, read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000,
//conference->interval,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
@@ -4387,30 +4409,27 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
-
+
flags = 0;
goto done;
}
- member.frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
- member.frame = switch_core_alloc(member.pool, member.frame_size);
- member.mux_frame = switch_core_alloc(member.pool, member.frame_size);
-
+ member.frame_size = SWITCH_RECOMMENDED_BUFFER_SIZE;
+ member.frame = switch_core_alloc(member.pool, member.frame_size);
+ member.mux_frame = switch_core_alloc(member.pool, member.frame_size);
+
if (read_codec->implementation->actual_samples_per_second != conference->rate) {
if (switch_resample_create(&member.read_resampler,
read_codec->implementation->actual_samples_per_second,
- member.frame_size,
- conference->rate,
- member.frame_size,
- member.pool) != SWITCH_STATUS_SUCCESS) {
+ member.frame_size, conference->rate, member.frame_size, member.pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
goto done;
}
- member.resample_out = switch_core_alloc(member.pool, member.frame_size);
- member.resample_out_len = member.frame_size;
-
+ member.resample_out = switch_core_alloc(member.pool, member.frame_size);
+ member.resample_out_len = member.frame_size;
+
/* Setup an audio buffer for the resampled audio */
if (switch_buffer_create_dynamic(&member.resample_buffer, CONF_DBLOCK_SIZE, CONF_DBUFFER_SIZE, CONF_DBUFFER_MAX)
!= SWITCH_STATUS_SUCCESS) {
@@ -4478,7 +4497,7 @@
/* Run the confernece loop */
conference_loop_output(&member);
switch_channel_set_private(channel, "_conference_autocall_list_", NULL);
-
+
/* Tell the channel we are no longer going to be in a bridge */
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
switch_core_session_receive_message(session, &msg);
@@ -4490,11 +4509,11 @@
switch_core_session_set_read_codec(member.session, read_codec);
/* Clean Up. codec_done(X): is for error situations after the codecs were setup and done: is for situations before */
- codec_done1:
+ codec_done1:
switch_core_codec_destroy(&member.read_codec);
- codec_done2:
+ codec_done2:
switch_core_codec_destroy(&member.write_codec);
- done:
+ done:
switch_event_destroy(¶ms);
switch_buffer_destroy(&member.resample_buffer);
switch_buffer_destroy(&member.audio_buffer);
@@ -4521,7 +4540,7 @@
char *dfile = NULL;
if (conference->sound_prefix) {
- dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, conference->kicked_sound);
+ dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, conference->kicked_sound);
switch_assert(dfile);
toplay = dfile;
} else {
@@ -4541,7 +4560,7 @@
}
/* Create a thread for the conference and launch it */
-static void launch_conference_thread(conference_obj_t * conference)
+static void launch_conference_thread(conference_obj_t *conference)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -4569,7 +4588,7 @@
switch_thread_create(&thread, thd_attr, conference_video_thread_run, conference, conference->pool);
}
-static void launch_conference_record_thread(conference_obj_t * conference, char *path)
+static void launch_conference_record_thread(conference_obj_t *conference, char *path)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -4624,7 +4643,7 @@
} else {
switch_copy_string(name, to, sizeof(name));
}
-
+
if (!(conference = (conference_obj_t *) switch_core_hash_find(globals.conference_hash, name))) {
ci->chat_send(CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", "Conference not active.", NULL);
@@ -4638,8 +4657,7 @@
if (switch_stristr("list", lbuf)) {
conference_list_pretty(conference, &stream);
/* provide help */
- }
- else {
+ } else {
return SWITCH_STATUS_SUCCESS;
}
#if 0
@@ -4660,7 +4678,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t conf_default_controls(conference_obj_t * conference)
+static switch_status_t conf_default_controls(conference_obj_t *conference)
{
switch_status_t status = SWITCH_STATUS_FALSE;
uint32_t i;
@@ -4688,7 +4706,7 @@
return status;
}
-static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t * conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
+static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t *conference, switch_xml_t xml_controls, switch_xml_t xml_menus)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_xml_t xml_kvp;
@@ -4778,7 +4796,7 @@
char *maxmember_sound = NULL;
uint32_t rate = 8000, interval = 20;
switch_status_t status;
- int comfort_noise_level = 0;
+ int comfort_noise_level = 0;
char *suppress_events = NULL;
/* Validate the conference name */
@@ -4805,10 +4823,10 @@
}
if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
- uint32_t tmp = atoi(val);
- if (tmp == 8000 || tmp == 16000 || tmp == 32000) {
- rate = tmp;
- }
+ uint32_t tmp = atoi(val);
+ if (tmp == 8000 || tmp == 16000 || tmp == 32000) {
+ rate = tmp;
+ }
} else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
domain = val;
} else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
@@ -4817,7 +4835,7 @@
interval = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
+ "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
} else if (!strcasecmp(var, "timer-name") && !switch_strlen_zero(val)) {
timer_name = val;
@@ -4868,13 +4886,13 @@
} else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
caller_controls = val;
} else if (!strcasecmp(var, "comfort-noise") && !switch_strlen_zero(val)) {
- int tmp;
- tmp = atoi(val);
- if (tmp > 1 && tmp < 10000) {
- comfort_noise_level = tmp;
- } else if (switch_true(val)) {
- comfort_noise_level = 1400;
- }
+ int tmp;
+ tmp = atoi(val);
+ if (tmp > 1 && tmp < 10000) {
+ comfort_noise_level = tmp;
+ } else if (switch_true(val)) {
+ comfort_noise_level = 1400;
+ }
} else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
sound_prefix = val;
} else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(val)) {
@@ -4897,7 +4915,7 @@
}
} else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) {
suppress_events = val;
- }
+ }
}
/* Set defaults and various paramaters */
@@ -4946,7 +4964,7 @@
conference->tts_voice = switch_core_strdup(conference->pool, tts_voice);
}
- conference->comfort_noise_level = comfort_noise_level;
+ conference->comfort_noise_level = comfort_noise_level;
conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name);
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
@@ -5140,11 +5158,11 @@
{
switch_xml_t cxml, cfg, advertise, room;
switch_event_t *params = NULL;
-
+
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "presence", "true");
-
+
/* Open the config from the xml registry */
if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) {
@@ -5170,7 +5188,7 @@
}
}
- done:
+ done:
switch_event_destroy(¶ms);
/* Release the config registry handle */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c Tue May 27 07:24:06 2008
@@ -49,7 +49,7 @@
if (!caller_profile) {
caller_profile = switch_channel_get_caller_profile(channel);
- }
+ }
if ((extension = switch_caller_extension_new(session, "inline", "inline")) == 0) {
abort();
@@ -58,26 +58,26 @@
if (switch_strlen_zero(target)) {
target = caller_profile->destination_number;
}
-
+
if (!switch_strlen_zero(target) && (lbuf = switch_core_session_strdup(session, target))
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
} else {
return NULL;
}
-
- for(x = 0; x < argc; x++) {
+
+ for (x = 0; x < argc; x++) {
char *app = argv[x];
char *data = strchr(app, ':');
if (data) {
*data++ = '\0';
}
-
- while(*app == ' ') {
+
+ while (*app == ' ') {
app++;
}
-
+
switch_caller_extension_add_application(session, extension, app, data);
}
@@ -119,7 +119,7 @@
char *argv[4] = { 0 };
int argc;
char *lbuf = NULL;
-
+
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]);
@@ -135,13 +135,13 @@
char *argv[4] = { 0 };
int argc;
char *lbuf = NULL;
-
+
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
switch_ivr_say(session, argv[3], argv[0], argv[1], argv[2], NULL);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX);
- }
+ }
}
@@ -151,7 +151,7 @@
char *argv[3] = { 0 };
int argc;
char *lbuf = NULL;
-
+
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]);
@@ -166,7 +166,7 @@
char *argv[4] = { 0 };
int argc;
char *lbuf = NULL;
-
+
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
int kval = atoi(argv[0]);
@@ -239,7 +239,7 @@
} else {
uuid = argv[0];
}
-
+
switch_ivr_intercept_session(session, uuid, bleg);
}
return;
@@ -275,10 +275,10 @@
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *require_group = switch_channel_get_variable(channel, "eavesdrop_require_group");
- if (!strcasecmp((char *)data, "all")) {
+ if (!strcasecmp((char *) data, "all")) {
switch_core_db_t *db = switch_core_db_handle();
char *errmsg = NULL;
- struct e_data e_data = {{ 0 }};
+ struct e_data e_data = { {0} };
char *sql = switch_mprintf("select uuid from channels where uuid != '%q'", switch_core_session_get_uuid(session));
const char *file = NULL;
int x = 0;
@@ -286,9 +286,9 @@
switch_size_t buflen = sizeof(buf);
char terminator;
switch_status_t status;
-
- while(switch_channel_ready(channel)) {
- for(x = 0; x < MAX_SPY; x++) {
+
+ while (switch_channel_ready(channel)) {
+ for (x = 0; x < MAX_SPY; x++) {
switch_safe_free(e_data.uuid_list[x]);
}
e_data.total = 0;
@@ -326,12 +326,12 @@
}
}
- for(x = 0; x < MAX_SPY; x++) {
+ for (x = 0; x < MAX_SPY; x++) {
switch_safe_free(e_data.uuid_list[x]);
}
switch_core_db_close(db);
-
+
} else {
switch_ivr_eavesdrop_session(session, data, require_group, ED_DTMF);
}
@@ -352,7 +352,7 @@
#define SET_USER_SYNTAX "<user>@<domain>"
SWITCH_STANDARD_APP(set_user_function)
{
- switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
+ switch_xml_t x_domain, xml = NULL, x_user, x_param, x_params;
char *user, *mailbox, *domain;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -367,21 +367,21 @@
}
*domain++ = '\0';
-
+
if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", user, domain);
goto done;
}
- if ((mailbox = (char *)switch_xml_attr(x_user, "mailbox"))) {
+ if ((mailbox = (char *) switch_xml_attr(x_user, "mailbox"))) {
switch_channel_set_variable(channel, "mailbox", mailbox);
}
-
+
if ((x_params = switch_xml_child(x_user, "variables"))) {
for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
-
+
if (var && val) {
switch_channel_set_variable(channel, var, val);
}
@@ -393,10 +393,10 @@
goto done;
- error:
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No user@domain specified.\n");
- done:
+ done:
if (xml) {
switch_xml_free(xml);
}
@@ -425,7 +425,7 @@
SWITCH_STANDARD_APP(check_acl_function)
{
int argc;
- char *argv[3] = { 0 };
+ char *argv[3] = { 0 };
char *mydata;
switch_call_cause_t cause = SWITCH_CAUSE_CALL_REJECTED;
@@ -441,7 +441,7 @@
}
}
}
-
+
}
SWITCH_STANDARD_APP(transfer_function)
@@ -451,7 +451,7 @@
char *mydata;
int bleg = 0, both = 0;
-
+
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
bleg = !strcasecmp(argv[0], "-bleg");
@@ -459,7 +459,7 @@
if (bleg || both) {
const char *uuid;
- switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_channel_t *channel = switch_core_session_get_channel(session);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *b_session;
if ((b_session = switch_core_session_locate(uuid))) {
@@ -592,7 +592,7 @@
} else {
len = atoi(data);
}
-
+
switch_ivr_delay_echo(session, len);
}
@@ -776,16 +776,16 @@
caller_profile->caller_id_number = val;
}
if (val && !strcasecmp(name, "caller_ton")) {
- caller_profile->caller_ton = (uint8_t)atoi(val);
+ caller_profile->caller_ton = (uint8_t) atoi(val);
}
if (val && !strcasecmp(name, "caller_numplan")) {
- caller_profile->caller_numplan = (uint8_t)atoi(val);
+ caller_profile->caller_numplan = (uint8_t) atoi(val);
}
if (val && !strcasecmp(name, "destination_number_ton")) {
- caller_profile->destination_number_ton = (uint8_t)atoi(val);
+ caller_profile->destination_number_ton = (uint8_t) atoi(val);
}
if (val && !strcasecmp(name, "destination_number_numplan")) {
- caller_profile->destination_number_numplan = (uint8_t)atoi(val);
+ caller_profile->destination_number_numplan = (uint8_t) atoi(val);
}
if (!strcasecmp(name, "ani")) {
caller_profile->ani = val;
@@ -846,7 +846,8 @@
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "", val ? val : "UNDEF");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "",
+ val ? val : "UNDEF");
switch_channel_set_variable(channel, var, val);
if (var && val) {
@@ -929,17 +930,20 @@
if (this) {
char *var, *val;
p = this;
- while(*p == ' ') *p++ = '\0';
+ while (*p == ' ')
+ *p++ = '\0';
this = p;
-
+
var = this;
val = NULL;
if ((val = strchr(var, '='))) {
p = val - 1;
*val++ = '\0';
- while(*p == ' ') *p-- = '\0';
+ while (*p == ' ')
+ *p-- = '\0';
p = val;
- while(*p == ' ') *p++ = '\0';
+ while (*p == ' ')
+ *p++ = '\0';
val = p;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, var, "%s", val);
}
@@ -1019,8 +1023,8 @@
switch_time_t thetime;
char *p;
if (!switch_strlen_zero(cmd) && (p = strchr(cmd, '|'))) {
- thetime = switch_time_make(atoi(cmd),0);
- cmd = p+1;
+ thetime = switch_time_make(atoi(cmd), 0);
+ cmd = p + 1;
} else {
thetime = switch_timestamp_now();
}
@@ -1091,7 +1095,7 @@
static char *ivr_cf_name = "ivr.conf";
#ifdef _TEST_CALLBACK_
-static switch_ivr_action_t menu_handler(switch_ivr_menu_t * menu, char *param, char *buf, size_t buflen, void *obj)
+static switch_ivr_action_t menu_handler(switch_ivr_menu_t *menu, char *param, char *buf, size_t buflen, void *obj)
{
switch_ivr_action_t action = SWITCH_IVR_ACTION_NOOP;
@@ -1107,7 +1111,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_event_t *params;
-
+
if (channel) {
switch_xml_t cxml = NULL, cfg = NULL, xml_menus = NULL, xml_menu = NULL;
@@ -1118,7 +1122,7 @@
if ((cxml = switch_xml_open_cfg(ivr_cf_name, &cfg, params)) != NULL) {
if ((xml_menus = switch_xml_child(cfg, "menus"))) {
- xml_menu = switch_xml_find_child(xml_menus, "menu", "name", (char *)data);
+ xml_menu = switch_xml_find_child(xml_menus, "menu", "name", (char *) data);
// if the menu was found
if (xml_menu != NULL) {
@@ -1134,7 +1138,7 @@
switch_xml_free(cxml);
cxml = NULL;
switch_channel_pre_answer(channel);
- switch_ivr_menu_execute(session, menu_stack, (char *)data, NULL);
+ switch_ivr_menu_execute(session, menu_stack, (char *) data, NULL);
switch_ivr_menu_stack_free(menu_stack);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to create menu\n");
@@ -1164,12 +1168,12 @@
SWITCH_STANDARD_APP(dtmf_session_generate_function)
{
switch_bool_t do_read = SWITCH_TRUE;
-
+
if (!switch_strlen_zero(data)) {
if (!strcasecmp(data, "write")) {
do_read = SWITCH_FALSE;
}
- }
+ }
switch_ivr_inband_dtmf_generate_session(session, do_read);
}
@@ -1185,9 +1189,9 @@
SWITCH_STANDARD_APP(system_session_function)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n",data);
- if (!system(data)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n",data);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Executing command: %s\n", data);
+ if (!system(data)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", data);
}
}
@@ -1211,7 +1215,7 @@
if (argv[3]) {
uint32_t mto;
if (*argv[3] == '+') {
- if ((mto = atol(argv[3]+1)) > 0) {
+ if ((mto = atol(argv[3] + 1)) > 0) {
to = switch_timestamp(NULL) + mto;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "INVALID Timeout!\n");
@@ -1225,7 +1229,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Enabling tone detection '%s' '%s'\n", argv[0], argv[1]);
-
+
switch_ivr_tone_detect_session(session, argv[0], argv[1], argv[2], to, argv[4], argv[5]);
}
@@ -1261,7 +1265,7 @@
static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
{
char *str = (char *) buf;
-
+
if (str && input && itype == SWITCH_INPUT_TYPE_DTMF) {
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
if (strchr(str, dtmf->digit)) {
@@ -1288,7 +1292,7 @@
terminators = NULL;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit %c\n", dtmf->digit);
-
+
for (p = terminators; p && *p; p++) {
if (*p == dtmf->digit) {
return SWITCH_STATUS_BREAK;
@@ -1326,7 +1330,7 @@
}
argc = switch_separate_string(mydata, '|', argv, sizeof(argv) / sizeof(argv[0]));
-
+
if (argc == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Params!\n");
return;
@@ -1381,11 +1385,11 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
- {
+ {
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
-
+
if (dtmf->digit == '#') {
return SWITCH_STATUS_FALSE;
}
@@ -1404,12 +1408,12 @@
}
switch_core_session_rwunlock(b_session);
}
-
+
if ((extension = switch_caller_extension_new(peer_session, app, app_arg)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
abort();
}
-
+
switch_caller_extension_add_application(peer_session, extension, app, app_arg);
switch_channel_set_caller_extension(peer_channel, extension);
switch_channel_set_flag(peer_channel, CF_TRANSFER);
@@ -1418,7 +1422,7 @@
return SWITCH_STATUS_FALSE;
}
-
+
}
break;
default:
@@ -1444,7 +1448,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nHangup Command uuid_bridge(%s):\n%s\n", id, switch_str_nil((char *) stream.data));
switch_safe_free(stream.data);
}
-
+
switch_core_event_hook_remove_state_change(session, hanguphook);
}
return SWITCH_STATUS_SUCCESS;
@@ -1468,8 +1472,8 @@
}
switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, bond);
-
-
+
+
if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
timelimit = atoi(var);
}
@@ -1481,9 +1485,9 @@
peer_channel = switch_core_session_get_channel(peer_session);
switch_channel_set_flag(peer_channel, CF_INNER_BRIDGE);
switch_channel_set_flag(channel, CF_INNER_BRIDGE);
-
+
switch_ivr_multi_threaded_bridge(session, peer_session, xfer_on_dtmf, peer_session, NULL);
-
+
switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
@@ -1510,13 +1514,13 @@
switch_core_session_rwunlock(b_session);
}
-
+
switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
}
-
+
switch_core_session_rwunlock(peer_session);
-
- end:
+
+ end:
switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
}
@@ -1538,12 +1542,12 @@
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No arguements specified.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No arguements specified.\n");
return;
}
min_digits = atoi(argv[0]);
-
+
if (argc > 1) {
max_digits = atoi(argv[1]);
}
@@ -1551,19 +1555,19 @@
if (argc > 2) {
prompt_audio_file = argv[2];
}
-
+
if (argc > 3) {
var_name = argv[3];
}
-
+
if (argc > 4) {
timeout = atoi(argv[4]);
}
-
+
if (argc > 5) {
valid_terminators = argv[5];
}
-
+
if (min_digits <= 1) {
min_digits = 1;
}
@@ -1571,7 +1575,7 @@
if (max_digits < min_digits) {
max_digits = min_digits;
}
-
+
if (timeout <= 1000) {
timeout = 1000;
}
@@ -1634,7 +1638,7 @@
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
path = argv[0];
- for(x = 1; x < argc; x++) {
+ for (x = 1; x < argc; x++) {
if (strchr(argv[x], '+')) {
limit = atoi(argv[x]);
} else if (!switch_strlen_zero(argv[x])) {
@@ -1659,7 +1663,7 @@
switch_input_args_t args = { 0 };
switch_file_handle_t fh = { 0 };
int argc;
- char *mydata, *argv[4] = { 0 };
+ char *mydata, *argv[4] = { 0 };
char *l = NULL;
const char *tmp;
int rate;
@@ -1667,10 +1671,10 @@
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file specified.\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No file specified.\n");
return;
}
-
+
path = argv[0];
l = argv[1];
@@ -1726,11 +1730,12 @@
path = switch_core_session_strdup(session, data);
- if (!path) return;
+ if (!path)
+ return;
if ((p = strchr(path, '+'))) {
char *q = p - 1;
- while(q && *q == ' ') {
+ while (q && *q == ' ') {
*q = '\0';
q--;
}
@@ -1767,11 +1772,11 @@
}
continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail");
-
+
if ((var = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE)) && switch_true(var)) {
switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
}
-
+
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)
|| ((var = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE)) && switch_true(var))) {
if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
@@ -1801,7 +1806,7 @@
'true' to continue on all failures.
'false' to not continue.
A list of codes either names or numbers eg "user_busy,normal_temporary_failure,603"
- */
+ */
if (continue_on_fail) {
const char *cause_str;
char cause_num[35] = "";
@@ -1850,11 +1855,11 @@
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
- char *a_key = (char *)switch_channel_get_variable(channel, "bridge_terminate_key");
- char *b_key = (char *)switch_channel_get_variable(peer_channel, "bridge_terminate_key");
+ char *a_key = (char *) switch_channel_get_variable(channel, "bridge_terminate_key");
+ char *b_key = (char *) switch_channel_get_variable(peer_channel, "bridge_terminate_key");
int ok = 0;
switch_input_callback_function_t func = NULL;
-
+
if (a_key) {
a_key = switch_core_session_strdup(session, a_key);
ok++;
@@ -1873,7 +1878,7 @@
switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
}
}
- end:
+ end:
if (peer_session) {
switch_core_session_rwunlock(peer_session);
}
@@ -1885,9 +1890,7 @@
static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags);
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
switch_io_routines_t user_io_routines = {
/*.outgoing_channel */ user_outgoing_channel
};
@@ -1895,11 +1898,9 @@
static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags)
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
- switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_param, x_params;
+ switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_param, x_params;
char *user = NULL, *domain = NULL;
const char *dest = NULL;
static switch_call_cause_t cause = SWITCH_CAUSE_UNALLOCATED;
@@ -1912,7 +1913,8 @@
user = strdup(outbound_profile->destination_number);
- if (!user) goto done;
+ if (!user)
+ goto done;
if (!(domain = strchr(user, '@'))) {
goto done;
@@ -1934,7 +1936,7 @@
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
-
+
if (!strcasecmp(var, "dial-string")) {
dest = val;
break;
@@ -1946,7 +1948,7 @@
for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
const char *var = switch_xml_attr(x_param, "name");
const char *val = switch_xml_attr(x_param, "value");
-
+
if (!strcasecmp(var, "dial-string")) {
dest = val;
break;
@@ -1965,10 +1967,10 @@
if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))) {
timelimit = atoi(var);
}
-
+
switch_channel_set_variable(channel, "dialed_user", user);
switch_channel_set_variable(channel, "dialed_domain", domain);
-
+
d_dest = switch_channel_expand_variables(channel, dest);
} else {
@@ -1977,7 +1979,7 @@
switch_event_create(&event, SWITCH_EVENT_MESSAGE);
switch_assert(event);
}
-
+
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
d_dest = switch_event_expand_headers(event, dest);
@@ -1985,7 +1987,7 @@
switch_event_destroy(&event);
}
}
-
+
if ((flags & SOF_FORKED_DIAL)) {
myflags |= SOF_NOBLOCK;
}
@@ -1995,7 +1997,7 @@
switch_caller_profile_t *cp;
new_channel = switch_core_session_get_channel(*new_session);
-
+
if ((context = switch_channel_get_variable(new_channel, "user_context"))) {
if ((cp = switch_channel_get_caller_profile(new_channel))) {
cp->context = switch_core_strdup(cp->pool, context);
@@ -2027,12 +2029,12 @@
}
}
- done:
+ done:
if (xml) {
switch_xml_free(xml);
}
-
+
if (params) {
switch_event_destroy(¶ms);
}
@@ -2080,20 +2082,22 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
user_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
- user_endpoint_interface->interface_name = "USER";
- user_endpoint_interface->io_routines = &user_io_routines;
+ user_endpoint_interface->interface_name = "USER";
+ user_endpoint_interface->io_routines = &user_io_routines;
SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>");
SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, "<user> <rpid> <message>");
- SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "hold", "Send a hold message", "Send a hold message", hold_function, HOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "unhold", "Send a un-hold message", "Send a un-hold message", unhold_function, UNHOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list",
- "Check an ip against an ACL list", check_acl_function, "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", "Check an ip against an ACL list", check_acl_function,
+ "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "strftime", NULL, NULL, strftime_function, NULL, SAF_SUPPORT_NOMEDIA);
@@ -2106,37 +2110,50 @@
SWITCH_ADD_APP(app_interface, "log", "Logs a channel variable", LOG_LONG_DESC, log_function, "<varname>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function,
+ "<varname>=<value>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "<varname>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "detect_speech", "Detect speech", "Detect speech on a channel.", detect_speech_function, DETECT_SPEECH_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "<menu_name>", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "reject", "Send session reject (depricated)", "Send a respond message to a session.", respond_function, "<respond_data>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function, "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function, "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "sched_hangup", SCHED_HANGUP_DESCR, SCHED_HANGUP_DESCR, sched_hangup_function, "[+]<time> [<cause>]",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "sched_broadcast", SCHED_BROADCAST_DESCR, SCHED_BROADCAST_DESCR, sched_broadcast_function,
+ "[+]<time> <path> [aleg|bleg|both]", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function,
+ "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX, SAF_NONE);
- SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX, SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
+ SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "intercept", "intercept", "intercept", intercept_function, INTERCEPT_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "eavesdrop", "eavesdrop on a uuid", "eavesdrop on a uuid", eavesdrop_function, eavesdrop_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "three_way", "three way call with a uuid", "three way call with a uuid", three_way_function, threeway_SYNTAX, SAF_NONE);
SWITCH_ADD_APP(app_interface, "set_user", "Set a User", "Set a User", set_user_function, SET_USER_SYNTAX, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "stop_dtmf_generate", "stop inband dtmf generation", "Stop generating inband dtmf.",
+ SWITCH_ADD_APP(app_interface, "stop_dtmf_generate", "stop inband dtmf generation", "Stop generating inband dtmf.",
stop_dtmf_session_generate_function, "[write]", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "start_dtmf_generate", "Generate dtmf", "Generate inband dtmf on the session", dtmf_session_generate_function, "", SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "start_dtmf_generate", "Generate dtmf", "Generate inband dtmf on the session", dtmf_session_generate_function, "",
+ SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_tone_detect", "stop detecting tones", "Stop detecting tones", stop_fax_detect_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_NONE);
SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_NONE);
@@ -2149,13 +2166,19 @@
SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, "<min> <max> <file> <var name> <timeout> <terminators>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path>", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function, "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]", SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,
+ "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>",
+ SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [+time_limit_ms] [mux]",
+ SAF_NONE);
SWITCH_ADD_APP(app_interface, "speak", "Speak text", SPEAK_DESC, speak_function, "<engine>|<voice>|<text>", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "", SAF_NONE);
- SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>", SAF_SUPPORT_NOMEDIA);
- SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "",
+ SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "bridge", "Bridge Audio", "Bridge the audio between two sessions", audio_bridge_function, "<channel_url>",
+ SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "system", "Execute a system command", "Execute a system command", system_session_function, "<command>",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_enum/mod_enum.c Tue May 27 07:24:06 2008
@@ -203,16 +203,16 @@
return out;
}
-static void dnserror(enum_query_t * q, int errnum)
+static void dnserror(enum_query_t *q, int errnum)
{
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unable to lookup %s record for %s: %s\n",
dns_typename(q->qtyp), dns_dntosp(q->dn), dns_strerror(errnum));
q->errs++;
}
-static void add_result(enum_query_t * q, int order, int preference, char *service, char *route, int supported)
+static void add_result(enum_query_t *q, int order, int preference, char *service, char *route, int supported)
{
enum_record_t *new_result, *rp, *prev = NULL;
@@ -258,7 +258,7 @@
}
-static void free_results(enum_record_t ** results)
+static void free_results(enum_record_t **results)
{
enum_record_t *fp, *rp;
@@ -272,7 +272,7 @@
*results = NULL;
}
-static void parse_rr(const struct dns_parse *p, enum_query_t * q, struct dns_rr *rr)
+static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr *rr)
{
const unsigned char *pkt = p->dnsp_pkt;
const unsigned char *end = p->dnsp_end;
@@ -290,17 +290,17 @@
int argc = 0;
char *argv[4] = { 0 };
int n;
- char string_arg[3][256] = {{0}};
+ char string_arg[3][256] = { {0} };
switch (rr->dnsrr_typ) {
- case DNS_T_NAPTR:/* prio weight port targetDN */
+ case DNS_T_NAPTR: /* prio weight port targetDN */
c = dptr;
- c += 4; /* order, pref */
+ c += 4; /* order, pref */
for (n = 0; n < 3; ++n) {
if (c >= dend) {
goto xperr;
- } else {
+ } else {
c += *c + 1;
}
}
@@ -310,18 +310,18 @@
}
c = dptr;
- order = dns_get16(c+0);
- preference = dns_get16(c+2);
+ order = dns_get16(c + 0);
+ preference = dns_get16(c + 2);
flags = (char) dns_get16(c + 4);
c += 4;
- for(n = 0; n < 3; n++) {
+ for (n = 0; n < 3; n++) {
uint32_t len = *c++, cpylen = len;
switch_assert(string_arg[n]);
if (len > sizeof(string_arg[n]) - 1) {
cpylen = sizeof(string_arg[n]) - 1;
}
- strncpy(string_arg[n], (char *)c, cpylen);
+ strncpy(string_arg[n], (char *) c, cpylen);
*(string_arg[n] + len) = '\0';
c += len;
}
@@ -360,7 +360,7 @@
}
switch_mutex_lock(MUTEX);
- for(route = globals.route_order; route; route = route->next) {
+ for (route = globals.route_order; route; route = route->next) {
if (strcasecmp(service, route->service)) {
continue;
}
@@ -380,9 +380,9 @@
if (!supported) {
add_result(q, order, preference, service, uri, 0);
}
- }
+ }
switch_mutex_unlock(MUTEX);
-
+
switch_regex_safe_free(re);
}
@@ -395,7 +395,7 @@
return;
- xperr:
+ xperr:
//printf("<parse error>\n");
return;
}
@@ -455,7 +455,7 @@
}
-static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** results)
+static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results)
{
switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
char *name = NULL;
@@ -470,7 +470,7 @@
char *num, *mnum = NULL, *mroot = NULL, *p;
mnum = switch_mprintf("%s%s", *in == '+' ? "" : "+", in);
-
+
if ((p = strchr(mnum, '*'))) {
*p++ = '\0';
mroot = switch_mprintf("%s.%s", p, root ? root : globals.isn_root);
@@ -594,15 +594,15 @@
}
switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
-
+
for (rp = results; rp; rp = rp->next) {
if (!rp->supported) {
continue;
}
- switch_caller_extension_add_application(session, extension, "bridge", rp->route);
+ switch_caller_extension_add_application(session, extension, "bridge", rp->route);
}
-
+
free_results(&results);
}
@@ -651,7 +651,7 @@
continue;
}
switch_snprintf(vbuf, sizeof(vbuf), "enum_route_%d", cnt++);
- switch_channel_set_variable(channel, vbuf, rp->route);
+ switch_channel_set_variable(channel, vbuf, rp->route);
if (rp->preference == last_pref && rp->order == last_order) {
*last_delim = ',';
}
@@ -663,7 +663,7 @@
rbp += l;
rbl -= l;
}
-
+
switch_snprintf(vbuf, sizeof(vbuf), "%d", cnt);
switch_channel_set_variable(channel, "enum_route_count", vbuf);
*(rbuf + strlen(rbuf) - 1) = '\0';
@@ -688,7 +688,7 @@
int last_order = -1, last_pref = -2;
char *last_delim = "|";
int ok = 0;
-
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "%s", "none");
return SWITCH_STATUS_SUCCESS;
@@ -716,7 +716,7 @@
l = strlen(rp->route) + 1;
rbp += l;
rbl -= l;
-
+
}
*(rbuf + strlen(rbuf) - 1) = '\0';
stream->write_function(stream, "%s", rbuf);
@@ -745,7 +745,7 @@
memset(&globals, 0, sizeof(globals));
switch_core_new_memory_pool(&globals.pool);
globals.timeout = 10;
- load_config();
+ load_config();
switch_mutex_unlock(MUTEX);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ENUM Reloaded\n");
@@ -779,7 +779,7 @@
if (!strcasecmp(dest, "reload")) {
do_load();
stream->write_function(stream, "+OK ENUM Reloaded.\n");
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
@@ -846,10 +846,11 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
SWITCH_ADD_API(api_interface, "enum_auto", "ENUM", enum_api, "");
- SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "[reload | <number> [<root>]]", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "enum", "Perform an ENUM lookup", "Perform an ENUM lookup", enum_app_function, "[reload | <number> [<root>]]",
+ SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_DIALPLAN(dp_interface, "enum", enum_dialplan_hunt);
-
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c Tue May 27 07:24:06 2008
@@ -63,7 +63,7 @@
switch_status_t status;
switch_size_t bytes;
ls_control_packet_t control_packet;
- switch_codec_t codec = { 0}, *read_codec, *orig_codec = NULL;
+ switch_codec_t codec = { 0 }, *read_codec, *orig_codec = NULL;
uint32_t flags = 0;
const char *err;
switch_rtp_t *rtp_session = NULL;
@@ -71,7 +71,7 @@
char guess_ip[25];
ls_how_t ready = SEND_TYPE_UNKNOWN;
int argc;
- char *mydata, *argv[5];
+ char *mydata, *argv[5];
char *mcast_ip = "224.168.168.168";
switch_port_t mcast_port = 34567;
switch_port_t mcast_control_port = 6061;
@@ -84,7 +84,7 @@
assert(mydata != NULL);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-
+
if ((var = switch_channel_get_variable(channel, "esf_multicast_ip"))) {
mcast_ip = switch_core_session_strdup(session, var);
}
@@ -95,23 +95,23 @@
if (!switch_strlen_zero(argv[1])) {
mcast_port_str = argv[1];
- mcast_port = (switch_port_t)atoi(mcast_port_str);
+ mcast_port = (switch_port_t) atoi(mcast_port_str);
}
if (!switch_strlen_zero(argv[2])) {
- mcast_control_port = (switch_port_t)atoi(argv[2]);
+ mcast_control_port = (switch_port_t) atoi(argv[2]);
}
}
-
+
if (switch_true(switch_channel_get_variable(channel, SWITCH_BYPASS_MEDIA_VARIABLE))) {
switch_core_session_message_t msg = { 0 };
ready = SEND_TYPE_NOMEDIA;
-
+
switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, mcast_ip);
switch_channel_set_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, mcast_port_str);
-
+
/* special answer with the mcast addr */
msg.from = __FILE__;
msg.string_arg = "recvonly";
@@ -119,7 +119,7 @@
switch_core_session_receive_message(session, &msg);
} else {
switch_channel_answer(channel);
- }
+ }
read_codec = switch_core_session_get_read_codec(session);
@@ -128,14 +128,14 @@
goto fail;
}
- if (switch_sockaddr_info_get(&control_packet_addr, mcast_ip, SWITCH_UNSPEC,
+ if (switch_sockaddr_info_get(&control_packet_addr, mcast_ip, SWITCH_UNSPEC,
mcast_control_port, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error 3\n");
goto fail;
}
- while(!ready) {
+ while (!ready) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (read_frame && switch_test_flag(read_frame, SFF_CNG)) {
continue;
@@ -144,7 +144,7 @@
if (!SWITCH_READ_ACCEPTABLE(status) || !read_frame) {
goto fail;
}
-
+
if (read_frame->packet && read_frame->packetlen && read_codec->implementation->ianacode == 0) {
ready = SEND_TYPE_RAW;
} else {
@@ -153,23 +153,23 @@
}
if (ready == SEND_TYPE_RTP) {
- if (read_codec->implementation->ianacode != 0) {
- if (switch_core_codec_init(&codec,
- "PCMU",
- NULL,
- 8000,
- 20,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
- NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
- orig_codec = read_codec;
- read_codec = &codec;
- switch_core_session_set_read_codec(session, read_codec);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Activation Success\n");
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Activation Fail\n");
- goto fail;
- }
- }
+ if (read_codec->implementation->ianacode != 0) {
+ if (switch_core_codec_init(&codec,
+ "PCMU",
+ NULL,
+ 8000,
+ 20,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ orig_codec = read_codec;
+ read_codec = &codec;
+ switch_core_session_set_read_codec(session, read_codec);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Codec Activation Success\n");
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Codec Activation Fail\n");
+ goto fail;
+ }
+ }
if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) {
esf_broadcast_ip = switch_core_session_strdup(session, var);
@@ -191,9 +191,8 @@
read_codec->implementation->ianacode,
read_codec->implementation->samples_per_frame,
read_codec->implementation->microseconds_per_frame,
- (switch_rtp_flag_t) flags,
- "soft", &err, switch_core_session_get_pool(session));
-
+ (switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
+
if (!switch_rtp_ready(rtp_session)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Error\n");
goto fail;
@@ -207,23 +206,23 @@
}
}
- control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
+ control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
control_packet.command = htonl(LS_START_BCAST);
control_packet.ip = inet_addr(mcast_ip);
control_packet.port = htonl(mcast_port);
bytes = 16;
- switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+ switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
bytes = 16;
- switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+ switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
- for(;;) {
+ for (;;) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
- break;
- }
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
@@ -235,23 +234,23 @@
}
}
- control_packet.unique_id = htonl((u_long)switch_timestamp(NULL));
+ control_packet.unique_id = htonl((u_long) switch_timestamp(NULL));
control_packet.command = htonl(LS_STOP_BCAST);
bytes = 8;
- switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+ switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
bytes = 8;
- switch_socket_sendto(socket, control_packet_addr, 0, (void *)&control_packet, &bytes);
+ switch_socket_sendto(socket, control_packet_addr, 0, (void *) &control_packet, &bytes);
- fail:
+ fail:
- if (orig_codec) {
- switch_core_session_set_read_codec(session, orig_codec);
- switch_core_codec_destroy(&codec);
- }
+ if (orig_codec) {
+ switch_core_session_set_read_codec(session, orig_codec);
+ switch_core_codec_destroy(&codec);
+ }
if (rtp_session && ready == SEND_TYPE_RTP && switch_rtp_ready(rtp_session)) {
switch_rtp_destroy(&rtp_session);
- }
+ }
if (socket) {
switch_socket_close(socket);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/expreval.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/expreval.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/expreval.c Tue May 27 07:24:06 2008
@@ -25,244 +25,224 @@
/* This routine will evaluate an expression */
-int exprEval(exprObj *obj, EXPRTYPE *val)
- {
- EXPRTYPE dummy;
-
- if(val == NULL)
- val = &dummy;
-
- /* Make sure it was parsed successfully */
- if(!obj->parsedbad && obj->parsedgood && obj->headnode)
- {
- /* Do NOT reset the break count. Let is accumulate
- between calls until breaker function is called */
- return exprEvalNode(obj, obj->headnode, 0, val);
- }
- else
- return EXPR_ERROR_BADEXPR;
- }
+int exprEval(exprObj * obj, EXPRTYPE * val)
+{
+ EXPRTYPE dummy;
+
+ if (val == NULL)
+ val = &dummy;
+
+ /* Make sure it was parsed successfully */
+ if (!obj->parsedbad && obj->parsedgood && obj->headnode) {
+ /* Do NOT reset the break count. Let is accumulate
+ between calls until breaker function is called */
+ return exprEvalNode(obj, obj->headnode, 0, val);
+ } else
+ return EXPR_ERROR_BADEXPR;
+}
/* Evaluate a node */
-int exprEvalNode(exprObj *obj, exprNode *nodes, int curnode, EXPRTYPE *val)
- {
- int err;
- int pos;
- EXPRTYPE d1, d2;
-
- if(obj == NULL || nodes == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Update n to point to correct node */
- nodes += curnode;
-
- /* Check breaker count */
- if(obj->breakcur-- <= 0)
- {
- /* Reset count before returning */
- obj->breakcur = obj->breakcount;
-
- if(exprGetBreakResult(obj))
- {
- return EXPR_ERROR_BREAK;
- }
- }
-
- switch(nodes->type)
- {
- case EXPR_NODETYPE_MULTI:
- {
- /* Multi for multiple expressions in one string */
- for(pos = 0; pos < nodes->data.oper.nodecount; pos++)
- {
- err = exprEvalNode(obj, nodes->data.oper.nodes, pos, val);
- if(err)
- return err;
- }
- break;
- }
-
- case EXPR_NODETYPE_ADD:
- {
- /* Addition */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
- if(!err)
- *val = d1 + d2;
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_SUBTRACT:
- {
- /* Subtraction */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
- if(!err)
- *val = d1 - d2;
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_MULTIPLY:
- {
- /* Multiplication */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
- if(!err)
- *val = d1 * d2;
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_DIVIDE:
- {
- /* Division */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
- if(!err)
- {
- if(d2 != 0.0)
- *val = d1 / d2;
- else
- {
+int exprEvalNode(exprObj * obj, exprNode * nodes, int curnode, EXPRTYPE * val)
+{
+ int err;
+ int pos;
+ EXPRTYPE d1, d2;
+
+ if (obj == NULL || nodes == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Update n to point to correct node */
+ nodes += curnode;
+
+ /* Check breaker count */
+ if (obj->breakcur-- <= 0) {
+ /* Reset count before returning */
+ obj->breakcur = obj->breakcount;
+
+ if (exprGetBreakResult(obj)) {
+ return EXPR_ERROR_BREAK;
+ }
+ }
+
+ switch (nodes->type) {
+ case EXPR_NODETYPE_MULTI:
+ {
+ /* Multi for multiple expressions in one string */
+ for (pos = 0; pos < nodes->data.oper.nodecount; pos++) {
+ err = exprEvalNode(obj, nodes->data.oper.nodes, pos, val);
+ if (err)
+ return err;
+ }
+ break;
+ }
+
+ case EXPR_NODETYPE_ADD:
+ {
+ /* Addition */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+ if (!err)
+ *val = d1 + d2;
+ else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_SUBTRACT:
+ {
+ /* Subtraction */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+ if (!err)
+ *val = d1 - d2;
+ else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_MULTIPLY:
+ {
+ /* Multiplication */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+ if (!err)
+ *val = d1 * d2;
+ else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_DIVIDE:
+ {
+ /* Division */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+ if (!err) {
+ if (d2 != 0.0)
+ *val = d1 / d2;
+ else {
#if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
- return EXPR_ERROR_DIVBYZERO;
+ return EXPR_ERROR_DIVBYZERO;
#else
- *val = 0.0;
- return EXPR_ERROR_NOERROR;
+ *val = 0.0;
+ return EXPR_ERROR_NOERROR;
#endif
- }
- }
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_EXPONENT:
- {
- /* Exponent */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
-
- if(!err)
- {
- EXPR_RESET_ERR();
- *val = pow(d1, d2);
- EXPR_CHECK_ERR();
- }
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_NEGATE:
- {
- /* Negative value */
- err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
-
- if(!err)
- *val = -d1;
- else
- return err;
-
- break;
- }
-
-
- case EXPR_NODETYPE_VALUE:
- {
- /* Directly access the value */
- *val = nodes->data.value.value;
- break;
- }
-
- case EXPR_NODETYPE_VARIABLE:
- {
- /* Directly access the variable or constant */
- *val = *(nodes->data.variable.vaddr);
- break;
- }
-
- case EXPR_NODETYPE_ASSIGN:
- {
- /* Evaluate assignment subnode */
- err = exprEvalNode(obj, nodes->data.assign.node, 0, val);
-
- if(!err)
- {
- /* Directly assign the variable */
- *(nodes->data.assign.vaddr) = *val;
- }
- else
- return err;
-
- break;
- }
-
- case EXPR_NODETYPE_FUNCTION:
- {
- /* Evaluate the function */
- if(nodes->data.function.fptr == NULL)
- {
- /* No function pointer means we are not using
- function solvers. See if the function has a
- type to solve directly. */
- switch(nodes->data.function.type)
- {
- /* This is to keep the file from being too crowded.
- See exprilfs.h for the definitions. */
+ }
+ } else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_EXPONENT:
+ {
+ /* Exponent */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 1, &d2);
+
+ if (!err) {
+ EXPR_RESET_ERR();
+ *val = pow(d1, d2);
+ EXPR_CHECK_ERR();
+ } else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_NEGATE:
+ {
+ /* Negative value */
+ err = exprEvalNode(obj, nodes->data.oper.nodes, 0, &d1);
+
+ if (!err)
+ *val = -d1;
+ else
+ return err;
+
+ break;
+ }
+
+
+ case EXPR_NODETYPE_VALUE:
+ {
+ /* Directly access the value */
+ *val = nodes->data.value.value;
+ break;
+ }
+
+ case EXPR_NODETYPE_VARIABLE:
+ {
+ /* Directly access the variable or constant */
+ *val = *(nodes->data.variable.vaddr);
+ break;
+ }
+
+ case EXPR_NODETYPE_ASSIGN:
+ {
+ /* Evaluate assignment subnode */
+ err = exprEvalNode(obj, nodes->data.assign.node, 0, val);
+
+ if (!err) {
+ /* Directly assign the variable */
+ *(nodes->data.assign.vaddr) = *val;
+ } else
+ return err;
+
+ break;
+ }
+
+ case EXPR_NODETYPE_FUNCTION:
+ {
+ /* Evaluate the function */
+ if (nodes->data.function.fptr == NULL) {
+ /* No function pointer means we are not using
+ function solvers. See if the function has a
+ type to solve directly. */
+ switch (nodes->data.function.type) {
+ /* This is to keep the file from being too crowded.
+ See exprilfs.h for the definitions. */
#include "exprilfs.h"
-
-
- default:
- {
- return EXPR_ERROR_UNKNOWN;
- }
- }
- }
- else
- {
- /* Call the correct function */
- return (*(nodes->data.function.fptr))(obj,
- nodes->data.function.nodes, nodes->data.function.nodecount,
- nodes->data.function.refs, nodes->data.function.refcount, val);
- }
-
- break;
- }
-
- default:
- {
- /* Unknown node type */
- return EXPR_ERROR_UNKNOWN;
- }
- }
-
- return EXPR_ERROR_NOERROR;
- }
+ default:
+ {
+ return EXPR_ERROR_UNKNOWN;
+ }
+ }
+ } else {
+ /* Call the correct function */
+ return (*(nodes->data.function.fptr)) (obj,
+ nodes->data.function.nodes, nodes->data.function.nodecount,
+ nodes->data.function.refs, nodes->data.function.refcount, val);
+ }
+
+ break;
+ }
+
+ default:
+ {
+ /* Unknown node type */
+ return EXPR_ERROR_UNKNOWN;
+ }
+ }
+ return EXPR_ERROR_NOERROR;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprfunc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprfunc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprfunc.c Tue May 27 07:24:06 2008
@@ -17,313 +17,296 @@
/* Internal functions */
static exprFunc *exprCreateFunc(char *name, exprFuncType ptr, int type, int min, int max, int refmin, int refmax);
-static void exprFuncListFreeData(exprFunc *func);
+static void exprFuncListFreeData(exprFunc * func);
/* This function creates the function list, */
-int exprFuncListCreate(exprFuncList **flist)
- {
- exprFuncList *tmp;
+int exprFuncListCreate(exprFuncList ** flist)
+{
+ exprFuncList *tmp;
- if(flist == NULL)
- return EXPR_ERROR_NULLPOINTER;
+ if (flist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
- *flist = NULL; /* Set to NULL initially */
+ *flist = NULL; /* Set to NULL initially */
- tmp = exprAllocMem(sizeof(exprFuncList));
+ tmp = exprAllocMem(sizeof(exprFuncList));
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY; /* Could not allocate memory */
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY; /* Could not allocate memory */
- /* Update pointer */
- *flist = tmp;
+ /* Update pointer */
+ *flist = tmp;
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Add a function to the list */
-int exprFuncListAdd(exprFuncList *flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax)
- {
- exprFunc *tmp;
- exprFunc *cur;
- int result;
-
- if(flist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Make sure the name is valid */
- if(!exprValidIdent(name))
- return EXPR_ERROR_BADIDENTIFIER;
-
- /* Fix values only if none are negative (negative values mean no limit) */
-
- /* if both are neg, no min or max number of args */
- /* if min is neg, max pos, no min number of args but a maximum */
- /* if min is pos, max neg, there is a min number of args, but no max */
- /* if both pos, then a min and max limit. We swap to make sure it works
- right. I.E. Min of 3 and max of 2 would make function unusable */
- if(min >= 0 && max >= 0)
- {
- if(min > max)
- {
- result = min;
- min = max;
- max = result;
- }
- }
-
- if(refmin >= 0 && refmax >= 0)
- {
- if(refmin > refmax)
- {
- result = refmin;
- refmin = max;
- refmax = result;
- }
- }
-
- if(flist->head == NULL)
- {
- /* Create the node right here */
- tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- flist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
-
- /* See if it already exists */
- cur = flist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->fname);
-
- if(result == 0)
- return EXPR_ERROR_ALREADYEXISTS;
-
- cur = cur->next;
- }
-
- /* It did not exist, so add it at the head */
- tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- tmp->next = flist->head;
- flist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
+int exprFuncListAdd(exprFuncList * flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax)
+{
+ exprFunc *tmp;
+ exprFunc *cur;
+ int result;
+
+ if (flist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Make sure the name is valid */
+ if (!exprValidIdent(name))
+ return EXPR_ERROR_BADIDENTIFIER;
+
+ /* Fix values only if none are negative (negative values mean no limit) */
+
+ /* if both are neg, no min or max number of args */
+ /* if min is neg, max pos, no min number of args but a maximum */
+ /* if min is pos, max neg, there is a min number of args, but no max */
+ /* if both pos, then a min and max limit. We swap to make sure it works
+ right. I.E. Min of 3 and max of 2 would make function unusable */
+ if (min >= 0 && max >= 0) {
+ if (min > max) {
+ result = min;
+ min = max;
+ max = result;
+ }
+ }
+
+ if (refmin >= 0 && refmax >= 0) {
+ if (refmin > refmax) {
+ result = refmin;
+ refmin = max;
+ refmax = result;
+ }
+ }
+
+ if (flist->head == NULL) {
+ /* Create the node right here */
+ tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ flist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+ }
+
+ /* See if it already exists */
+ cur = flist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->fname);
+
+ if (result == 0)
+ return EXPR_ERROR_ALREADYEXISTS;
+
+ cur = cur->next;
+ }
+
+ /* It did not exist, so add it at the head */
+ tmp = exprCreateFunc(name, ptr, EXPR_NODETYPE_FUNCTION, min, max, refmin, refmax);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ tmp->next = flist->head;
+ flist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+}
/* Add a function node type to the list
This works pretty much the same way, except the function
pointer is NULL and the node type specifies the function
to do. exprEvalNode handles this, instead of calling
a function solver. */
-int exprFuncListAddType(exprFuncList *flist, char *name, int type, int min, int max, int refmin, int refmax)
- {
- exprFunc *tmp;
- exprFunc *cur;
- int result;
-
- if(flist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Make sure the name is valid */
- if(!exprValidIdent(name))
- return EXPR_ERROR_BADIDENTIFIER;
-
- /* Fix values only if none are negative (negative values mean no limit) */
-
- /* if both are neg, no min or max number of args */
- /* if min is neg, max pos, no min number of args but a maximum */
- /* if min is pos, max neg, there is a min number of args, but no max */
- /* if both pos, then a min and max limit. We swap to make sure it works
- right. I.E. Min of 3 and max of 2 would make function unusable */
- if(min >= 0 && max >= 0)
- {
- if(min > max)
- {
- result = min;
- min = max;
- max = result;
- }
- }
-
- if(refmin >= 0 && refmax >= 0)
- {
- if(refmin > refmax)
- {
- result = refmin;
- refmin = max;
- refmax = result;
- }
- }
-
- if(flist->head == NULL)
- {
- /* Create the node right here */
- tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- flist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
-
- /* See if it already exists */
- cur = flist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->fname);
-
- if(result == 0)
- return EXPR_ERROR_ALREADYEXISTS;
-
- cur = cur->next;
- }
-
- /* It did not exist, so add it at the head */
- tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- tmp->next = flist->head;
- flist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
+int exprFuncListAddType(exprFuncList * flist, char *name, int type, int min, int max, int refmin, int refmax)
+{
+ exprFunc *tmp;
+ exprFunc *cur;
+ int result;
+
+ if (flist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Make sure the name is valid */
+ if (!exprValidIdent(name))
+ return EXPR_ERROR_BADIDENTIFIER;
+
+ /* Fix values only if none are negative (negative values mean no limit) */
+
+ /* if both are neg, no min or max number of args */
+ /* if min is neg, max pos, no min number of args but a maximum */
+ /* if min is pos, max neg, there is a min number of args, but no max */
+ /* if both pos, then a min and max limit. We swap to make sure it works
+ right. I.E. Min of 3 and max of 2 would make function unusable */
+ if (min >= 0 && max >= 0) {
+ if (min > max) {
+ result = min;
+ min = max;
+ max = result;
+ }
+ }
+
+ if (refmin >= 0 && refmax >= 0) {
+ if (refmin > refmax) {
+ result = refmin;
+ refmin = max;
+ refmax = result;
+ }
+ }
+
+ if (flist->head == NULL) {
+ /* Create the node right here */
+ tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ flist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+ }
+
+ /* See if it already exists */
+ cur = flist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->fname);
+
+ if (result == 0)
+ return EXPR_ERROR_ALREADYEXISTS;
+
+ cur = cur->next;
+ }
+
+ /* It did not exist, so add it at the head */
+ tmp = exprCreateFunc(name, NULL, type, min, max, refmin, refmax);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ tmp->next = flist->head;
+ flist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+}
/* Get the function from a list along with it's min an max data */
-int exprFuncListGet(exprFuncList *flist, char *name, exprFuncType *ptr, int *type, int *min, int *max, int *refmin, int *refmax)
- {
- exprFunc *cur;
- int result;
-
- if(flist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- if(name == NULL || name[0] == '\0')
- return EXPR_ERROR_NOTFOUND;
-
- /* Search for the item */
- cur = flist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->fname);
-
- if(result == 0)
- {
- /* We found it. */
- *ptr = cur->fptr;
- *min = cur->min;
- *max = cur->max;
- *refmin = cur->refmin;
- *refmax = cur->refmax;
- *type = cur->type;
-
- /* return now */
- return EXPR_ERROR_NOERROR;
- }
-
- cur = cur->next;
- }
-
- /* If we got here, we did not find the item in the list */
- return EXPR_ERROR_NOTFOUND;
- }
+int exprFuncListGet(exprFuncList * flist, char *name, exprFuncType * ptr, int *type, int *min, int *max, int *refmin, int *refmax)
+{
+ exprFunc *cur;
+ int result;
+
+ if (flist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ if (name == NULL || name[0] == '\0')
+ return EXPR_ERROR_NOTFOUND;
+
+ /* Search for the item */
+ cur = flist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->fname);
+
+ if (result == 0) {
+ /* We found it. */
+ *ptr = cur->fptr;
+ *min = cur->min;
+ *max = cur->max;
+ *refmin = cur->refmin;
+ *refmax = cur->refmax;
+ *type = cur->type;
+
+ /* return now */
+ return EXPR_ERROR_NOERROR;
+ }
+
+ cur = cur->next;
+ }
+
+ /* If we got here, we did not find the item in the list */
+ return EXPR_ERROR_NOTFOUND;
+}
/* This routine will free the function list */
-int exprFuncListFree(exprFuncList *flist)
- {
- /* Make sure it exists, if not it is not error */
- if(flist == NULL)
- return EXPR_ERROR_NOERROR;
+int exprFuncListFree(exprFuncList * flist)
+{
+ /* Make sure it exists, if not it is not error */
+ if (flist == NULL)
+ return EXPR_ERROR_NOERROR;
- /* Free the nodes */
- exprFuncListFreeData(flist->head);
+ /* Free the nodes */
+ exprFuncListFreeData(flist->head);
- /* Free the container */
- exprFreeMem(flist);
+ /* Free the container */
+ exprFreeMem(flist);
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* This routine will clear the function list */
-int exprFuncListClear(exprFuncList *flist)
- {
- if(flist == NULL)
- return EXPR_ERROR_NOERROR;
-
- /* Free the nodes only */
- if(flist->head)
- {
- exprFuncListFreeData(flist->head);
+int exprFuncListClear(exprFuncList * flist)
+{
+ if (flist == NULL)
+ return EXPR_ERROR_NOERROR;
+
+ /* Free the nodes only */
+ if (flist->head) {
+ exprFuncListFreeData(flist->head);
- flist->head = NULL;
- }
+ flist->head = NULL;
+ }
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* This routine will free any child nodes, and then free itself */
-void exprFuncListFreeData(exprFunc *func)
- {
- exprFunc *next;
-
- while(func)
- {
- /* Remember the next item */
- next = func->next;
-
- /* Free name */
- exprFreeMem(func->fname);
-
- /* Free ourself */
- exprFreeMem(func);
-
- func = next;
- }
- }
+void exprFuncListFreeData(exprFunc * func)
+{
+ exprFunc *next;
+
+ while (func) {
+ /* Remember the next item */
+ next = func->next;
+
+ /* Free name */
+ exprFreeMem(func->fname);
+
+ /* Free ourself */
+ exprFreeMem(func);
+
+ func = next;
+ }
+}
/* This routine will create the function object */
exprFunc *exprCreateFunc(char *name, exprFuncType ptr, int type, int min, int max, int refmin, int refmax)
- {
- exprFunc *tmp;
- char *vtmp;
-
- /* We already checked the name in exprFuncListAdd */
-
- /* Create it */
- tmp = exprAllocMem(sizeof(exprFunc));
- if(tmp == NULL)
- return NULL;
-
- /* Allocate space for the name */
- vtmp = exprAllocMem(strlen(name) + 1);
-
- if(vtmp == NULL)
- {
- exprFreeMem(tmp);
- return NULL;
- }
-
- /* Copy the data over */
- strcpy(vtmp, name);
- tmp->fname = vtmp;
- tmp->fptr = ptr;
- tmp->min = min;
- tmp->max = max;
- tmp->refmin = refmin;
- tmp->refmax = refmax;
- tmp->type = type;
+{
+ exprFunc *tmp;
+ char *vtmp;
+
+ /* We already checked the name in exprFuncListAdd */
+
+ /* Create it */
+ tmp = exprAllocMem(sizeof(exprFunc));
+ if (tmp == NULL)
+ return NULL;
+
+ /* Allocate space for the name */
+ vtmp = exprAllocMem(strlen(name) + 1);
+
+ if (vtmp == NULL) {
+ exprFreeMem(tmp);
+ return NULL;
+ }
+
+ /* Copy the data over */
+ strcpy(vtmp, name);
+ tmp->fname = vtmp;
+ tmp->fptr = ptr;
+ tmp->min = min;
+ tmp->max = max;
+ tmp->refmin = refmin;
+ tmp->refmax = refmax;
+ tmp->type = type;
- return tmp;
- }
+ return tmp;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprinit.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprinit.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprinit.c Tue May 27 07:24:06 2008
@@ -26,90 +26,88 @@
return err;
/* Call this function to initialize these functions into a function list */
-int exprFuncListInit(exprFuncList *flist)
- {
- int err;
-
- if(flist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- EXPR_ADDFUNC_TYPE("abs", EXPR_NODEFUNC_ABS, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("mod", EXPR_NODEFUNC_MOD, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("ipart", EXPR_NODEFUNC_IPART, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("fpart", EXPR_NODEFUNC_FPART, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("min", EXPR_NODEFUNC_MIN, 1, -1, 0, 0);
- EXPR_ADDFUNC_TYPE("max", EXPR_NODEFUNC_MAX, 1, -1, 0, 0);
- EXPR_ADDFUNC_TYPE("pow", EXPR_NODEFUNC_POW, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("sqrt", EXPR_NODEFUNC_SQRT, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("sin", EXPR_NODEFUNC_SIN, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("sinh", EXPR_NODEFUNC_SINH, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("asin", EXPR_NODEFUNC_ASIN, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("cos", EXPR_NODEFUNC_COS, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("cosh", EXPR_NODEFUNC_COSH, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("acos", EXPR_NODEFUNC_ACOS, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("tan", EXPR_NODEFUNC_TAN, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("tanh", EXPR_NODEFUNC_TANH, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("atan", EXPR_NODEFUNC_ATAN, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("atan2", EXPR_NODEFUNC_ATAN2, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("log", EXPR_NODEFUNC_LOG, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("pow10", EXPR_NODEFUNC_POW10, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("ln", EXPR_NODEFUNC_LN, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("exp", EXPR_NODEFUNC_EXP, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("logn", EXPR_NODEFUNC_LOGN, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("ceil", EXPR_NODEFUNC_CEIL, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("floor", EXPR_NODEFUNC_FLOOR, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("rand", EXPR_NODEFUNC_RAND, 0, 0, 1, 1);
- EXPR_ADDFUNC_TYPE("random", EXPR_NODEFUNC_RANDOM, 2, 2, 1, 1);
- EXPR_ADDFUNC_TYPE("randomize", EXPR_NODEFUNC_RANDOMIZE, 0, 0, 1, 1);
- EXPR_ADDFUNC_TYPE("deg", EXPR_NODEFUNC_DEG, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("rad", EXPR_NODEFUNC_RAD, 1, 1, 0, 0);
- EXPR_ADDFUNC_TYPE("recttopolr", EXPR_NODEFUNC_RECTTOPOLR, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("recttopola", EXPR_NODEFUNC_RECTTOPOLA, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("poltorectx", EXPR_NODEFUNC_POLTORECTX, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("poltorecty", EXPR_NODEFUNC_POLTORECTY, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("if", EXPR_NODEFUNC_IF, 3, 3, 0, 0);
- EXPR_ADDFUNC_TYPE("select", EXPR_NODEFUNC_SELECT, 3, 4, 0, 0);
- EXPR_ADDFUNC_TYPE("equal", EXPR_NODEFUNC_EQUAL, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("above", EXPR_NODEFUNC_ABOVE, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("below", EXPR_NODEFUNC_BELOW, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("avg", EXPR_NODEFUNC_AVG, 1, -1, 0, 0);
- EXPR_ADDFUNC_TYPE("clip", EXPR_NODEFUNC_CLIP, 3, 3, 0, 0);
- EXPR_ADDFUNC_TYPE("clamp", EXPR_NODEFUNC_CLAMP, 3, 3, 0, 0);
- EXPR_ADDFUNC_TYPE("pntchange", EXPR_NODEFUNC_PNTCHANGE, 5, 5, 0, 0);
- EXPR_ADDFUNC_TYPE("poly", EXPR_NODEFUNC_POLY, 2, -1, 0, 0);
- EXPR_ADDFUNC_TYPE("and", EXPR_NODEFUNC_AND, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("or", EXPR_NODEFUNC_OR, 2, 2, 0, 0);
- EXPR_ADDFUNC_TYPE("not", EXPR_NODEFUNC_NOT, 1 ,1, 0, 0);
- EXPR_ADDFUNC_TYPE("for", EXPR_NODEFUNC_FOR, 4, -1, 0, 0);
- EXPR_ADDFUNC_TYPE("many", EXPR_NODEFUNC_MANY, 1, -1, 0, 0);
+int exprFuncListInit(exprFuncList * flist)
+{
+ int err;
+
+ if (flist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ EXPR_ADDFUNC_TYPE("abs", EXPR_NODEFUNC_ABS, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("mod", EXPR_NODEFUNC_MOD, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("ipart", EXPR_NODEFUNC_IPART, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("fpart", EXPR_NODEFUNC_FPART, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("min", EXPR_NODEFUNC_MIN, 1, -1, 0, 0);
+ EXPR_ADDFUNC_TYPE("max", EXPR_NODEFUNC_MAX, 1, -1, 0, 0);
+ EXPR_ADDFUNC_TYPE("pow", EXPR_NODEFUNC_POW, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("sqrt", EXPR_NODEFUNC_SQRT, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("sin", EXPR_NODEFUNC_SIN, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("sinh", EXPR_NODEFUNC_SINH, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("asin", EXPR_NODEFUNC_ASIN, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("cos", EXPR_NODEFUNC_COS, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("cosh", EXPR_NODEFUNC_COSH, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("acos", EXPR_NODEFUNC_ACOS, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("tan", EXPR_NODEFUNC_TAN, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("tanh", EXPR_NODEFUNC_TANH, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("atan", EXPR_NODEFUNC_ATAN, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("atan2", EXPR_NODEFUNC_ATAN2, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("log", EXPR_NODEFUNC_LOG, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("pow10", EXPR_NODEFUNC_POW10, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("ln", EXPR_NODEFUNC_LN, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("exp", EXPR_NODEFUNC_EXP, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("logn", EXPR_NODEFUNC_LOGN, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("ceil", EXPR_NODEFUNC_CEIL, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("floor", EXPR_NODEFUNC_FLOOR, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("rand", EXPR_NODEFUNC_RAND, 0, 0, 1, 1);
+ EXPR_ADDFUNC_TYPE("random", EXPR_NODEFUNC_RANDOM, 2, 2, 1, 1);
+ EXPR_ADDFUNC_TYPE("randomize", EXPR_NODEFUNC_RANDOMIZE, 0, 0, 1, 1);
+ EXPR_ADDFUNC_TYPE("deg", EXPR_NODEFUNC_DEG, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("rad", EXPR_NODEFUNC_RAD, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("recttopolr", EXPR_NODEFUNC_RECTTOPOLR, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("recttopola", EXPR_NODEFUNC_RECTTOPOLA, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("poltorectx", EXPR_NODEFUNC_POLTORECTX, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("poltorecty", EXPR_NODEFUNC_POLTORECTY, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("if", EXPR_NODEFUNC_IF, 3, 3, 0, 0);
+ EXPR_ADDFUNC_TYPE("select", EXPR_NODEFUNC_SELECT, 3, 4, 0, 0);
+ EXPR_ADDFUNC_TYPE("equal", EXPR_NODEFUNC_EQUAL, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("above", EXPR_NODEFUNC_ABOVE, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("below", EXPR_NODEFUNC_BELOW, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("avg", EXPR_NODEFUNC_AVG, 1, -1, 0, 0);
+ EXPR_ADDFUNC_TYPE("clip", EXPR_NODEFUNC_CLIP, 3, 3, 0, 0);
+ EXPR_ADDFUNC_TYPE("clamp", EXPR_NODEFUNC_CLAMP, 3, 3, 0, 0);
+ EXPR_ADDFUNC_TYPE("pntchange", EXPR_NODEFUNC_PNTCHANGE, 5, 5, 0, 0);
+ EXPR_ADDFUNC_TYPE("poly", EXPR_NODEFUNC_POLY, 2, -1, 0, 0);
+ EXPR_ADDFUNC_TYPE("and", EXPR_NODEFUNC_AND, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("or", EXPR_NODEFUNC_OR, 2, 2, 0, 0);
+ EXPR_ADDFUNC_TYPE("not", EXPR_NODEFUNC_NOT, 1, 1, 0, 0);
+ EXPR_ADDFUNC_TYPE("for", EXPR_NODEFUNC_FOR, 4, -1, 0, 0);
+ EXPR_ADDFUNC_TYPE("many", EXPR_NODEFUNC_MANY, 1, -1, 0, 0);
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Call this function to initialize some constants into a value list */
-int exprValListInit(exprValList *vlist)
- {
- int err;
-
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- EXPR_ADDCONST("M_E", M_E);
- EXPR_ADDCONST("M_LOG2E", M_LOG2E);
- EXPR_ADDCONST("M_LOG10E", M_LOG10E);
- EXPR_ADDCONST("M_LN2", M_LN2);
- EXPR_ADDCONST("M_LN10", M_LN10);
- EXPR_ADDCONST("M_PI", M_PI);
- EXPR_ADDCONST("M_PI_2", M_PI_2);
- EXPR_ADDCONST("M_PI_4", M_PI_4);
- EXPR_ADDCONST("M_1_PI", M_1_PI);
- EXPR_ADDCONST("M_2_PI", M_2_PI);
- EXPR_ADDCONST("M_1_SQRTPI", M_1_SQRTPI);
- EXPR_ADDCONST("M_2_SQRTPI", M_2_SQRTPI);
- EXPR_ADDCONST("M_SQRT2", M_SQRT2);
- EXPR_ADDCONST("M_1_SQRT2", M_1_SQRT2);
-
- return EXPR_ERROR_NOERROR;
- }
-
+int exprValListInit(exprValList * vlist)
+{
+ int err;
+
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ EXPR_ADDCONST("M_E", M_E);
+ EXPR_ADDCONST("M_LOG2E", M_LOG2E);
+ EXPR_ADDCONST("M_LOG10E", M_LOG10E);
+ EXPR_ADDCONST("M_LN2", M_LN2);
+ EXPR_ADDCONST("M_LN10", M_LN10);
+ EXPR_ADDCONST("M_PI", M_PI);
+ EXPR_ADDCONST("M_PI_2", M_PI_2);
+ EXPR_ADDCONST("M_PI_4", M_PI_4);
+ EXPR_ADDCONST("M_1_PI", M_1_PI);
+ EXPR_ADDCONST("M_2_PI", M_2_PI);
+ EXPR_ADDCONST("M_1_SQRTPI", M_1_SQRTPI);
+ EXPR_ADDCONST("M_2_SQRTPI", M_2_SQRTPI);
+ EXPR_ADDCONST("M_SQRT2", M_SQRT2);
+ EXPR_ADDCONST("M_1_SQRT2", M_1_SQRT2);
+ return EXPR_ERROR_NOERROR;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprmem.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprmem.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprmem.c Tue May 27 07:24:06 2008
@@ -13,27 +13,26 @@
#include "exprmem.h"
/* Allocate memory and zero it */
-void* exprAllocMem(size_t size)
- {
- void *data = malloc(size);
-
- if(data)
- {
- memset(data, 0, size);
- }
-
- return data;
- }
+void *exprAllocMem(size_t size)
+{
+ void *data = malloc(size);
+
+ if (data) {
+ memset(data, 0, size);
+ }
+
+ return data;
+}
/* Free memory */
void exprFreeMem(void *data)
- {
- if(data)
- free(data);
- }
+{
+ if (data)
+ free(data);
+}
/* Allocate a list of nodes */
exprNode *exprAllocNodes(size_t count)
- {
- return exprAllocMem(count * sizeof(exprNode));
- }
+{
+ return exprAllocMem(count * sizeof(exprNode));
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprobj.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprobj.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprobj.c Tue May 27 07:24:06 2008
@@ -14,224 +14,215 @@
#include "exprmem.h"
/* Internal functions */
-static void exprFreeNodeData(exprNode *node);
+static void exprFreeNodeData(exprNode * node);
/* Function to create an expression object */
-int exprCreate(exprObj **obj, exprFuncList *flist, exprValList *vlist, exprValList *clist,
- exprBreakFuncType breaker, void *userdata)
- {
- exprObj *tmp;
-
- /* Allocate memory for the object */
- tmp = exprAllocMem(sizeof(exprObj));
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Assign data */
- tmp->flist = flist;
- tmp->vlist = vlist;
- tmp->clist = clist;
- tmp->breakerfunc = breaker;
- tmp->userdata = userdata;
- tmp->breakcount = 100000; /* Default breaker count setting */
- tmp->breakcur = 0;
+int exprCreate(exprObj ** obj, exprFuncList * flist, exprValList * vlist, exprValList * clist, exprBreakFuncType breaker, void *userdata)
+{
+ exprObj *tmp;
+
+ /* Allocate memory for the object */
+ tmp = exprAllocMem(sizeof(exprObj));
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Assign data */
+ tmp->flist = flist;
+ tmp->vlist = vlist;
+ tmp->clist = clist;
+ tmp->breakerfunc = breaker;
+ tmp->userdata = userdata;
+ tmp->breakcount = 100000; /* Default breaker count setting */
+ tmp->breakcur = 0;
- /* Update pointer */
- *obj = tmp;
+ /* Update pointer */
+ *obj = tmp;
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Free the expression */
-int exprFree(exprObj *obj)
- {
- if(obj == NULL)
- return EXPR_ERROR_NOERROR;
-
- /* First free the node data */
- exprFreeNodeData(obj->headnode);
- exprFreeMem(obj->headnode);
+int exprFree(exprObj * obj)
+{
+ if (obj == NULL)
+ return EXPR_ERROR_NOERROR;
+
+ /* First free the node data */
+ exprFreeNodeData(obj->headnode);
+ exprFreeMem(obj->headnode);
- /* Free ourself */
- exprFreeMem(obj);
+ /* Free ourself */
+ exprFreeMem(obj);
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Clear expression, keep lists, etc */
-int exprClear(exprObj *obj)
- {
- if(obj == NULL)
- return EXPR_ERROR_NOERROR;
-
- /* Free the node data only, keep function, variable, constant lists */
- exprFreeNodeData(obj->headnode);
- exprFreeMem(obj->headnode);
-
- obj->headnode = NULL;
- obj->parsedbad = 0;
- obj->parsedgood = 0;
+int exprClear(exprObj * obj)
+{
+ if (obj == NULL)
+ return EXPR_ERROR_NOERROR;
+
+ /* Free the node data only, keep function, variable, constant lists */
+ exprFreeNodeData(obj->headnode);
+ exprFreeMem(obj->headnode);
+
+ obj->headnode = NULL;
+ obj->parsedbad = 0;
+ obj->parsedgood = 0;
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Get functions to get information about the expression object */
/* Get the function list */
-exprFuncList *exprGetFuncList(exprObj *obj)
- {
- return (obj == NULL) ? NULL : obj->flist;
- }
+exprFuncList *exprGetFuncList(exprObj * obj)
+{
+ return (obj == NULL) ? NULL : obj->flist;
+}
/* Get the variable list */
-exprValList *exprGetVarList(exprObj *obj)
- {
- return (obj == NULL) ? NULL : obj->vlist;
- }
+exprValList *exprGetVarList(exprObj * obj)
+{
+ return (obj == NULL) ? NULL : obj->vlist;
+}
/* Get the constant list */
-exprValList *exprGetConstList(exprObj *obj)
- {
- return (obj == NULL) ? NULL : obj->clist;
- }
+exprValList *exprGetConstList(exprObj * obj)
+{
+ return (obj == NULL) ? NULL : obj->clist;
+}
/* Get the breaker function */
-exprBreakFuncType exprGetBreakFunc(exprObj *obj)
- {
- return (obj == NULL) ? NULL : obj->breakerfunc;
- }
+exprBreakFuncType exprGetBreakFunc(exprObj * obj)
+{
+ return (obj == NULL) ? NULL : obj->breakerfunc;
+}
/* Check for break status */
-int exprGetBreakResult(exprObj *obj)
- {
- if(obj == NULL)
- return 0;
+int exprGetBreakResult(exprObj * obj)
+{
+ if (obj == NULL)
+ return 0;
- if(obj->breakerfunc == NULL)
- return 0;
+ if (obj->breakerfunc == NULL)
+ return 0;
- return (*(obj->breakerfunc))(obj);
- }
+ return (*(obj->breakerfunc)) (obj);
+}
/* Get the user data */
-void *exprGetUserData(exprObj *obj)
- {
- return (obj == NULL) ? NULL : obj->userdata;
- }
+void *exprGetUserData(exprObj * obj)
+{
+ return (obj == NULL) ? NULL : obj->userdata;
+}
/* Set functions to set certain data */
/* Set user data */
-void exprSetUserData(exprObj *obj, void *userdata)
- {
- if(obj)
- obj->userdata = userdata;
- }
+void exprSetUserData(exprObj * obj, void *userdata)
+{
+ if (obj)
+ obj->userdata = userdata;
+}
/* Set breaker count */
-void exprSetBreakCount(exprObj *obj, int count)
- {
- if(obj)
- {
- /* If count is negative, make it positive */
- if(count < 0)
- count = -count;
-
- obj->breakcount = count;
-
- /* Make sure the current value is not bigger than count */
- if(obj->breakcur > count)
- obj->breakcur = count;
- }
- }
+void exprSetBreakCount(exprObj * obj, int count)
+{
+ if (obj) {
+ /* If count is negative, make it positive */
+ if (count < 0)
+ count = -count;
+
+ obj->breakcount = count;
+
+ /* Make sure the current value is not bigger than count */
+ if (obj->breakcur > count)
+ obj->breakcur = count;
+ }
+}
/* Get error position */
-void exprGetErrorPosition(exprObj *obj, int *start, int *end)
- {
- if(obj)
- {
- if(start)
- *start = obj->starterr;
-
- if(end)
- *end = obj->enderr;
- }
- }
+void exprGetErrorPosition(exprObj * obj, int *start, int *end)
+{
+ if (obj) {
+ if (start)
+ *start = obj->starterr;
+
+ if (end)
+ *end = obj->enderr;
+ }
+}
/* This function will free a node's data */
-static void exprFreeNodeData(exprNode *node)
- {
- int pos;
-
- if(node == NULL)
- return;
-
- /* free data based on type */
- switch(node->type)
- {
- case EXPR_NODETYPE_ADD:
- case EXPR_NODETYPE_SUBTRACT:
- case EXPR_NODETYPE_MULTIPLY:
- case EXPR_NODETYPE_DIVIDE:
- case EXPR_NODETYPE_EXPONENT:
- case EXPR_NODETYPE_NEGATE:
- case EXPR_NODETYPE_MULTI:
- /* Free operation data */
- if(node->data.oper.nodes)
- {
- for(pos = 0; pos < node->data.oper.nodecount; pos++)
- exprFreeNodeData(&(node->data.oper.nodes[pos]));
-
- exprFreeMem(node->data.oper.nodes);
- }
-
- break;
-
-
- case EXPR_NODETYPE_VALUE:
- /* Nothing to free for value */
- break;
-
- case EXPR_NODETYPE_VARIABLE:
- /* Nothing to free for variable */
- break;
-
- case EXPR_NODETYPE_FUNCTION:
- /* Free data of each subnode */
- if(node->data.function.nodes)
- {
- for(pos = 0; pos < node->data.function.nodecount; pos++)
- exprFreeNodeData(&(node->data.function.nodes[pos]));
-
- /* Free the subnode array */
- exprFreeMem(node->data.function.nodes);
- }
-
- /* Free reference variable list */
- if(node->data.function.refs)
- exprFreeMem(node->data.function.refs);
-
- break;
-
- case EXPR_NODETYPE_ASSIGN:
- /* Free subnode data */
- if(node->data.assign.node)
- {
- exprFreeNodeData(node->data.assign.node);
-
- /* Free the subnode */
- exprFreeMem(node->data.assign.node);
- }
-
- break;
- }
- }
-
-
+static void exprFreeNodeData(exprNode * node)
+{
+ int pos;
+
+ if (node == NULL)
+ return;
+
+ /* free data based on type */
+ switch (node->type) {
+ case EXPR_NODETYPE_ADD:
+ case EXPR_NODETYPE_SUBTRACT:
+ case EXPR_NODETYPE_MULTIPLY:
+ case EXPR_NODETYPE_DIVIDE:
+ case EXPR_NODETYPE_EXPONENT:
+ case EXPR_NODETYPE_NEGATE:
+ case EXPR_NODETYPE_MULTI:
+ /* Free operation data */
+ if (node->data.oper.nodes) {
+ for (pos = 0; pos < node->data.oper.nodecount; pos++)
+ exprFreeNodeData(&(node->data.oper.nodes[pos]));
+
+ exprFreeMem(node->data.oper.nodes);
+ }
+
+ break;
+
+
+ case EXPR_NODETYPE_VALUE:
+ /* Nothing to free for value */
+ break;
+
+ case EXPR_NODETYPE_VARIABLE:
+ /* Nothing to free for variable */
+ break;
+
+ case EXPR_NODETYPE_FUNCTION:
+ /* Free data of each subnode */
+ if (node->data.function.nodes) {
+ for (pos = 0; pos < node->data.function.nodecount; pos++)
+ exprFreeNodeData(&(node->data.function.nodes[pos]));
+
+ /* Free the subnode array */
+ exprFreeMem(node->data.function.nodes);
+ }
+
+ /* Free reference variable list */
+ if (node->data.function.refs)
+ exprFreeMem(node->data.function.refs);
+
+ break;
+
+ case EXPR_NODETYPE_ASSIGN:
+ /* Free subnode data */
+ if (node->data.assign.node) {
+ exprFreeNodeData(node->data.assign.node);
+
+ /* Free the subnode */
+ exprFreeMem(node->data.assign.node);
+ }
+
+ break;
+ }
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprpars.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprpars.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprpars.c Tue May 27 07:24:06 2008
@@ -14,18 +14,16 @@
#include "exprmem.h"
/* Data structure used by parser */
-typedef struct _exprToken
- {
- int type; /* token type */
- int start; /* token start position */
- int end; /* token end position */
-
- union _tdata
- {
- char *str; /* string data */
- EXPRTYPE val; /* value data */
- } data;
- } exprToken;
+typedef struct _exprToken {
+ int type; /* token type */
+ int start; /* token start position */
+ int end; /* token end position */
+
+ union _tdata {
+ char *str; /* string data */
+ EXPRTYPE val; /* value data */
+ } data;
+} exprToken;
/* Defines for token types */
#define EXPR_TOKEN_UNKNOWN 0
@@ -44,1515 +42,1378 @@
#define EXPR_TOKEN_HAT 13
/* Internal functions */
-int exprMultiParse(exprObj *obj, exprNode *node, exprToken *tokens, int count);
-int exprInternalParse(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end);
-int exprInternalParseAssign(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseAdd(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseSub(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseMul(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseDiv(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParsePosNeg(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseExp(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index);
-int exprInternalParseFunction(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int p1, int p2);
-int exprInternalParseVarVal(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end);
-int exprStringToTokenList(exprObj *obj, char *expr, exprToken **tokens, int *count);
-void exprFreeTokenList(exprToken *tokens, int count);
+int exprMultiParse(exprObj * obj, exprNode * node, exprToken * tokens, int count);
+int exprInternalParse(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end);
+int exprInternalParseAssign(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseAdd(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseSub(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseMul(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseDiv(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParsePosNeg(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseExp(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index);
+int exprInternalParseFunction(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int p1, int p2);
+int exprInternalParseVarVal(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end);
+int exprStringToTokenList(exprObj * obj, char *expr, exprToken ** tokens, int *count);
+void exprFreeTokenList(exprToken * tokens, int count);
/* This frees a token list */
-void exprFreeTokenList(exprToken *tokens, int count)
- {
- int pos;
-
- if(tokens == NULL)
- return;
-
- for(pos = 0; pos < count; pos++)
- {
- if(tokens[pos].type == EXPR_TOKEN_IDENTIFIER)
- exprFreeMem(tokens[pos].data.str);
- }
+void exprFreeTokenList(exprToken * tokens, int count)
+{
+ int pos;
+
+ if (tokens == NULL)
+ return;
+
+ for (pos = 0; pos < count; pos++) {
+ if (tokens[pos].type == EXPR_TOKEN_IDENTIFIER)
+ exprFreeMem(tokens[pos].data.str);
+ }
- exprFreeMem(tokens);
- }
+ exprFreeMem(tokens);
+}
/* This converts an expression string to a token list */
-int exprStringToTokenList(exprObj *obj, char *expr, exprToken **tokens, int *count)
- {
- int found;
- exprToken *list;
- int pass;
- int pos, len;
- int tpos;
- int comment; /* Is a comment active */
- int start, ilen;
- char buf[EXPR_MAXIDENTSIZE + 1];
-
- /* Set initial variables */
- found = 0;
- tpos = 0;
- list = NULL;
- comment = 0;
- *tokens = NULL;
- *count = 0;
-
-
- /* Check string length */
- len = (int)strlen(expr);
- if(len == 0)
- return EXPR_ERROR_EMPTYEXPR;
-
- /* Two passes, one to count, one to tokenize */
- for(pass = 0; pass <= 1; pass++)
- {
- for(pos = 0; pos < len; pos++)
- {
- switch(expr[pos])
- {
- /* Comment */
- case '#':
- {
- /* Only set it if a comment is not already active */
- if(!comment)
- comment = 1;
-
- break;
- }
-
- /* Newline characters turn off comments */
- case '\r':
- case '\n':
- {
- /* If a comment is active, unset it */
- if(comment)
- comment = 0;
-
- break;
- }
-
- /* Open parenthesis */
- case '(':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_OPAREN;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Close parenthesis */
- case ')':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_CPAREN;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Plus */
- case '+':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_PLUS;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Hyphen */
- case '-':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_HYPHEN;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Asterisk */
- case '*':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_ASTERISK;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Forward slash */
- case '/':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_FSLASH;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Hat */
- case '^':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_HAT;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Ampersand */
- case '&':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_AMPERSAND;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Semicolon */
- case ';':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_SEMICOLON;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Comma */
- case ',':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_COMMA;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Equal sign */
- case '=':
- {
- if(!comment)
- {
- if(pass == 0)
- found++;
- else
- {
- list[tpos].type = EXPR_TOKEN_EQUAL;
- list[tpos].start = pos;
- list[tpos].end = pos;
- tpos++;
- }
- }
-
- break;
- }
-
- /* Identifiers and values */
- default:
- {
- if(!comment)
- {
- if(expr[pos] == '.' || isdigit(expr[pos]))
- {
- /* Value */
- start = pos;
-
- /* Find digits before a period */
- while(isdigit(expr[pos]))
- pos++;
-
- /* Find a period */
- if(expr[pos] == '.')
- pos++;
-
- /* Find digits after a period */
- while(isdigit(expr[pos]))
- pos++;
-
- /* pos is AFTER last item, back up */
- pos--;
-
- if(pass == 0)
- found++;
- else
- {
- ilen = pos - start + 1;
-
- /* Is the value to large */
- if(ilen > EXPR_MAXIDENTSIZE)
- {
- obj->starterr = start;
- obj->enderr = pos;
- exprFreeTokenList(list, found);
- return EXPR_ERROR_BADIDENTIFIER;
- }
-
- /* Create value token */
- strncpy(buf, expr + start, ilen);
- buf[ilen] = '\0';
-
- list[tpos].type = EXPR_TOKEN_VALUE;
- list[tpos].start = start;
- list[tpos].end = pos;
- list[tpos].data.val = (EXPRTYPE)atof(buf);
- tpos++;
- }
- }
- else if(expr[pos] == '_' || isalpha(expr[pos]))
- {
- /* Identifier */
- start = pos;
-
- /* Find rest of identifier */
- while(expr[pos] == '_' || isalnum(expr[pos]))
- pos++;
-
- /* pos is AFTER last item, back up */
- pos--;
-
- if(pass == 0)
- found++;
- else
- {
- ilen = pos - start + 1;
-
- /* Is the value to large */
- if(ilen > EXPR_MAXIDENTSIZE)
- {
- obj->starterr = start;
- obj->enderr = pos;
- exprFreeTokenList(list, found);
- return EXPR_ERROR_BADIDENTIFIER;
- }
-
- /* Create value token */
- strncpy(buf, expr + start, ilen);
- buf[ilen] = '\0';
-
- /* Allocate memory for identifier */
- list[tpos].data.str = exprAllocMem(ilen + 1);
- if(list[tpos].data.str == NULL)
- {
- exprFreeTokenList(list, found);
- return EXPR_ERROR_MEMORY;
- }
-
- list[tpos].type = EXPR_TOKEN_IDENTIFIER;
- list[tpos].start = start;
- list[tpos].end = pos;
- strcpy(list[tpos].data.str, buf);
- tpos++;
- }
- }
- else if(isspace(expr[pos]))
- {
- /* Spaces are ignored, do nothing */
- }
- else
- {
- /* Unknown */
- obj->starterr = obj->enderr = pos;
- exprFreeTokenList(list, found);
- return EXPR_ERROR_INVALIDCHAR;
- }
- }
-
- break;
- }
- }
- }
-
- /* If pass is 0, allocate memory for next pass */
- if(pass == 0)
- {
- /* First, make sure all comments were ended */
- if(comment)
- comment = 0;
-
- /* Make sure the expression is not empty */
- if(found == 0)
- return EXPR_ERROR_EMPTYEXPR;
-
- /* Allocate memory for token list */
- list = exprAllocMem(found * sizeof(exprToken));
- if(list == NULL)
- return EXPR_ERROR_MEMORY;
-
- tpos = 0;
- }
- }
-
- *count = found;
- *tokens = list;
- return EXPR_ERROR_NOERROR;
- }
+int exprStringToTokenList(exprObj * obj, char *expr, exprToken ** tokens, int *count)
+{
+ int found;
+ exprToken *list;
+ int pass;
+ int pos, len;
+ int tpos;
+ int comment; /* Is a comment active */
+ int start, ilen;
+ char buf[EXPR_MAXIDENTSIZE + 1];
+
+ /* Set initial variables */
+ found = 0;
+ tpos = 0;
+ list = NULL;
+ comment = 0;
+ *tokens = NULL;
+ *count = 0;
+
+
+ /* Check string length */
+ len = (int) strlen(expr);
+ if (len == 0)
+ return EXPR_ERROR_EMPTYEXPR;
+
+ /* Two passes, one to count, one to tokenize */
+ for (pass = 0; pass <= 1; pass++) {
+ for (pos = 0; pos < len; pos++) {
+ switch (expr[pos]) {
+ /* Comment */
+ case '#':
+ {
+ /* Only set it if a comment is not already active */
+ if (!comment)
+ comment = 1;
+
+ break;
+ }
+
+ /* Newline characters turn off comments */
+ case '\r':
+ case '\n':
+ {
+ /* If a comment is active, unset it */
+ if (comment)
+ comment = 0;
+
+ break;
+ }
+
+ /* Open parenthesis */
+ case '(':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_OPAREN;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Close parenthesis */
+ case ')':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_CPAREN;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Plus */
+ case '+':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_PLUS;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Hyphen */
+ case '-':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_HYPHEN;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Asterisk */
+ case '*':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_ASTERISK;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Forward slash */
+ case '/':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_FSLASH;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Hat */
+ case '^':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_HAT;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Ampersand */
+ case '&':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_AMPERSAND;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Semicolon */
+ case ';':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_SEMICOLON;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Comma */
+ case ',':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_COMMA;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Equal sign */
+ case '=':
+ {
+ if (!comment) {
+ if (pass == 0)
+ found++;
+ else {
+ list[tpos].type = EXPR_TOKEN_EQUAL;
+ list[tpos].start = pos;
+ list[tpos].end = pos;
+ tpos++;
+ }
+ }
+
+ break;
+ }
+
+ /* Identifiers and values */
+ default:
+ {
+ if (!comment) {
+ if (expr[pos] == '.' || isdigit(expr[pos])) {
+ /* Value */
+ start = pos;
+
+ /* Find digits before a period */
+ while (isdigit(expr[pos]))
+ pos++;
+
+ /* Find a period */
+ if (expr[pos] == '.')
+ pos++;
+
+ /* Find digits after a period */
+ while (isdigit(expr[pos]))
+ pos++;
+
+ /* pos is AFTER last item, back up */
+ pos--;
+
+ if (pass == 0)
+ found++;
+ else {
+ ilen = pos - start + 1;
+
+ /* Is the value to large */
+ if (ilen > EXPR_MAXIDENTSIZE) {
+ obj->starterr = start;
+ obj->enderr = pos;
+ exprFreeTokenList(list, found);
+ return EXPR_ERROR_BADIDENTIFIER;
+ }
+
+ /* Create value token */
+ strncpy(buf, expr + start, ilen);
+ buf[ilen] = '\0';
+
+ list[tpos].type = EXPR_TOKEN_VALUE;
+ list[tpos].start = start;
+ list[tpos].end = pos;
+ list[tpos].data.val = (EXPRTYPE) atof(buf);
+ tpos++;
+ }
+ } else if (expr[pos] == '_' || isalpha(expr[pos])) {
+ /* Identifier */
+ start = pos;
+
+ /* Find rest of identifier */
+ while (expr[pos] == '_' || isalnum(expr[pos]))
+ pos++;
+
+ /* pos is AFTER last item, back up */
+ pos--;
+
+ if (pass == 0)
+ found++;
+ else {
+ ilen = pos - start + 1;
+
+ /* Is the value to large */
+ if (ilen > EXPR_MAXIDENTSIZE) {
+ obj->starterr = start;
+ obj->enderr = pos;
+ exprFreeTokenList(list, found);
+ return EXPR_ERROR_BADIDENTIFIER;
+ }
+
+ /* Create value token */
+ strncpy(buf, expr + start, ilen);
+ buf[ilen] = '\0';
+
+ /* Allocate memory for identifier */
+ list[tpos].data.str = exprAllocMem(ilen + 1);
+ if (list[tpos].data.str == NULL) {
+ exprFreeTokenList(list, found);
+ return EXPR_ERROR_MEMORY;
+ }
+
+ list[tpos].type = EXPR_TOKEN_IDENTIFIER;
+ list[tpos].start = start;
+ list[tpos].end = pos;
+ strcpy(list[tpos].data.str, buf);
+ tpos++;
+ }
+ } else if (isspace(expr[pos])) {
+ /* Spaces are ignored, do nothing */
+ } else {
+ /* Unknown */
+ obj->starterr = obj->enderr = pos;
+ exprFreeTokenList(list, found);
+ return EXPR_ERROR_INVALIDCHAR;
+ }
+ }
+
+ break;
+ }
+ }
+ }
+
+ /* If pass is 0, allocate memory for next pass */
+ if (pass == 0) {
+ /* First, make sure all comments were ended */
+ if (comment)
+ comment = 0;
+
+ /* Make sure the expression is not empty */
+ if (found == 0)
+ return EXPR_ERROR_EMPTYEXPR;
+
+ /* Allocate memory for token list */
+ list = exprAllocMem(found * sizeof(exprToken));
+ if (list == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ tpos = 0;
+ }
+ }
+
+ *count = found;
+ *tokens = list;
+ return EXPR_ERROR_NOERROR;
+}
/* This is the main parsing routine */
-int exprParse(exprObj *obj, char *expr)
- {
- exprToken *tokens;
- int count;
- int err;
- exprNode *tmp;
-
- /* Make sure an object was passed */
- if(obj == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Clear expression error position */
- obj->starterr = obj->enderr = -1;
-
- /* Have we already been parsed? */
- if(obj->parsedbad != 0)
- return EXPR_ERROR_ALREADYPARSEDBAD;
-
- if(obj->parsedgood != 0)
- return EXPR_ERROR_ALREADYPARSEDGOOD;
-
- /* Make sure an expression was passed */
- if(expr == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Create token list */
- err = exprStringToTokenList(obj, expr, &tokens, &count);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* Create head pointer */
- tmp = exprAllocNodes(1);
- if(tmp == NULL)
- {
- exprFreeTokenList(tokens, count);
- return EXPR_ERROR_MEMORY;
- }
-
- obj->headnode = tmp;
-
- /* Call the multiparse routine to parse subexpressions */
- err = exprMultiParse(obj, tmp, tokens, count);
-
- /* Free the token list */
- exprFreeTokenList(tokens, count);
-
- /* successful parse? */
- if(err == EXPR_ERROR_NOERROR)
- {
- obj->parsedgood = 1;
- obj->parsedbad = 0;
- }
- else
- {
- obj->parsedbad = 1;
- obj->parsedgood = 0;
- }
+int exprParse(exprObj * obj, char *expr)
+{
+ exprToken *tokens;
+ int count;
+ int err;
+ exprNode *tmp;
+
+ /* Make sure an object was passed */
+ if (obj == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Clear expression error position */
+ obj->starterr = obj->enderr = -1;
+
+ /* Have we already been parsed? */
+ if (obj->parsedbad != 0)
+ return EXPR_ERROR_ALREADYPARSEDBAD;
+
+ if (obj->parsedgood != 0)
+ return EXPR_ERROR_ALREADYPARSEDGOOD;
+
+ /* Make sure an expression was passed */
+ if (expr == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Create token list */
+ err = exprStringToTokenList(obj, expr, &tokens, &count);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* Create head pointer */
+ tmp = exprAllocNodes(1);
+ if (tmp == NULL) {
+ exprFreeTokenList(tokens, count);
+ return EXPR_ERROR_MEMORY;
+ }
+
+ obj->headnode = tmp;
+
+ /* Call the multiparse routine to parse subexpressions */
+ err = exprMultiParse(obj, tmp, tokens, count);
+
+ /* Free the token list */
+ exprFreeTokenList(tokens, count);
+
+ /* successful parse? */
+ if (err == EXPR_ERROR_NOERROR) {
+ obj->parsedgood = 1;
+ obj->parsedbad = 0;
+ } else {
+ obj->parsedbad = 1;
+ obj->parsedgood = 0;
+ }
- return err;
- }
+ return err;
+}
/* Parse the subexpressions, each ending with semicolons */
-int exprMultiParse(exprObj *obj, exprNode *node, exprToken *tokens, int count)
- {
- int pos, plevel, last;
- int num, cur, err;
- exprNode *tmp;
-
- plevel = 0;
- num = 0;
- last = -1;
-
- /* First count the number of arguments */
- for(pos = 0; pos < count; pos++)
- {
- switch(tokens[pos].type)
- {
- case EXPR_TOKEN_OPAREN:
- /* increase plevel */
- plevel++;
- break;
-
- case EXPR_TOKEN_CPAREN:
- /* decrease plevel */
- plevel--;
-
- if(plevel < 0)
- {
- obj->starterr = tokens[pos].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_UNMATCHEDPAREN;
- }
-
- break;
-
- case EXPR_TOKEN_SEMICOLON:
- if(plevel == 0)
- {
- if(last == pos - 1 || pos == 0)
- {
- /* last semicolon is before us or we are at the start */
- obj->starterr = tokens[pos].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_SYNTAX;
- }
- else
- {
- /* last semicolon is not right before us */
- num++;
- }
- }
- else
- {
- /* Semicolon should not be in a parenthesis */
- obj->starterr = tokens[pos].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- last = pos; /* update position of last semicolon */
- break;
- }
- }
-
- /* plevel should be zero now */
- if(plevel != 0)
- return EXPR_ERROR_UNMATCHEDPAREN;
-
- /* the last character should be a semicolon */
- if(last != pos - 1)
- return EXPR_ERROR_MISSINGSEMICOLON;
-
- /* Now we know how many arguments there are */
-
- /* Allocate array of subnodes */
- tmp = exprAllocNodes(num);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- /* Set the current node's data */
- node->type = EXPR_NODETYPE_MULTI;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = num;
-
- /* now we parse each subexpression */
- last = 0; /* Not for last semicolon, but for first char of subexpr */
- cur = 0;
-
- for(pos = 0; pos < count; pos++)
- {
- if(tokens[pos].type == EXPR_TOKEN_SEMICOLON)
- {
- /* Everything from last up to pos - 1 is a parameter */
- err = exprInternalParse(obj, &(tmp[cur]), tokens, last, pos - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* Update last position and current argument */
- last = pos + 1;
- cur++;
- }
- }
+int exprMultiParse(exprObj * obj, exprNode * node, exprToken * tokens, int count)
+{
+ int pos, plevel, last;
+ int num, cur, err;
+ exprNode *tmp;
+
+ plevel = 0;
+ num = 0;
+ last = -1;
+
+ /* First count the number of arguments */
+ for (pos = 0; pos < count; pos++) {
+ switch (tokens[pos].type) {
+ case EXPR_TOKEN_OPAREN:
+ /* increase plevel */
+ plevel++;
+ break;
+
+ case EXPR_TOKEN_CPAREN:
+ /* decrease plevel */
+ plevel--;
+
+ if (plevel < 0) {
+ obj->starterr = tokens[pos].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_UNMATCHEDPAREN;
+ }
+
+ break;
+
+ case EXPR_TOKEN_SEMICOLON:
+ if (plevel == 0) {
+ if (last == pos - 1 || pos == 0) {
+ /* last semicolon is before us or we are at the start */
+ obj->starterr = tokens[pos].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_SYNTAX;
+ } else {
+ /* last semicolon is not right before us */
+ num++;
+ }
+ } else {
+ /* Semicolon should not be in a parenthesis */
+ obj->starterr = tokens[pos].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ last = pos; /* update position of last semicolon */
+ break;
+ }
+ }
+
+ /* plevel should be zero now */
+ if (plevel != 0)
+ return EXPR_ERROR_UNMATCHEDPAREN;
+
+ /* the last character should be a semicolon */
+ if (last != pos - 1)
+ return EXPR_ERROR_MISSINGSEMICOLON;
+
+ /* Now we know how many arguments there are */
+
+ /* Allocate array of subnodes */
+ tmp = exprAllocNodes(num);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ /* Set the current node's data */
+ node->type = EXPR_NODETYPE_MULTI;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = num;
+
+ /* now we parse each subexpression */
+ last = 0; /* Not for last semicolon, but for first char of subexpr */
+ cur = 0;
+
+ for (pos = 0; pos < count; pos++) {
+ if (tokens[pos].type == EXPR_TOKEN_SEMICOLON) {
+ /* Everything from last up to pos - 1 is a parameter */
+ err = exprInternalParse(obj, &(tmp[cur]), tokens, last, pos - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* Update last position and current argument */
+ last = pos + 1;
+ cur++;
+ }
+ }
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* This function parses each subnode and recurses if needed */
-int exprInternalParse(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end)
- {
- int pos;
- int plevel = 0; /* Paren level */
- int fgopen = -1; /* First paren group open index */
- int fgclose = -1; /* First paren group close index */
- int assignindex = -1; /* First = at plevel 0 for assignment */
- int addsubindex = -1; /* Last + or - at plevel 0 for adding or subtracting */
- int muldivindex = -1; /* Last * or / at plevel 0 for multiplying or dividing */
- int expindex = -1; /* Last ^ fount at plevel 0 for exponents */
- int posnegindex = -1; /* First +,- at plevel 0 for positive,negative */
-
- /* Make sure some conditions are right */
- if(start > end)
- return EXPR_ERROR_UNKNOWN;
-
- /* Scan the string for certain characters */
- for(pos = start; pos <= end; pos++)
- {
- switch(tokens[pos].type)
- {
- case EXPR_TOKEN_OPAREN:
- plevel++;
-
- /* First group open? */
- if(plevel == 1 && fgopen == -1)
- fgopen = pos;
- break;
-
- case EXPR_TOKEN_CPAREN:
- plevel--;
-
- /* First group close? */
- if(plevel == 0 && fgclose == -1)
- fgclose = pos;
-
- if(plevel < 0)
- {
- obj->starterr = tokens[pos].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_UNMATCHEDPAREN;
- }
- break;
-
- case EXPR_TOKEN_EQUAL:
- /* Assignment found */
- if(plevel == 0)
- {
- if(assignindex == -1)
- assignindex = pos;
- }
- break;
-
- case EXPR_TOKEN_ASTERISK:
- case EXPR_TOKEN_FSLASH:
- /* Multiplication or division */
- if(plevel == 0)
- muldivindex = pos;
- break;
-
- case EXPR_TOKEN_HAT:
- /* Exponent */
- if(plevel == 0)
- expindex = pos;
- break;
-
-
- case EXPR_TOKEN_PLUS:
- case EXPR_TOKEN_HYPHEN:
- /* Addition or positive or subtraction or negative*/
- if(plevel == 0)
- {
- if(pos == start)
- {
- /* At the start area, positive/negative */
- if(posnegindex == -1)
- posnegindex = pos;
- }
- else
- {
- /* Not at start, check item in front */
- switch(tokens[pos - 1].type)
- {
- case EXPR_TOKEN_EQUAL: /* Equal sign */
- case EXPR_TOKEN_PLUS: /* Add/positive sign */
- case EXPR_TOKEN_HYPHEN: /* Subtract/negative sign */
- case EXPR_TOKEN_ASTERISK: /* Multiply sign */
- case EXPR_TOKEN_FSLASH: /* Divide sign */
- case EXPR_TOKEN_HAT: /* Exponent sign */
-
- /* After theses, it is positive/negative */
- if(posnegindex == -1)
- posnegindex = pos;
-
- break;
-
- default:
- /* Otherwise it is addition/subtraction */
- addsubindex = pos;
- break;
- }
- }
- }
- break;
-
- }
- }
-
- /* plevel should now be zero */
- if(plevel != 0)
- return EXPR_ERROR_UNMATCHEDPAREN;
-
- /* We must parse the data in a certain order to maintain the
- correct order of operators at evaluation time */
-
- /* First, take care of assignment */
- if(assignindex != -1)
- return exprInternalParseAssign(obj, node, tokens, start, end, assignindex);
-
- /* Addition or subtraction is next */
- if(addsubindex != -1)
- {
- if(tokens[addsubindex].type == EXPR_TOKEN_PLUS)
- return exprInternalParseAdd(obj, node, tokens, start, end, addsubindex);
- else
- return exprInternalParseSub(obj, node, tokens, start, end, addsubindex);
- }
-
-
- /* Multiplycation or division */
- if(muldivindex != -1)
- {
- if(tokens[muldivindex].type == EXPR_TOKEN_ASTERISK)
- return exprInternalParseMul(obj, node, tokens, start, end, muldivindex);
- else
- return exprInternalParseDiv(obj, node, tokens, start, end, muldivindex);
- }
-
- /* Exponent */
- if(expindex != -1)
- return exprInternalParseExp(obj, node, tokens, start, end, expindex);
-
- /* Negation */
- if(posnegindex != -1)
- return exprInternalParsePosNeg(obj, node, tokens, start, end, posnegindex);
-
-
- /* Grouped parenthesis */
- if(fgopen == start)
- {
- /* Closing paren. should be at the end */
- if(fgclose == end)
- {
- /* Anything between them */
- if(fgclose > fgopen + 1)
- {
- return exprInternalParse(obj, node, tokens, fgopen + 1, fgclose - 1);
- }
- else
- {
- /* Nothing between them */
- obj->starterr = tokens[fgopen].start;
- obj->enderr = tokens[fgclose].end;
- return EXPR_ERROR_SYNTAX;
- }
- }
- else /* Closing paren not at the end */
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Functions */
- if(fgopen > start)
- {
- /* Closing paren should be at end */
- if(fgclose == end)
- {
- return exprInternalParseFunction(obj, node, tokens, start, end, fgopen, fgclose);
- }
- else /* Closing paren not at end */
- return EXPR_ERROR_SYNTAX;
- }
-
- /* If it was none of the above, it must be a variable or value */
- return exprInternalParseVarVal(obj, node, tokens, start, end);
- }
+int exprInternalParse(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end)
+{
+ int pos;
+ int plevel = 0; /* Paren level */
+ int fgopen = -1; /* First paren group open index */
+ int fgclose = -1; /* First paren group close index */
+ int assignindex = -1; /* First = at plevel 0 for assignment */
+ int addsubindex = -1; /* Last + or - at plevel 0 for adding or subtracting */
+ int muldivindex = -1; /* Last * or / at plevel 0 for multiplying or dividing */
+ int expindex = -1; /* Last ^ fount at plevel 0 for exponents */
+ int posnegindex = -1; /* First +,- at plevel 0 for positive,negative */
+
+ /* Make sure some conditions are right */
+ if (start > end)
+ return EXPR_ERROR_UNKNOWN;
+
+ /* Scan the string for certain characters */
+ for (pos = start; pos <= end; pos++) {
+ switch (tokens[pos].type) {
+ case EXPR_TOKEN_OPAREN:
+ plevel++;
+
+ /* First group open? */
+ if (plevel == 1 && fgopen == -1)
+ fgopen = pos;
+ break;
+
+ case EXPR_TOKEN_CPAREN:
+ plevel--;
+
+ /* First group close? */
+ if (plevel == 0 && fgclose == -1)
+ fgclose = pos;
+
+ if (plevel < 0) {
+ obj->starterr = tokens[pos].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_UNMATCHEDPAREN;
+ }
+ break;
+
+ case EXPR_TOKEN_EQUAL:
+ /* Assignment found */
+ if (plevel == 0) {
+ if (assignindex == -1)
+ assignindex = pos;
+ }
+ break;
+
+ case EXPR_TOKEN_ASTERISK:
+ case EXPR_TOKEN_FSLASH:
+ /* Multiplication or division */
+ if (plevel == 0)
+ muldivindex = pos;
+ break;
+
+ case EXPR_TOKEN_HAT:
+ /* Exponent */
+ if (plevel == 0)
+ expindex = pos;
+ break;
+
+
+ case EXPR_TOKEN_PLUS:
+ case EXPR_TOKEN_HYPHEN:
+ /* Addition or positive or subtraction or negative */
+ if (plevel == 0) {
+ if (pos == start) {
+ /* At the start area, positive/negative */
+ if (posnegindex == -1)
+ posnegindex = pos;
+ } else {
+ /* Not at start, check item in front */
+ switch (tokens[pos - 1].type) {
+ case EXPR_TOKEN_EQUAL: /* Equal sign */
+ case EXPR_TOKEN_PLUS: /* Add/positive sign */
+ case EXPR_TOKEN_HYPHEN: /* Subtract/negative sign */
+ case EXPR_TOKEN_ASTERISK: /* Multiply sign */
+ case EXPR_TOKEN_FSLASH: /* Divide sign */
+ case EXPR_TOKEN_HAT: /* Exponent sign */
+
+ /* After theses, it is positive/negative */
+ if (posnegindex == -1)
+ posnegindex = pos;
+
+ break;
+
+ default:
+ /* Otherwise it is addition/subtraction */
+ addsubindex = pos;
+ break;
+ }
+ }
+ }
+ break;
+
+ }
+ }
+
+ /* plevel should now be zero */
+ if (plevel != 0)
+ return EXPR_ERROR_UNMATCHEDPAREN;
+
+ /* We must parse the data in a certain order to maintain the
+ correct order of operators at evaluation time */
+
+ /* First, take care of assignment */
+ if (assignindex != -1)
+ return exprInternalParseAssign(obj, node, tokens, start, end, assignindex);
+
+ /* Addition or subtraction is next */
+ if (addsubindex != -1) {
+ if (tokens[addsubindex].type == EXPR_TOKEN_PLUS)
+ return exprInternalParseAdd(obj, node, tokens, start, end, addsubindex);
+ else
+ return exprInternalParseSub(obj, node, tokens, start, end, addsubindex);
+ }
+
+
+ /* Multiplycation or division */
+ if (muldivindex != -1) {
+ if (tokens[muldivindex].type == EXPR_TOKEN_ASTERISK)
+ return exprInternalParseMul(obj, node, tokens, start, end, muldivindex);
+ else
+ return exprInternalParseDiv(obj, node, tokens, start, end, muldivindex);
+ }
+
+ /* Exponent */
+ if (expindex != -1)
+ return exprInternalParseExp(obj, node, tokens, start, end, expindex);
+
+ /* Negation */
+ if (posnegindex != -1)
+ return exprInternalParsePosNeg(obj, node, tokens, start, end, posnegindex);
+
+
+ /* Grouped parenthesis */
+ if (fgopen == start) {
+ /* Closing paren. should be at the end */
+ if (fgclose == end) {
+ /* Anything between them */
+ if (fgclose > fgopen + 1) {
+ return exprInternalParse(obj, node, tokens, fgopen + 1, fgclose - 1);
+ } else {
+ /* Nothing between them */
+ obj->starterr = tokens[fgopen].start;
+ obj->enderr = tokens[fgclose].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+ } else /* Closing paren not at the end */
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Functions */
+ if (fgopen > start) {
+ /* Closing paren should be at end */
+ if (fgclose == end) {
+ return exprInternalParseFunction(obj, node, tokens, start, end, fgopen, fgclose);
+ } else /* Closing paren not at end */
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* If it was none of the above, it must be a variable or value */
+ return exprInternalParseVarVal(obj, node, tokens, start, end);
+}
/* Function to parse an assignment node */
-int exprInternalParseAssign(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- exprValList *l;
- EXPRTYPE *addr;
-
- /* Make sure the equal sign is not at the start or end */
- if(index != start + 1 || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Make sure item before equal sign is an identifier */
- if(tokens[index - 1].type != EXPR_TOKEN_IDENTIFIER)
- {
- obj->starterr = tokens[index - 1].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Create expression subnode */
- tmp = exprAllocNodes(1);
- if(tmp == NULL)
- {
- return EXPR_ERROR_MEMORY;
- }
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_ASSIGN;
- node->data.assign.node = tmp;
-
-
- /*
- The fast access method directly accesses the memory address
- of the variable's value at evaluation time. Because of this,
- we must make sure the variable does exists in the variable list.
- */
-
- /* Make sure name is not a constant name */
- l = exprGetConstList(obj);
- if(l)
- {
- exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
- if(addr)
- {
- obj->starterr = tokens[index - 1].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_CONSTANTASSIGN;
- }
- }
-
- /* Get the variable list */
- l = exprGetVarList(obj);
- if(l == NULL)
- return EXPR_ERROR_NOVARLIST;
-
- /* Get variable address if already in the list */
- exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
- if(addr == NULL) /* Variable not in the list, add it */
- {
- exprValListAdd(l, tokens[index - 1].data.str, 0.0);
-
- /* Try to get address again */
- exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
- if(addr == NULL) /* Could not add variable */
- return EXPR_ERROR_MEMORY; /* Could not add variable to list */
- }
-
- node->data.assign.vaddr = addr;
-
- /* Parse the subnode */
- return exprInternalParse(obj, tmp, tokens, index + 1, end);
- }
+int exprInternalParseAssign(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ exprValList *l;
+ EXPRTYPE *addr;
+
+ /* Make sure the equal sign is not at the start or end */
+ if (index != start + 1 || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Make sure item before equal sign is an identifier */
+ if (tokens[index - 1].type != EXPR_TOKEN_IDENTIFIER) {
+ obj->starterr = tokens[index - 1].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Create expression subnode */
+ tmp = exprAllocNodes(1);
+ if (tmp == NULL) {
+ return EXPR_ERROR_MEMORY;
+ }
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_ASSIGN;
+ node->data.assign.node = tmp;
+
+
+ /*
+ The fast access method directly accesses the memory address
+ of the variable's value at evaluation time. Because of this,
+ we must make sure the variable does exists in the variable list.
+ */
+
+ /* Make sure name is not a constant name */
+ l = exprGetConstList(obj);
+ if (l) {
+ exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+ if (addr) {
+ obj->starterr = tokens[index - 1].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_CONSTANTASSIGN;
+ }
+ }
+
+ /* Get the variable list */
+ l = exprGetVarList(obj);
+ if (l == NULL)
+ return EXPR_ERROR_NOVARLIST;
+
+ /* Get variable address if already in the list */
+ exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+ if (addr == NULL) { /* Variable not in the list, add it */
+ exprValListAdd(l, tokens[index - 1].data.str, 0.0);
+
+ /* Try to get address again */
+ exprValListGetAddress(l, tokens[index - 1].data.str, &addr);
+ if (addr == NULL) /* Could not add variable */
+ return EXPR_ERROR_MEMORY; /* Could not add variable to list */
+ }
+
+ node->data.assign.vaddr = addr;
+
+ /* Parse the subnode */
+ return exprInternalParse(obj, tmp, tokens, index + 1, end);
+}
/* Function to parse an addition operator */
-int exprInternalParseAdd(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- int err;
-
- /* Make sure plus sign is at a good place */
- if(index <= start || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Allocate space for 2 subnodes */
- tmp = exprAllocNodes(2);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_ADD;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 2;
-
- /* parse the left side */
- err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* parse the right side */
- return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
- }
+int exprInternalParseAdd(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ int err;
+
+ /* Make sure plus sign is at a good place */
+ if (index <= start || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Allocate space for 2 subnodes */
+ tmp = exprAllocNodes(2);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_ADD;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 2;
+
+ /* parse the left side */
+ err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* parse the right side */
+ return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
/* Function to parse a subtraction operator */
-int exprInternalParseSub(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- int err;
-
- /* Make sure minus sign is at a good place */
- if(index <= start || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Allocate space for 2 subnodes */
- tmp = exprAllocNodes(2);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_SUBTRACT;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 2;
-
- /* parse the left side */
- err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* parse the right side */
- return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
- }
+int exprInternalParseSub(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ int err;
+
+ /* Make sure minus sign is at a good place */
+ if (index <= start || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Allocate space for 2 subnodes */
+ tmp = exprAllocNodes(2);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_SUBTRACT;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 2;
+
+ /* parse the left side */
+ err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* parse the right side */
+ return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
/* Function to parse a multiplication operator */
-int exprInternalParseMul(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- int err;
-
- /* Make sure times sign is at a good place */
- if(index <= start || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
-
- /* Allocate space for 2 subnodes */
- tmp = exprAllocNodes(2);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_MULTIPLY;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 2;
-
- /* parse the left side */
- err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* parse the right side */
- return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
- }
+int exprInternalParseMul(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ int err;
+
+ /* Make sure times sign is at a good place */
+ if (index <= start || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+
+ /* Allocate space for 2 subnodes */
+ tmp = exprAllocNodes(2);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_MULTIPLY;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 2;
+
+ /* parse the left side */
+ err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* parse the right side */
+ return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
/* Function to parse a division operator */
-int exprInternalParseDiv(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- int err;
-
- /* Make sure slash sign is at a good place */
- if(index <= start || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
-
- /* Allocate space for 2 subnodes */
- tmp = exprAllocNodes(2);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_DIVIDE;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 2;
-
- /* parse the left side */
- err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* parse the right side */
- return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
- }
+int exprInternalParseDiv(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ int err;
+
+ /* Make sure slash sign is at a good place */
+ if (index <= start || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+
+ /* Allocate space for 2 subnodes */
+ tmp = exprAllocNodes(2);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_DIVIDE;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 2;
+
+ /* parse the left side */
+ err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* parse the right side */
+ return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
/* Function to parse an exponent operator */
-int exprInternalParseExp(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
- int err;
-
- /* Make sure exponent sign is at a good place */
- if(index <= start || index >= end)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_SYNTAX;
- }
-
-
- /* Allocate space for 2 subnodes */
- tmp = exprAllocNodes(2);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
-
- /* Set the data */
- node->type = EXPR_NODETYPE_EXPONENT;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 2;
-
- /* parse the left side */
- err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* parse the right side */
- return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
- }
+int exprInternalParseExp(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+ int err;
+
+ /* Make sure exponent sign is at a good place */
+ if (index <= start || index >= end) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+
+ /* Allocate space for 2 subnodes */
+ tmp = exprAllocNodes(2);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+
+ /* Set the data */
+ node->type = EXPR_NODETYPE_EXPONENT;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 2;
+
+ /* parse the left side */
+ err = exprInternalParse(obj, &(tmp[0]), tokens, start, index - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* parse the right side */
+ return exprInternalParse(obj, &(tmp[1]), tokens, index + 1, end);
+}
/* Function to parse for positive and negative */
-int exprInternalParsePosNeg(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int index)
- {
- exprNode *tmp;
-
- /* Position should be the same as start */
- if(index != start)
- {
- obj->starterr = tokens[index].start;
- obj->enderr = tokens[index].end;
- return EXPR_ERROR_UNKNOWN;
- }
-
- /* If it is a positive, just parse the internal of it */
- if(tokens[index].type == EXPR_TOKEN_PLUS)
- return exprInternalParse(obj, node, tokens, index + 1, end);
- else
- {
- /* Allocate subnode */
- tmp = exprAllocNodes(1);
- if(tmp == NULL)
- return EXPR_ERROR_NOERROR;
-
-
- /* Set data */
- node->type = EXPR_NODETYPE_NEGATE;
- node->data.oper.nodes = tmp;
- node->data.oper.nodecount = 1;
-
- /* Parse the subnode */
- return exprInternalParse(obj, tmp, tokens, index + 1, end);
- }
- }
+int exprInternalParsePosNeg(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int index)
+{
+ exprNode *tmp;
+
+ /* Position should be the same as start */
+ if (index != start) {
+ obj->starterr = tokens[index].start;
+ obj->enderr = tokens[index].end;
+ return EXPR_ERROR_UNKNOWN;
+ }
+
+ /* If it is a positive, just parse the internal of it */
+ if (tokens[index].type == EXPR_TOKEN_PLUS)
+ return exprInternalParse(obj, node, tokens, index + 1, end);
+ else {
+ /* Allocate subnode */
+ tmp = exprAllocNodes(1);
+ if (tmp == NULL)
+ return EXPR_ERROR_NOERROR;
+
+
+ /* Set data */
+ node->type = EXPR_NODETYPE_NEGATE;
+ node->data.oper.nodes = tmp;
+ node->data.oper.nodecount = 1;
+
+ /* Parse the subnode */
+ return exprInternalParse(obj, tmp, tokens, index + 1, end);
+ }
+}
/* Function will parse a call to a function */
-int exprInternalParseFunction(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end, int p1, int p2)
- {
- int pos;
- int num, cur;
- int refnum, refcur;
- int plevel = 0;
- int lv, err;
- exprNode *tmp;
- exprFuncType fptr;
- int argmin, argmax;
- int refargmin, refargmax;
- int type;
- exprFuncList *l;
- exprValList *vars;
- EXPRTYPE *addr;
- EXPRTYPE **reftmp;
-
- /* We should have a function list */
- l = exprGetFuncList(obj);
- if(l == NULL)
- return EXPR_ERROR_NOSUCHFUNCTION;
-
- /* check paren. location */
- if(p2 <= p1)
- return EXPR_ERROR_SYNTAX;
-
- /* second paren. should not be after the end */
- if(p2 > end)
- return EXPR_ERROR_SYNTAX;
-
- /* Item before parenthesis should be an identifier */
- if(tokens[p1 - 1].type != EXPR_TOKEN_IDENTIFIER)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p1].end;
- return EXPR_ERROR_SYNTAX;
- }
-
-
- /* Look up the function */
- err = exprFuncListGet(l, tokens[p1 - 1].data.str, &fptr, &type, &argmin, &argmax, &refargmin, &refargmax);
- if(err != EXPR_ERROR_NOERROR)
- {
- if(err == EXPR_ERROR_NOTFOUND)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p1 - 1].end;
- return EXPR_ERROR_NOSUCHFUNCTION;
- }
- else
- return err;
- }
-
- /* Make sure the function exists */
- if(fptr == NULL && type == 0)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p1 - 1].end;
- return EXPR_ERROR_NOSUCHFUNCTION;
- }
-
- /* Count arguments */
- if(p2 == p1 + 1)
- {
- num = 0;
- refnum = 0;
- }
- else
- {
- num = 1;
- refnum = 0;
-
-
- /* count commas */
- for(pos = p1 + 1; pos < p2; pos++)
- {
- switch(tokens[pos].type)
- {
- case EXPR_TOKEN_OPAREN:
- plevel++;
- break;
-
- case EXPR_TOKEN_CPAREN:
- plevel--;
- if(plevel < 0)
- {
- obj->starterr = tokens[pos].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_UNMATCHEDPAREN;
- }
- break;
-
- case EXPR_TOKEN_COMMA:
- /* Found comma */
- if(plevel == 0)
- num++;
- break;
-
- case EXPR_TOKEN_AMPERSAND:
- /* Found reference mark */
- if(plevel == 0)
- {
- /* This may only occur after the open parenthesis or comma */
- if(tokens[pos - 1].type == EXPR_TOKEN_OPAREN || tokens[pos - 1].type == EXPR_TOKEN_COMMA)
- refnum++;
- else
- return EXPR_ERROR_SYNTAX;
- }
- break;
- }
- }
-
- /* plevel should be zero */
- if(plevel != 0)
- return EXPR_ERROR_UNMATCHEDPAREN;
- }
-
- /* We now have the number of total arguments and
- number of ref arguments. Get number of normal
- arguments */
- num = num - refnum;
-
- /* Make sure number of arguments is correct */
- /* Here we make sure the limits are greater
- or equal to zero because any negative number
- could be used to specify no limit */
- if(argmin >= 0 && num < argmin)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p2].end;
- return EXPR_ERROR_BADNUMBERARGUMENTS;
- }
-
- if(argmax >= 0 && num > argmax)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p2].end;
- return EXPR_ERROR_BADNUMBERARGUMENTS;
- }
-
- if(refargmin >= 0 && refnum < refargmin)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p2].end;
- return EXPR_ERROR_BADNUMBERARGUMENTS;
- }
-
- if(refargmax >= 0 && refnum > refargmax)
- {
- obj->starterr = tokens[p1 - 1].start;
- obj->enderr = tokens[p2].end;
- return EXPR_ERROR_BADNUMBERARGUMENTS;
- }
-
- /* Set tmp to null in case of no arguments */
- tmp = NULL;
- reftmp = NULL;
-
- if(num > 0)
- {
- /* Allocate subnodes */
- tmp = exprAllocNodes(num);
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
- }
-
- if(refnum > 0)
- {
- /* Allocate ref pointers */
- reftmp = exprAllocMem(sizeof(EXPRTYPE*) * refnum);
- if(reftmp == NULL)
- {
- exprFreeMem(tmp);
- return EXPR_ERROR_MEMORY;
- }
- }
-
-
-
- /* Set this node's data */
- node->type = EXPR_NODETYPE_FUNCTION;
- node->data.function.fptr = fptr;
- node->data.function.nodecount = num;
- node->data.function.nodes = tmp;
- node->data.function.refcount = refnum;
- node->data.function.refs = reftmp;
- node->data.function.type = type;
-
- /* parse each subnode */
- if(num + refnum > 0)
- {
- plevel = 0;
- cur = 0;
- refcur = 0;
- lv = p1 + 1;
-
- /* look for commas if more than 1 arg */
- if(num + refnum > 1)
- {
- for(pos = p1 + 1; pos < p2; pos++)
- {
- switch(tokens[pos].type)
- {
- case EXPR_TOKEN_OPAREN:
- plevel++;
- break;
-
- case EXPR_TOKEN_CPAREN:
- plevel--;
- break; /* Already checked paren nesting above */
-
- case EXPR_TOKEN_COMMA:
- /* Found comma */
- if(plevel == 0)
- {
- /* parse inside */
- if(tokens[lv].type == EXPR_TOKEN_AMPERSAND)
- {
- if(lv != pos - 2)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[pos].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* It is a reference */
- if(tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[lv + 1].end;
- return EXPR_ERROR_SYNTAX;
- }
-
-
- /* Make sure it is not a constant */
- vars = exprGetConstList(obj);
- if(vars)
- {
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[lv + 1].start;
- return EXPR_ERROR_REFCONSTANT;
- }
- }
-
- /* Get variable list */
- vars = exprGetVarList(obj);
- if(vars == NULL)
- return EXPR_ERROR_NOVARLIST;
-
- /* Get variable address */
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr == NULL)
- {
- /* Add variable to list */
- exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
-
- /* Try to get address again */
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr == NULL)
- return EXPR_ERROR_MEMORY; /* Could not add variable */
- }
-
- /* Set reference item */
- reftmp[refcur] = addr;
-
- /* increase ref arg number and lv position*/
- refcur++;
- lv = pos + 1;
- }
- else
- {
- err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, pos - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
-
- /* increase arg number and lv position*/
- lv = pos + 1;
- cur++;
- }
- }
- break;
- }
- }
- }
-
- /* lv should point after the last comma, or open paren. if only 1 arg */
- if(tokens[lv].type == EXPR_TOKEN_AMPERSAND)
- {
- if(lv != p2 - 2)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[p2].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* It is a reference */
- if(tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[lv + 1].end;
- return EXPR_ERROR_SYNTAX;
- }
-
- /* Make sure it is not a constant */
- vars = exprGetConstList(obj);
- if(vars)
- {
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr)
- {
- obj->starterr = tokens[lv].start;
- obj->enderr = tokens[lv + 1].start;
- return EXPR_ERROR_REFCONSTANT;
- }
- }
-
- /* Get variable list */
- vars = exprGetVarList(obj);
- if(vars == NULL)
- return EXPR_ERROR_NOVARLIST;
-
- /* Get variable address */
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr == NULL)
- {
- /* Add variable to list */
- exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
-
- /* Try to get address again */
- exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
- if(addr == NULL)
- return EXPR_ERROR_MEMORY; /* Could not add variable */
- }
-
- /* Set reference item */
- reftmp[refcur] = addr;
- }
- else
- {
- err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, p2 - 1);
- if(err != EXPR_ERROR_NOERROR)
- return err;
- }
- }
+int exprInternalParseFunction(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end, int p1, int p2)
+{
+ int pos;
+ int num, cur;
+ int refnum, refcur;
+ int plevel = 0;
+ int lv, err;
+ exprNode *tmp;
+ exprFuncType fptr;
+ int argmin, argmax;
+ int refargmin, refargmax;
+ int type;
+ exprFuncList *l;
+ exprValList *vars;
+ EXPRTYPE *addr;
+ EXPRTYPE **reftmp;
+
+ /* We should have a function list */
+ l = exprGetFuncList(obj);
+ if (l == NULL)
+ return EXPR_ERROR_NOSUCHFUNCTION;
+
+ /* check paren. location */
+ if (p2 <= p1)
+ return EXPR_ERROR_SYNTAX;
+
+ /* second paren. should not be after the end */
+ if (p2 > end)
+ return EXPR_ERROR_SYNTAX;
+
+ /* Item before parenthesis should be an identifier */
+ if (tokens[p1 - 1].type != EXPR_TOKEN_IDENTIFIER) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p1].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+
+ /* Look up the function */
+ err = exprFuncListGet(l, tokens[p1 - 1].data.str, &fptr, &type, &argmin, &argmax, &refargmin, &refargmax);
+ if (err != EXPR_ERROR_NOERROR) {
+ if (err == EXPR_ERROR_NOTFOUND) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p1 - 1].end;
+ return EXPR_ERROR_NOSUCHFUNCTION;
+ } else
+ return err;
+ }
+
+ /* Make sure the function exists */
+ if (fptr == NULL && type == 0) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p1 - 1].end;
+ return EXPR_ERROR_NOSUCHFUNCTION;
+ }
+
+ /* Count arguments */
+ if (p2 == p1 + 1) {
+ num = 0;
+ refnum = 0;
+ } else {
+ num = 1;
+ refnum = 0;
+
+
+ /* count commas */
+ for (pos = p1 + 1; pos < p2; pos++) {
+ switch (tokens[pos].type) {
+ case EXPR_TOKEN_OPAREN:
+ plevel++;
+ break;
+
+ case EXPR_TOKEN_CPAREN:
+ plevel--;
+ if (plevel < 0) {
+ obj->starterr = tokens[pos].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_UNMATCHEDPAREN;
+ }
+ break;
+
+ case EXPR_TOKEN_COMMA:
+ /* Found comma */
+ if (plevel == 0)
+ num++;
+ break;
+
+ case EXPR_TOKEN_AMPERSAND:
+ /* Found reference mark */
+ if (plevel == 0) {
+ /* This may only occur after the open parenthesis or comma */
+ if (tokens[pos - 1].type == EXPR_TOKEN_OPAREN || tokens[pos - 1].type == EXPR_TOKEN_COMMA)
+ refnum++;
+ else
+ return EXPR_ERROR_SYNTAX;
+ }
+ break;
+ }
+ }
+
+ /* plevel should be zero */
+ if (plevel != 0)
+ return EXPR_ERROR_UNMATCHEDPAREN;
+ }
+
+ /* We now have the number of total arguments and
+ number of ref arguments. Get number of normal
+ arguments */
+ num = num - refnum;
+
+ /* Make sure number of arguments is correct */
+ /* Here we make sure the limits are greater
+ or equal to zero because any negative number
+ could be used to specify no limit */
+ if (argmin >= 0 && num < argmin) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p2].end;
+ return EXPR_ERROR_BADNUMBERARGUMENTS;
+ }
+
+ if (argmax >= 0 && num > argmax) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p2].end;
+ return EXPR_ERROR_BADNUMBERARGUMENTS;
+ }
+
+ if (refargmin >= 0 && refnum < refargmin) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p2].end;
+ return EXPR_ERROR_BADNUMBERARGUMENTS;
+ }
+
+ if (refargmax >= 0 && refnum > refargmax) {
+ obj->starterr = tokens[p1 - 1].start;
+ obj->enderr = tokens[p2].end;
+ return EXPR_ERROR_BADNUMBERARGUMENTS;
+ }
+
+ /* Set tmp to null in case of no arguments */
+ tmp = NULL;
+ reftmp = NULL;
+
+ if (num > 0) {
+ /* Allocate subnodes */
+ tmp = exprAllocNodes(num);
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+ }
+
+ if (refnum > 0) {
+ /* Allocate ref pointers */
+ reftmp = exprAllocMem(sizeof(EXPRTYPE *) * refnum);
+ if (reftmp == NULL) {
+ exprFreeMem(tmp);
+ return EXPR_ERROR_MEMORY;
+ }
+ }
+
+
+
+ /* Set this node's data */
+ node->type = EXPR_NODETYPE_FUNCTION;
+ node->data.function.fptr = fptr;
+ node->data.function.nodecount = num;
+ node->data.function.nodes = tmp;
+ node->data.function.refcount = refnum;
+ node->data.function.refs = reftmp;
+ node->data.function.type = type;
+
+ /* parse each subnode */
+ if (num + refnum > 0) {
+ plevel = 0;
+ cur = 0;
+ refcur = 0;
+ lv = p1 + 1;
+
+ /* look for commas if more than 1 arg */
+ if (num + refnum > 1) {
+ for (pos = p1 + 1; pos < p2; pos++) {
+ switch (tokens[pos].type) {
+ case EXPR_TOKEN_OPAREN:
+ plevel++;
+ break;
+
+ case EXPR_TOKEN_CPAREN:
+ plevel--;
+ break; /* Already checked paren nesting above */
+
+ case EXPR_TOKEN_COMMA:
+ /* Found comma */
+ if (plevel == 0) {
+ /* parse inside */
+ if (tokens[lv].type == EXPR_TOKEN_AMPERSAND) {
+ if (lv != pos - 2) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[pos].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* It is a reference */
+ if (tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[lv + 1].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+
+ /* Make sure it is not a constant */
+ vars = exprGetConstList(obj);
+ if (vars) {
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[lv + 1].start;
+ return EXPR_ERROR_REFCONSTANT;
+ }
+ }
+
+ /* Get variable list */
+ vars = exprGetVarList(obj);
+ if (vars == NULL)
+ return EXPR_ERROR_NOVARLIST;
+
+ /* Get variable address */
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr == NULL) {
+ /* Add variable to list */
+ exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
+
+ /* Try to get address again */
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr == NULL)
+ return EXPR_ERROR_MEMORY; /* Could not add variable */
+ }
+
+ /* Set reference item */
+ reftmp[refcur] = addr;
+
+ /* increase ref arg number and lv position */
+ refcur++;
+ lv = pos + 1;
+ } else {
+ err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, pos - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+
+ /* increase arg number and lv position */
+ lv = pos + 1;
+ cur++;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /* lv should point after the last comma, or open paren. if only 1 arg */
+ if (tokens[lv].type == EXPR_TOKEN_AMPERSAND) {
+ if (lv != p2 - 2) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[p2].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* It is a reference */
+ if (tokens[lv + 1].type != EXPR_TOKEN_IDENTIFIER) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[lv + 1].end;
+ return EXPR_ERROR_SYNTAX;
+ }
+
+ /* Make sure it is not a constant */
+ vars = exprGetConstList(obj);
+ if (vars) {
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr) {
+ obj->starterr = tokens[lv].start;
+ obj->enderr = tokens[lv + 1].start;
+ return EXPR_ERROR_REFCONSTANT;
+ }
+ }
+
+ /* Get variable list */
+ vars = exprGetVarList(obj);
+ if (vars == NULL)
+ return EXPR_ERROR_NOVARLIST;
+
+ /* Get variable address */
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr == NULL) {
+ /* Add variable to list */
+ exprValListAdd(vars, tokens[lv + 1].data.str, 0.0);
+
+ /* Try to get address again */
+ exprValListGetAddress(vars, tokens[lv + 1].data.str, &addr);
+ if (addr == NULL)
+ return EXPR_ERROR_MEMORY; /* Could not add variable */
+ }
+
+ /* Set reference item */
+ reftmp[refcur] = addr;
+ } else {
+ err = exprInternalParse(obj, &(tmp[cur]), tokens, lv, p2 - 1);
+ if (err != EXPR_ERROR_NOERROR)
+ return err;
+ }
+ }
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Parse a variable or value */
-int exprInternalParseVarVal(exprObj *obj, exprNode *node, exprToken *tokens, int start, int end)
- {
- exprValList *l;
- EXPRTYPE *addr;
-
-
- /* Make sure positions are correct */
- if(start != end)
- {
- return EXPR_ERROR_UNKNOWN;
- }
-
-
- /* Are we an identifier */
- if(tokens[start].type == EXPR_TOKEN_IDENTIFIER)
- {
- /* we are an identifier */
-
- /* check to see if it is a constant */
- l = exprGetConstList(obj);
- if(l != NULL)
- {
- if(exprValListGetAddress(l, tokens[start].data.str, &addr) == EXPR_ERROR_NOERROR)
- {
- /* We found it in the constant list */
-
- /*
- Treat is like a variable node so application can change
- constant value and it will reflect in expression
- */
-
- node->type = EXPR_NODETYPE_VARIABLE;
- node->data.variable.vaddr = addr;
- return EXPR_ERROR_NOERROR;
- }
- }
-
- /* Not found in the constant list, so it must be a variable */
-
- /* Set node type */
- node->type = EXPR_NODETYPE_VARIABLE;
-
- /*
- The fast access method directly accesses the memory address
- of the variable's value at evaluation time. Because of this,
- we must make sure the variable does exists in the variable list.
- */
-
- /* Get the variable list */
- l = exprGetVarList(obj);
- if(l == NULL)
- return EXPR_ERROR_NOVARLIST;
-
- /* Get variable address if already in the list */
- exprValListGetAddress(l, tokens[start].data.str, &addr);
- if(addr == NULL) /* Variable not in the list, add it */
- {
- exprValListAdd(l, tokens[start].data.str, 0.0);
-
- /* Try to get address again */
- exprValListGetAddress(l, tokens[start].data.str, &addr);
- if(addr == NULL) /* Could not add variable */
- return EXPR_ERROR_MEMORY; /* Could not add variable to list */
- }
-
- node->data.variable.vaddr = addr;
-
- return EXPR_ERROR_NOERROR;
- }
- else if(tokens[start].type == EXPR_TOKEN_VALUE)
- {
- /* we are a value */
- node->type = EXPR_NODETYPE_VALUE;
- node->data.value.value = tokens[start].data.val;
- return EXPR_ERROR_NOERROR;
- }
- else
- {
- obj->starterr = tokens[start].start;
- obj->enderr = tokens[end].end;
- return EXPR_ERROR_UNKNOWN;
- }
- }
+int exprInternalParseVarVal(exprObj * obj, exprNode * node, exprToken * tokens, int start, int end)
+{
+ exprValList *l;
+ EXPRTYPE *addr;
+
+
+ /* Make sure positions are correct */
+ if (start != end) {
+ return EXPR_ERROR_UNKNOWN;
+ }
+
+
+ /* Are we an identifier */
+ if (tokens[start].type == EXPR_TOKEN_IDENTIFIER) {
+ /* we are an identifier */
+
+ /* check to see if it is a constant */
+ l = exprGetConstList(obj);
+ if (l != NULL) {
+ if (exprValListGetAddress(l, tokens[start].data.str, &addr) == EXPR_ERROR_NOERROR) {
+ /* We found it in the constant list */
+
+ /*
+ Treat is like a variable node so application can change
+ constant value and it will reflect in expression
+ */
+
+ node->type = EXPR_NODETYPE_VARIABLE;
+ node->data.variable.vaddr = addr;
+ return EXPR_ERROR_NOERROR;
+ }
+ }
+
+ /* Not found in the constant list, so it must be a variable */
+
+ /* Set node type */
+ node->type = EXPR_NODETYPE_VARIABLE;
+
+ /*
+ The fast access method directly accesses the memory address
+ of the variable's value at evaluation time. Because of this,
+ we must make sure the variable does exists in the variable list.
+ */
+
+ /* Get the variable list */
+ l = exprGetVarList(obj);
+ if (l == NULL)
+ return EXPR_ERROR_NOVARLIST;
+
+ /* Get variable address if already in the list */
+ exprValListGetAddress(l, tokens[start].data.str, &addr);
+ if (addr == NULL) { /* Variable not in the list, add it */
+ exprValListAdd(l, tokens[start].data.str, 0.0);
+
+ /* Try to get address again */
+ exprValListGetAddress(l, tokens[start].data.str, &addr);
+ if (addr == NULL) /* Could not add variable */
+ return EXPR_ERROR_MEMORY; /* Could not add variable to list */
+ }
+
+ node->data.variable.vaddr = addr;
+
+ return EXPR_ERROR_NOERROR;
+ } else if (tokens[start].type == EXPR_TOKEN_VALUE) {
+ /* we are a value */
+ node->type = EXPR_NODETYPE_VALUE;
+ node->data.value.value = tokens[start].data.val;
+ return EXPR_ERROR_NOERROR;
+ } else {
+ obj->starterr = tokens[start].start;
+ obj->enderr = tokens[end].end;
+ return EXPR_ERROR_UNKNOWN;
+ }
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprutil.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprutil.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprutil.c Tue May 27 07:24:06 2008
@@ -15,29 +15,27 @@
/* Return the version number */
void exprGetVersion(int *major, int *minor)
- {
- *major = EXPR_VERSIONMAJOR;
- *minor = EXPR_VERSIONMINOR;
- }
+{
+ *major = EXPR_VERSIONMAJOR;
+ *minor = EXPR_VERSIONMINOR;
+}
/* This utility function determines if an identifier is valid */
int exprValidIdent(char *name)
- {
- if(name == NULL) /* Null string */
- return 0;
-
- /* First must be letter or underscore */
- if(isalpha(*name) || *name == '_')
- name++; /* Point to next letter */
- else
- return 0; /* Not letter or underscore, maybe empty*/
-
- /* others can be letter, number, or underscore */
- while(isalnum(*name) || *name == '_')
- name++;
-
- /* When the while breaks out, we should be at the end */
- return (*name == '\0') ? 1 : 0;
- }
-
-
+{
+ if (name == NULL) /* Null string */
+ return 0;
+
+ /* First must be letter or underscore */
+ if (isalpha(*name) || *name == '_')
+ name++; /* Point to next letter */
+ else
+ return 0; /* Not letter or underscore, maybe empty */
+
+ /* others can be letter, number, or underscore */
+ while (isalnum(*name) || *name == '_')
+ name++;
+
+ /* When the while breaks out, we should be at the end */
+ return (*name == '\0') ? 1 : 0;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprval.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprval.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/exprval.c Tue May 27 07:24:06 2008
@@ -15,381 +15,365 @@
/* Internal functions */
-static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE *addr);
-static void exprValListFreeData(exprVal *val);
-static void exprValListResetData(exprVal *val);
+static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE * addr);
+static void exprValListFreeData(exprVal * val);
+static void exprValListResetData(exprVal * val);
/* This function creates the value list, */
-int exprValListCreate(exprValList **vlist)
- {
- exprValList *tmp;
+int exprValListCreate(exprValList ** vlist)
+{
+ exprValList *tmp;
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
- *vlist = NULL; /* Set to NULL initially */
+ *vlist = NULL; /* Set to NULL initially */
- tmp = exprAllocMem(sizeof(exprValList));
+ tmp = exprAllocMem(sizeof(exprValList));
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY; /* Could not allocate memory */
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY; /* Could not allocate memory */
- /* Update pointer */
- *vlist = tmp;
+ /* Update pointer */
+ *vlist = tmp;
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* Add a value to the list */
-int exprValListAdd(exprValList *vlist, char *name, EXPRTYPE val)
- {
- exprVal *tmp;
- exprVal *cur;
- int result;
-
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Make sure the name is valid */
- if(!exprValidIdent(name))
- return EXPR_ERROR_BADIDENTIFIER;
-
- if(vlist->head == NULL)
- {
- /* Create the node right here */
- tmp = exprCreateVal(name, val, NULL);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- vlist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
-
- /* See if already exists */
- cur = vlist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->vname);
-
- if(result == 0)
- return EXPR_ERROR_ALREADYEXISTS;
-
- cur = cur->next;
- }
-
- /* We did not find it, create it and add it to the beginning */
- tmp = exprCreateVal(name, val, NULL);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- tmp->next = vlist->head;
- vlist->head = tmp;
-
- return EXPR_ERROR_NOERROR;
- }
-
+int exprValListAdd(exprValList * vlist, char *name, EXPRTYPE val)
+{
+ exprVal *tmp;
+ exprVal *cur;
+ int result;
+
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Make sure the name is valid */
+ if (!exprValidIdent(name))
+ return EXPR_ERROR_BADIDENTIFIER;
+
+ if (vlist->head == NULL) {
+ /* Create the node right here */
+ tmp = exprCreateVal(name, val, NULL);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ vlist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+ }
+
+ /* See if already exists */
+ cur = vlist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->vname);
+
+ if (result == 0)
+ return EXPR_ERROR_ALREADYEXISTS;
+
+ cur = cur->next;
+ }
+
+ /* We did not find it, create it and add it to the beginning */
+ tmp = exprCreateVal(name, val, NULL);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ tmp->next = vlist->head;
+ vlist->head = tmp;
+
+ return EXPR_ERROR_NOERROR;
+}
+
/* Set a value in the list */
-int exprValListSet(exprValList *vlist, char *name, EXPRTYPE val)
- {
- exprVal *cur;
- int result;
-
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- if(name == NULL || name[0] == '\0')
- return EXPR_ERROR_NOTFOUND;
-
- /* Find and set it */
- cur = vlist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->vname);
-
- if(result == 0)
- {
- if(cur->vptr)
- *(cur->vptr) = val;
- else
- cur->vval = val;
-
- return EXPR_ERROR_NOERROR;
- }
-
- cur = cur->next;
- }
-
- return EXPR_ERROR_NOTFOUND;
- }
+int exprValListSet(exprValList * vlist, char *name, EXPRTYPE val)
+{
+ exprVal *cur;
+ int result;
+
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ if (name == NULL || name[0] == '\0')
+ return EXPR_ERROR_NOTFOUND;
+
+ /* Find and set it */
+ cur = vlist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->vname);
+
+ if (result == 0) {
+ if (cur->vptr)
+ *(cur->vptr) = val;
+ else
+ cur->vval = val;
+
+ return EXPR_ERROR_NOERROR;
+ }
+
+ cur = cur->next;
+ }
+
+ return EXPR_ERROR_NOTFOUND;
+}
/* Get the value from a list */
-int exprValListGet(exprValList *vlist, char *name, EXPRTYPE *val)
- {
- exprVal *cur;
- int result;
-
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- if(name == NULL || name[0] == '\0')
- return EXPR_ERROR_NOTFOUND;
-
- /* Search for the item */
- cur = vlist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->vname);
-
- if(result == 0)
- {
- /* We found it. */
- if(cur->vptr)
- *val = *(cur->vptr);
- else
- *val = cur->vval;
-
- /* return now */
- return EXPR_ERROR_NOERROR;
- }
-
- cur = cur->next;
- }
-
- /* If we got here, we did not find the item in the list */
- return EXPR_ERROR_NOTFOUND;
- }
-
+int exprValListGet(exprValList * vlist, char *name, EXPRTYPE * val)
+{
+ exprVal *cur;
+ int result;
+
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ if (name == NULL || name[0] == '\0')
+ return EXPR_ERROR_NOTFOUND;
+
+ /* Search for the item */
+ cur = vlist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->vname);
+
+ if (result == 0) {
+ /* We found it. */
+ if (cur->vptr)
+ *val = *(cur->vptr);
+ else
+ *val = cur->vval;
+
+ /* return now */
+ return EXPR_ERROR_NOERROR;
+ }
+
+ cur = cur->next;
+ }
+
+ /* If we got here, we did not find the item in the list */
+ return EXPR_ERROR_NOTFOUND;
+}
+
/* Add an address to the list */
-int exprValListAddAddress(exprValList *vlist, char *name, EXPRTYPE *addr)
- {
- exprVal *tmp;
- exprVal *cur;
- int result;
-
- if(vlist == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
- /* Make sure the name is valid */
- if(!exprValidIdent(name))
- return EXPR_ERROR_BADIDENTIFIER;
-
- if(vlist->head == NULL)
- {
- /* Create the node right here */
- tmp = exprCreateVal(name, (EXPRTYPE)0.0, addr);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- vlist->head = tmp;
- return EXPR_ERROR_NOERROR;
- }
-
- /* See if it already exists */
- cur = vlist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->vname);
-
- if(result == 0)
- return EXPR_ERROR_ALREADYEXISTS;
-
- cur = cur->next;
- }
-
- /* Add it to the list */
- tmp = exprCreateVal(name, (EXPRTYPE)0.0, addr);
-
- if(tmp == NULL)
- return EXPR_ERROR_MEMORY;
-
- tmp->next = vlist->head;
- vlist->head = tmp;
+int exprValListAddAddress(exprValList * vlist, char *name, EXPRTYPE * addr)
+{
+ exprVal *tmp;
+ exprVal *cur;
+ int result;
- return EXPR_ERROR_NOERROR;
- }
+ if (vlist == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+ /* Make sure the name is valid */
+ if (!exprValidIdent(name))
+ return EXPR_ERROR_BADIDENTIFIER;
+
+ if (vlist->head == NULL) {
+ /* Create the node right here */
+ tmp = exprCreateVal(name, (EXPRTYPE) 0.0, addr);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ vlist->head = tmp;
+ return EXPR_ERROR_NOERROR;
+ }
+
+ /* See if it already exists */
+ cur = vlist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->vname);
+
+ if (result == 0)
+ return EXPR_ERROR_ALREADYEXISTS;
+
+ cur = cur->next;
+ }
+
+ /* Add it to the list */
+ tmp = exprCreateVal(name, (EXPRTYPE) 0.0, addr);
+
+ if (tmp == NULL)
+ return EXPR_ERROR_MEMORY;
+
+ tmp->next = vlist->head;
+ vlist->head = tmp;
+
+ return EXPR_ERROR_NOERROR;
+}
/* Get memory address of a variable value in a value list */
-int exprValListGetAddress(exprValList *vlist, char *name, EXPRTYPE **addr)
- {
- exprVal *cur;
- int result;
-
- /* Not found yet */
- *addr = NULL;
-
- if(vlist == NULL || addr == NULL)
- return EXPR_ERROR_NULLPOINTER;
-
-
- if(name == NULL || name[0] == '\0')
- return EXPR_ERROR_NOTFOUND;
-
- /* Search for the item */
- cur = vlist->head;
-
- while(cur)
- {
- result = strcmp(name, cur->vname);
-
- if(result == 0)
- {
- /* We found it. */
- if(cur->vptr)
- *addr = cur->vptr;
- else
- *addr = &(cur->vval);
-
- /* return now */
- return EXPR_ERROR_NOERROR;
- }
-
- cur = cur->next;
- }
-
- /* If we got here, we did not find it in the list */
- return EXPR_ERROR_NOTFOUND;
- }
-
+int exprValListGetAddress(exprValList * vlist, char *name, EXPRTYPE ** addr)
+{
+ exprVal *cur;
+ int result;
+
+ /* Not found yet */
+ *addr = NULL;
+
+ if (vlist == NULL || addr == NULL)
+ return EXPR_ERROR_NULLPOINTER;
+
+
+ if (name == NULL || name[0] == '\0')
+ return EXPR_ERROR_NOTFOUND;
+
+ /* Search for the item */
+ cur = vlist->head;
+
+ while (cur) {
+ result = strcmp(name, cur->vname);
+
+ if (result == 0) {
+ /* We found it. */
+ if (cur->vptr)
+ *addr = cur->vptr;
+ else
+ *addr = &(cur->vval);
+
+ /* return now */
+ return EXPR_ERROR_NOERROR;
+ }
+
+ cur = cur->next;
+ }
+
+ /* If we got here, we did not find it in the list */
+ return EXPR_ERROR_NOTFOUND;
+}
+
/* This function is used to enumerate the values in a value list */
-void *exprValListGetNext(exprValList *vlist, char **name, EXPRTYPE *value, EXPRTYPE** addr, void *cookie)
- {
- exprVal *cur;
-
- if(vlist == NULL)
- return NULL;
-
- /* Get the current item */
- cur = (exprVal*)cookie;
-
- /* Find the next item */
- if(cur == NULL)
- cur = vlist->head;
- else
- cur = cur->next;
-
- /* Set up the data */
- if(cur)
- {
- if(name)
- *name = cur->vname;
-
- if(value)
- {
- if(cur->vptr)
- *value = *(cur->vptr);
- else
- *value = cur->vval;
- }
-
- if(addr)
- {
- if(cur->vptr)
- *addr = cur->vptr;
- else
- *addr = &(cur->vval);
- }
- }
-
- /* If there was no value, return NULL, otherwise, return the item */
- return (void*)cur;
- }
+void *exprValListGetNext(exprValList * vlist, char **name, EXPRTYPE * value, EXPRTYPE ** addr, void *cookie)
+{
+ exprVal *cur;
+
+ if (vlist == NULL)
+ return NULL;
+
+ /* Get the current item */
+ cur = (exprVal *) cookie;
+
+ /* Find the next item */
+ if (cur == NULL)
+ cur = vlist->head;
+ else
+ cur = cur->next;
+
+ /* Set up the data */
+ if (cur) {
+ if (name)
+ *name = cur->vname;
+
+ if (value) {
+ if (cur->vptr)
+ *value = *(cur->vptr);
+ else
+ *value = cur->vval;
+ }
+
+ if (addr) {
+ if (cur->vptr)
+ *addr = cur->vptr;
+ else
+ *addr = &(cur->vval);
+ }
+ }
+
+ /* If there was no value, return NULL, otherwise, return the item */
+ return (void *) cur;
+}
/* This routine will free the value list */
-int exprValListFree(exprValList *vlist)
- {
- /* Make sure it exists, if not it is not error */
- if(vlist == NULL)
- return EXPR_ERROR_NOERROR;
+int exprValListFree(exprValList * vlist)
+{
+ /* Make sure it exists, if not it is not error */
+ if (vlist == NULL)
+ return EXPR_ERROR_NOERROR;
- /* Free the nodes */
- exprValListFreeData(vlist->head);
+ /* Free the nodes */
+ exprValListFreeData(vlist->head);
- /* Freethe container */
- exprFreeMem(vlist);
+ /* Freethe container */
+ exprFreeMem(vlist);
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* This routine will reset the value list to 0.0 */
-int exprValListClear(exprValList *vlist)
- {
- if(vlist == NULL)
- return EXPR_ERROR_NOERROR;
+int exprValListClear(exprValList * vlist)
+{
+ if (vlist == NULL)
+ return EXPR_ERROR_NOERROR;
- exprValListResetData(vlist->head);
+ exprValListResetData(vlist->head);
- return EXPR_ERROR_NOERROR;
- }
+ return EXPR_ERROR_NOERROR;
+}
/* This routine will free any child nodes, and then free itself */
-static void exprValListFreeData(exprVal *val)
- {
- exprVal *next;
-
- while(val)
- {
- /* Remember the next */
- next = val->next;
-
- /* Free name */
- exprFreeMem(val->vname);
-
- /* Free ourself */
- exprFreeMem(val);
-
- val = next;
- }
- }
+static void exprValListFreeData(exprVal * val)
+{
+ exprVal *next;
+
+ while (val) {
+ /* Remember the next */
+ next = val->next;
+
+ /* Free name */
+ exprFreeMem(val->vname);
+
+ /* Free ourself */
+ exprFreeMem(val);
+
+ val = next;
+ }
+}
/* This routine will reset variables to 0.0 */
-static void exprValListResetData(exprVal *val)
- {
- while(val)
- {
- /* Reset data */
- if(val->vptr)
- *(val->vptr) = 0.0;
-
- val->vval = 0.0;
-
- val = val->next;
- }
- }
+static void exprValListResetData(exprVal * val)
+{
+ while (val) {
+ /* Reset data */
+ if (val->vptr)
+ *(val->vptr) = 0.0;
+
+ val->vval = 0.0;
+
+ val = val->next;
+ }
+}
/* This routine will create the value object */
-static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE *addr)
- {
- exprVal *tmp;
- char *vtmp;
-
- /* Name already tested in exprValListAdd */
-
- /* Create it */
- tmp = exprAllocMem(sizeof(exprVal));
- if(tmp == NULL)
- return NULL;
-
- /* Allocate space for the name */
- vtmp = exprAllocMem(strlen(name) + 1);
-
- if(vtmp == NULL)
- {
- exprFreeMem(tmp);
- return NULL;
- }
-
- /* Copy the data over */
- strcpy(vtmp, name);
- tmp->vname = vtmp;
- tmp->vval = val;
- tmp->vptr = addr;
+static exprVal *exprCreateVal(char *name, EXPRTYPE val, EXPRTYPE * addr)
+{
+ exprVal *tmp;
+ char *vtmp;
+
+ /* Name already tested in exprValListAdd */
+
+ /* Create it */
+ tmp = exprAllocMem(sizeof(exprVal));
+ if (tmp == NULL)
+ return NULL;
+
+ /* Allocate space for the name */
+ vtmp = exprAllocMem(strlen(name) + 1);
+
+ if (vtmp == NULL) {
+ exprFreeMem(tmp);
+ return NULL;
+ }
+
+ /* Copy the data over */
+ strcpy(vtmp, name);
+ tmp->vname = vtmp;
+ tmp->vval = val;
+ tmp->vptr = addr;
- return tmp;
- }
+ return tmp;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_expr/mod_expr.c Tue May 27 07:24:06 2008
@@ -33,145 +33,145 @@
/* Breaker function to break out of long expression functions
such as the 'for' function */
-int breaker(exprObj *o)
+int breaker(exprObj * o)
{
- /* Return nonzero to break out */
- return -1;
+ /* Return nonzero to break out */
+ return -1;
}
SWITCH_STANDARD_API(expr_function)
{
- exprObj *e = NULL;
- exprFuncList *f = NULL;
- exprValList *v = NULL;
- exprValList *c = NULL;
- EXPRTYPE last_expr;
+ exprObj *e = NULL;
+ exprFuncList *f = NULL;
+ exprValList *v = NULL;
+ exprValList *c = NULL;
+ EXPRTYPE last_expr;
const char *expr;
int err;
- char val[512] = "", *p;
- char *m_cmd = NULL;
- size_t len;
-
- if (switch_strlen_zero(cmd)) {
- goto error;
- }
-
- len = strlen(cmd) + 3;
-
-
- m_cmd = malloc(len);
- switch_assert(m_cmd);
- switch_copy_string(m_cmd, cmd, len);
-
- for (p = m_cmd; p && *p; p++) {
- if (*p == '|') {
- *p = ';';
- }
- }
-
- p = m_cmd + (strlen(m_cmd) - 1);
- if (*p != ';') {
- p++;
- *p = ';';
- p++;
- *p = '\0';
- }
-
- expr = m_cmd;
-
- /* Create function list */
- err = exprFuncListCreate(&f);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Init function list with internal functions */
- err = exprFuncListInit(f);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Add custom function */
- //err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1);
- //if (err != EXPR_ERROR_NOERROR)
+ char val[512] = "", *p;
+ char *m_cmd = NULL;
+ size_t len;
+
+ if (switch_strlen_zero(cmd)) {
+ goto error;
+ }
+
+ len = strlen(cmd) + 3;
+
+
+ m_cmd = malloc(len);
+ switch_assert(m_cmd);
+ switch_copy_string(m_cmd, cmd, len);
+
+ for (p = m_cmd; p && *p; p++) {
+ if (*p == '|') {
+ *p = ';';
+ }
+ }
+
+ p = m_cmd + (strlen(m_cmd) - 1);
+ if (*p != ';') {
+ p++;
+ *p = ';';
+ p++;
+ *p = '\0';
+ }
+
+ expr = m_cmd;
+
+ /* Create function list */
+ err = exprFuncListCreate(&f);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Init function list with internal functions */
+ err = exprFuncListInit(f);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Add custom function */
+ //err = exprFuncListAdd(f, my_func, "myfunc", 1, 1, 1, 1);
+ //if (err != EXPR_ERROR_NOERROR)
//goto error;
- /* Create constant list */
- err = exprValListCreate(&c);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Init constant list with internal constants */
- err = exprValListInit(c);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Create variable list */
- err = exprValListCreate(&v);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Create expression object */
- err = exprCreate(&e, f, v, c, breaker, NULL);
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Parse expression */
- err = exprParse(e, (char *)expr);
-
- if (err != EXPR_ERROR_NOERROR)
- goto error;
-
- /* Enable soft errors */
- //exprSetSoftErrors(e, 1);
-
+ /* Create constant list */
+ err = exprValListCreate(&c);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Init constant list with internal constants */
+ err = exprValListInit(c);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Create variable list */
+ err = exprValListCreate(&v);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Create expression object */
+ err = exprCreate(&e, f, v, c, breaker, NULL);
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Parse expression */
+ err = exprParse(e, (char *) expr);
+
+ if (err != EXPR_ERROR_NOERROR)
+ goto error;
+
+ /* Enable soft errors */
+ //exprSetSoftErrors(e, 1);
+
do {
err = exprEval(e, &last_expr);
} while (err);
- switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
- for (p = (val + strlen(val) - 1); p != val; p--) {
- if (*p != '0') {
- *(p+1) = '\0';
- break;
- }
- }
+ switch_snprintf(val, sizeof(val), "%0.10f", last_expr);
+ for (p = (val + strlen(val) - 1); p != val; p--) {
+ if (*p != '0') {
+ *(p + 1) = '\0';
+ break;
+ }
+ }
- p = val + strlen(val) - 1;
- if (*p == '.') {
- *p = '\0';
- }
+ p = val + strlen(val) - 1;
+ if (*p == '.') {
+ *p = '\0';
+ }
- stream->write_function(stream, "%s", val);
+ stream->write_function(stream, "%s", val);
- goto done;
+ goto done;
- error:
- /* Alert user of error */
- stream->write_function(stream, "!err!");
+ error:
+ /* Alert user of error */
+ stream->write_function(stream, "!err!");
- done:
- /* Do cleanup */
- if (e) {
- exprFree(e);
- }
+ done:
+ /* Do cleanup */
+ if (e) {
+ exprFree(e);
+ }
- if (f) {
- exprFuncListFree(f);
- }
+ if (f) {
+ exprFuncListFree(f);
+ }
- if (v) {
- exprValListFree(v);
- }
+ if (v) {
+ exprValListFree(v);
+ }
- if (c) {
- exprValListFree(c);
- }
+ if (c) {
+ exprValListFree(c);
+ }
- switch_safe_free(m_cmd);
+ switch_safe_free(m_cmd);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
@@ -181,10 +181,10 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_expr_load)
{
switch_api_interface_t *commands_api_interface;
-
+
/* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
SWITCH_ADD_API(commands_api_interface, "expr", "Eval an expession", expr_function, "<expr>");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c Tue May 27 07:24:06 2008
@@ -39,13 +39,13 @@
#define MAX_PRI 10
struct fifo_node {
- char *name;
- switch_mutex_t *mutex;
- switch_queue_t *fifo_list[MAX_PRI];
- switch_hash_t *caller_hash;
- switch_hash_t *consumer_hash;
- int caller_count;
- int consumer_count;
+ char *name;
+ switch_mutex_t *mutex;
+ switch_queue_t *fifo_list[MAX_PRI];
+ switch_hash_t *caller_hash;
+ switch_hash_t *consumer_hash;
+ int caller_count;
+ int consumer_count;
switch_time_t start_waiting;
uint32_t importance;
};
@@ -57,12 +57,12 @@
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
{
- switch_core_session_t *bleg = (switch_core_session_t *) buf;
+ switch_core_session_t *bleg = (switch_core_session_t *) buf;
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
- {
- switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
switch_channel_t *bchan = switch_core_session_get_channel(bleg);
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_ORIGINATOR)) {
@@ -71,11 +71,11 @@
return SWITCH_STATUS_BREAK;
} else if (dtmf->digit == '0') {
const char *moh_a = NULL, *moh_b = NULL;
-
+
if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) {
moh_b = switch_channel_get_variable(bchan, "hold_music");
}
-
+
if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) {
if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) {
moh_a = switch_channel_get_variable(channel, "hold_music");
@@ -86,7 +86,7 @@
return SWITCH_STATUS_IGNORE;
}
}
- }
+ }
break;
default:
break;
@@ -101,17 +101,17 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
- {
- switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *caller_exit_key = switch_channel_get_variable(channel, "fifo_caller_exit_key");
-
- if (caller_exit_key && dtmf->digit == *caller_exit_key) {
+
+ if (caller_exit_key && dtmf->digit == *caller_exit_key) {
char *bp = buf;
*bp = dtmf->digit;
return SWITCH_STATUS_BREAK;
- }
- }
+ }
+ }
break;
default:
break;
@@ -125,7 +125,7 @@
static int node_consumer_wait_count(fifo_node_t *node)
{
int i, len = 0;
-
+
for (i = 0; i < MAX_PRI; i++) {
len += switch_queue_size(node->fifo_list[i]);
}
@@ -142,9 +142,9 @@
if (!(len = switch_queue_size(node->fifo_list[i]))) {
continue;
}
- while(len) {
+ while (len) {
if (switch_queue_trypop(node->fifo_list[i], &pop) == SWITCH_STATUS_SUCCESS && pop) {
- if (!done && !strcmp((char *)pop, uuid)) {
+ if (!done && !strcmp((char *) pop, uuid)) {
free(pop);
done++;
} else {
@@ -181,7 +181,7 @@
static switch_status_t caller_read_frame_callback(switch_core_session_t *session, switch_frame_t *frame, void *user_data)
{
fifo_chime_data_t *cd = (fifo_chime_data_t *) user_data;
-
+
if (!cd) {
return SWITCH_STATUS_SUCCESS;
}
@@ -220,8 +220,8 @@
{
fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
int x = 0, total = 0, i = 0;
-
- for(i = 0; ; i++) {
+
+ for (i = 0;; i++) {
if (!(node = node_list[i])) {
break;
}
@@ -230,74 +230,74 @@
}
}
- if (total) {
- return SWITCH_STATUS_FALSE;
- }
+ if (total) {
+ return SWITCH_STATUS_FALSE;
+ }
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static struct {
- switch_hash_t *fifo_hash;
- switch_mutex_t *mutex;
- switch_memory_pool_t *pool;
- int running;
+ switch_hash_t *fifo_hash;
+ switch_mutex_t *mutex;
+ switch_memory_pool_t *pool;
+ int running;
} globals;
static fifo_node_t *create_node(const char *name, uint32_t importance)
{
- fifo_node_t *node;
+ fifo_node_t *node;
int x = 0;
-
- if (!globals.running) {
- return NULL;
- }
- node = switch_core_alloc(globals.pool, sizeof(*node));
- node->name = switch_core_strdup(globals.pool, name);
+ if (!globals.running) {
+ return NULL;
+ }
+
+ node = switch_core_alloc(globals.pool, sizeof(*node));
+ node->name = switch_core_strdup(globals.pool, name);
for (x = 0; x < MAX_PRI; x++) {
switch_queue_create(&node->fifo_list[x], SWITCH_CORE_QUEUE_LEN, globals.pool);
switch_assert(node->fifo_list[x]);
}
- switch_core_hash_init(&node->caller_hash, globals.pool);
- switch_core_hash_init(&node->consumer_hash, globals.pool);
-
- switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, globals.pool);
- switch_core_hash_insert(globals.fifo_hash, name, node);
+ switch_core_hash_init(&node->caller_hash, globals.pool);
+ switch_core_hash_init(&node->consumer_hash, globals.pool);
+
+ switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, globals.pool);
+ switch_core_hash_insert(globals.fifo_hash, name, node);
node->importance = importance;
- return node;
+ return node;
}
static void send_presence(fifo_node_t *node)
{
- switch_event_t *event;
+ switch_event_t *event;
int wait_count = 0;
- if (!globals.running) {
- return;
- }
+ if (!globals.running) {
+ return;
+ }
if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%s", "park");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "login", "%s", node->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s", node->name);
- if ((wait_count = node_consumer_wait_count(node)) > 0) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count);
- } else {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
- }
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", "unknown");
+ if ((wait_count = node_consumer_wait_count(node)) > 0) {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count);
+ } else {
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Idle");
+ }
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "rpid", "%s", "unknown");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", wait_count > 0 ? "early" : "terminated");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-state", "%s", wait_count > 0 ? "CS_ROUTING" : "CS_HANGUP");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "unique-id", "%s", node->name);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "answer-state", "%s", wait_count > 0 ? "early" : "terminated");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", "inbound");
switch_event_fire(&event);
}
}
@@ -307,29 +307,29 @@
{
char *to = switch_event_get_header(event, "to");
char *dup_to = NULL, *node_name;
- fifo_node_t *node;
+ fifo_node_t *node;
+
+ if (!globals.running) {
+ return;
+ }
- if (!globals.running) {
- return;
- }
-
if (!to || strncasecmp(to, "park+", 5)) {
return;
}
dup_to = strdup(to);
- switch_assert(dup_to);
+ switch_assert(dup_to);
node_name = dup_to + 5;
- switch_mutex_lock(globals.mutex);
- if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
- node = create_node(node_name, 0);
- }
+ switch_mutex_lock(globals.mutex);
+ if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) {
+ node = create_node(node_name, 0);
+ }
- send_presence(node);
+ send_presence(node);
- switch_mutex_unlock(globals.mutex);
+ switch_mutex_unlock(globals.mutex);
switch_safe_free(dup_to);
}
@@ -344,18 +344,18 @@
#define FIFO_USAGE "<fifo name> [in [<announce file>|undef] [<music file>|undef] | out [wait|nowait] [<announce file>|undef] [<music file>|undef]]"
SWITCH_STANDARD_APP(fifo_function)
{
- int argc;
- char *mydata = NULL, *argv[5] = { 0 };
- fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER+1] = { 0 };
- switch_channel_t *channel = switch_core_session_get_channel(session);
- int do_wait = 1, node_count = 0, i = 0;
- const char *moh = NULL;
- const char *announce = NULL;
- switch_event_t *event = NULL;
- char date[80] = "";
- switch_time_exp_t tm;
- switch_time_t ts = switch_timestamp_now();
- switch_size_t retsize;
+ int argc;
+ char *mydata = NULL, *argv[5] = { 0 };
+ fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER + 1] = { 0 };
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ int do_wait = 1, node_count = 0, i = 0;
+ const char *moh = NULL;
+ const char *announce = NULL;
+ switch_event_t *event = NULL;
+ char date[80] = "";
+ switch_time_exp_t tm;
+ switch_time_t ts = switch_timestamp_now();
+ switch_size_t retsize;
char *list_string;
int nlist_count;
char *nlist[MAX_NODES_PER_CONSUMER];
@@ -364,51 +364,51 @@
const char *arg_inout = NULL;
const char *serviced_uuid = NULL;
- if (!globals.running) {
- return;
- }
+ if (!globals.running) {
+ return;
+ }
if (switch_strlen_zero(data)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Args\n");
- return;
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Args\n");
+ return;
+ }
- mydata = switch_core_session_strdup(session, data);
- switch_assert(mydata);
+ mydata = switch_core_session_strdup(session, data);
+ switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
arg_fifo_name = argv[0];
arg_inout = argv[1];
-
- if (!(arg_fifo_name && arg_inout)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
- return;
- }
+
+ if (!(arg_fifo_name && arg_inout)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+ return;
+ }
if (!strcasecmp(arg_inout, "out")) {
consumer = 1;
} else if (strcasecmp(arg_inout, "in")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
- return;
+ return;
}
list_string = switch_core_session_strdup(session, arg_fifo_name);
- if (!(nlist_count = switch_separate_string(list_string, ',', nlist, (sizeof(nlist) / sizeof(nlist[0]))))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
- return;
+ if (!(nlist_count = switch_separate_string(list_string, ',', nlist, (sizeof(nlist) / sizeof(nlist[0]))))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+ return;
}
if (!consumer && nlist_count > 1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
- return;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
+ return;
}
switch_mutex_lock(globals.mutex);
- for(i = 0; i < nlist_count; i++) {
+ for (i = 0; i < nlist_count; i++) {
int importance = 0;
char *p;
-
+
if ((p = strrchr(nlist[i], '!'))) {
*p++ = '\0';
importance = atoi(p);
@@ -422,37 +422,37 @@
}
node_list[node_count++] = node;
}
- switch_mutex_unlock(globals.mutex);
+ switch_mutex_unlock(globals.mutex);
moh = switch_channel_get_variable(channel, "fifo_music");
- announce = switch_channel_get_variable(channel, "fifo_announce");
+ announce = switch_channel_get_variable(channel, "fifo_announce");
if (consumer) {
if (argc > 3) {
- announce = argv[3];
- }
+ announce = argv[3];
+ }
- if (argc > 4) {
- moh = argv[4];
- }
+ if (argc > 4) {
+ moh = argv[4];
+ }
} else {
if (argc > 2) {
- announce = argv[2];
- }
+ announce = argv[2];
+ }
- if (argc > 3) {
- moh = argv[3];
- }
+ if (argc > 3) {
+ moh = argv[3];
+ }
}
check_string(announce);
check_string(moh);
- if (!consumer && node) {
- switch_core_session_t *other_session;
+ if (!consumer && node) {
+ switch_core_session_t *other_session;
switch_channel_t *other_channel;
- const char *uuid = switch_core_session_get_uuid(session);
+ const char *uuid = switch_core_session_get_uuid(session);
const char *pri;
char tmp[25] = "";
int p = 0;
@@ -479,8 +479,8 @@
cd.orbit_timeout = switch_timestamp(NULL) + to;
}
}
-
-
+
+
if (chime_freq) {
ftmp = atoi(chime_freq);
if (ftmp > 0) {
@@ -490,50 +490,50 @@
- switch_channel_answer(channel);
+ switch_channel_answer(channel);
+
+ switch_mutex_lock(node->mutex);
+ node->caller_count++;
- switch_mutex_lock(node->mutex);
- node->caller_count++;
+ switch_core_hash_insert(node->caller_hash, uuid, session);
- switch_core_hash_insert(node->caller_hash, uuid, session);
-
- if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
+ if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) {
p = atoi(pri);
}
if (p >= MAX_PRI) {
p = MAX_PRI - 1;
}
-
+
if (!node_consumer_wait_count(node)) {
node->start_waiting = switch_timestamp_now();
}
-
- switch_queue_push(node->fifo_list[p], (void *)strdup(uuid));
+
+ switch_queue_push(node->fifo_list[p], (void *) strdup(uuid));
if (!pri) {
switch_snprintf(tmp, sizeof(tmp), "%d", p);
switch_channel_set_variable(channel, "fifo_priority", tmp);
}
- switch_mutex_unlock(node->mutex);
-
- ts = switch_timestamp_now();
- switch_time_exp_lt(&tm, ts);
- switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
- switch_channel_set_variable(channel, "fifo_status", "WAITING");
- switch_channel_set_variable(channel, "fifo_timestamp", date);
-
+ switch_mutex_unlock(node->mutex);
+
+ ts = switch_timestamp_now();
+ switch_time_exp_lt(&tm, ts);
+ switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+ switch_channel_set_variable(channel, "fifo_status", "WAITING");
+ switch_channel_set_variable(channel, "fifo_timestamp", date);
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "push");
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Slot", "%d", p);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "push");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Slot", "%d", p);
switch_event_fire(&event);
}
-
- switch_channel_set_flag(channel, CF_TAGGED);
+
+ switch_channel_set_flag(channel, CF_TAGGED);
if (chime_list) {
char *list_dup = switch_core_session_strdup(session, chime_list);
@@ -542,12 +542,12 @@
cd.next = switch_timestamp(NULL) + cd.freq;
}
- send_presence(node);
+ send_presence(node);
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
switch_input_args_t args = { 0 };
char buf[25] = "";
-
+
args.input_callback = moh_on_dtmf;
args.buf = buf;
args.buflen = sizeof(buf);
@@ -559,7 +559,7 @@
if (cd.abort || cd.do_orbit) {
aborted = 1;
- goto abort;
+ goto abort;
}
if ((serviced_uuid = switch_channel_get_variable(channel, "fifo_serviced_uuid"))) {
@@ -577,7 +577,7 @@
} else {
switch_ivr_collect_digits_callback(session, &args, 0);
}
-
+
if (caller_exit_key && *buf == *caller_exit_key) {
aborted = 1;
goto abort;
@@ -596,59 +596,59 @@
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
}
-
+
switch_core_session_flush_private_events(session);
if (switch_channel_ready(channel)) {
- if (announce) {
- switch_ivr_play_file(session, NULL, announce, NULL);
- }
- }
-
- switch_channel_clear_flag(channel, CF_TAGGED);
-
- abort:
-
- if (!aborted && switch_channel_ready(channel)) {
- switch_channel_set_state(channel, CS_HIBERNATE);
- } else {
- ts = switch_timestamp_now();
- switch_time_exp_lt(&tm, ts);
- switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
- switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
- switch_channel_set_variable(channel, "fifo_timestamp", date);
-
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", cd.do_orbit ? "timeout" : "abort");
- switch_event_fire(&event);
- }
- switch_mutex_lock(node->mutex);
+ if (announce) {
+ switch_ivr_play_file(session, NULL, announce, NULL);
+ }
+ }
+
+ switch_channel_clear_flag(channel, CF_TAGGED);
+
+ abort:
+
+ if (!aborted && switch_channel_ready(channel)) {
+ switch_channel_set_state(channel, CS_HIBERNATE);
+ } else {
+ ts = switch_timestamp_now();
+ switch_time_exp_lt(&tm, ts);
+ switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+ switch_channel_set_variable(channel, "fifo_status", cd.do_orbit ? "TIMEOUT" : "ABORTED");
+ switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", cd.do_orbit ? "timeout" : "abort");
+ switch_event_fire(&event);
+ }
+ switch_mutex_lock(node->mutex);
node_remove_uuid(node, uuid);
- node->caller_count--;
- switch_core_hash_delete(node->caller_hash, uuid);
- switch_mutex_unlock(node->mutex);
- send_presence(node);
-
- }
-
+ node->caller_count--;
+ switch_core_hash_delete(node->caller_hash, uuid);
+ switch_mutex_unlock(node->mutex);
+ send_presence(node);
+
+ }
+
if (cd.do_orbit && cd.orbit_exten) {
- if (orbit_ann) {
- switch_ivr_play_file(session, NULL, orbit_ann, NULL);
- }
+ if (orbit_ann) {
+ switch_ivr_play_file(session, NULL, orbit_ann, NULL);
+ }
switch_ivr_session_transfer(session, cd.orbit_exten, NULL, NULL);
}
- return;
- } else { /* consumer */
- void *pop = NULL;
- switch_frame_t *read_frame;
- switch_status_t status;
- char *uuid;
- int done = 0;
- switch_core_session_t *other_session;
- switch_input_args_t args = { 0 };
+ return;
+ } else { /* consumer */
+ void *pop = NULL;
+ switch_frame_t *read_frame;
+ switch_status_t status;
+ char *uuid;
+ int done = 0;
+ switch_core_session_t *other_session;
+ switch_input_args_t args = { 0 };
const char *pop_order = NULL;
int custom_pop = 0;
int pop_array[MAX_PRI] = { 0 };
@@ -660,7 +660,7 @@
const char *strat_str = switch_channel_get_variable(channel, "fifo_strategy");
fifo_strategy_t strat = STRAT_WAITING_LONGER;
-
+
if (!switch_strlen_zero(strat_str)) {
if (!strcasecmp(strat_str, "more_ppl")) {
strat = STRAT_MORE_PPL;
@@ -687,8 +687,8 @@
my_id = switch_core_session_get_uuid(session);
}
-
- if (do_wait) {
+
+ if (do_wait) {
for (i = 0; i < node_count; i++) {
if (!(node = node_list[i])) {
continue;
@@ -698,28 +698,28 @@
switch_core_hash_insert(node->consumer_hash, switch_core_session_get_uuid(session), session);
switch_mutex_unlock(node->mutex);
}
- switch_channel_answer(channel);
- }
-
+ switch_channel_answer(channel);
+ }
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_start");
- switch_event_fire(&event);
- }
-
- ts = switch_timestamp_now();
- switch_time_exp_lt(&tm, ts);
- switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
- switch_channel_set_variable(channel, "fifo_status", "WAITING");
- switch_channel_set_variable(channel, "fifo_timestamp", date);
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_start");
+ switch_event_fire(&event);
+ }
+
+ ts = switch_timestamp_now();
+ switch_time_exp_lt(&tm, ts);
+ switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+ switch_channel_set_variable(channel, "fifo_status", "WAITING");
+ switch_channel_set_variable(channel, "fifo_timestamp", date);
- if ((pop_order = switch_channel_get_variable(channel, "fifo_pop_order"))) {
+ if ((pop_order = switch_channel_get_variable(channel, "fifo_pop_order"))) {
char *tmp = switch_core_session_strdup(session, pop_order);
int x;
custom_pop = switch_separate_string(tmp, ',', pop_list, (sizeof(pop_list) / sizeof(pop_list[0])));
if (custom_pop >= MAX_PRI) {
- custom_pop = MAX_PRI -1;
+ custom_pop = MAX_PRI - 1;
}
for (x = 0; x < custom_pop; x++) {
@@ -731,33 +731,33 @@
}
}
}
-
- while(switch_channel_ready(channel)) {
+
+ while (switch_channel_ready(channel)) {
int x = 0, winner = -1;
switch_time_t longest = 0xFFFFFFFFFFFFFFFF / 2;
uint32_t importance = 0, waiting = 0, most_waiting = 0;
-
+
pop = NULL;
-
- if (moh && do_wait) {
+
+ if (moh && do_wait) {
switch_status_t moh_status = switch_ivr_play_file(session, NULL, moh, &args);
memset(&args, 0, sizeof(args));
- args.read_frame_callback = consumer_read_frame_callback;
- args.user_data = node_list;
- switch_ivr_play_file(session, NULL, moh, &args);
-
+ args.read_frame_callback = consumer_read_frame_callback;
+ args.user_data = node_list;
+ switch_ivr_play_file(session, NULL, moh, &args);
+
if (!SWITCH_READ_ACCEPTABLE(moh_status)) {
break;
}
- }
-
- for(i = 0; i < node_count; i++) {
+ }
+
+ for (i = 0; i < node_count; i++) {
if (!(node = node_list[i])) {
continue;
}
-
+
if ((waiting = node_consumer_wait_count(node))) {
-
+
if (!importance || node->importance > importance) {
if (strat == STRAT_WAITING_LONGER) {
if (node->start_waiting < longest) {
@@ -771,14 +771,14 @@
}
}
}
-
+
if (node->importance > importance) {
importance = node->importance;
}
}
}
-
+
if (winner > -1) {
node = node_list[winner];
} else {
@@ -787,76 +787,76 @@
if (node) {
if (custom_pop) {
- for(x = 0; x < MAX_PRI; x++) {
+ for (x = 0; x < MAX_PRI; x++) {
if (switch_queue_trypop(node->fifo_list[pop_array[x]], &pop) == SWITCH_STATUS_SUCCESS && pop) {
break;
}
}
} else {
- for(x = 0; x < MAX_PRI; x++) {
+ for (x = 0; x < MAX_PRI; x++) {
if (switch_queue_trypop(node->fifo_list[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
break;
}
}
}
-
+
if (pop && !node_consumer_wait_count(node)) {
switch_mutex_lock(node->mutex);
node->start_waiting = 0;
switch_mutex_unlock(node->mutex);
}
}
-
+
if (!pop) {
- if (!do_wait) {
- break;
- }
-
- status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
- if (!SWITCH_READ_ACCEPTABLE(status)) {
- break;
- }
-
- continue;
- }
-
- uuid = (char *) pop;
+ if (!do_wait) {
+ break;
+ }
+
+ status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
+
+ continue;
+ }
+
+ uuid = (char *) pop;
pop = NULL;
- if (node && (other_session = switch_core_session_locate(uuid))) {
- switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
- switch_caller_profile_t *cloned_profile;
+ if (node && (other_session = switch_core_session_locate(uuid))) {
+ switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+ switch_caller_profile_t *cloned_profile;
const char *o_announce = NULL;
const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
char *expanded = NULL;
-
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(other_channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "caller_pop");
- switch_event_fire(&event);
- }
-
- if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_pop");
- switch_event_fire(&event);
- }
+ switch_channel_event_set_data(other_channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "caller_pop");
+ switch_event_fire(&event);
+ }
+
+ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_pop");
+ switch_event_fire(&event);
+ }
if ((o_announce = switch_channel_get_variable(other_channel, "fifo_override_announce"))) {
announce = o_announce;
}
if (announce) {
- switch_ivr_play_file(session, NULL, announce, NULL);
- } else {
+ switch_ivr_play_file(session, NULL, announce, NULL);
+ } else {
switch_ivr_sleep(session, 500);
- }
-
-
+ }
+
+
switch_channel_set_variable(other_channel, "fifo_serviced_by", my_id);
switch_channel_set_variable(other_channel, "fifo_serviced_uuid", switch_core_session_get_uuid(session));
@@ -868,7 +868,7 @@
break;
}
}
-
+
if (!(switch_channel_ready(channel))) {
switch_channel_hangup(other_channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(other_session);
@@ -876,28 +876,28 @@
}
- switch_channel_answer(channel);
+ switch_channel_answer(channel);
cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
- switch_assert(cloned_profile);
- switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
+ switch_assert(cloned_profile);
+ switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
cloned_profile = switch_caller_profile_clone(session, switch_channel_get_caller_profile(other_channel));
- switch_assert(cloned_profile);
- switch_assert(cloned_profile->next == NULL);
- switch_channel_set_originatee_caller_profile(channel, cloned_profile);
-
- ts = switch_timestamp_now();
- switch_time_exp_lt(&tm, ts);
- switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
- switch_channel_set_variable(channel, "fifo_status", "TALKING");
- switch_channel_set_variable(channel, "fifo_target", uuid);
- switch_channel_set_variable(channel, "fifo_timestamp", date);
-
- switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
- switch_channel_set_variable(other_channel, "fifo_timestamp", date);
- switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
+ switch_assert(cloned_profile);
+ switch_assert(cloned_profile->next == NULL);
+ switch_channel_set_originatee_caller_profile(channel, cloned_profile);
+
+ ts = switch_timestamp_now();
+ switch_time_exp_lt(&tm, ts);
+ switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+ switch_channel_set_variable(channel, "fifo_status", "TALKING");
+ switch_channel_set_variable(channel, "fifo_target", uuid);
+ switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+ switch_channel_set_variable(other_channel, "fifo_status", "TALKING");
+ switch_channel_set_variable(other_channel, "fifo_timestamp", date);
+ switch_channel_set_variable(other_channel, "fifo_target", switch_core_session_get_uuid(session));
- send_presence(node);
+ send_presence(node);
if (record_template) {
@@ -905,7 +905,7 @@
switch_ivr_record_session(session, expanded, 0, NULL);
}
- switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
+ switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
if (record_template) {
switch_ivr_stop_record_session(session, expanded);
@@ -914,26 +914,26 @@
}
}
- ts = switch_timestamp_now();
- switch_time_exp_lt(&tm, ts);
- switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
- switch_channel_set_variable(channel, "fifo_status", "WAITING");
- switch_channel_set_variable(channel, "fifo_timestamp", date);
-
- switch_channel_set_variable(other_channel, "fifo_status", "DONE");
- switch_channel_set_variable(other_channel, "fifo_timestamp", date);
-
- switch_mutex_lock(node->mutex);
- node->caller_count--;
- switch_core_hash_delete(node->caller_hash, uuid);
- switch_mutex_unlock(node->mutex);
- send_presence(node);
- switch_core_session_rwunlock(other_session);
-
-
- if (!do_wait) {
- done = 1;
- }
+ ts = switch_timestamp_now();
+ switch_time_exp_lt(&tm, ts);
+ switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
+ switch_channel_set_variable(channel, "fifo_status", "WAITING");
+ switch_channel_set_variable(channel, "fifo_timestamp", date);
+
+ switch_channel_set_variable(other_channel, "fifo_status", "DONE");
+ switch_channel_set_variable(other_channel, "fifo_timestamp", date);
+
+ switch_mutex_lock(node->mutex);
+ node->caller_count--;
+ switch_core_hash_delete(node->caller_hash, uuid);
+ switch_mutex_unlock(node->mutex);
+ send_presence(node);
+ switch_core_session_rwunlock(other_session);
+
+
+ if (!do_wait) {
+ done = 1;
+ }
fifo_consumer_wrapup_sound = switch_channel_get_variable(channel, "fifo_consumer_wrapup_sound");
fifo_consumer_wrapup_key = switch_channel_get_variable(channel, "fifo_consumer_wrapup_key");
@@ -947,33 +947,33 @@
}
if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
- for(;;) {
- char terminator = 0;
- switch_ivr_collect_digits_count(session, buf, sizeof(buf)-1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0, 0);
+ for (;;) {
+ char terminator = 0;
+ switch_ivr_collect_digits_count(session, buf, sizeof(buf) - 1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0, 0);
if (terminator == *fifo_consumer_wrapup_key) {
break;
}
}
}
}
-
- switch_safe_free(uuid);
- if (done) {
- break;
- }
- }
-
+ switch_safe_free(uuid);
+
+ if (done) {
+ break;
+ }
+ }
+
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
- switch_channel_event_set_data(channel, event);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_stop");
- switch_event_fire(&event);
- }
+ switch_channel_event_set_data(channel, event);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Name", "%s", argv[0]);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "consumer_stop");
+ switch_event_fire(&event);
+ }
- if (do_wait) {
+ if (do_wait) {
for (i = 0; i < node_count; i++) {
- if (!(node = node_list[i])) {
+ if (!(node = node_list[i])) {
continue;
}
switch_mutex_lock(node->mutex);
@@ -981,150 +981,150 @@
node->consumer_count--;
switch_mutex_unlock(node->mutex);
}
- }
-
- }
+ }
+
+ }
}
static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char *tag, int cc_off, int verbose)
{
- switch_xml_t x_tmp, x_caller, x_cp, variables;
- switch_hash_index_t *hi;
- switch_core_session_t *session;
- switch_channel_t *channel;
- void *val;
- const void *var;
-
- x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
- switch_assert(x_tmp);
-
- for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
- int c_off = 0, d_off = 0;
- const char *status;
- const char *ts;
-
- switch_hash_this(hi, &var, NULL, &val);
- session = (switch_core_session_t *) val;
- channel = switch_core_session_get_channel(session);
- x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
- switch_assert(x_caller);
-
- switch_xml_set_attr_d(x_caller, "uuid", switch_core_session_get_uuid(session));
-
- if ((status = switch_channel_get_variable(channel, "fifo_status"))) {
- switch_xml_set_attr_d(x_caller, "status", status);
- }
-
- if ((ts = switch_channel_get_variable(channel, "fifo_timestamp"))) {
- switch_xml_set_attr_d(x_caller, "timestamp", ts);
- }
-
- if ((ts = switch_channel_get_variable(channel, "fifo_target"))) {
- switch_xml_set_attr_d(x_caller, "target", ts);
- }
-
+ switch_xml_t x_tmp, x_caller, x_cp, variables;
+ switch_hash_index_t *hi;
+ switch_core_session_t *session;
+ switch_channel_t *channel;
+ void *val;
+ const void *var;
+
+ x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
+ switch_assert(x_tmp);
+
+ for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
+ int c_off = 0, d_off = 0;
+ const char *status;
+ const char *ts;
+
+ switch_hash_this(hi, &var, NULL, &val);
+ session = (switch_core_session_t *) val;
+ channel = switch_core_session_get_channel(session);
+ x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
+ switch_assert(x_caller);
+
+ switch_xml_set_attr_d(x_caller, "uuid", switch_core_session_get_uuid(session));
+
+ if ((status = switch_channel_get_variable(channel, "fifo_status"))) {
+ switch_xml_set_attr_d(x_caller, "status", status);
+ }
+
+ if ((ts = switch_channel_get_variable(channel, "fifo_timestamp"))) {
+ switch_xml_set_attr_d(x_caller, "timestamp", ts);
+ }
+
+ if ((ts = switch_channel_get_variable(channel, "fifo_target"))) {
+ switch_xml_set_attr_d(x_caller, "target", ts);
+ }
+
if (!(x_cp = switch_xml_add_child_d(x_caller, "caller_profile", d_off++))) {
- abort();
+ abort();
}
- if (verbose) {
- d_off += switch_ivr_set_xml_profile_data(x_cp, switch_channel_get_caller_profile(channel), d_off);
-
- if (!(variables = switch_xml_add_child_d(x_caller, "variables", c_off++))) {
- abort();
- }
-
- switch_ivr_set_xml_chan_vars(variables, channel, c_off);
- }
-
- }
+ if (verbose) {
+ d_off += switch_ivr_set_xml_profile_data(x_cp, switch_channel_get_caller_profile(channel), d_off);
+
+ if (!(variables = switch_xml_add_child_d(x_caller, "variables", c_off++))) {
+ abort();
+ }
+
+ switch_ivr_set_xml_chan_vars(variables, channel, c_off);
+ }
+
+ }
- return cc_off;
+ return cc_off;
}
static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int verbose)
{
- switch_xml_t x_fifo;
- int cc_off = 0;
- char buffer[35];
+ switch_xml_t x_fifo;
+ int cc_off = 0;
+ char buffer[35];
char *tmp = buffer;
- x_fifo = switch_xml_add_child_d(x_report, "fifo", (*off)++);;
- switch_assert(x_fifo);
+ x_fifo = switch_xml_add_child_d(x_report, "fifo", (*off)++);;
+ switch_assert(x_fifo);
+
+ switch_xml_set_attr_d(x_fifo, "name", node->name);
+ switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
+ switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
+ switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
+ switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
+ switch_snprintf(tmp, sizeof(buffer), "%d", node_consumer_wait_count(node));
+ switch_xml_set_attr_d(x_fifo, "waiting_count", tmp);
+ switch_snprintf(tmp, sizeof(buffer), "%u", node->importance);
+ switch_xml_set_attr_d(x_fifo, "importance", tmp);
- switch_xml_set_attr_d(x_fifo, "name", node->name);
- switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
- switch_xml_set_attr_d(x_fifo, "consumer_count", tmp);
- switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count);
- switch_xml_set_attr_d(x_fifo, "caller_count", tmp);
- switch_snprintf(tmp, sizeof(buffer), "%d", node_consumer_wait_count(node));
- switch_xml_set_attr_d(x_fifo, "waiting_count", tmp);
- switch_snprintf(tmp, sizeof(buffer), "%u", node->importance);
- switch_xml_set_attr_d(x_fifo, "importance", tmp);
-
- cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
- cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
+ cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
+ cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
}
#define FIFO_API_SYNTAX "list|list_verbose|count|importance [<fifo name>]"
SWITCH_STANDARD_API(fifo_api_function)
{
- int len = 0;
- fifo_node_t *node;
- char *data = NULL;
- int argc = 0;
- char *argv[5] = { 0 };
- switch_hash_index_t *hi;
- void *val;
- const void *var;
- int x = 0, verbose = 0;
-
-
- if (!globals.running) {
- return SWITCH_STATUS_FALSE;
- }
-
- if (!switch_strlen_zero(cmd)) {
- data = strdup(cmd);
- switch_assert(data);
- }
-
- if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
- stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
- return SWITCH_STATUS_SUCCESS;
- }
-
- switch_mutex_lock(globals.mutex);
- verbose = !strcasecmp(argv[0], "list_verbose");
-
- if (!strcasecmp(argv[0], "list") || verbose) {
- char *xml_text = NULL;
- switch_xml_t x_report = switch_xml_new("fifo_report");
- switch_assert(x_report);
-
- if (argc < 2) {
- for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, &var, NULL, &val);
- node = (fifo_node_t *) val;
- switch_mutex_lock(node->mutex);
- list_node(node, x_report, &x, verbose);
- switch_mutex_unlock(node->mutex);
- }
- } else {
- if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
- switch_mutex_lock(node->mutex);
- list_node(node, x_report, &x, verbose);
- switch_mutex_unlock(node->mutex);
- }
- }
- xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
- switch_assert(xml_text);
- stream->write_function(stream, "%s\n", xml_text);
- switch_xml_free(x_report);
- switch_safe_free(xml_text);
-
- } else if (!strcasecmp(argv[0], "importance")) {
+ int len = 0;
+ fifo_node_t *node;
+ char *data = NULL;
+ int argc = 0;
+ char *argv[5] = { 0 };
+ switch_hash_index_t *hi;
+ void *val;
+ const void *var;
+ int x = 0, verbose = 0;
+
+
+ if (!globals.running) {
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!switch_strlen_zero(cmd)) {
+ data = strdup(cmd);
+ switch_assert(data);
+ }
+
+ if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
+ stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ switch_mutex_lock(globals.mutex);
+ verbose = !strcasecmp(argv[0], "list_verbose");
+
+ if (!strcasecmp(argv[0], "list") || verbose) {
+ char *xml_text = NULL;
+ switch_xml_t x_report = switch_xml_new("fifo_report");
+ switch_assert(x_report);
+
+ if (argc < 2) {
+ for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ node = (fifo_node_t *) val;
+ switch_mutex_lock(node->mutex);
+ list_node(node, x_report, &x, verbose);
+ switch_mutex_unlock(node->mutex);
+ }
+ } else {
+ if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+ switch_mutex_lock(node->mutex);
+ list_node(node, x_report, &x, verbose);
+ switch_mutex_unlock(node->mutex);
+ }
+ }
+ xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
+ switch_assert(xml_text);
+ stream->write_function(stream, "%s\n", xml_text);
+ switch_xml_free(x_report);
+ switch_safe_free(xml_text);
+
+ } else if (!strcasecmp(argv[0], "importance")) {
if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
int importance = 0;
if (argc > 2) {
@@ -1138,40 +1138,40 @@
} else {
stream->write_function(stream, "no fifo by that name\n");
}
- } else if (!strcasecmp(argv[0], "count")) {
- if (argc < 2) {
- for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, &var, NULL, &val);
- node = (fifo_node_t *) val;
+ } else if (!strcasecmp(argv[0], "count")) {
+ if (argc < 2) {
+ for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
+ node = (fifo_node_t *) val;
len = node_consumer_wait_count(node);
- switch_mutex_lock(node->mutex);
- stream->write_function(stream, "%s:%d:%d:%d\n", (char *)var, node->consumer_count, node->caller_count, len);
- switch_mutex_unlock(node->mutex);
- x++;
- }
-
- if (!x) {
- stream->write_function(stream, "none\n");
- }
- } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+ switch_mutex_lock(node->mutex);
+ stream->write_function(stream, "%s:%d:%d:%d\n", (char *) var, node->consumer_count, node->caller_count, len);
+ switch_mutex_unlock(node->mutex);
+ x++;
+ }
+
+ if (!x) {
+ stream->write_function(stream, "none\n");
+ }
+ } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
len = node_consumer_wait_count(node);
- switch_mutex_lock(node->mutex);
- stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len);
- switch_mutex_unlock(node->mutex);
+ switch_mutex_lock(node->mutex);
+ stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len);
+ switch_mutex_unlock(node->mutex);
} else {
stream->write_function(stream, "none\n");
- }
- }
+ }
+ }
- switch_mutex_unlock(globals.mutex);
- return SWITCH_STATUS_SUCCESS;
+ switch_mutex_unlock(globals.mutex);
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load)
{
switch_application_interface_t *app_interface;
- switch_api_interface_t *commands_api_interface;
+ switch_api_interface_t *commands_api_interface;
/* create/register custom event message type */
@@ -1186,15 +1186,15 @@
return SWITCH_STATUS_GENERR;
}
- switch_core_new_memory_pool(&globals.pool);
- switch_core_hash_init(&globals.fifo_hash, globals.pool);
- switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
+ switch_core_new_memory_pool(&globals.pool);
+ switch_core_hash_init(&globals.fifo_hash, globals.pool);
+ switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "fifo", "Park with FIFO", FIFO_DESC, fifo_function, FIFO_USAGE, SAF_NONE);
- SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
- globals.running = 1;
+ SWITCH_ADD_API(commands_api_interface, "fifo", "Return data about a fifo", fifo_api_function, FIFO_API_SYNTAX);
+ globals.running = 1;
return SWITCH_STATUS_SUCCESS;
}
@@ -1204,32 +1204,32 @@
*/
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
{
- switch_hash_index_t *hi;
- void *val, *pop;
- fifo_node_t *node;
- switch_memory_pool_t *pool = globals.pool;
- switch_mutex_t *mutex = globals.mutex;
-
- switch_mutex_lock(mutex);
-
- globals.running = 0;
- /* Cleanup*/
- for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
- int x = 0 ;
- switch_hash_this(hi, NULL, NULL, &val);
- node = (fifo_node_t *) val;
+ switch_hash_index_t *hi;
+ void *val, *pop;
+ fifo_node_t *node;
+ switch_memory_pool_t *pool = globals.pool;
+ switch_mutex_t *mutex = globals.mutex;
+
+ switch_mutex_lock(mutex);
+
+ globals.running = 0;
+ /* Cleanup */
+ for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+ int x = 0;
+ switch_hash_this(hi, NULL, NULL, &val);
+ node = (fifo_node_t *) val;
for (x = 0; x < MAX_PRI; x++) {
while (switch_queue_trypop(node->fifo_list[x], &pop) == SWITCH_STATUS_SUCCESS) {
free(pop);
}
}
- switch_core_hash_destroy(&node->caller_hash);
- switch_core_hash_destroy(&node->consumer_hash);
- }
- switch_core_hash_destroy(&globals.fifo_hash);
- memset(&globals, 0, sizeof(globals));
- switch_mutex_unlock(mutex);
- switch_core_destroy_memory_pool(&pool);
+ switch_core_hash_destroy(&node->caller_hash);
+ switch_core_hash_destroy(&node->consumer_hash);
+ }
+ switch_core_hash_destroy(&globals.fifo_hash);
+ memset(&globals, 0, sizeof(globals));
+ switch_mutex_unlock(mutex);
+ switch_core_destroy_memory_pool(&pool);
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fsv/mod_fsv.c Tue May 27 07:24:06 2008
@@ -61,35 +61,35 @@
switch_status_t status;
switch_frame_t *read_frame;
int bytes;
-
- eh->up = 1;
- while(switch_channel_ready(channel)) {
+
+ eh->up = 1;
+ while (switch_channel_ready(channel)) {
status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
+
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
- bytes = read_frame->packetlen |VID_BIT;
-
+ bytes = read_frame->packetlen | VID_BIT;
+
switch_mutex_lock(eh->mutex);
-
- if (write(eh->fd, &bytes, sizeof(bytes)) != (int)sizeof(bytes)) {
+
+ if (write(eh->fd, &bytes, sizeof(bytes)) != (int) sizeof(bytes)) {
switch_mutex_unlock(eh->mutex);
break;
}
- if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int)read_frame->packetlen) {
+ if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int) read_frame->packetlen) {
switch_mutex_unlock(eh->mutex);
break;
}
switch_mutex_unlock(eh->mutex);
-
+
switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
}
eh->up = 0;
@@ -101,24 +101,24 @@
switch_status_t status;
switch_frame_t *read_frame;
switch_channel_t *channel = switch_core_session_get_channel(session);
- struct record_helper eh = {0};
+ struct record_helper eh = { 0 };
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
int fd;
switch_mutex_t *mutex = NULL;
switch_codec_t codec, *read_codec, *vid_codec;
-
+
switch_channel_answer(channel);
-
- if ((fd = open((char *)data, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) {
+
+ if ((fd = open((char *) data, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
return;
}
-
+
switch_channel_answer(channel);
read_codec = switch_core_session_get_read_codec(session);
-
+
if (switch_core_codec_init(&codec,
"L16",
NULL,
@@ -131,14 +131,14 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n");
goto end;
}
-
+
switch_core_session_set_read_codec(session, &codec);
-
+
if (switch_channel_test_flag(channel, CF_VIDEO)) {
struct file_header h;
memset(&h, 0, sizeof(h));
vid_codec = switch_core_session_get_video_read_codec(session);
-
+
h.version = VERSION;
h.created = switch_timestamp_now();
switch_set_string(h.video_codec_name, vid_codec->implementation->iananame);
@@ -147,11 +147,11 @@
}
h.audio_rate = read_codec->implementation->samples_per_second;
h.audio_ptime = read_codec->implementation->microseconds_per_frame / 1000;
-
+
if (write(fd, &h, sizeof(h)) != sizeof(h)) {
goto end;
}
-
+
switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
eh.mutex = mutex;
eh.fd = fd;
@@ -161,12 +161,12 @@
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&thread, thd_attr, record_video_thread, &eh, switch_core_session_get_pool(session));
}
-
-
- while(switch_channel_ready(channel)) {
+
+
+ while (switch_channel_ready(channel)) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
@@ -186,7 +186,7 @@
break;
}
- if (write(fd, read_frame->data, read_frame->datalen) != (int)read_frame->datalen) {
+ if (write(fd, read_frame->data, read_frame->datalen) != (int) read_frame->datalen) {
if (mutex) {
switch_mutex_unlock(mutex);
}
@@ -198,42 +198,44 @@
}
}
-
- end:
+
+ end:
if (eh.up) {
- while(eh.up) {
+ while (eh.up) {
switch_yield(1000);
}
}
switch_core_session_set_read_codec(session, read_codec);
switch_core_codec_destroy(&codec);
-
+
}
SWITCH_STANDARD_APP(play_fsv_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_frame_t write_frame = {0}, vid_frame = {0};
+ switch_frame_t write_frame = { 0 }, vid_frame = {
+ 0};
int fd = -1;
int bytes;
- switch_codec_t *read_codec = NULL, codec = {0}, vid_codec = {0}, *read_vid_codec;
+ switch_codec_t *read_codec = NULL, codec = { 0 }, vid_codec = {
+ 0}, *read_vid_codec;
unsigned char *aud_buffer;
unsigned char *vid_buffer;
struct file_header h;
- uint32_t ts = 0, last = 0;
- switch_timer_t timer = {0};
+ uint32_t ts = 0, last = 0;
+ switch_timer_t timer = { 0 };
switch_payload_t pt = 0;
aud_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
vid_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
-
- if ((fd = open((char *)data, O_RDONLY)) < 0) {
+
+ if ((fd = open((char *) data, O_RDONLY)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data);
return;
}
-
+
if (read(fd, &h, sizeof(h)) != sizeof(h)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "error reading file header\n");
goto end;
@@ -246,7 +248,7 @@
switch_channel_set_variable(channel, "sip_force_video_fmtp", h.video_fmtp);
switch_channel_answer(channel);
-
+
if ((read_vid_codec = switch_core_session_get_video_read_codec(session))) {
pt = read_vid_codec->agreed_pt;
}
@@ -254,16 +256,16 @@
write_frame.codec = &codec;
write_frame.data = aud_buffer;
write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-
+
vid_frame.codec = &vid_codec;
vid_frame.packet = vid_buffer;
vid_frame.data = vid_buffer + 12;
vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
switch_set_flag((&vid_frame), SFF_RAW_RTP);
-
+
read_codec = switch_core_session_get_read_codec(session);
- if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_frame / 1000,
+ if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_frame / 1000,
read_codec->implementation->samples_per_frame, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "timer Activation Fail\n");
goto end;
@@ -281,7 +283,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n");
goto end;
}
-
+
if (switch_core_codec_init(&vid_codec,
h.video_codec_name,
NULL,
@@ -296,20 +298,20 @@
}
switch_core_session_set_read_codec(session, &codec);
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
if (read(fd, &bytes, sizeof(bytes)) != sizeof(bytes)) {
break;
}
-
+
if (bytes & VID_BIT) {
switch_rtp_hdr_t *hdr = vid_frame.packet;
bytes &= ~VID_BIT;
- if ((vid_frame.packetlen = read(fd, vid_frame.packet, bytes)) != (uint32_t)bytes) {
+ if ((vid_frame.packetlen = read(fd, vid_frame.packet, bytes)) != (uint32_t) bytes) {
break;
}
-
+
ts = ntohl(hdr->ts);
if (pt) {
hdr->pt = pt;
@@ -322,7 +324,7 @@
}
last = ts;
} else {
- if (bytes > (int)write_frame.buflen) {
+ if (bytes > (int) write_frame.buflen) {
bytes = write_frame.buflen;
}
if ((write_frame.datalen = read(fd, write_frame.data, bytes)) <= 0) {
@@ -333,9 +335,9 @@
}
}
-
- end:
-
+
+ end:
+
if (timer.interval) {
switch_core_timer_destroy(&timer);
}
@@ -343,15 +345,15 @@
if (read_codec) {
switch_core_session_set_read_codec(session, read_codec);
}
-
+
if (codec.implementation) {
switch_core_codec_destroy(&codec);
}
-
+
if (vid_codec.implementation) {
switch_core_codec_destroy(&vid_codec);
}
-
+
if (fd > -1) {
close(fd);
}
@@ -362,7 +364,7 @@
switch_application_interface_t *app_interface;
/* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_APP(app_interface, "play_fsv", "play an fsv file", "play an fsv file", play_fsv_function, "<file>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "record_fsv", "record an fsv file", "record an fsv file", record_fsv_function, "<file>", SAF_NONE);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_limit/mod_limit.c Tue May 27 07:24:06 2008
@@ -53,28 +53,16 @@
static char limit_sql[] =
"CREATE TABLE limit_data (\n"
- " hostname VARCHAR(255),\n"
- " realm VARCHAR(255),\n"
- " id VARCHAR(255),\n"
- " uuid VARCHAR(255)\n"
- ");\n";
+ " hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " id VARCHAR(255),\n" " uuid VARCHAR(255)\n" ");\n";
static char db_sql[] =
"CREATE TABLE db_data (\n"
- " hostname VARCHAR(255),\n"
- " realm VARCHAR(255),\n"
- " data_key VARCHAR(255),\n"
- " data VARCHAR(255)\n"
- ");\n";
+ " hostname VARCHAR(255),\n" " realm VARCHAR(255),\n" " data_key VARCHAR(255),\n" " data VARCHAR(255)\n" ");\n";
static char group_sql[] =
- "CREATE TABLE group_data (\n"
- " hostname VARCHAR(255),\n"
- " groupname VARCHAR(255),\n"
- " url VARCHAR(255)\n"
- ");\n";
+ "CREATE TABLE group_data (\n" " hostname VARCHAR(255),\n" " groupname VARCHAR(255),\n" " url VARCHAR(255)\n" ");\n";
@@ -86,9 +74,8 @@
if (mutex) {
switch_mutex_lock(mutex);
}
-
#ifdef SWITCH_HAVE_ODBC
- if (globals.odbc_dsn) {
+ if (globals.odbc_dsn) {
SQLHSTMT stmt;
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
@@ -110,33 +97,29 @@
switch_core_db_close(db);
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
- end:
+ end:
if (mutex) {
switch_mutex_unlock(mutex);
}
- return status;
+ return status;
}
-static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex,
- char *sql,
- switch_core_db_callback_func_t callback,
- void *pdata)
+static switch_bool_t limit_execute_sql_callback(switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
switch_bool_t ret = SWITCH_FALSE;
switch_core_db_t *db;
char *errmsg = NULL;
-
+
if (mutex) {
switch_mutex_lock(mutex);
}
-
#ifdef SWITCH_HAVE_ODBC
if (globals.odbc_dsn) {
switch_odbc_handle_callback_exec(globals.master_odbc, sql, callback, pdata);
@@ -161,7 +144,7 @@
}
#endif
- end:
+ end:
if (mutex) {
switch_mutex_unlock(mutex);
}
@@ -185,12 +168,12 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
}
-
+
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = NULL;
char *val = NULL;
-
+
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
@@ -198,9 +181,9 @@
#ifdef SWITCH_HAVE_ODBC
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
- *odbc_user++ = '\0';
+ *odbc_user++ = '\0';
if ((odbc_pass = strchr(odbc_user, ':'))) {
- *odbc_pass++ = '\0';
+ *odbc_pass++ = '\0';
}
}
#else
@@ -214,7 +197,6 @@
if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
globals.dbname = "call_limit";
}
-
#ifdef SWITCH_HAVE_ODBC
if (globals.odbc_dsn) {
@@ -228,11 +210,11 @@
status = SWITCH_STATUS_FALSE;
goto done;
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.odbc_dsn);
if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from limit_data", NULL) != SWITCH_STATUS_SUCCESS) {
if (switch_odbc_handle_exec(globals.master_odbc, limit_sql, NULL) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
}
}
if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from db_data", NULL) != SWITCH_STATUS_SUCCESS) {
@@ -258,10 +240,10 @@
}
switch_core_db_close(db);
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
- done:
+ done:
sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
limit_execute_sql(sql, globals.mutex);
@@ -284,8 +266,8 @@
if (state == CS_HANGUP || state == CS_ROUTING) {
id = switch_channel_get_variable(channel, "limit_id");
realm = switch_channel_get_variable(channel, "limit_realm");
- sql = switch_mprintf("delete from limit_data where uuid='%q' and hostname='%q' and realm='%q'and id='%q';",
- switch_core_session_get_uuid(session), globals.hostname, realm, id);
+ sql = switch_mprintf("delete from limit_data where uuid='%q' and hostname='%q' and realm='%q'and id='%q';",
+ switch_core_session_get_uuid(session), globals.hostname, realm, id);
limit_execute_sql(sql, globals.mutex);
switch_safe_free(sql);
switch_core_event_hook_remove_state_change(session, hanguphook);
@@ -343,8 +325,10 @@
sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
assert(sql);
limit_execute_sql(sql, NULL);
- switch_safe_free(sql);
- sql = switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2], argv[3]);
+ switch_safe_free(sql);
+ sql =
+ switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2],
+ argv[3]);
assert(sql);
limit_execute_sql(sql, NULL);
switch_safe_free(sql);
@@ -357,7 +341,7 @@
sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
assert(sql);
limit_execute_sql(sql, NULL);
- switch_safe_free(sql);
+ switch_safe_free(sql);
stream->write_function(stream, "+OK");
goto done;
} else if (!strcasecmp(argv[0], "select")) {
@@ -372,18 +356,18 @@
limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
stream->write_function(stream, "%s", buf);
goto done;
- }
+ }
- error:
+ error:
stream->write_function(stream, "!err!");
-
- done:
+
+ done:
switch_mutex_unlock(globals.mutex);
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
-
+
}
@@ -411,8 +395,10 @@
switch_assert(sql);
limit_execute_sql(sql, globals.mutex);
switch_safe_free(sql);
-
- sql = switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2], argv[3]);
+
+ sql =
+ switch_mprintf("insert into db_data (hostname, realm, data_key, data) values('%q','%q','%q','%q');", globals.hostname, argv[1], argv[2],
+ argv[3]);
} else if (!strcasecmp(argv[0], "delete")) {
sql = switch_mprintf("delete from db_data where realm='%q' and data_key='%q'", argv[1], argv[2]);
}
@@ -422,7 +408,7 @@
switch_safe_free(sql);
return;
-error:
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: db %s\n", DB_USAGE);
}
@@ -481,7 +467,7 @@
callback_t cbt = { 0 };
cbt.buf = buf;
cbt.len = sizeof(buf);
-
+
if (argc > 2) {
if (!strcasecmp(argv[2], "order")) {
how = "|";
@@ -497,15 +483,15 @@
goto done;
}
- error:
+ error:
stream->write_function(stream, "!err!");
-
- done:
+
+ done:
switch_mutex_unlock(globals.mutex);
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
-
+
}
#define GROUP_USAGE "[insert|delete]:<group name>:<val>"
@@ -544,7 +530,7 @@
#define LIMIT_USAGE "<realm> <id> <max> [transfer_destination_number]"
#define LIMIT_DESC "limit access to an extension"
-static char *limit_def_xfer_exten="limit_exceeded";
+static char *limit_def_xfer_exten = "limit_exceeded";
SWITCH_STANDARD_APP(limit_function)
{
@@ -585,7 +571,7 @@
if (max < 0) {
max = 0;
}
-
+
switch_channel_set_variable(channel, "limit_realm", realm);
switch_channel_set_variable(channel, "limit_id", id);
switch_channel_set_variable(channel, "limit_max", argv[2]);
@@ -602,11 +588,13 @@
}
switch_core_event_hook_add_state_change(session, hanguphook);
- sql = switch_mprintf("insert into limit_data (hostname, realm, id, uuid) values('%q','%q','%q','%q');", globals.hostname, realm, id, switch_core_session_get_uuid(session));
+ sql =
+ switch_mprintf("insert into limit_data (hostname, realm, id, uuid) values('%q','%q','%q','%q');", globals.hostname, realm, id,
+ switch_core_session_get_uuid(session));
limit_execute_sql(sql, NULL);
switch_safe_free(sql);
-done:
+ done:
switch_mutex_unlock(globals.mutex);
}
@@ -626,7 +614,7 @@
}
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
-
+
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_rss/mod_rss.c Tue May 27 07:24:06 2008
@@ -91,7 +91,7 @@
{
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:{
- switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
struct dtmf_buffer *dtb;
dtb = (struct dtmf_buffer *) buf;
@@ -175,7 +175,8 @@
uint32_t last;
char *mydata = NULL;
char *filename = NULL;
- char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {0};
+ char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = {
+ 0};
int argc, feed_index = 0;
const char *cf = "rss.conf";
switch_xml_t cfg, cxml, feeds, feed;
@@ -311,12 +312,12 @@
switch_core_speech_flush_tts(&sh);
#ifdef MATCH_COUNT
switch_snprintf(buf + len, sizeof(buf) - len, "%s",
- ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
- "Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
+ ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
+ "Select one of the following news sources, or press 0 to exit. " ",<break time=\"600ms\"/>");
#else
switch_snprintf(buf + len, sizeof(buf) - len, "%s",
- ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
- "Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
+ ",<break time=\"500ms\"/>Main Menu. <break time=\"600ms\"/> "
+ "Select one of the following news sources, followed by the pound key or press 0 to exit. " ",<break time=\"600ms\"/>");
#endif
len = (int32_t) strlen(buf);
@@ -482,8 +483,8 @@
switch_snprintf(buf, sizeof(buf),
- ",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
- title_txt, description_txt, rights_txt, date);
+ ",<break time=\"500ms\"/>%s. %s. %s. local time: %s, Press 0 for options, 5 to change voice, or pound to return to the main menu. ",
+ title_txt, description_txt, rights_txt, date);
args.input_callback = NULL;
args.buf = dtmf;
args.buflen = sizeof(dtmf);
@@ -539,7 +540,8 @@
}
if (switch_test_flag(&dtb, SFLAG_INFO)) {
switch_clear_flag(&dtb, SFLAG_INFO);
- switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice, dtb.speed);
+ switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s %s. I am speaking at %u words per minute. ", sh.engine, sh.voice,
+ dtb.speed);
tmplen = (uint32_t) strlen(tmpbuf);
}
@@ -547,12 +549,12 @@
switch_clear_flag(&dtb, SFLAG_INSTRUCT);
cont = 1;
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "%s",
- "Press star to pause or resume speech. "
- "To go to the next item, press six. "
- "To go back, press 4. "
- "Press two to go faster, eight to slow down, or 7 to resume normal speed. "
- "To change voices, press five. To restore the original voice press 9. "
- "To hear these options again, press zero or press pound to return to the main menu. ");
+ "Press star to pause or resume speech. "
+ "To go to the next item, press six. "
+ "To go back, press 4. "
+ "Press two to go faster, eight to slow down, or 7 to resume normal speed. "
+ "To change voices, press five. To restore the original voice press 9. "
+ "To hear these options again, press zero or press pound to return to the main menu. ");
} else {
switch_snprintf(tmpbuf + tmplen, sizeof(tmpbuf) - tmplen, "Story %d. ", dtb.index + 1);
tmplen = (uint32_t) strlen(tmpbuf);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_skel/mod_skel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_skel/mod_skel.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_skel/mod_skel.c Tue May 27 07:24:06 2008
@@ -41,7 +41,7 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_skel_load)
{
/* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp Tue May 27 07:24:06 2008
@@ -43,107 +43,107 @@
SWITCH_MODULE_DEFINITION(mod_soundtouch, mod_soundtouch_load, NULL, NULL);
struct soundtouch_helper {
- SoundTouch *st;
- switch_core_session_t *session;
- int send;
- int read;
- float pitch;
- float octaves;
- float semi;
- float rate;
- float tempo;
- int literal;
+ SoundTouch *st;
+ switch_core_session_t *session;
+ int send;
+ int read;
+ float pitch;
+ float octaves;
+ float semi;
+ float rate;
+ float tempo;
+ int literal;
};
static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
- switch_media_bug_t *bug;
- switch_channel_t *channel = switch_core_session_get_channel(session);
-
- if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
- struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
-
- if (sth) {
- if (sth->literal) {
- sth->literal = 0;
- return SWITCH_STATUS_SUCCESS;
- }
-
-
- switch(dtmf->digit) {
- case '*':
- sth->literal++;
- break;
- case '3':
- sth->semi += .5;
- sth->st->setPitchSemiTones(sth->semi);
- sth->st->flush();
- break;
- case '2':
- sth->semi = 0;
- sth->st->setPitchSemiTones(sth->semi);
- sth->st->flush();
- break;
- case '1':
- sth->semi -= .5;
- sth->st->setPitchSemiTones(sth->semi);
- sth->st->flush();
- break;
-
- case '6':
- sth->pitch += .2;
- sth->st->setPitch(sth->pitch);
- sth->st->flush();
- break;
- case '5':
- sth->pitch = 1;
- sth->st->setPitch(sth->pitch);
- sth->st->flush();
- break;
- case '4':
- sth->pitch -= .2;
- if (sth->pitch <= 0) {
- sth->pitch = .2;
- }
- sth->st->setPitch(sth->pitch);
- sth->st->flush();
- break;
-
- case '9':
- sth->octaves += .2;
- sth->st->setPitchOctaves(sth->octaves);
- sth->st->flush();
- break;
- case '8':
- sth->octaves = 0;
- sth->st->setPitchOctaves(sth->octaves);
- sth->st->flush();
- break;
- case '7':
- sth->octaves -= .2;
- sth->st->setPitchOctaves(sth->octaves);
- sth->st->flush();
- break;
-
-
- case '0':
- sth->octaves = 0;
- sth->st->setPitchOctaves(sth->octaves);
- sth->pitch = 1;
- sth->st->setPitch(sth->pitch);
- sth->semi = 0;
- sth->st->setPitchSemiTones(sth->semi);
- sth->st->flush();
-
- }
-
- }
-
-
- return SWITCH_STATUS_FALSE;
- }
- return SWITCH_STATUS_SUCCESS;
+ switch_media_bug_t *bug;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+
+ if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
+ struct soundtouch_helper *sth = (struct soundtouch_helper *) switch_core_media_bug_get_user_data(bug);
+
+ if (sth) {
+ if (sth->literal) {
+ sth->literal = 0;
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+
+ switch (dtmf->digit) {
+ case '*':
+ sth->literal++;
+ break;
+ case '3':
+ sth->semi += .5;
+ sth->st->setPitchSemiTones(sth->semi);
+ sth->st->flush();
+ break;
+ case '2':
+ sth->semi = 0;
+ sth->st->setPitchSemiTones(sth->semi);
+ sth->st->flush();
+ break;
+ case '1':
+ sth->semi -= .5;
+ sth->st->setPitchSemiTones(sth->semi);
+ sth->st->flush();
+ break;
+
+ case '6':
+ sth->pitch += .2;
+ sth->st->setPitch(sth->pitch);
+ sth->st->flush();
+ break;
+ case '5':
+ sth->pitch = 1;
+ sth->st->setPitch(sth->pitch);
+ sth->st->flush();
+ break;
+ case '4':
+ sth->pitch -= .2;
+ if (sth->pitch <= 0) {
+ sth->pitch = .2;
+ }
+ sth->st->setPitch(sth->pitch);
+ sth->st->flush();
+ break;
+
+ case '9':
+ sth->octaves += .2;
+ sth->st->setPitchOctaves(sth->octaves);
+ sth->st->flush();
+ break;
+ case '8':
+ sth->octaves = 0;
+ sth->st->setPitchOctaves(sth->octaves);
+ sth->st->flush();
+ break;
+ case '7':
+ sth->octaves -= .2;
+ sth->st->setPitchOctaves(sth->octaves);
+ sth->st->flush();
+ break;
+
+
+ case '0':
+ sth->octaves = 0;
+ sth->st->setPitchOctaves(sth->octaves);
+ sth->pitch = 1;
+ sth->st->setPitch(sth->pitch);
+ sth->semi = 0;
+ sth->st->setPitchSemiTones(sth->semi);
+ sth->st->flush();
+
+ }
+
+ }
+
+
+ return SWITCH_STATUS_FALSE;
+ }
+ return SWITCH_STATUS_SUCCESS;
}
@@ -153,85 +153,85 @@
switch (type) {
case SWITCH_ABC_TYPE_INIT:
- {
- switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
- sth->st = new SoundTouch();
- sth->st->setSampleRate(read_codec->implementation->samples_per_second);
- sth->st->setChannels(read_codec->implementation->number_of_channels);
-
- sth->st->setSetting(SETTING_USE_QUICKSEEK, 1);
- sth->st->setSetting(SETTING_USE_AA_FILTER, 1);
-
- if (sth->semi) {
- sth->st->setPitchSemiTones(sth->semi);
- }
-
- if (sth->pitch) {
- sth->st->setPitch(sth->pitch);
- }
-
- if (sth->octaves) {
- sth->st->setPitchOctaves(sth->octaves);
- }
-
- if (sth->rate) {
- sth->st->setRate(sth->rate);
- }
-
- if (sth->tempo) {
- sth->st->setRate(sth->tempo);
- }
-
- if (sth->send) {
- switch_core_event_hook_add_send_dtmf(sth->session, on_dtmf);
- } else {
- switch_core_event_hook_add_recv_dtmf(sth->session, on_dtmf);
- }
- }
- break;
+ {
+ switch_codec_t *read_codec = switch_core_session_get_read_codec(sth->session);
+ sth->st = new SoundTouch();
+ sth->st->setSampleRate(read_codec->implementation->samples_per_second);
+ sth->st->setChannels(read_codec->implementation->number_of_channels);
+
+ sth->st->setSetting(SETTING_USE_QUICKSEEK, 1);
+ sth->st->setSetting(SETTING_USE_AA_FILTER, 1);
+
+ if (sth->semi) {
+ sth->st->setPitchSemiTones(sth->semi);
+ }
+
+ if (sth->pitch) {
+ sth->st->setPitch(sth->pitch);
+ }
+
+ if (sth->octaves) {
+ sth->st->setPitchOctaves(sth->octaves);
+ }
+
+ if (sth->rate) {
+ sth->st->setRate(sth->rate);
+ }
+
+ if (sth->tempo) {
+ sth->st->setRate(sth->tempo);
+ }
+
+ if (sth->send) {
+ switch_core_event_hook_add_send_dtmf(sth->session, on_dtmf);
+ } else {
+ switch_core_event_hook_add_recv_dtmf(sth->session, on_dtmf);
+ }
+ }
+ break;
case SWITCH_ABC_TYPE_CLOSE:
- {
- delete sth->st;
- if (sth->send) {
- switch_core_event_hook_remove_send_dtmf(sth->session, on_dtmf);
- } else {
- switch_core_event_hook_remove_recv_dtmf(sth->session, on_dtmf);
- }
- }
+ {
+ delete sth->st;
+ if (sth->send) {
+ switch_core_event_hook_remove_send_dtmf(sth->session, on_dtmf);
+ } else {
+ switch_core_event_hook_remove_recv_dtmf(sth->session, on_dtmf);
+ }
+ }
break;
case SWITCH_ABC_TYPE_READ:
case SWITCH_ABC_TYPE_WRITE:
- break;
+ break;
case SWITCH_ABC_TYPE_READ_REPLACE:
case SWITCH_ABC_TYPE_WRITE_REPLACE:
- {
- switch_frame_t *frame;
-
- assert(sth != NULL);
- assert(sth->st != NULL);
-
- if (sth->read) {
- frame = switch_core_media_bug_get_read_replace_frame(bug);
- } else {
- frame = switch_core_media_bug_get_write_replace_frame(bug);
- }
-
- sth->st->putSamples((SAMPLETYPE *)frame->data, frame->samples);
-
- if (sth->st->numSamples() >= frame->samples * 2) {
- frame->samples = sth->st->receiveSamples((SAMPLETYPE *)frame->data, frame->samples);
- frame->datalen = frame->samples * 2;
- } else {
- memset(frame->data, 0, frame->datalen);
- }
-
- if (sth->read) {
- switch_core_media_bug_set_read_replace_frame(bug, frame);
- } else {
- switch_core_media_bug_set_write_replace_frame(bug, frame);
- }
-
- }
+ {
+ switch_frame_t *frame;
+
+ assert(sth != NULL);
+ assert(sth->st != NULL);
+
+ if (sth->read) {
+ frame = switch_core_media_bug_get_read_replace_frame(bug);
+ } else {
+ frame = switch_core_media_bug_get_write_replace_frame(bug);
+ }
+
+ sth->st->putSamples((SAMPLETYPE *) frame->data, frame->samples);
+
+ if (sth->st->numSamples() >= frame->samples * 2) {
+ frame->samples = sth->st->receiveSamples((SAMPLETYPE *) frame->data, frame->samples);
+ frame->datalen = frame->samples * 2;
+ } else {
+ memset(frame->data, 0, frame->datalen);
+ }
+
+ if (sth->read) {
+ switch_core_media_bug_set_read_replace_frame(bug, frame);
+ } else {
+ switch_core_media_bug_set_write_replace_frame(bug, frame);
+ }
+
+ }
default:
break;
}
@@ -241,68 +241,68 @@
SWITCH_STANDARD_APP(soundtouch_start_function)
{
- switch_media_bug_t *bug;
- switch_status_t status;
- switch_channel_t *channel = switch_core_session_get_channel(session);
- struct soundtouch_helper *sth;
- char *argv[6];
+ switch_media_bug_t *bug;
+ switch_status_t status;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ struct soundtouch_helper *sth;
+ char *argv[6];
int argc;
char *lbuf = NULL;
- int x;
-
- if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
- if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
- switch_channel_set_private(channel, "_soundtouch_", NULL);
- switch_core_media_bug_remove(session, &bug);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
- }
- return;
- }
+ int x;
+
+ if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
+ if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
+ switch_channel_set_private(channel, "_soundtouch_", NULL);
+ switch_core_media_bug_remove(session, &bug);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+ }
+ return;
+ }
- sth = (struct soundtouch_helper *) switch_core_session_alloc(session, sizeof(*sth));
- assert(sth != NULL);
+ sth = (struct soundtouch_helper *) switch_core_session_alloc(session, sizeof(*sth));
+ assert(sth != NULL);
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
- sth->send = 0;
- sth->read = 0;
- sth->pitch = 1;
- for(x = 0; x < argc; x++) {
- if (!strncasecmp(argv[x], "send", 4)) {
- sth->send = 1;
- } else if (!strncasecmp(argv[x], "read", 4)) {
- sth->read = 1;
- } else if (strchr(argv[x], 'p')) {
- if ((sth->pitch = atof(argv[x]) < 0)) {
- sth->pitch = 0;
- }
- } else if (strchr(argv[x], 'r')) {
- sth->rate = atof(argv[x]);
- } else if (strchr(argv[x], 'o')) {
- sth->octaves = atof(argv[x]);
- } else if (strchr(argv[x], 's')) {
- sth->semi = atof(argv[x]);
- } else if (strchr(argv[x], 't')) {
- if ((sth->tempo = atof(argv[x]) < 0)) {
- sth->tempo = 0;
- }
- }
- }
- }
-
-
- sth->session = session;
-
- if ((status = switch_core_media_bug_add(session, soundtouch_callback, sth, 0,
- sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure!\n");
+ sth->send = 0;
+ sth->read = 0;
+ sth->pitch = 1;
+ for (x = 0; x < argc; x++) {
+ if (!strncasecmp(argv[x], "send", 4)) {
+ sth->send = 1;
+ } else if (!strncasecmp(argv[x], "read", 4)) {
+ sth->read = 1;
+ } else if (strchr(argv[x], 'p')) {
+ if ((sth->pitch = atof(argv[x]) < 0)) {
+ sth->pitch = 0;
+ }
+ } else if (strchr(argv[x], 'r')) {
+ sth->rate = atof(argv[x]);
+ } else if (strchr(argv[x], 'o')) {
+ sth->octaves = atof(argv[x]);
+ } else if (strchr(argv[x], 's')) {
+ sth->semi = atof(argv[x]);
+ } else if (strchr(argv[x], 't')) {
+ if ((sth->tempo = atof(argv[x]) < 0)) {
+ sth->tempo = 0;
+ }
+ }
+ }
+ }
+
+
+ sth->session = session;
+
+ if ((status = switch_core_media_bug_add(session, soundtouch_callback, sth, 0,
+ sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure!\n");
return;
}
-
+
switch_channel_set_private(channel, "_soundtouch_", bug);
-
+
}
static switch_application_interface_t soundtouch_application_interface = {
/*.interface_name */ "soundtouch",
@@ -311,8 +311,8 @@
/* short_desc */ "Alter the audio stream",
/* syntax */ "[send|recv] [-]<X>s [.]<X>p",
/* flags */ SAF_NONE,
- /* next*/
-
+ /* next */
+
};
static switch_loadable_module_interface_t soundtouch_module_interface = {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c Tue May 27 07:24:06 2008
@@ -35,7 +35,7 @@
#include <switch_odbc.h>
#endif
-#ifdef _MSC_VER /* compilers are stupid sometimes */
+#ifdef _MSC_VER /* compilers are stupid sometimes */
#define TRY_CODE(code) for(;;) {status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;}
#else
#define TRY_CODE(code) do { status = code; if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { goto end; } break;} while(status)
@@ -62,7 +62,7 @@
char play_new_messages_key[2];
char play_saved_messages_key[2];
- char main_menu_key[2];
+ char main_menu_key[2];
char config_menu_key[2];
char record_greeting_key[2];
char choose_greeting_key[2];
@@ -141,7 +141,7 @@
switch_core_db_close(db);
}
-end:
+ end:
if (mutex) {
switch_mutex_unlock(mutex);
}
@@ -149,11 +149,7 @@
}
-static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile,
- switch_mutex_t *mutex,
- char *sql,
- switch_core_db_callback_func_t callback,
- void *pdata)
+static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
switch_bool_t ret = SWITCH_FALSE;
switch_core_db_t *db;
@@ -185,7 +181,7 @@
}
}
-end:
+ end:
if (mutex) {
switch_mutex_unlock(mutex);
}
@@ -196,26 +192,19 @@
static char vm_sql[] =
"CREATE TABLE voicemail_msgs (\n"
" created_epoch INTEGER,\n"
- " read_epoch INTEGER,\n"
- " username VARCHAR(255),\n"
- " domain VARCHAR(255),\n"
- " uuid VARCHAR(255),\n"
- " cid_name VARCHAR(255),\n"
- " cid_number VARCHAR(255),\n"
- " in_folder VARCHAR(255),\n"
- " file_path VARCHAR(255),\n"
- " message_len INTEGER,\n"
- " flags VARCHAR(255),\n"
- " read_flags VARCHAR(255)\n"
- ");\n";
+ " read_epoch INTEGER,\n"
+ " username VARCHAR(255),\n"
+ " domain VARCHAR(255),\n"
+ " uuid VARCHAR(255),\n"
+ " cid_name VARCHAR(255),\n"
+ " cid_number VARCHAR(255),\n"
+ " in_folder VARCHAR(255),\n"
+ " file_path VARCHAR(255),\n" " message_len INTEGER,\n" " flags VARCHAR(255),\n" " read_flags VARCHAR(255)\n" ");\n";
static char vm_pref_sql[] =
"CREATE TABLE voicemail_prefs (\n"
- " username VARCHAR(255),\n"
- " domain VARCHAR(255),\n"
- " name_path VARCHAR(255),\n"
- " greeting_path VARCHAR(255)\n"
- ");\n";
+ " username VARCHAR(255),\n"
+ " domain VARCHAR(255),\n" " name_path VARCHAR(255),\n" " greeting_path VARCHAR(255)\n" ");\n";
static switch_status_t load_config(void)
{
@@ -254,7 +243,7 @@
char *play_new_messages_key = "1";
char *play_saved_messages_key = "2";
- char *main_menu_key = "0";
+ char *main_menu_key = "0";
char *config_menu_key = "5";
char *record_greeting_key = "1";
char *choose_greeting_key = "2";
@@ -328,17 +317,14 @@
if (switch_is_file_path(val)) {
path = val;
} else {
- dpath = switch_mprintf("%s%s%s",
- SWITCH_GLOBAL_dirs.conf_dir,
- SWITCH_PATH_SEPARATOR,
- val);
+ dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
path = dpath;
}
if ((fd = open(path, O_RDONLY)) > -1) {
char buf[2048];
SWITCH_STANDARD_STREAM(stream);
- while(switch_fd_read_line(fd, buf, sizeof(buf))) {
+ while (switch_fd_read_line(fd, buf, sizeof(buf))) {
stream.write_function(&stream, "%s", buf);
}
close(fd);
@@ -373,17 +359,14 @@
if (switch_is_file_path(val)) {
path = val;
} else {
- dpath = switch_mprintf("%s%s%s",
- SWITCH_GLOBAL_dirs.conf_dir,
- SWITCH_PATH_SEPARATOR,
- val);
+ dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, val);
path = dpath;
}
if ((fd = open(path, O_RDONLY)) > -1) {
char buf[2048];
SWITCH_STANDARD_STREAM(stream);
- while(switch_fd_read_line(fd, buf, sizeof(buf))) {
+ while (switch_fd_read_line(fd, buf, sizeof(buf))) {
stream.write_function(&stream, "%s", buf);
}
close(fd);
@@ -437,10 +420,10 @@
operator_key = val;
} else if (!strcasecmp(var, "operator-extension") && !switch_strlen_zero(val)) {
operator_ext = val;
- } else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
- vmain_key = val;
- } else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
- vmain_ext = val;
+ } else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
+ vmain_key = val;
+ } else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
+ vmain_ext = val;
} else if (!strcasecmp(var, "storage-dir") && !switch_strlen_zero(val)) {
storage_dir = val;
} else if (!strcasecmp(var, "callback-dialplan") && !switch_strlen_zero(val)) {
@@ -577,19 +560,18 @@
switch_odbc_handle_exec(profile->master_odbc, vm_pref_sql, NULL);
}
- if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
- /* XXX: Old table found.. migrating data into new table */
- if (switch_odbc_handle_exec(profile->master_odbc,
+ if (switch_odbc_handle_exec(profile->master_odbc, "select count(message_len) from voicemail_data", NULL) == SWITCH_ODBC_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Old table voicemail_data found, migrating data!\n");
+ /* XXX: Old table found.. migrating data into new table */
+ if (switch_odbc_handle_exec(profile->master_odbc,
"insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
NULL) != SWITCH_ODBC_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
- continue;
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to migrate old voicemail_data to voicemail_msgs!\n");
+ continue;
+ }
switch_odbc_handle_exec(profile->master_odbc, "drop table voicemail_data", NULL);
- }
-
+ }
#endif
} else {
if ((db = switch_core_db_open_file(profile->dbname))) {
@@ -604,12 +586,12 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Migrating data from voicemail_data to voicemail_msgs!\n");
switch_core_db_exec(db, "insert into voicemail_msgs select created_epoch, read_epoch, user as username, domain, uuid,"
"cid_name, cid_number, in_folder, file_path, message_len, flags, read_flags from voicemail_data",
- NULL, NULL, &errmsg);
+ NULL, NULL, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
switch_core_db_free(errmsg);
errmsg = NULL;
- }
+ }
switch_core_db_exec(db, "drop table voicemail_data", NULL, NULL, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n", errmsg);
@@ -625,7 +607,7 @@
continue;
}
switch_core_db_close(db);
- }
+ }
profile->web_head = web_head;
profile->web_tail = web_tail;
@@ -660,13 +642,13 @@
*profile->rew_key = *rew_key;
*profile->urgent_key = *urgent_key;
*profile->operator_key = *operator_key;
- *profile->vmain_key = *vmain_key;
+ *profile->vmain_key = *vmain_key;
profile->record_threshold = record_threshold;
profile->record_silence_hits = record_silence_hits;
profile->record_sample_rate = record_sample_rate;
profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
- profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
+ profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
profile->tone_spec = switch_core_strdup(globals.pool, tone_spec);
profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan);
@@ -684,7 +666,7 @@
}
}
-end:
+ end:
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
}
@@ -730,7 +712,9 @@
switch_file_handle_t *fh = cc->fh;
uint32_t pos = 0;
- if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key || dtmf->digit == *cc->profile->terminator_key)) {
+ if (!cc->noexit
+ && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key
+ || dtmf->digit == *cc->profile->terminator_key)) {
*cc->buf = dtmf->digit;
return SWITCH_STATUS_BREAK;
}
@@ -770,7 +754,7 @@
break;
default:
break;
- }
+ }
return SWITCH_STATUS_SUCCESS;
}
@@ -834,12 +818,7 @@
static switch_status_t vm_macro_get(switch_core_session_t *session,
char *macro,
char *macro_arg,
- char *buf,
- switch_size_t buflen,
- switch_size_t maxlen,
- char *term_chars,
- char *terminator_key,
- uint32_t timeout)
+ char *buf, switch_size_t buflen, switch_size_t maxlen, char *term_chars, char *terminator_key, uint32_t timeout)
{
switch_input_args_t args = { 0 }, *ap = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -849,7 +828,7 @@
memset(buf, 0, buflen);
args.input_callback = cancel_on_dtmf;
args.buf = buf;
- args.buflen = (uint32_t)buflen;
+ args.buflen = (uint32_t) buflen;
ap = &args;
}
@@ -869,7 +848,7 @@
bslen = strlen(buf);
if (maxlen == 0 || maxlen > buflen - 1) {
- maxlen = buflen -1;
+ maxlen = buflen - 1;
}
if (bslen < maxlen) {
status = switch_ivr_collect_digits_count(session, buf + bslen, buflen, maxlen - bslen, term_chars, terminator_key, timeout, 0, 0);
@@ -913,29 +892,26 @@
} msg_type_t;
-static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile,
- char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
+static switch_status_t create_file(switch_core_session_t *session, vm_profile_t *profile,
+ char *macro_name, char *file_path, switch_size_t *message_len, switch_bool_t limit)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_file_handle_t fh = { 0 };
switch_input_args_t args = { 0 };
char term;
- char input[10] = "" , key_buf[80] = "";
+ char input[10] = "", key_buf[80] = "";
cc_t cc = { 0 };
switch_codec_t *read_codec;
read_codec = switch_core_session_get_read_codec(session);
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
- switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s",
- profile->listen_file_key,
- profile->save_file_key,
- profile->record_file_key);
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s", profile->listen_file_key, profile->save_file_key, profile->record_file_key);
-record_file:
- *message_len = 0;
+ record_file:
+ *message_len = 0;
args.input_callback = cancel_on_dtmf;
TRY_CODE(switch_ivr_phrase_macro(session, macro_name, NULL, NULL, NULL));
TRY_CODE(switch_ivr_gentones(session, profile->tone_spec, 0, NULL));
@@ -946,22 +922,22 @@
fh.samplerate = profile->record_sample_rate;
switch_ivr_record_file(session, &fh, file_path, &args, profile->max_record_len);
if (limit && (*message_len = fh.sample_count / read_codec->implementation->actual_samples_per_second) < profile->min_record_len) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n",
- profile->min_record_len);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Message is less than minimum record length: %d, discarding it.\n",
+ profile->min_record_len);
if (unlink(file_path) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
}
- if (switch_channel_ready(channel)) {
- /* TODO Rel 1.0 : Add Playback of Prompt <message is too short, please rerecord your message>, then go back at record_file */
- goto record_file;
- } else {
- status = SWITCH_STATUS_BREAK;
- goto end;
- }
- } else {
- status = SWITCH_STATUS_SUCCESS;
- }
-play_file:
+ if (switch_channel_ready(channel)) {
+ /* TODO Rel 1.0 : Add Playback of Prompt <message is too short, please rerecord your message>, then go back at record_file */
+ goto record_file;
+ } else {
+ status = SWITCH_STATUS_BREAK;
+ goto end;
+ }
+ } else {
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ play_file:
memset(&fh, 0, sizeof(fh));
args.input_callback = control_playback;
memset(&cc, 0, sizeof(cc));
@@ -970,15 +946,14 @@
args.buf = &cc;
switch_ivr_play_file(session, &fh, file_path, &args);
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
if (*cc.buf) {
*input = *cc.buf;
- *(input+1) = '\0';
+ *(input + 1) = '\0';
status = SWITCH_STATUS_SUCCESS;
*cc.buf = '\0';
} else {
- status = vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO,
- key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+ status = vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
}
if (!strcmp(input, profile->listen_file_key)) {
@@ -992,7 +967,7 @@
}
}
-end:
+ end:
return status;
}
@@ -1042,7 +1017,7 @@
}
-static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, char *myfolder,
+static void message_count(vm_profile_t *profile, const char *myid, const char *domain_name, char *myfolder,
int *total_new_messages, int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
{
char msg_count[80] = "";
@@ -1052,37 +1027,27 @@
cbt.buf = msg_count;
cbt.len = sizeof(msg_count);
- switch_snprintf(sql, sizeof(sql),
- "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
- myid,
- domain_name,
- myfolder);
+ switch_snprintf(sql, sizeof(sql),
+ "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0",
+ myid, domain_name, myfolder);
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_new_messages = atoi(msg_count);
- switch_snprintf(sql, sizeof(sql),
- "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'",
- myid,
- domain_name,
- myfolder,
- URGENT_FLAG_STRING);
+ switch_snprintf(sql, sizeof(sql),
+ "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch=0 and read_flags='%s'",
+ myid, domain_name, myfolder, URGENT_FLAG_STRING);
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_new_urgent_messages = atoi(msg_count);
- switch_snprintf(sql, sizeof(sql),
- "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
- myid,
- domain_name,
- myfolder);
+ switch_snprintf(sql, sizeof(sql),
+ "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0",
+ myid, domain_name, myfolder);
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_saved_messages = atoi(msg_count);
- switch_snprintf(sql, sizeof(sql),
- "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'",
- myid,
- domain_name,
- myfolder,
- URGENT_FLAG_STRING);
+ switch_snprintf(sql, sizeof(sql),
+ "select count(*) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' and read_epoch!=0 and read_flags='%s'",
+ myid, domain_name, myfolder, URGENT_FLAG_STRING);
vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
*total_saved_urgent_messages = atoi(msg_count);
}
@@ -1094,7 +1059,7 @@
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_input_args_t args = { 0 };
char term;
- char input[10] = "" , key_buf[80] = "";
+ char input[10] = "", key_buf[80] = "";
switch_file_handle_t fh = { 0 };
cc_t cc = { 0 };
@@ -1102,14 +1067,10 @@
args.input_callback = cancel_on_dtmf;
- switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
- profile->listen_file_key,
- profile->save_file_key,
- profile->delete_file_key,
- profile->email_key,
- profile->callback_key);
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
+ profile->listen_file_key, profile->save_file_key, profile->delete_file_key, profile->email_key, profile->callback_key);
- switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want+1);
+ switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1);
memset(&cc, 0, sizeof(cc));
cc.profile = profile;
args.buf = &cc;
@@ -1118,7 +1079,7 @@
if (!*cc.buf) {
TRY_CODE(switch_ivr_phrase_macro(session, VM_SAY_DATE_MACRO, cbt->created_epoch, NULL, &args));
}
-play_file:
+ play_file:
if (!*cc.buf) {
memset(&fh, 0, sizeof(fh));
@@ -1133,12 +1094,11 @@
if (switch_channel_ready(channel)) {
if (*cc.buf) {
*input = *cc.buf;
- *(input+1) = '\0';
+ *(input + 1) = '\0';
status = SWITCH_STATUS_SUCCESS;
*cc.buf = '\0';
} else {
- status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO,
- key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+ status = vm_macro_get(session, VM_LISTEN_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
}
if (!strcmp(input, profile->listen_file_key)) {
goto play_file;
@@ -1157,7 +1117,7 @@
switch_size_t retsize;
switch_time_exp_t tm;
char date[80] = "";
- char tmp[50]="";
+ char tmp[50] = "";
int total_new_messages = 0;
int total_saved_messages = 0;
int total_new_urgent_messages = 0;
@@ -1173,18 +1133,18 @@
}
message_count(profile, cbt->user, cbt->domain, cbt->in_folder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ &total_new_urgent_messages, &total_saved_urgent_messages);
switch_time_exp_lt(&tm, atoi(cbt->created_epoch) * 1000000);
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_messages);
switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_new_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
switch_channel_set_variable(channel, "voicemail_current_folder", cbt->in_folder);
switch_channel_set_variable(channel, "voicemail_account", cbt->user);
@@ -1194,7 +1154,7 @@
switch_channel_set_variable(channel, "voicemail_file_path", cbt->file_path);
switch_channel_set_variable(channel, "voicemail_read_flags", cbt->read_flags);
switch_channel_set_variable(channel, "voicemail_time", date);
- switch_snprintf(tmp,sizeof(tmp), "%d", priority);
+ switch_snprintf(tmp, sizeof(tmp), "%d", priority);
switch_channel_set_variable(channel, "voicemail_priority", tmp);
message_len = atoi(cbt->message_len);
@@ -1203,11 +1163,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
- duration.hr,
- duration.min,
- duration.sec
- );
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
switch_channel_set_variable(channel, "voicemail_email", cbt->email);
@@ -1215,20 +1171,20 @@
if (switch_strlen_zero(profile->email_headers)) {
from = switch_core_session_sprintf(session, "%s@%s", cbt->user, cbt->domain);
} else {
- from = switch_channel_expand_variables(channel,profile->email_from);
+ from = switch_channel_expand_variables(channel, profile->email_from);
}
if (switch_strlen_zero(profile->email_headers)) {
- headers = switch_core_session_sprintf(session,
- "From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
- cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
+ headers = switch_core_session_sprintf(session,
+ "From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
+ cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
} else {
- headers = switch_channel_expand_variables(channel,profile->email_headers);
+ headers = switch_channel_expand_variables(channel, profile->email_headers);
}
p = headers + (strlen(headers) - 1);
if (*p == '\n') {
- if (*(p-1) == '\r') {
+ if (*(p - 1) == '\r') {
p--;
}
*p = '\0';
@@ -1238,8 +1194,8 @@
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
/* this isnt done? it was in the other place
- * switch_channel_event_set_data(channel, event);
- */
+ * switch_channel_event_set_data(channel, event);
+ */
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Type", "forwarded-voicemail");
switch_event_fire(&event);
}
@@ -1247,8 +1203,7 @@
if (profile->email_body) {
body = switch_channel_expand_variables(channel, profile->email_body);
} else {
- body = switch_mprintf("%u second Voicemail from %s %s", message_len,
- cbt->cid_name, cbt->cid_number);
+ body = switch_mprintf("%u second Voicemail from %s %s", message_len, cbt->cid_name, cbt->cid_number);
}
switch_simple_email(cbt->email, from, header_string, body, cbt->file_path);
@@ -1267,7 +1222,7 @@
}
}
-end:
+ end:
return status;
}
@@ -1307,413 +1262,407 @@
args.buflen = sizeof(foo);
status = switch_ivr_phrase_macro(session, VM_HELLO_MACRO, NULL, NULL, &args);
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
switch_ivr_sleep(session, 100);
- switch(vm_check_state) {
-case VM_CHECK_START:
- {
- total_new_messages = 0;
- total_saved_messages = 0;
- total_new_urgent_messages = 0;
- total_saved_urgent_messages = 0;
- heard_auto_saved = 0;
- heard_auto_new = 0;
- play_msg_type = MSG_NONE;
- attempts = profile->max_login_attempts;
- myid = id;
- mypass = NULL;
- myfolder = "inbox";
- vm_check_state = VM_CHECK_AUTH;
- if (x_domain_root) {
- switch_xml_free(x_domain_root);
- }
- x_user = x_domain = x_domain_root = NULL;
- }
- break;
-case VM_CHECK_FOLDER_SUMMARY:
- {
- int informed = 0;
- char msg_count[80] = "";
+ switch (vm_check_state) {
+ case VM_CHECK_START:
+ {
+ total_new_messages = 0;
+ total_saved_messages = 0;
+ total_new_urgent_messages = 0;
+ total_saved_urgent_messages = 0;
+ heard_auto_saved = 0;
+ heard_auto_new = 0;
+ play_msg_type = MSG_NONE;
+ attempts = profile->max_login_attempts;
+ myid = id;
+ mypass = NULL;
+ myfolder = "inbox";
+ vm_check_state = VM_CHECK_AUTH;
+ if (x_domain_root) {
+ switch_xml_free(x_domain_root);
+ }
+ x_user = x_domain = x_domain_root = NULL;
+ }
+ break;
+ case VM_CHECK_FOLDER_SUMMARY:
+ {
+ int informed = 0;
+ char msg_count[80] = "";
- switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
- message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
+ message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+ &total_new_urgent_messages, &total_saved_urgent_messages);
- if (total_new_urgent_messages > 0) {
- switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
- TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
- informed++;
- }
- if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
- switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
- TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
- informed++;
- }
+ if (total_new_urgent_messages > 0) {
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+ informed++;
+ }
+ if (total_new_messages > 0 && total_new_messages != total_new_urgent_messages) {
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+ informed++;
+ }
- if (!heard_auto_new && total_new_messages + total_new_urgent_messages> 0) {
- heard_auto_new = 1;
- play_msg_type = MSG_NEW;
- vm_check_state = VM_CHECK_PLAY_MESSAGES;
- continue;
- }
+ if (!heard_auto_new && total_new_messages + total_new_urgent_messages > 0) {
+ heard_auto_new = 1;
+ play_msg_type = MSG_NEW;
+ vm_check_state = VM_CHECK_PLAY_MESSAGES;
+ continue;
+ }
- if (total_saved_urgent_messages > 0) {
- switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
- TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
- informed++;
- }
+ if (total_saved_urgent_messages > 0) {
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved", total_saved_urgent_messages);
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+ informed++;
+ }
+
+ if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
+ switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+ informed++;
+ }
+
+ if (!heard_auto_saved && total_saved_messages + total_saved_urgent_messages > 0) {
+ heard_auto_saved = 1;
+ play_msg_type = MSG_SAVED;
+ vm_check_state = VM_CHECK_PLAY_MESSAGES;
+ continue;
+ }
- if (total_saved_messages > 0 && total_saved_messages != total_saved_urgent_messages) {
- switch_snprintf(msg_count, sizeof(msg_count), "%d:saved", total_saved_messages);
- TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
- informed++;
- }
+ if (!informed) {
+ switch_snprintf(msg_count, sizeof(msg_count), "0:new");
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+ informed++;
+ }
- if (!heard_auto_saved && total_saved_messages + total_saved_urgent_messages> 0) {
- heard_auto_saved = 1;
- play_msg_type = MSG_SAVED;
- vm_check_state = VM_CHECK_PLAY_MESSAGES;
- continue;
- }
+ vm_check_state = VM_CHECK_MENU;
+ }
+ break;
+ case VM_CHECK_PLAY_MESSAGES:
+ {
+ listen_callback_t cbt;
+ char sql[256];
+ int cur_message, total_messages;
+ switch_event_t *event;
- if (!informed) {
- switch_snprintf(msg_count, sizeof(msg_count), "0:new");
- TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
- informed++;
- }
+ message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+ &total_new_urgent_messages, &total_saved_urgent_messages);
+ memset(&cbt, 0, sizeof(cbt));
+ cbt.email = email_vm;
+ switch (play_msg_type) {
+ case MSG_NEW:
+ {
+ switch_snprintf(sql, sizeof(sql),
+ "select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0 order by read_flags", myid,
+ domain_name);
+ total_messages = total_new_messages;
+ heard_auto_new = heard_auto_saved = 1;
+ }
+ break;
+ case MSG_SAVED:
+ default:
+ {
+ switch_snprintf(sql, sizeof(sql),
+ "select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid,
+ domain_name);
+ total_messages = total_saved_messages;
+ heard_auto_new = heard_auto_saved = 1;
+ }
+ break;
+ }
+ for (cur_message = 0; cur_message < total_messages; cur_message++) {
+ cbt.index = 0;
+ cbt.want = cur_message;
+ cbt.type = play_msg_type;
+ vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt);
+ status = listen_file(session, profile, &cbt);
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ break;
+ }
+ }
+ switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'",
+ (long) switch_timestamp(NULL), myid, domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid,
+ domain_name);
+ vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
+ switch_snprintf(sql, sizeof(sql), "delete from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ vm_check_state = VM_CHECK_FOLDER_SUMMARY;
- vm_check_state = VM_CHECK_MENU;
- }
- break;
-case VM_CHECK_PLAY_MESSAGES:
- {
- listen_callback_t cbt;
- char sql[256];
- int cur_message, total_messages;
- switch_event_t *event;
+ message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
+ &total_new_urgent_messages, &total_saved_urgent_messages);
- message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
- memset(&cbt, 0, sizeof(cbt));
- cbt.email = email_vm;
- switch(play_msg_type) {
-case MSG_NEW:
- {
- switch_snprintf(sql, sizeof(sql),
- "select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch=0 order by read_flags", myid, domain_name);
- total_messages = total_new_messages;
- heard_auto_new = heard_auto_saved = 1;
- }
- break;
-case MSG_SAVED:
-default:
- {
- switch_snprintf(sql, sizeof(sql),
- "select * from voicemail_msgs where username='%s' and domain='%s' and read_epoch !=0 order by read_flags", myid, domain_name);
- total_messages = total_saved_messages;
- heard_auto_new = heard_auto_saved = 1;
- }
- break;
- }
- for (cur_message = 0; cur_message < total_messages; cur_message++) {
- cbt.index = 0;
- cbt.want = cur_message;
- cbt.type = play_msg_type;
- vm_execute_sql_callback(profile, profile->mutex, sql, listen_callback, &cbt);
- status = listen_file(session, profile, &cbt);
- if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- break;
+ if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+ char *mwi_id;
+ const char *yn = "no";
+ if (total_new_messages || total_new_urgent_messages) {
+ yn = "yes";
+ }
+ mwi_id = switch_mprintf("%s@%s", myid, domain_name);
+ switch_assert(mwi_id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+ total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+ switch_event_fire(&event);
+ switch_safe_free(mwi_id);
+ }
}
- }
- switch_snprintf(sql, sizeof(sql), "update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and flags='save'",
- (long)switch_timestamp(NULL), myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- switch_snprintf(sql, sizeof(sql), "select file_path from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
- vm_execute_sql_callback(profile, profile->mutex, sql, unlink_callback, NULL);
- switch_snprintf(sql, sizeof(sql), "delete from voicemail_msgs where username='%s' and domain='%s' and flags='delete'", myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- vm_check_state = VM_CHECK_FOLDER_SUMMARY;
+ break;
+ case VM_CHECK_CONFIG:
+ {
+ char *sql = NULL;
+ char input[10] = "";
+ char key_buf[80] = "";
+ callback_t cbt = { 0 };
+ char msg_count[80] = "";
+ cc_t cc = { 0 };
+ switch_size_t message_len = 0;
+
+ cbt.buf = msg_count;
+ cbt.len = sizeof(msg_count);
+ sql = switch_mprintf("select count(*) from voicemail_prefs where username='%q' and domain = '%q'", myid, domain_name);
+ vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
+ switch_safe_free(sql);
+ if (*msg_count == '\0' || !atoi(msg_count)) {
+ sql = switch_mprintf("insert into voicemail_prefs values('%q','%q','','')", myid, domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ switch_safe_free(sql);
+ }
- message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+ profile->record_greeting_key, profile->choose_greeting_key, profile->record_name_key, profile->main_menu_key);
- if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
- char *mwi_id;
- const char *yn = "no";
- if (total_new_messages || total_new_urgent_messages ) {
- yn = "yes";
- }
- mwi_id = switch_mprintf("%s@%s", myid, domain_name);
- switch_assert(mwi_id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
- total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
- switch_event_fire(&event);
- switch_safe_free(mwi_id);
- }
- }
- break;
-case VM_CHECK_CONFIG:
- {
- char *sql = NULL;
- char input[10] = "";
- char key_buf[80] = "";
- callback_t cbt = { 0 };
- char msg_count[80] = "";
- cc_t cc = { 0 };
- switch_size_t message_len = 0;
-
- cbt.buf = msg_count;
- cbt.len = sizeof(msg_count);
- sql = switch_mprintf("select count(*) from voicemail_prefs where username='%q' and domain = '%q'", myid, domain_name);
- vm_execute_sql_callback(profile, profile->mutex, sql, sql2str_callback, &cbt);
- switch_safe_free(sql);
- if (*msg_count == '\0' || !atoi(msg_count)) {
- sql = switch_mprintf("insert into voicemail_prefs values('%q','%q','','')", myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- switch_safe_free(sql);
- }
-
- switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
- profile->record_greeting_key,
- profile->choose_greeting_key,
- profile->record_name_key,
- profile->main_menu_key);
+ TRY_CODE(vm_macro_get(session, VM_CONFIG_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ goto end;
+ }
- TRY_CODE(vm_macro_get(session, VM_CONFIG_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
- if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- goto end;
- }
+ if (!strcmp(input, profile->main_menu_key)) {
+ vm_check_state = VM_CHECK_MENU;
+ } else if (!strcmp(input, profile->choose_greeting_key)) {
+ int num;
+ switch_input_args_t greeting_args = { 0 };
+ greeting_args.input_callback = cancel_on_dtmf;
+
+ TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
- if (!strcmp(input, profile->main_menu_key)) {
- vm_check_state = VM_CHECK_MENU;
- } else if (!strcmp(input, profile->choose_greeting_key)) {
- int num;
- switch_input_args_t greeting_args = { 0 };
- greeting_args.input_callback = cancel_on_dtmf;
-
- TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
+ num = atoi(input);
+ file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
+ if (num < 1 || num > VM_MAX_GREETINGS) {
+ status = SWITCH_STATUS_FALSE;
+ } else {
+ switch_file_handle_t fh = { 0 };
+ memset(&fh, 0, sizeof(fh));
+ greeting_args.input_callback = control_playback;
+ memset(&cc, 0, sizeof(cc));
+ cc.profile = profile;
+ cc.fh = &fh;
+ cc.noexit = 1;
+ greeting_args.buf = &cc;
+ status = switch_ivr_play_file(session, NULL, file_path, &greeting_args);
+ }
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
+ } else {
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_SELECTED_MACRO, input, NULL, NULL));
+ sql =
+ switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid,
+ domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ switch_safe_free(sql);
+ }
+ switch_safe_free(file_path);
+ } else if (!strcmp(input, profile->record_greeting_key)) {
+ int num;
+ TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
+
+ num = atoi(input);
+ if (num < 1 || num > VM_MAX_GREETINGS) {
+ TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
+ } else {
+ file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
+ TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE));
+ sql =
+ switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid,
+ domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ switch_safe_free(sql);
+ switch_safe_free(file_path);
+ }
- num = atoi(input);
- file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
- if (num < 1 || num > VM_MAX_GREETINGS) {
- status = SWITCH_STATUS_FALSE;
- } else {
- switch_file_handle_t fh = { 0 };
- memset(&fh, 0, sizeof(fh));
- greeting_args.input_callback = control_playback;
- memset(&cc, 0, sizeof(cc));
- cc.profile = profile;
- cc.fh = &fh;
- cc.noexit = 1;
- greeting_args.buf = &cc;
- status = switch_ivr_play_file(session, NULL, file_path, &greeting_args);
- }
- if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
- } else {
- TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_SELECTED_MACRO, input, NULL, NULL));
- sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- switch_safe_free(sql);
- }
- switch_safe_free(file_path);
- } else if (!strcmp(input, profile->record_greeting_key)) {
- int num;
- TRY_CODE(vm_macro_get(session, VM_CHOOSE_GREETING_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
-
- num = atoi(input);
- if (num < 1 || num > VM_MAX_GREETINGS) {
- TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL));
- } else {
- file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext);
- TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE));
- sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- switch_safe_free(sql);
- switch_safe_free(file_path);
+ } else if (!strcmp(input, profile->record_name_key)) {
+ file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
+ TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE));
+ sql = switch_mprintf("update voicemail_prefs set name_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
+ vm_execute_sql(profile, sql, profile->mutex);
+ switch_safe_free(file_path);
+ switch_safe_free(sql);
+ }
+ continue;
}
+ break;
+ case VM_CHECK_MENU:
+ {
+ char input[10] = "";
+ char key_buf[80] = "";
+ play_msg_type = MSG_NONE;
- } else if (!strcmp(input, profile->record_name_key)) {
- file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
- TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE));
- sql = switch_mprintf("update voicemail_prefs set name_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name);
- vm_execute_sql(profile, sql, profile->mutex);
- switch_safe_free(file_path);
- switch_safe_free(sql);
- }
- continue;
- }
- break;
-case VM_CHECK_MENU:
- {
- char input[10] = "";
- char key_buf[80] = "";
- play_msg_type = MSG_NONE;
-
- switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
- profile->play_new_messages_key,
- profile->play_saved_messages_key,
- profile->config_menu_key,
- profile->terminator_key);
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
+ profile->play_new_messages_key, profile->play_saved_messages_key, profile->config_menu_key, profile->terminator_key);
- status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout);
+ status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout);
- if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- goto end;
- }
+ if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
+ goto end;
+ }
- if (!strcmp(input, profile->play_new_messages_key)) {
- play_msg_type = MSG_NEW;
- } else if (!strcmp(input, profile->play_saved_messages_key)) {
- play_msg_type = MSG_SAVED;
- } else if (!strcmp(input, profile->terminator_key)) {
- goto end;
- } else if (!strcmp(input, profile->config_menu_key)) {
- vm_check_state = VM_CHECK_CONFIG;
- }
+ if (!strcmp(input, profile->play_new_messages_key)) {
+ play_msg_type = MSG_NEW;
+ } else if (!strcmp(input, profile->play_saved_messages_key)) {
+ play_msg_type = MSG_SAVED;
+ } else if (!strcmp(input, profile->terminator_key)) {
+ goto end;
+ } else if (!strcmp(input, profile->config_menu_key)) {
+ vm_check_state = VM_CHECK_CONFIG;
+ }
- if (play_msg_type) {
- vm_check_state = VM_CHECK_PLAY_MESSAGES;
- }
+ if (play_msg_type) {
+ vm_check_state = VM_CHECK_PLAY_MESSAGES;
+ }
- continue;
- }
- break;
-case VM_CHECK_AUTH:
- {
- if (!attempts) {
- failed = 1;
- goto end;
- }
+ continue;
+ }
+ break;
+ case VM_CHECK_AUTH:
+ {
+ if (!attempts) {
+ failed = 1;
+ goto end;
+ }
- attempts--;
+ attempts--;
- if (!myid) {
- status = vm_macro_get(session, VM_ENTER_ID_MACRO, profile->terminator_key, id_buf, sizeof(id_buf), 0,
- profile->terminator_key, &term, timeout);
- if (status != SWITCH_STATUS_SUCCESS) {
- goto end;
- }
+ if (!myid) {
+ status = vm_macro_get(session, VM_ENTER_ID_MACRO, profile->terminator_key, id_buf, sizeof(id_buf), 0,
+ profile->terminator_key, &term, timeout);
+ if (status != SWITCH_STATUS_SUCCESS) {
+ goto end;
+ }
- if (*id_buf == '\0') {
- continue;
- } else {
- myid = id_buf;
- }
- }
+ if (*id_buf == '\0') {
+ continue;
+ } else {
+ myid = id_buf;
+ }
+ }
- if (!x_user) {
- switch_event_t *params;
- int ok = 1;
- caller_profile = switch_channel_get_caller_profile(channel);
-
- switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
- switch_assert(params);
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_profile->caller_id_number);
-
-
- if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
- &x_domain_root, &x_domain, &x_user, params) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", myid, domain_name);
- ok = 0;
- }
-
- switch_event_destroy(¶ms);
+ if (!x_user) {
+ switch_event_t *params;
+ int ok = 1;
+ caller_profile = switch_channel_get_caller_profile(channel);
+
+ switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
+ switch_assert(params);
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", myid);
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_profile->caller_id_number);
+
+
+ if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
+ &x_domain_root, &x_domain, &x_user, params) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", myid, domain_name);
+ ok = 0;
+ }
- if (!ok) {
- goto end;
- }
- }
+ switch_event_destroy(¶ms);
- if (!mypass) {
- if (auth) {
- mypass = "OK";
- } else {
- status = vm_macro_get(session, VM_ENTER_PASS_MACRO, profile->terminator_key,
- pass_buf, sizeof(pass_buf), 0, profile->terminator_key, &term, timeout);
- if (status != SWITCH_STATUS_SUCCESS) {
- goto end;
+ if (!ok) {
+ goto end;
+ }
}
- if (*pass_buf == '\0') {
- continue;
- } else {
- mypass = pass_buf;
+
+ if (!mypass) {
+ if (auth) {
+ mypass = "OK";
+ } else {
+ status = vm_macro_get(session, VM_ENTER_PASS_MACRO, profile->terminator_key,
+ pass_buf, sizeof(pass_buf), 0, profile->terminator_key, &term, timeout);
+ if (status != SWITCH_STATUS_SUCCESS) {
+ goto end;
+ }
+ if (*pass_buf == '\0') {
+ continue;
+ } else {
+ mypass = pass_buf;
+ }
+ }
}
- }
- }
- if (!(x_params = switch_xml_child(x_user, "params"))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", myid, domain_name);
- goto failed;
- }
+ if (!(x_params = switch_xml_child(x_user, "params"))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find params for user [%s@%s]\n", myid, domain_name);
+ goto failed;
+ }
+
+ thepass = NULL;
+ for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+ const char *var = switch_xml_attr_soft(x_param, "name");
+ const char *val = switch_xml_attr_soft(x_param, "value");
+
+ if (!strcasecmp(var, "password")) {
+ thepass = val;
+ } else if (!strcasecmp(var, "vm-password")) {
+ thepass = val;
+ } else if (!strcasecmp(var, "vm-mailto")) {
+ email_vm = switch_core_session_strdup(session, val);
+ }
+ }
+ switch_xml_free(x_domain_root);
+ x_domain_root = NULL;
- thepass = NULL;
- for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
- const char *var = switch_xml_attr_soft(x_param, "name");
- const char *val = switch_xml_attr_soft(x_param, "value");
+ if (auth || !thepass || (thepass && mypass && !strcmp(thepass, mypass))) {
+ if (!dir_path) {
+ if (switch_strlen_zero(profile->storage_dir)) {
+ dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
+ SWITCH_PATH_SEPARATOR,
+ SWITCH_PATH_SEPARATOR,
+ profile->name, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
+ } else {
+ dir_path = switch_core_session_sprintf(session, "%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, myid);
+ }
- if (!strcasecmp(var, "password")) {
- thepass = val;
- } else if (!strcasecmp(var, "vm-password")) {
- thepass = val;
- } else if (!strcasecmp(var, "vm-mailto")) {
- email_vm = switch_core_session_strdup(session, val);
- }
- }
- switch_xml_free(x_domain_root);
- x_domain_root = NULL;
+ if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", dir_path);
+ return;
+ }
+ }
- if (auth || !thepass || (thepass && mypass && !strcmp(thepass, mypass))) {
- if (!dir_path) {
- if (switch_strlen_zero(profile->storage_dir)) {
- dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
- SWITCH_PATH_SEPARATOR,
- SWITCH_PATH_SEPARATOR,
- profile->name,
- SWITCH_PATH_SEPARATOR,
- domain_name,
- SWITCH_PATH_SEPARATOR,
- myid);
+ vm_check_state = VM_CHECK_FOLDER_SUMMARY;
} else {
- dir_path = switch_core_session_sprintf(session, "%s%s%s",
- profile->storage_dir,
- SWITCH_PATH_SEPARATOR,
- myid);
+ goto failed;
}
- if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", dir_path);
- return;
- }
- }
-
- vm_check_state = VM_CHECK_FOLDER_SUMMARY;
- } else {
- goto failed;
- }
-
- continue;
+ continue;
-failed:
- status = switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL);
- myid = id;
- mypass = NULL;
- continue;
- }
- break;
-default:
- break;
+ failed:
+ status = switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL);
+ myid = id;
+ mypass = NULL;
+ continue;
+ }
+ break;
+ default:
+ break;
}
}
-end:
+ end:
if (switch_channel_ready(channel)) {
if (failed) {
@@ -1743,9 +1692,9 @@
switch_file_handle_t fh = { 0 };
switch_input_args_t args = { 0 };
char *email_vm = NULL;
- char *email_vm_notify = NULL;
+ char *email_vm_notify = NULL;
int send_mail = 0;
- int send_mail_only = 0;
+ int send_mail_only = 0;
cc_t cc = { 0 };
char *read_flags = NORMAL_FLAG_STRING;
int priority = 3;
@@ -1768,19 +1717,11 @@
}
if (switch_strlen_zero(profile->storage_dir)) {
- dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
- SWITCH_PATH_SEPARATOR,
- SWITCH_PATH_SEPARATOR,
- profile->name,
- SWITCH_PATH_SEPARATOR,
- domain_name,
- SWITCH_PATH_SEPARATOR,
- id);
+ dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
+ SWITCH_PATH_SEPARATOR,
+ SWITCH_PATH_SEPARATOR, profile->name, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, id);
} else {
- dir_path = switch_core_session_sprintf(session, "%s%s%s",
- profile->storage_dir,
- SWITCH_PATH_SEPARATOR,
- id);
+ dir_path = switch_core_session_sprintf(session, "%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, id);
}
if (switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -1790,60 +1731,57 @@
if (id) {
int ok = 1;
- switch_event_t *params = NULL;
+ switch_event_t *params = NULL;
switch_xml_t x_domain, x_domain_root, x_user, x_params, x_param;
const char *email_addr = NULL;
-
- switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
- switch_assert(params);
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
-
+
+ switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
+ switch_assert(params);
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
+
x_user = x_domain = x_domain_root = NULL;
- if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
- &x_domain_root, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
- if ((x_params = switch_xml_child(x_user, "params"))) {
- for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
- const char *var = switch_xml_attr_soft(x_param, "name");
- const char *val = switch_xml_attr_soft(x_param, "value");
-
- if (!strcasecmp(var, "vm-mailto")) {
- email_vm = switch_core_session_strdup(session, val);
- } else if (!strcasecmp(var, "vm-mailto-notify")) {
- email_vm_notify = switch_core_session_strdup(session, val);
- } else if (!strcasecmp(var, "email-addr")) {
- email_addr = val;
- } else if (!strcasecmp(var, "vm-email-only")) {
- send_mail_only = switch_true(val);
- } else if (!strcasecmp(var, "vm-email-all-messages")) {
- send_mail = switch_true(val);
- } else if (!strcasecmp(var, "vm-delete-file")) {
- email_delete = switch_true(val);
- } else if (!strcasecmp(var, "vm-attach-file")) {
- email_attach = switch_true(val);
- }
+ if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
+ &x_domain_root, &x_domain, &x_user, params) == SWITCH_STATUS_SUCCESS) {
+ if ((x_params = switch_xml_child(x_user, "params"))) {
+ for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+ const char *var = switch_xml_attr_soft(x_param, "name");
+ const char *val = switch_xml_attr_soft(x_param, "value");
+
+ if (!strcasecmp(var, "vm-mailto")) {
+ email_vm = switch_core_session_strdup(session, val);
+ } else if (!strcasecmp(var, "vm-mailto-notify")) {
+ email_vm_notify = switch_core_session_strdup(session, val);
+ } else if (!strcasecmp(var, "email-addr")) {
+ email_addr = val;
+ } else if (!strcasecmp(var, "vm-email-only")) {
+ send_mail_only = switch_true(val);
+ } else if (!strcasecmp(var, "vm-email-all-messages")) {
+ send_mail = switch_true(val);
+ } else if (!strcasecmp(var, "vm-delete-file")) {
+ email_delete = switch_true(val);
+ } else if (!strcasecmp(var, "vm-attach-file")) {
+ email_attach = switch_true(val);
}
}
+ }
- if (send_mail && switch_strlen_zero(email_vm) && !switch_strlen_zero(email_addr)) {
- email_vm = switch_core_session_strdup(session, email_addr);
- }
+ if (send_mail && switch_strlen_zero(email_vm) && !switch_strlen_zero(email_addr)) {
+ email_vm = switch_core_session_strdup(session, email_addr);
+ }
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", id, domain_name);
ok = 0;
}
- switch_event_destroy(¶ms);
+ switch_event_destroy(¶ms);
switch_xml_free(x_domain_root);
if (!ok) {
goto end;
}
}
- switch_snprintf(sql, sizeof(sql),
- "select * from voicemail_prefs where username='%s' and domain='%s'",
- id,
- domain_name);
+ switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain_name);
vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
file_path = switch_mprintf("%s%smsg_%s.%s", dir_path, SWITCH_PATH_SEPARATOR, uuid, profile->file_ext);
@@ -1857,7 +1795,7 @@
greet_path = cbt.greeting_path;
}
-greet:
+ greet:
memset(buf, 0, sizeof(buf));
args.input_callback = cancel_on_dtmf;
args.buf = buf;
@@ -1890,7 +1828,7 @@
if (argc >= 1 && argc <= 4) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
- send_mail=0;
+ send_mail = 0;
goto end;
}
}
@@ -1904,7 +1842,7 @@
if (argc >= 1 && argc <= 4) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
/* the application still runs after we leave it so we need to make sure that we dont do anything evil */
- send_mail=0;
+ send_mail = 0;
goto end;
}
}
@@ -1938,9 +1876,7 @@
if ((status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && switch_channel_ready(channel)) {
char input[10] = "", key_buf[80] = "", term = 0;
- switch_snprintf(key_buf, sizeof(key_buf), "%s:%s",
- profile->urgent_key,
- profile->terminator_key);
+ switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", profile->urgent_key, profile->terminator_key);
vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
if (*profile->urgent_key == *input) {
@@ -1961,14 +1897,14 @@
int total_new_urgent_messages = 0;
int total_saved_urgent_messages = 0;
- usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long)switch_timestamp(NULL),
- id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number,
- myfolder, file_path, message_len, read_flags);
+ usql = switch_mprintf("insert into voicemail_msgs values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_timestamp(NULL),
+ id, domain_name, uuid, caller_profile->caller_id_name, caller_profile->caller_id_number,
+ myfolder, file_path, message_len, read_flags);
vm_execute_sql(profile, usql, profile->mutex);
switch_safe_free(usql);
message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ &total_new_urgent_messages, &total_saved_urgent_messages);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
const char *yn = "no";
@@ -1978,14 +1914,14 @@
mwi_id = switch_mprintf("%s@%s", id, domain_name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", mwi_id);
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
- total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+ total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
switch_event_fire(&event);
switch_safe_free(mwi_id);
- }
+ }
}
-end:
+ end:
if (send_mail && !switch_strlen_zero(email_vm) && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event;
@@ -1993,7 +1929,7 @@
char *body;
char *headers;
char *header_string;
- char tmp[50]="";
+ char tmp[50] = "";
int total_new_messages = 0;
int total_saved_messages = 0;
int total_new_urgent_messages = 0;
@@ -2004,19 +1940,19 @@
char duration_str[80];
message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ &total_new_urgent_messages, &total_saved_urgent_messages);
switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_new_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
switch_channel_set_variable(channel, "voicemail_total_new_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_messages);
switch_channel_set_variable(channel, "voicemail_total_saved_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_new_urgent_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_new_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_new_messages", tmp);
- switch_snprintf(tmp,sizeof(tmp), "%d", total_saved_urgent_messages);
+ switch_snprintf(tmp, sizeof(tmp), "%d", total_saved_urgent_messages);
switch_channel_set_variable(channel, "voicemail_urgent_saved_messages", tmp);
switch_channel_set_variable(channel, "voicemail_account", id);
switch_channel_set_variable(channel, "voicemail_domain", domain_name);
@@ -2025,19 +1961,15 @@
switch_channel_set_variable(channel, "voicemail_file_path", file_path);
switch_channel_set_variable(channel, "voicemail_read_flags", read_flags);
switch_channel_set_variable(channel, "voicemail_time", date);
- switch_snprintf(tmp,sizeof(tmp), "%d", priority);
+ switch_snprintf(tmp, sizeof(tmp), "%d", priority);
switch_channel_set_variable(channel, "voicemail_priority", tmp);
switch_channel_set_variable(channel, "voicemail_email", email_vm);
- l_duration = (long)message_len * 1000000;
+ l_duration = (long) message_len *1000000;
switch_core_measure_time(l_duration, &duration);
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
- duration.hr,
- duration.min,
- duration.sec
- );
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
@@ -2048,13 +1980,10 @@
}
if (switch_strlen_zero(profile->email_headers)) {
- headers = switch_core_session_sprintf(session,
- "From: FreeSWITCH mod_voicemail <%s@%s>\n"
- "Subject: Voicemail from %s %s\nX-Priority: %d",
- id, domain_name,
- caller_profile->caller_id_name,
- caller_profile->caller_id_number,
- priority);
+ headers = switch_core_session_sprintf(session,
+ "From: FreeSWITCH mod_voicemail <%s@%s>\n"
+ "Subject: Voicemail from %s %s\nX-Priority: %d",
+ id, domain_name, caller_profile->caller_id_name, caller_profile->caller_id_number, priority);
} else {
headers = switch_channel_expand_variables(channel, profile->email_headers);
}
@@ -2062,7 +1991,7 @@
p = headers + (strlen(headers) - 1);
if (*p == '\n') {
- if (*(p-1) == '\r') {
+ if (*(p - 1) == '\r') {
p--;
}
*p = '\0';
@@ -2079,8 +2008,7 @@
if (profile->email_body) {
body = switch_channel_expand_variables(channel, profile->email_body);
} else {
- body = switch_mprintf("%u second Voicemail from %s %s", message_len,
- caller_profile->caller_id_name, caller_profile->caller_id_number);
+ body = switch_mprintf("%u second Voicemail from %s %s", message_len, caller_profile->caller_id_name, caller_profile->caller_id_number);
}
if (email_attach) {
@@ -2088,9 +2016,9 @@
} else {
switch_simple_email(email_vm, from, header_string, body, NULL);
}
- if (!switch_strlen_zero(email_vm_notify)) {
- switch_simple_email(email_vm_notify, from, header_string, body, NULL);
- }
+ if (!switch_strlen_zero(email_vm_notify)) {
+ switch_simple_email(email_vm_notify, from, header_string, body, NULL);
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email_vm);
switch_safe_free(body);
@@ -2126,7 +2054,8 @@
int x = 0, check = 0, auth = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
- if (switch_dir_make_recursive(SWITCH_GLOBAL_dirs.storage_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ if (switch_dir_make_recursive(SWITCH_GLOBAL_dirs.storage_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) !=
+ SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", SWITCH_GLOBAL_dirs.storage_dir);
return;
}
@@ -2216,18 +2145,18 @@
free(dup);
return SWITCH_STATUS_SUCCESS;
}
-
+
if ((domain = strchr(id, '@'))) {
*domain++ = '\0';
if ((p = strchr(domain, '|'))) {
*p++ = '\0';
how = p;
}
-
+
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
- total_new_messages = total_saved_messages = 0;
+ total_new_messages = total_saved_messages = 0;
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
}
@@ -2285,19 +2214,19 @@
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
profile = (vm_profile_t *) val;
- total_new_messages = total_saved_messages = 0;
+ total_new_messages = total_saved_messages = 0;
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
- &total_new_urgent_messages, &total_saved_urgent_messages);
+ &total_new_urgent_messages, &total_saved_urgent_messages);
if (total_new_messages || total_saved_messages) {
if (switch_event_create(&new_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
const char *yn = "no";
- if (total_new_messages || total_new_urgent_messages ) {
+ if (total_new_messages || total_new_urgent_messages) {
yn = "yes";
}
switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", "%s", yn);
switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", account);
- switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
- total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+ switch_event_add_header(new_event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)",
+ total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
created++;
}
}
@@ -2383,8 +2312,8 @@
if (switch_file_open(&fd, argv[8], SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, holder->pool) == SWITCH_STATUS_SUCCESS) {
flen = switch_file_get_size(fd);
holder->stream->write_function(holder->stream, "Content-type: %s\n", mime_type);
- holder->stream->write_function(holder->stream, "Content-length: %ld\n\n", (long)flen);
- for(;;) {
+ holder->stream->write_function(holder->stream, "Content-length: %ld\n\n", (long) flen);
+ for (;;) {
switch_status_t status;
flen = sizeof(chunk);
@@ -2405,8 +2334,8 @@
char *sql;
struct holder holder;
- sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'",
- (long)switch_timestamp(NULL), user, domain, file);
+ sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'",
+ (long) switch_timestamp(NULL), user, domain, file);
vm_execute_sql(profile, sql, profile->mutex);
free(sql);
@@ -2444,9 +2373,8 @@
free(sql);
if (ref) {
- stream->write_function(stream,"Content-type: text/html\n\n<h2>Message Deleted</h2>\n"
- "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
- }
+ stream->write_function(stream, "Content-type: text/html\n\n<h2>Message Deleted</h2>\n" "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
+ }
}
@@ -2467,7 +2395,7 @@
const char *fmt = "%a, %e %b %Y %T %z";
char heard[80];
char title_b4[128] = "";
- char title_aft[128*3] = "";
+ char title_aft[128 * 3] = "";
if (argc > 0) {
l_created = atol(argv[0]) * 1000000;
@@ -2495,11 +2423,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
- duration.hr,
- duration.min,
- duration.sec
- );
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
if (l_created) {
switch_time_exp_lt(&tm, l_created);
@@ -2517,25 +2441,22 @@
get = switch_mprintf("http://%s:%s%s/get/%s", holder->host, holder->port, holder->uri, fname);
del = switch_mprintf("http://%s:%s%s/del/%s", holder->host, holder->port, holder->uri, fname);
- holder->stream->write_function(holder->stream, "<font face=tahoma><div class=title><b>Message from %s %s</b></div><hr noshade size=1>\n",
- argv[5], argv[6]);
- holder->stream->write_function(holder->stream, "Priority: %s<br>\n"
- "Created: %s<br>\n"
- "Last Heard: %s<br>\n"
- "Duration: %s<br>\n",
- //"<a href=%s>Delete This Message</a><br><hr noshade size=1>",
- strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
+ holder->stream->write_function(holder->stream, "<font face=tahoma><div class=title><b>Message from %s %s</b></div><hr noshade size=1>\n",
+ argv[5], argv[6]);
+ holder->stream->write_function(holder->stream, "Priority: %s<br>\n" "Created: %s<br>\n" "Last Heard: %s<br>\n" "Duration: %s<br>\n",
+ //"<a href=%s>Delete This Message</a><br><hr noshade size=1>",
+ strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
switch_url_encode(title_b4, title_aft, sizeof(title_aft));
holder->stream->write_function(holder->stream,
- "<br><object width=550 height=15 \n"
- "type=\"application/x-shockwave-flash\" \n"
- "data=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\">\n"
- "<param name=movie value=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\"></object><br><br>\n"
- "[<a href=%s>delete</a>] [<a href=%s>download</a>] [<a href=tel:%s>call</a>] <br><br><br></font>\n",
- holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get, argv[6]);
+ "<br><object width=550 height=15 \n"
+ "type=\"application/x-shockwave-flash\" \n"
+ "data=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\">\n"
+ "<param name=movie value=\"http://%s:%s/pub/slim.swf?song_url=%s&player_title=%s\"></object><br><br>\n"
+ "[<a href=%s>delete</a>] [<a href=%s>download</a>] [<a href=tel:%s>call</a>] <br><br><br></font>\n",
+ holder->host, holder->port, get, title_aft, holder->host, holder->port, get, title_aft, del, get, argv[6]);
free(get);
free(del);
@@ -2582,11 +2503,7 @@
duration.day += duration.yr * 365;
duration.hr += duration.day * 24;
- switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u",
- duration.hr,
- duration.min,
- duration.sec
- );
+ switch_snprintf(duration_str, sizeof(duration_str), "%.2u:%.2u:%.2u", duration.hr, duration.min, duration.sec);
if (l_created) {
switch_time_exp_lt(&tm, l_created);
@@ -2622,10 +2539,9 @@
switch_xml_set_txt_d(x_link, del);
tmp = switch_mprintf("<![CDATA[Priority: %s<br>"
- "Last Heard: %s<br>Duration: %s<br>"
- "<a href=%s>Delete This Message</a><br>"
- "]]>",
- strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
+ "Last Heard: %s<br>Duration: %s<br>"
+ "<a href=%s>Delete This Message</a><br>"
+ "]]>", strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", heard, duration_str, del);
switch_xml_set_txt_d(x_tmp, tmp);
free(tmp);
@@ -2740,7 +2656,7 @@
holder.uri = uri;
if (profile->web_head) {
- stream->raw_write_function(stream, (uint8_t *)profile->web_head, strlen(profile->web_head));
+ stream->raw_write_function(stream, (uint8_t *) profile->web_head, strlen(profile->web_head));
}
cbt.buf = buf;
@@ -2758,7 +2674,7 @@
stream->write_function(stream, "%d message%s<br>", ttl, ttl == 1 ? "" : "s");
if (profile->web_tail) {
- stream->raw_write_function(stream, (uint8_t *)profile->web_tail, strlen(profile->web_tail));
+ stream->raw_write_function(stream, (uint8_t *) profile->web_tail, strlen(profile->web_tail));
}
}
@@ -2840,9 +2756,9 @@
if (path_info) {
if (!strncasecmp(path_info, "get/", 4)) {
- do_play(profile, user, domain, path_info + 4, stream);
+ do_play(profile, user, domain, path_info + 4, stream);
} else if (!strncasecmp(path_info, "del/", 4)) {
- do_del(profile, user, domain, path_info + 4, stream);
+ do_del(profile, user, domain, path_info + 4, stream);
} else if (!strncasecmp(path_info, "web", 3)) {
do_web(profile, user, domain, host, port, uri, stream);
}
@@ -2854,7 +2770,7 @@
goto done;
-error:
+ error:
if (host) {
if (!ct) {
stream->write_function(stream, "Content-type: text/html\n\n<h2>");
@@ -2862,7 +2778,7 @@
}
stream->write_function(stream, "Error: %s\n", VOICEMAIL_SYNTAX);
-done:
+ done:
switch_safe_free(mydata);
return SWITCH_STATUS_SUCCESS;
}
@@ -2883,13 +2799,13 @@
if (switch_event_bind((char *) modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
!= SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
- return SWITCH_STATUS_GENERR;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+ return SWITCH_STATUS_GENERR;
}
SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
-
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_NOUNLOAD;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c Tue May 27 07:24:06 2008
@@ -257,7 +257,7 @@
swift_port_stop(cepstral->port, SWIFT_ASYNC_ANY, SWIFT_EVENT_NOW);
}
-static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
+static switch_status_t cepstral_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
{
cepstral_t *cepstral;
size_t desired = *datalen;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_lumenvox/mod_lumenvox.cpp Tue May 27 07:24:06 2008
@@ -56,7 +56,7 @@
switch_mutex_t *flag_mutex;
} lumenvox_t;
-static void log_callback(const char* message, void* userdata)
+static void log_callback(const char *message, void *userdata)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", message);
}
@@ -72,50 +72,47 @@
"BEEP"
};
-std::ostream& operator << (std::ostream& os ,const LVSemanticData& Data)
+std::ostream & operator <<(std::ostream & os, const LVSemanticData & Data)
{
int i;
LVSemanticObject Obj;
- switch (Data.Type())
- {
- case SI_TYPE_BOOL:
- os << Data.GetBool();
- break;
- case SI_TYPE_INT:
- os << Data.GetInt();
- break;
- case SI_TYPE_DOUBLE:
- os << Data.GetDouble();
- break;
- case SI_TYPE_STRING:
- os << Data.GetString();
- break;
- case SI_TYPE_OBJECT:
- Obj = Data.GetSemanticObject();
- for (i = 0; i < Obj.NumberOfProperties(); ++i)
- {
- os << "<" << Obj.PropertyName(i) << ">";
- os << Obj.PropertyValue(i);
- os << "</" << Obj.PropertyName(i) << ">";
- }
- break;
- case SI_TYPE_ARRAY:
- for (i = 0; i < Data.GetSemanticArray().Size(); ++i)
- {
- os << Data.GetArray().At(i);
- }
- break;
+ switch (Data.Type()) {
+ case SI_TYPE_BOOL:
+ os << Data.GetBool();
+ break;
+ case SI_TYPE_INT:
+ os << Data.GetInt();
+ break;
+ case SI_TYPE_DOUBLE:
+ os << Data.GetDouble();
+ break;
+ case SI_TYPE_STRING:
+ os << Data.GetString();
+ break;
+ case SI_TYPE_OBJECT:
+ Obj = Data.GetSemanticObject();
+ for (i = 0; i < Obj.NumberOfProperties(); ++i) {
+ os << "<" << Obj.PropertyName(i) << ">";
+ os << Obj.PropertyValue(i);
+ os << "</" << Obj.PropertyName(i) << ">";
+ }
+ break;
+ case SI_TYPE_ARRAY:
+ for (i = 0; i < Data.GetSemanticArray().Size(); ++i) {
+ os << Data.GetArray().At(i);
}
+ break;
+ }
return os;
}
//==============================================================================================
// code to plug LVInterpretation into any standard stream
-std::ostream& operator << (std::ostream& os, const LVInterpretation& Interp)
+std::ostream & operator <<(std::ostream & os, const LVInterpretation & Interp)
{
- os << "<interpretation grammar=\""<<Interp.GrammarLabel()
- <<"\" score=\""<<Interp.Score()<<"\">";
- os << "<result name=\""<<Interp.ResultName()<<"\">";
+ os << "<interpretation grammar=\"" << Interp.GrammarLabel()
+ << "\" score=\"" << Interp.Score() << "\">";
+ os << "<result name=\"" << Interp.ResultName() << "\">";
os << Interp.ResultData();
os << "</result>";
os << "<input>";
@@ -126,30 +123,26 @@
}
-static void state_change_callback(long new_state, unsigned long total_bytes,
- unsigned long recorded_bytes, void *user_data)
+static void state_change_callback(long new_state, unsigned long total_bytes, unsigned long recorded_bytes, void *user_data)
{
lumenvox_t *lv = (lumenvox_t *) user_data;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "State: [%s] total bytes: [%ld] recorded bytes: [%ld]\n",
- state_names[new_state],
- total_bytes,
- recorded_bytes);
-
- switch (new_state)
- {
- case STREAM_STATUS_READY:
- break;
- case STREAM_STATUS_STOPPED:
- switch_clear_flag_locked(lv, LVFLAG_READY);
- break;
- case STREAM_STATUS_END_SPEECH:
- switch_set_flag_locked(lv, LVFLAG_HAS_TEXT);
- break;
- case STREAM_STATUS_BARGE_IN:
- switch_set_flag_locked(lv, LVFLAG_BARGE);
- break;
- }
+ state_names[new_state], total_bytes, recorded_bytes);
+
+ switch (new_state) {
+ case STREAM_STATUS_READY:
+ break;
+ case STREAM_STATUS_STOPPED:
+ switch_clear_flag_locked(lv, LVFLAG_READY);
+ break;
+ case STREAM_STATUS_END_SPEECH:
+ switch_set_flag_locked(lv, LVFLAG_HAS_TEXT);
+ break;
+ case STREAM_STATUS_BARGE_IN:
+ switch_set_flag_locked(lv, LVFLAG_BARGE);
+ break;
+ }
}
static switch_status_t lumenvox_asr_pause(switch_asr_handle_t *ah)
@@ -177,20 +170,20 @@
lv->port.ClosePort();
return SWITCH_STATUS_GENERR;
}
- switch_set_flag_locked(lv, LVFLAG_READY);
+ switch_set_flag_locked(lv, LVFLAG_READY);
return SWITCH_STATUS_SUCCESS;
}
-
+
return SWITCH_STATUS_GENERR;
}
/*! function to open the asr interface */
-static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
+static switch_status_t lumenvox_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags)
{
-
+
lumenvox_t *lv;
int error_code;
-
+
if (!(lv = (lumenvox_t *) switch_core_alloc(ah->memory_pool, sizeof(*lv)))) {
return SWITCH_STATUS_MEMERR;
}
@@ -199,7 +192,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Rate: Pick 8000 or 16000\n");
return SWITCH_STATUS_FALSE;
}
-
+
if (!strcasecmp(codec, "PCMU")) {
switch (rate) {
case 8000:
@@ -238,36 +231,35 @@
if (!lv->sound_format) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot negotiate sound format.\n");
return SWITCH_STATUS_FALSE;
- }
+ }
ah->rate = rate;
ah->codec = switch_core_strdup(ah->memory_pool, codec);
-
+
lv->port.OpenPort(log_callback, NULL, 5);
error_code = lv->port.GetOpenPortStatus();
-
- switch(error_code)
- {
- case LV_FAILURE:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Licenses Exceeded!\n");
- return SWITCH_STATUS_GENERR;
- case LV_OPEN_PORT_FAILED__PRIMARY_SERVER_NOT_RESPONDING:
- case LV_NO_SERVER_RESPONDING:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SRE Server Unavailable!\n");
- return SWITCH_STATUS_GENERR;
- case LV_SUCCESS:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Port Opened %d %dkhz.\n", lv->sound_format, rate);
- break;
- }
+
+ switch (error_code) {
+ case LV_FAILURE:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Licenses Exceeded!\n");
+ return SWITCH_STATUS_GENERR;
+ case LV_OPEN_PORT_FAILED__PRIMARY_SERVER_NOT_RESPONDING:
+ case LV_NO_SERVER_RESPONDING:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SRE Server Unavailable!\n");
+ return SWITCH_STATUS_GENERR;
+ case LV_SUCCESS:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Port Opened %d %dkhz.\n", lv->sound_format, rate);
+ break;
+ }
// turn on sound and response file logging
/*
- int save_sound_files = 1;
- lv->port.SetPropertyEx(PROP_EX_SAVE_SOUND_FILES,
- PROP_EX_VALUE_TYPE_INT_PTR,
- &save_sound_files);
- */
+ int save_sound_files = 1;
+ lv->port.SetPropertyEx(PROP_EX_SAVE_SOUND_FILES,
+ PROP_EX_VALUE_TYPE_INT_PTR,
+ &save_sound_files);
+ */
lv->channel = 1;
lv->flags = *flags;
lv->port.StreamSetParameter(STREAM_PARM_DETECT_BARGE_IN, 1);
@@ -275,9 +267,9 @@
lv->port.StreamSetParameter(STREAM_PARM_AUTO_DECODE, 1);
lv->port.StreamSetParameter(STREAM_PARM_DECODE_FLAGS, LV_DECODE_SEMANTIC_INTERPRETATION);
lv->port.StreamSetParameter(STREAM_PARM_VOICE_CHANNEL, lv->channel);
- lv->port.StreamSetParameter(STREAM_PARM_GRAMMAR_SET, (long unsigned int) LV_ACTIVE_GRAMMAR_SET);
+ lv->port.StreamSetParameter(STREAM_PARM_GRAMMAR_SET, (long unsigned int) LV_ACTIVE_GRAMMAR_SET);
+
-
lv->port.StreamSetStateChangeCallBack(state_change_callback, lv);
lv->port.StreamSetParameter(STREAM_PARM_SOUND_FORMAT, lv->sound_format);
@@ -292,7 +284,7 @@
lv->port.ClosePort();
return SWITCH_STATUS_GENERR;
}
-
+
ah->private_info = lv;
return SWITCH_STATUS_SUCCESS;
@@ -347,13 +339,13 @@
{
lumenvox_t *lv = (lumenvox_t *) ah->private_info;
-
+
if (!switch_test_flag(lv, LVFLAG_HAS_TEXT) && switch_test_flag(lv, LVFLAG_READY)) {
if (lv->port.StreamSendData(data, len)) {
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
}
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -384,21 +376,21 @@
lv->port.StreamStop();
code = lv->port.WaitForEngineToIdle(3000, lv->channel);
-
+
if (code == LV_TIME_OUT) {
return SWITCH_STATUS_FALSE;
}
-
+
numInterp = lv->port.GetNumberOfInterpretations(lv->channel);
-
+
for (int t = 0; t < numInterp; ++t) {
ss << lv->port.GetInterpretation(lv->channel, t);
}
-
- *xmlstr = strdup((char *)ss.str().c_str());
+
+ *xmlstr = strdup((char *) ss.str().c_str());
switch_clear_flag_locked(lv, LVFLAG_HAS_TEXT);
-
+
if (switch_test_flag(lv, SWITCH_ASR_FLAG_AUTO_RESUME)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto Resuming\n");
switch_set_flag_locked(lv, LVFLAG_READY);
@@ -410,21 +402,21 @@
ret = SWITCH_STATUS_SUCCESS;
}
-
+
return ret;
}
static const switch_asr_interface_t lumenvox_asr_interface = {
- /*.interface_name*/ "lumenvox",
- /*.asr_open*/ lumenvox_asr_open,
- /*.asr_load_grammar*/ lumenvox_asr_load_grammar,
- /*.asr_unload_grammar*/ lumenvox_asr_unload_grammar,
- /*.asr_close*/ lumenvox_asr_close,
- /*.asr_feed*/ lumenvox_asr_feed,
- /*.asr_resume*/ lumenvox_asr_resume,
- /*.asr_pause*/ lumenvox_asr_pause,
- /*.asr_check_results*/ lumenvox_asr_check_results,
- /*.asr_get_results*/ lumenvox_asr_get_results
+ /*.interface_name */ "lumenvox",
+ /*.asr_open */ lumenvox_asr_open,
+ /*.asr_load_grammar */ lumenvox_asr_load_grammar,
+ /*.asr_unload_grammar */ lumenvox_asr_unload_grammar,
+ /*.asr_close */ lumenvox_asr_close,
+ /*.asr_feed */ lumenvox_asr_feed,
+ /*.asr_resume */ lumenvox_asr_resume,
+ /*.asr_pause */ lumenvox_asr_pause,
+ /*.asr_check_results */ lumenvox_asr_check_results,
+ /*.asr_get_results */ lumenvox_asr_get_results
};
static const switch_loadable_module_interface_t lumenvox_module_interface = {
@@ -447,7 +439,7 @@
{
LVSpeechPort::RegisterAppLogMsg(log_callback, NULL, 5);
//LVSpeechPort::SetClientPropertyEx(PROP_EX_SRE_SERVERS, PROP_EX_VALUE_TYPE_STRING, (void *)"127.0.0.1");
-
+
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &lumenvox_module_interface;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Tue May 27 07:24:06 2008
@@ -66,40 +66,39 @@
#include "mrcp_synthesizer.h"
#include "mrcp_generic_header.h"
-
+
SWITCH_MODULE_LOAD_FUNCTION(mod_openmrcp_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_openmrcp_shutdown);
-SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load,
- mod_openmrcp_shutdown, NULL);
+SWITCH_MODULE_DEFINITION(mod_openmrcp, mod_openmrcp_load, mod_openmrcp_shutdown, NULL);
typedef struct {
- char *name;
+ char *name;
openmrcp_client_options_t *mrcp_options;
- mrcp_client_t *mrcp_client;
- mrcp_client_context_t *mrcp_context;
+ mrcp_client_t *mrcp_client;
+ mrcp_client_context_t *mrcp_context;
} openmrcp_profile_t;
typedef struct {
- openmrcp_profile_t *profile;
- mrcp_session_t *client_session;
+ openmrcp_profile_t *profile;
+ mrcp_session_t *client_session;
mrcp_client_channel_t *control_channel;
- mrcp_audio_channel_t *audio_channel;
- mrcp_message_t *mrcp_message_last_rcvd;
- apr_pool_t *pool;
- switch_speech_flag_t flags;
- switch_mutex_t *flag_mutex;
- switch_thread_cond_t *wait_object;
+ mrcp_audio_channel_t *audio_channel;
+ mrcp_message_t *mrcp_message_last_rcvd;
+ apr_pool_t *pool;
+ switch_speech_flag_t flags;
+ switch_mutex_t *flag_mutex;
+ switch_thread_cond_t *wait_object;
} openmrcp_session_t;
typedef enum {
- FLAG_HAS_MESSAGE = (1 << 0),
- FLAG_FEED_STARTED = (1 << 1),
- FLAG_TERMINATING = (1 << 2)
+ FLAG_HAS_MESSAGE = (1 << 0),
+ FLAG_FEED_STARTED = (1 << 1),
+ FLAG_TERMINATING = (1 << 2)
} mrcp_flag_t;
typedef struct {
switch_memory_pool_t *pool;
- switch_hash_t *profile_hash;
+ switch_hash_t *profile_hash;
char *asr_profile_name;
char *tts_profile_name;
//openmrcp_profile_t *asr_profile;
@@ -109,7 +108,7 @@
static openmrcp_module_t openmrcp_module;
static switch_status_t openmrcp_profile_run(openmrcp_profile_t *profile);
-static openmrcp_session_t* openmrcp_session_create(openmrcp_profile_t *profile)
+static openmrcp_session_t *openmrcp_session_create(openmrcp_profile_t *profile)
{
openmrcp_session_t *openmrcp_session;
apr_pool_t *session_pool;
@@ -172,14 +171,14 @@
if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
openmrcp_session_destroy(openmrcp_session);
- }
- else {
+ } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "abnormal session terminate\n");
}
return MRCP_STATUS_SUCCESS;
}
-static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel, mrcp_audio_channel_t *audio_channel)
+static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrcp_session_t *session, mrcp_client_channel_t *control_channel,
+ mrcp_audio_channel_t *audio_channel)
{
openmrcp_session_t *openmrcp_session = mrcp_client_context_session_object_get(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "on_channel_add called\n");
@@ -242,8 +241,9 @@
apr_finfo_t finfo;
char *buf1;
apr_size_t bytes2read = 0;
-
- mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
+
+ mrcp_message_t *mrcp_message =
+ mrcp_client_context_message_get(context, asr_session->client_session, asr_session->control_channel, RECOGNIZER_RECOGNIZE);
if (!mrcp_message) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create mrcp msg\n");
@@ -257,9 +257,9 @@
return -1;
}
rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fp);
-
- buf1 = apr_palloc(mp, (apr_size_t)finfo.size + 1);
- bytes2read = (apr_size_t)finfo.size;
+
+ buf1 = apr_palloc(mp, (apr_size_t) finfo.size + 1);
+ bytes2read = (apr_size_t) finfo.size;
rv = apr_file_read(fp, buf1, &bytes2read);
buf1[bytes2read] = '\0';
@@ -286,27 +286,23 @@
* This code expects certain one-time initialization of the openmrcp client
* engine/systeme to have already taken place.function to open the asr interface
*/
-static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah,
- const char *codec,
- int rate,
- const char *dest,
- switch_asr_flag_t *flags)
+static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags)
{
openmrcp_session_t *asr_session;
mrcp_client_channel_t *asr_channel;
char *profile_name = openmrcp_module.asr_profile_name;
- openmrcp_profile_t *asr_profile = NULL;
+ openmrcp_profile_t *asr_profile = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "asr_open called, codec: %s, rate: %d\n", codec, rate);
if (strcmp(codec, "L16")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only L16 codec supported\n");
- return SWITCH_STATUS_GENERR;
+ return SWITCH_STATUS_GENERR;
}
if (rate != 8000) {
// TODO: look into supporting other sample rates
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sorry, only 8kz supported\n");
- return SWITCH_STATUS_GENERR;
+ return SWITCH_STATUS_GENERR;
}
if (!switch_strlen_zero(ah->param)) {
@@ -315,7 +311,7 @@
if (!(asr_profile = switch_core_hash_find(openmrcp_module.profile_hash, profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot locate profile %s\n", profile_name);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_STATUS_GENERR;
}
/* create session */
@@ -336,7 +332,7 @@
switch_mutex_lock(asr_session->flag_mutex);
mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
- if (switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+ if (switch_thread_cond_timedwait(asr_session->wait_object, asr_session->flag_mutex, 5000 * 1000) != APR_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
}
switch_mutex_unlock(asr_session->flag_mutex);
@@ -358,15 +354,15 @@
TODO: - how does DEFINE-GRAMMAR fit into the picture here? (if at all)
*/
-
+
openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
mrcp_client_context_t *context = asr_session->profile->mrcp_context;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading grammar\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Start Recognizer\n");
openmrcp_recog_start(context, asr_session, path);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished loading grammar\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -387,22 +383,22 @@
/* sampling rate and frame size should be retrieved from audio sink */
media_frame.codec_frame.size = 160;
media_frame.codec_frame.buffer = data;
- while(len >= media_frame.codec_frame.size) {
+ while (len >= media_frame.codec_frame.size) {
if (!audio_sink) {
/*!
- If there is no audio_sink established yet, discard the audio and
- return SUCCESS. returning anything other than success causes freeswitch
- to abort the call and tear down the channel. One reason there might
- not be an audio sink is that the openmrcp client lib is still in the startup
- process.
- */
+ If there is no audio_sink established yet, discard the audio and
+ return SUCCESS. returning anything other than success causes freeswitch
+ to abort the call and tear down the channel. One reason there might
+ not be an audio sink is that the openmrcp client lib is still in the startup
+ process.
+ */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!audio_sink\n");
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
audio_sink->method_set->write_frame(audio_sink, &media_frame);
-
- len -= (unsigned int)media_frame.codec_frame.size;
- media_frame.codec_frame.buffer = (char*)media_frame.codec_frame.buffer + media_frame.codec_frame.size;
+
+ len -= (unsigned int) media_frame.codec_frame.size;
+ media_frame.codec_frame.buffer = (char *) media_frame.codec_frame.buffer + media_frame.codec_frame.size;
}
if (len > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "None frame alligned data len [%d]\n", len);
@@ -452,9 +448,9 @@
// terminate client session
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
- switch_set_flag_locked(asr_session, FLAG_TERMINATING);
+ switch_set_flag_locked(asr_session, FLAG_TERMINATING);
mrcp_client_context_session_terminate(context, asr_session->client_session);
-
+
switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
return SWITCH_STATUS_SUCCESS;
@@ -470,7 +466,7 @@
static switch_status_t openmrcp_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
{
openmrcp_session_t *asr_session = (openmrcp_session_t *) ah->private_info;
-
+
switch_status_t rv = (switch_test_flag(asr_session, FLAG_HAS_MESSAGE)) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
return rv;
@@ -491,49 +487,44 @@
switch_clear_flag_locked(asr_session, FLAG_HAS_MESSAGE);
if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS &&
- message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+ if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
ret = SWITCH_STATUS_FALSE;
}
- }
- else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+ } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
/*!
we have to extract the XML but stripping off the <?xml version="1.0"?>
header. the body looks like:
-
+
Completion-Cause:001 no-match
Content-Type: application/nlsml+xml
Content-Length: 260
-
- <?xml version="1.0"?>
- <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
- <interpretation> <input mode="speech">open a</input>
- </interpretation>
- </result>
- */
+
+ <?xml version="1.0"?>
+ <result xmlns="http://www.ietf.org/xml/ns/mrcpv2" xmlns:ex="http://www.example.com/example" score="100" grammar="session:request1@form-level.store">
+ <interpretation> <input mode="speech">open a</input>
+ </interpretation>
+ </result>
+ */
if (message->body) {
- char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
+ char *marker = "?>"; // FIXME -- lame and brittle way of doing this. use regex or better.
char *position = strstr(message->body, marker);
if (!position) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", message->body);
ret = SWITCH_STATUS_FALSE;
- }
- else {
+ } else {
position += strlen(marker);
*xmlstr = strdup(position);
}
- }
- else {
+ } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server\n");
ret = SWITCH_STATUS_FALSE;
}
- ret = SWITCH_STATUS_SUCCESS;
- }
- else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
+ ret = SWITCH_STATUS_SUCCESS;
+ } else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) {
ret = SWITCH_STATUS_BREAK;
}
}
@@ -546,23 +537,17 @@
mrcp_generic_header_t *generic_header;
mrcp_message_t *mrcp_message;
mrcp_status_t status = MRCP_STATUS_FAILURE;
-
+
char *text2speak;
- const char v2_xml_head[] =
- "<?xml version=\"1.0\"?>\r\n"
- "<speak>\r\n"
- "<paragraph>\r\n"
- " <sentence><break time=\"1000ms\"/>";
+ const char v2_xml_head[] = "<?xml version=\"1.0\"?>\r\n" "<speak>\r\n" "<paragraph>\r\n" " <sentence><break time=\"1000ms\"/>";
- const char v2_xml_tail[] = "<break time=\"1000ms\"/></sentence>\r\n"
- "</paragraph>\r\n"
- "</speak>\r\n";
+ const char v2_xml_tail[] = "<break time=\"1000ms\"/></sentence>\r\n" "</paragraph>\r\n" "</speak>\r\n";
- const char v1_xml_head[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\">\n<break time=\"1000ms\"/>";
+ const char v1_xml_head[] = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\">\n<break time=\"1000ms\"/>";
- const char v1_xml_tail[] = "<break time=\"1000ms\"/>\n</speak>\n";
+ const char v1_xml_tail[] = "<break time=\"1000ms\"/>\n</speak>\n";
const char *xml_head, *xml_tail;
@@ -592,7 +577,7 @@
status = mrcp_client_context_channel_modify(context, tts_session->client_session, mrcp_message);
- end:
+ end:
return status;
@@ -609,12 +594,12 @@
}
-static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
+static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, const char *voice_name, int rate, switch_speech_flag_t *flags)
{
openmrcp_session_t *tts_session;
mrcp_client_channel_t *tts_channel;
char *profile_name = openmrcp_module.tts_profile_name;
- openmrcp_profile_t *tts_profile = NULL;
+ openmrcp_profile_t *tts_profile = NULL;
if (!switch_strlen_zero(sh->param)) {
profile_name = sh->param;
@@ -622,7 +607,7 @@
if (!(tts_profile = switch_core_hash_find(openmrcp_module.profile_hash, profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot locate profile %s\n", profile_name);
- return SWITCH_STATUS_GENERR;
+ return SWITCH_STATUS_GENERR;
}
/* create session */
@@ -642,7 +627,7 @@
}
switch_mutex_lock(tts_session->flag_mutex);
mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
- if (switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000*1000) != APR_SUCCESS) {
+ if (switch_thread_cond_timedwait(tts_session->wait_object, tts_session->flag_mutex, 5000 * 1000) != APR_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
}
switch_mutex_unlock(tts_session->flag_mutex);
@@ -665,7 +650,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "terminate tts_session\n");
switch_set_flag_locked(tts_session, FLAG_TERMINATING);
mrcp_client_context_session_terminate(context, tts_session->client_session);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
static switch_status_t openmrcp_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
@@ -677,11 +662,11 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no synthesizer channel too feed tts\n");
return SWITCH_STATUS_FALSE;
}
-
- synth_speak(context, tts_session, text);
-
+
+ synth_speak(context, tts_session, text);
+
switch_clear_flag(tts_session, FLAG_FEED_STARTED);
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
/**
@@ -693,7 +678,7 @@
static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
{
openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
- size_t return_len=0;
+ size_t return_len = 0;
media_frame_t media_frame;
audio_source_t *audio_source;
@@ -703,13 +688,11 @@
switch_clear_flag_locked(tts_session, FLAG_HAS_MESSAGE);
if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
- if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS &&
- message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
+ if (message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "error code received [%d]\n", message->start_line.status_code);
return SWITCH_STATUS_BREAK;
}
- }
- else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
+ } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) {
/* tell fs we are done */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FLAG_SPEAK_COMPLETE\n");
@@ -724,7 +707,7 @@
}
if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
- switch_set_flag(tts_session, FLAG_FEED_STARTED); // shouldn't this use set_flag_locked? -tl
+ switch_set_flag(tts_session, FLAG_FEED_STARTED); // shouldn't this use set_flag_locked? -tl
if (audio_source->method_set->open) {
audio_source->method_set->open(audio_source);
}
@@ -733,8 +716,8 @@
/* sampling rate and frame size should be retrieved from audio source */
*rate = 8000;
media_frame.codec_frame.size = 160;
- while(return_len < *datalen) {
- media_frame.codec_frame.buffer = (char*)data + return_len;
+ while (return_len < *datalen) {
+ media_frame.codec_frame.buffer = (char *) data + return_len;
audio_source->method_set->read_frame(audio_source, &media_frame);
if (media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
memset(media_frame.codec_frame.buffer, 0, media_frame.codec_frame.size);
@@ -742,7 +725,7 @@
return_len += media_frame.codec_frame.size;
}
*datalen = return_len;
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
@@ -752,7 +735,7 @@
mrcp_client_context_t *context = tts_session->profile->mrcp_context;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "flush_tts called\n");
- synth_stop(context, tts_session); // TODO
+ synth_stop(context, tts_session); // TODO
}
static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
@@ -797,8 +780,7 @@
apt_log_priority_set(atoi(val));
}
}
- }
- else {
+ } else {
goto error;
}
if ((profiles = switch_xml_child(cfg, "profiles"))) {
@@ -818,9 +800,8 @@
const char *val = switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "proto_version")) {
- mrcp_options->proto_version =(mrcp_version_t) atoi(val);
- }
- else if (!strcasecmp(var, "client_ip")) {
+ mrcp_options->proto_version = (mrcp_version_t) atoi(val);
+ } else if (!strcasecmp(var, "client_ip")) {
mrcp_options->client_ip = switch_core_strdup(openmrcp_module.pool, val);
} else if (!strcasecmp(var, "server_ip")) {
mrcp_options->server_ip = switch_core_strdup(openmrcp_module.pool, val);
@@ -835,27 +816,24 @@
}
}
mrcp_profile->mrcp_options = mrcp_options;
-
+
/* add profile */
if (!switch_core_hash_find(openmrcp_module.profile_hash, mrcp_profile->name)) {
if (openmrcp_profile_run(mrcp_profile) == SWITCH_STATUS_SUCCESS) {
switch_core_hash_insert(openmrcp_module.profile_hash, mrcp_profile->name, mrcp_profile);
}
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "profile with the name [%s] already exists\n", mrcp_profile->name);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "profile with the name [%s] already exists\n", mrcp_profile->name);
}
}
- }
- else {
+ } else {
goto error;
}
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
- error:
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load module configuration\n");
switch_xml_free(xml);
return SWITCH_STATUS_TERM;
@@ -867,10 +845,10 @@
mrcp_client_event_handler_t *mrcp_event_handler;
mrcp_client_t *mrcp_client;
mrcp_client_context_t *mrcp_context;
-
+
/*!
- Perform one-time initialization of mrcp client library
- */
+ Perform one-time initialization of mrcp client library
+ */
mrcp_event_handler = switch_core_alloc(openmrcp_module.pool, sizeof(mrcp_client_event_handler_t));
mrcp_event_handler->on_session_initiate = openmrcp_on_session_initiate;
mrcp_event_handler->on_session_terminate = openmrcp_on_session_terminate;
@@ -902,7 +880,7 @@
static switch_status_t openmrcp_init()
{
/* one-time mrcp global initialization */
- if(apr_pool_create(&openmrcp_module.pool,NULL) != APR_SUCCESS) {
+ if (apr_pool_create(&openmrcp_module.pool, NULL) != APR_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
@@ -931,7 +909,7 @@
/* shutdown client engine */
openmrcp_client_shutdown(mrcp_profile->mrcp_client);
/* destroy client context */
- mrcp_client_context_destroy(mrcp_profile->mrcp_context);
+ mrcp_client_context_destroy(mrcp_profile->mrcp_context);
}
switch_core_hash_destroy(&openmrcp_module.profile_hash);
openmrcp_module.profile_hash = NULL;
@@ -973,7 +951,7 @@
/* initialize openmrcp */
if (openmrcp_init() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
}
/* indicate that the module should continue to be loaded */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_amr/mod_amr.c Tue May 27 07:24:06 2008
@@ -139,8 +139,8 @@
if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct amr_context))))) {
return SWITCH_STATUS_FALSE;
- } else {
-
+ } else {
+
context->dtx_mode = AMR_DTX_ENABLED;
if (codec->fmtp_in) {
argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -207,7 +207,8 @@
context->enc_mode = globals.default_bitrate;
}
- switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+ switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMR_OPT_OCTET_ALIGN) ? 1 : 0,
+ context->enc_mode);
codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
context->enc_mode = AMR_DEFAULT_BITRATE;
@@ -249,8 +250,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
- unsigned int *flag)
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
{
#ifdef AMR_PASSTHROUGH
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -272,8 +272,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
- unsigned int *flag)
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
{
#ifdef AMR_PASSTHROUGH
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -320,10 +319,9 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "AMR");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200,
- 20000, 160, 320, 0, 1, 1, 1,
- switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200,
+ 20000, 160, 320, 0, 1, 1, 1, switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g723_1/mod_g723_1.c Tue May 27 07:24:06 2008
@@ -110,7 +110,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
#ifdef G723_PASSTHROUGH
@@ -141,7 +141,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
#ifdef G723_PASSTHROUGH
@@ -170,16 +170,16 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
{
switch_codec_interface_t *codec_interface;
- int mpf = 30000, spf = 240, bpf = 480, ebpf = 24, count;
+ int mpf = 30000, spf = 240, bpf = 480, ebpf = 24, count;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "G.723.1 6.3k");
- for (count = 1; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 4,
- switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
- }
+ for (count = 1; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 4,
+ switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
+ }
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_g729/mod_g729.c Tue May 27 07:24:06 2008
@@ -95,7 +95,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
#ifdef G729_PASSTHROUGH
@@ -138,7 +138,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
#ifdef G729_PASSTHROUGH
@@ -154,7 +154,7 @@
}
if (encoded_data_len % 2 == 0) {
-
+
if (encoded_data_len == 2 || encoded_data_len % 12 == 0) {
return SWITCH_STATUS_BREAK;
//divisor = 12;
@@ -209,18 +209,18 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load)
{
switch_codec_interface_t *codec_interface;
- int mpf = 10000, spf = 80, bpf = 160, ebpf = 10, count;
+ int mpf = 10000, spf = 80, bpf = 160, ebpf = 10, count;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "G.729");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 18, "G729", NULL, 8000, 8000, 8000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g729_init, switch_g729_encode, switch_g729_decode, switch_g729_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 18, "G729", NULL, 8000, 8000, 8000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g729_init, switch_g729_encode, switch_g729_decode, switch_g729_destroy);
+ }
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_h26x/mod_h26x.c Tue May 27 07:24:06 2008
@@ -45,7 +45,7 @@
if (!(encoding || decoding)) {
return SWITCH_STATUS_FALSE;
} else {
- if (codec->fmtp_in) {
+ if (codec->fmtp_in) {
codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in);
}
return SWITCH_STATUS_SUCCESS;
@@ -53,21 +53,21 @@
}
static switch_status_t switch_h26x_encode(switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *decoded_data,
- uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
- unsigned int *flag)
+ switch_codec_t *other_codec,
+ void *decoded_data,
+ uint32_t decoded_data_len,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+ unsigned int *flag)
{
return SWITCH_STATUS_FALSE;
}
static switch_status_t switch_h26x_decode(switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *encoded_data,
- uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
- unsigned int *flag)
+ switch_codec_t *other_codec,
+ void *encoded_data,
+ uint32_t encoded_data_len,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+ unsigned int *flag)
{
return SWITCH_STATUS_FALSE;
}
@@ -83,30 +83,25 @@
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "H.264 Video (passthru)");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 99, "H264", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 99, "H264", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263 Video (passthru)");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263+ Video (passthru)");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263++ Video (passthru)");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.261 Video (passthru)");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c Tue May 27 07:24:06 2008
@@ -97,7 +97,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
struct ilbc_context *context = codec->private_info;
@@ -137,7 +137,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
struct ilbc_context *context = codec->private_info;
@@ -187,31 +187,31 @@
SWITCH_ADD_CODEC(codec_interface, "iLBC");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
- /* 30ms variants */
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
- 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
- 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
- switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ /* 30ms variants */
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
+ 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
+ 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+ switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_speex/mod_speex.c Tue May 27 07:24:06 2008
@@ -159,7 +159,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
struct speex_context *context = codec->private_info;
@@ -211,7 +211,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
struct speex_context *context = codec->private_info;
@@ -264,24 +264,24 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load)
{
switch_codec_interface_t *codec_interface;
- int mpf = 20000, spf = 160, bpf = 320, ebpf = 0, rate = 8000, counta, countb;
- switch_payload_t ianacode[4] = { 0, 98, 99, 103};
- int bps[4] = { 0, 24600, 42200, 44000 };
+ int mpf = 20000, spf = 160, bpf = 320, ebpf = 0, rate = 8000, counta, countb;
+ switch_payload_t ianacode[4] = { 0, 98, 99, 103 };
+ int bps[4] = { 0, 24600, 42200, 44000 };
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "Speex");
- for (counta = 1; counta <= 3; counta++) {
- for (countb = 1; countb > 0; countb--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "SPEEX", NULL, rate, rate, bps[counta],
- mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 6,
- switch_speex_init, switch_speex_encode, switch_speex_decode, switch_speex_destroy);
- }
- rate = rate * 2;
- spf = spf * 2;
- bpf = bpf * 2;
- ebpf = ebpf * 2;
- }
+ for (counta = 1; counta <= 3; counta++) {
+ for (countb = 1; countb > 0; countb--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "SPEEX", NULL, rate, rate, bps[counta],
+ mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 6,
+ switch_speex_init, switch_speex_encode, switch_speex_decode, switch_speex_destroy);
+ }
+ rate = rate * 2;
+ spf = spf * 2;
+ bpf = bpf * 2;
+ ebpf = ebpf * 2;
+ }
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c Tue May 27 07:24:06 2008
@@ -81,7 +81,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
struct lpc10_context *context = codec->private_info;
@@ -99,7 +99,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
struct lpc10_context *context = codec->private_info;
@@ -138,8 +138,8 @@
}
if (decoding) {
gsm0610_init(&context->decoder_object, GSM0610_PACKING_VOIP);
- }
-
+ }
+
codec->private_info = context;
return SWITCH_STATUS_SUCCESS;
}
@@ -149,8 +149,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
- unsigned int *flag)
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
{
struct gsm_context *context = codec->private_info;
@@ -167,8 +166,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
- unsigned int *flag)
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
{
struct gsm_context *context = codec->private_info;
@@ -187,6 +185,7 @@
codec->private_info = NULL;
return SWITCH_STATUS_SUCCESS;
}
+
/* GSM - END */
#ifdef ENABLE_G711
@@ -209,7 +208,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -232,7 +231,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -280,7 +279,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -303,7 +302,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -370,7 +369,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
struct g722_context *context = codec->private_info;
@@ -388,7 +387,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
struct g722_context *context = codec->private_info;
@@ -416,8 +415,8 @@
static switch_status_t switch_g726_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings)
{
uint32_t encoding, decoding;
- int packing = G726_PACKING_RIGHT;
- g726_state_t *context;
+ int packing = G726_PACKING_RIGHT;
+ g726_state_t *context;
encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
@@ -426,10 +425,10 @@
return SWITCH_STATUS_FALSE;
} else {
if ((flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))) {
- packing = G726_PACKING_LEFT;
- }
+ packing = G726_PACKING_LEFT;
+ }
- g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
+ g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
codec->private_info = context;
return SWITCH_STATUS_SUCCESS;
@@ -446,7 +445,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
g726_state_t *context = codec->private_info;
@@ -455,7 +454,7 @@
return SWITCH_STATUS_FALSE;
}
- *encoded_data_len = g726_encode(context, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
+ *encoded_data_len = g726_encode(context, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
return SWITCH_STATUS_SUCCESS;
}
@@ -464,16 +463,16 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
- g726_state_t *context = codec->private_info;
+ g726_state_t *context = codec->private_info;
if (!context) {
return SWITCH_STATUS_FALSE;
}
- *decoded_data_len = (2 * g726_decode(context, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+ *decoded_data_len = (2 * g726_decode(context, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
return SWITCH_STATUS_SUCCESS;
}
@@ -503,8 +502,8 @@
}
if (decoding) {
ima_adpcm_init(&context->decoder_object, IMA_ADPCM_DVI4, 0);
- }
-
+ }
+
codec->private_info = context;
return SWITCH_STATUS_SUCCESS;
}
@@ -514,7 +513,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
struct ima_adpcm_context *context = codec->private_info;
@@ -532,7 +531,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
struct ima_adpcm_context *context = codec->private_info;
@@ -559,7 +558,7 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_voipcodecs_load)
{
switch_codec_interface_t *codec_interface;
- int mpf, spf, bpf, ebpf, count;
+ int mpf, spf, bpf, ebpf, count;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -567,134 +566,133 @@
/* IMA_ADPCM */
mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
SWITCH_ADD_CODEC(codec_interface, "ADPCM (IMA)");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 5, "DVI4", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
- switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 5, "DVI4", NULL, 8000, 8000, 32000,
+ mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+ switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
+ }
mpf = 10000, spf = 160, bpf = 320, ebpf = 160;
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 6, "DVI4", NULL, 16000, 16000, 64000,
- mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
- switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 6, "DVI4", NULL, 16000, 16000, 64000,
+ mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+ switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
+ }
/* G726 */
mpf = 10000, spf = 80, bpf = 160, ebpf = 20;
SWITCH_ADD_CODEC(codec_interface, "G.726 16k (AAL2)");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
SWITCH_ADD_CODEC(codec_interface, "G.726 16k");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
- /* Increase encoded bytes per frame by 10 */
- ebpf = ebpf + 10;
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
+ /* Increase encoded bytes per frame by 10 */
+ ebpf = ebpf + 10;
SWITCH_ADD_CODEC(codec_interface, "G.726 24k (AAL2)");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
- /* Increase encoded bytes per frame by 10 */
- ebpf = ebpf + 10;
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
+ /* Increase encoded bytes per frame by 10 */
+ ebpf = ebpf + 10;
SWITCH_ADD_CODEC(codec_interface, "G.726 32k (AAL2)");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
SWITCH_ADD_CODEC(codec_interface, "G.726 32k");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
- /* Increase encoded bytes per frame by 10 */
- ebpf = ebpf + 10;
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
+ /* Increase encoded bytes per frame by 10 */
+ ebpf = ebpf + 10;
SWITCH_ADD_CODEC(codec_interface, "G.726 40k (AAL2)");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
SWITCH_ADD_CODEC(codec_interface, "G.726 40k");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
+ }
/* G722 */
mpf = 10000, spf = 80, bpf = 320, ebpf = 80;
SWITCH_ADD_CODEC(codec_interface, "G.722");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
+ }
#ifdef ENABLE_G711
/* G711 */
mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
- }
-
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
+ }
+
SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
+ }
#endif
/* GSM */
mpf = 20000, spf = 160, bpf = 320, ebpf = 33;
SWITCH_ADD_CODEC(codec_interface, "GSM");
- for (count = 6; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
- switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
- }
+ for (count = 6; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
+ switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
+ }
/* LPC10 */
#if SWITCH_MAX_INTERVAL >= 90
SWITCH_ADD_CODEC(codec_interface, "LPC-10");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 7, "LPC", NULL, 8000, 8000, 2400,
- 90000, 720, 1440, 28, 1, 1, 1,
- switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
+ 90000, 720, 1440, 28, 1, 1, 1, switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
#endif
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c Tue May 27 07:24:06 2008
@@ -58,31 +58,31 @@
if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
goto error;
}
-
+
if (argc > 1) {
switch_channel_set_variable(channel, "call_timeout", argv[1]);
}
-
- switch_replace_char(argv[0], '&',',', SWITCH_FALSE);
-
+
+ switch_replace_char(argv[0], '&', ',', SWITCH_FALSE);
+
if (exec_app(session, "bridge", argv[0]) != SWITCH_STATUS_SUCCESS) {
goto error;
}
-
+
goto ok;
}
-
- error:
+
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
- ok:
-
+ ok:
+
return;
}
SWITCH_STANDARD_APP(avoid_function)
{
- void *y = NULL;
+ void *y = NULL;
int x = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -92,7 +92,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "I should never be called!.\n");
- memset((void *) y, 0, 1000);
+ memset((void *) y, 0, 1000);
}
SWITCH_STANDARD_APP(goto_function)
@@ -105,16 +105,16 @@
if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
goto error;
}
-
+
switch_ivr_session_transfer(session, argv[1], "asterisk", argv[0]);
goto ok;
}
-
- error:
+
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
- ok:
-
+ ok:
+
return;
}
@@ -134,14 +134,14 @@
if (!caller_profile) {
caller_profile = switch_channel_get_caller_profile(channel);
}
-
+
if (!caller_profile || switch_strlen_zero(caller_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
return NULL;
}
context = caller_profile->context ? caller_profile->context : "default";
-
+
if (!switch_config_open_file(&cfg, cf)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -166,11 +166,11 @@
const char *field_data = caller_profile->destination_number;
int proceed = 0;
switch_regex_t *re = NULL;
- int ovector[30] = {0};
+ int ovector[30] = { 0 };
char *cid = NULL;
expression = expression_buf;
-
+
argc = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc < 3) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "parse error line %d!\n", cfg.lineno);
@@ -178,14 +178,14 @@
}
pattern = argv[0];
-
+
if (!strcasecmp(var, "exten")) {
char *p;
if (pattern && (p = strchr(pattern, '/'))) {
*p++ = '\0';
cid = pattern;
pattern = p;
- }
+ }
} else {
if (strchr(var, '$')) {
if ((field_expanded = switch_channel_expand_variables(channel, var)) == var) {
@@ -198,19 +198,19 @@
field_data = switch_caller_get_field_by_name(caller_profile, var);
}
}
-
+
if (pattern && (*pattern == '_' || *pattern == '~')) {
if (*pattern == '_') {
pattern++;
if (switch_ast2regex(pattern, expression_buf, sizeof(expression_buf))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "converting [%s] to real regex [%s] you should try them!\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "converting [%s] to real regex [%s] you should try them!\n",
pattern, expression_buf);
}
} else {
pattern++;
expression = pattern;
}
-
+
if (!field_data) {
field_data = "";
}
@@ -225,7 +225,7 @@
continue;
}
}
-
+
if (cid) {
if (strcasecmp(cid, caller_profile->caller_id_number)) {
continue;
@@ -235,21 +235,21 @@
switch_channel_set_variable(channel, "EXTEN", caller_profile->destination_number);
switch_channel_set_variable(channel, "CHANNEL", switch_channel_get_name(channel));
switch_channel_set_variable(channel, "UNIQUEID", switch_core_session_get_uuid(session));
-
+
pri = argv[1];
app = argv[2];
-
+
if ((argument = strchr(app, '('))) {
char *p;
*argument++ = '\0';
p = strrchr(argument, ')');
if (p) {
- *p = '\0';
+ *p = '\0';
}
} else if ((argument = strchr(app, ','))) {
*argument++ = '\0';
}
-
+
if (!argument) {
argument = "";
}
@@ -274,10 +274,10 @@
break;
}
}
-
+
switch_caller_extension_add_application(session, extension, app, argument);
}
-
+
switch_safe_free(field_expanded);
}
}
@@ -291,18 +291,14 @@
switch_endpoint_interface_t *sip_endpoint_interface;
static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags);
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
switch_io_routines_t sip_io_routines = {
/*.outgoing_channel */ sip_outgoing_channel
};
static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags)
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
const char *profile;
@@ -326,18 +322,14 @@
switch_endpoint_interface_t *iax2_endpoint_interface;
static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags);
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
switch_io_routines_t iax2_io_routines = {
/*.outgoing_channel */ iax2_outgoing_channel
};
static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags)
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE);
}
@@ -346,7 +338,7 @@
#define WE_DONT_NEED_NO_STINKIN_KEY "true"
static char *key()
{
- return WE_DONT_NEED_NO_STINKIN_KEY;
+ return WE_DONT_NEED_NO_STINKIN_KEY;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_asterisk_load)
@@ -359,7 +351,7 @@
if ((mykey = key())) {
mykey = NULL;
}
-
+
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
/* add a dialplan interface */
@@ -369,7 +361,7 @@
SWITCH_ADD_APP(app_interface, "Dial", "Dial", "Dial", dial_function, "Dial", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "Goto", "Goto", "Goto", goto_function, "Goto", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "AvoidingDeadlock", "Avoid", "Avoid", avoid_function, "Avoid", SAF_SUPPORT_NOMEDIA);
-
+
/* fake chan_sip facade */
sip_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
sip_endpoint_interface->interface_name = "SIP";
@@ -379,7 +371,7 @@
iax2_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
iax2_endpoint_interface->interface_name = "IAX2";
iax2_endpoint_interface->io_routines = &iax2_io_routines;
-
+
if (getenv("FAITHFUL_EMULATION")) {
for (x = 0; x < 10; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Avoiding Deadlock.\n");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c Tue May 27 07:24:06 2008
@@ -96,7 +96,7 @@
if (!caller_profile) {
caller_profile = switch_channel_get_caller_profile(channel);
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Hello %s You Dialed %s!\n", caller_profile->caller_id_name,
caller_profile->destination_number);
@@ -134,7 +134,7 @@
}
}
}
- out:
+ out:
switch_core_directory_close(&dh);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c Tue May 27 07:24:06 2008
@@ -185,15 +185,14 @@
return proceed;
}
-static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t * root,
- switch_xml_t * node)
+static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t *root, switch_xml_t *node)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_GENERR;
switch_event_t *params = NULL;
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
- switch_assert(params);
+ switch_assert(params);
switch_channel_event_set_data(channel, params);
@@ -215,7 +214,7 @@
goto done;
}
}
-
+
if (!caller_profile->context) {
caller_profile->context = "default";
}
@@ -265,7 +264,7 @@
proceed = parse_exten(session, caller_profile, xexten, &extension);
- if (proceed && !switch_true(cont)) {
+ if (proceed && !switch_true(cont)) {
break;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c Tue May 27 07:24:06 2008
@@ -139,8 +139,8 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_device_name, globals.device_name);
#define is_master(t) switch_test_flag(t, TFLAG_MASTER)
-static void add_pvt(private_t * tech_pvt, int master);
-static void remove_pvt(private_t * tech_pvt);
+static void add_pvt(private_t *tech_pvt, int master);
+static void remove_pvt(private_t *tech_pvt);
static switch_status_t channel_on_init(switch_core_session_t *session);
static switch_status_t channel_on_hangup(switch_core_session_t *session);
static switch_status_t channel_on_routing(switch_core_session_t *session);
@@ -356,7 +356,7 @@
-static void add_pvt(private_t * tech_pvt, int master)
+static void add_pvt(private_t *tech_pvt, int master)
{
private_t *tp;
uint8_t in_list = 0;
@@ -399,7 +399,7 @@
switch_mutex_unlock(globals.pvt_lock);
}
-static void remove_pvt(private_t * tech_pvt)
+static void remove_pvt(private_t *tech_pvt)
{
private_t *tp, *last = NULL;
@@ -562,8 +562,7 @@
tech_pvt->hold_file,
globals.read_codec.implementation->number_of_channels,
globals.read_codec.implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_core_codec_destroy(&tech_pvt->write_codec);
tech_pvt->hold_file = NULL;
goto cng;
@@ -578,12 +577,12 @@
goto hold;
}
- cng:
+ cng:
switch_yield(globals.read_codec.implementation->microseconds_per_frame);
*frame = &globals.cng_frame;
return SWITCH_STATUS_SUCCESS;
- hold:
+ hold:
{
switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
@@ -612,7 +611,7 @@
}
switch_mutex_lock(globals.device_lock);
- if ((samples = snd_pcm_readi (globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) > 0) {
+ if ((samples = snd_pcm_readi(globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) > 0) {
globals.read_frame.datalen = samples * 2;
globals.read_frame.samples = samples;
@@ -887,7 +886,7 @@
globals.codec_ms = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
+ "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
} else if (!strcmp(var, "dialplan")) {
set_global_dialplan(val);
@@ -951,18 +950,18 @@
int err = 0;
snd_pcm_hw_params_t *hw_params = NULL;
char *device = globals.device_name;
-
+
if (globals.audio_stream_in && globals.audio_stream_out) {
return SWITCH_STATUS_SUCCESS;
- }
+ }
if (globals.audio_stream_in) {
- snd_pcm_close (globals.audio_stream_in);
+ snd_pcm_close(globals.audio_stream_in);
globals.audio_stream_in = NULL;
}
if (globals.audio_stream_out) {
- snd_pcm_close (globals.audio_stream_out);
+ snd_pcm_close(globals.audio_stream_out);
globals.audio_stream_out = NULL;
}
@@ -976,33 +975,30 @@
if (switch_core_codec_init(&globals.read_codec,
"L16",
- NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
} else {
if (switch_core_codec_init(&globals.write_codec,
"L16",
NULL,
- sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
switch_core_codec_destroy(&globals.read_codec);
return SWITCH_STATUS_FALSE;
}
}
-
+
if (switch_core_timer_init(&globals.timer,
- globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
- module_pool) != SWITCH_STATUS_SUCCESS) {
+ globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame, module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
switch_core_codec_destroy(&globals.read_codec);
switch_core_codec_destroy(&globals.write_codec);
return SWITCH_STATUS_FALSE;
}
-
-
+
+
globals.read_frame.rate = sample_rate;
globals.read_frame.codec = &globals.read_codec;
@@ -1011,176 +1007,152 @@
switch_mutex_lock(globals.device_lock);
/* LOCKED ************************************************************************************************** */
-
- if ((err = snd_pcm_open (&globals.audio_stream_out, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n",
- device,
- snd_strerror (err));
+
+ if ((err = snd_pcm_open(&globals.audio_stream_out, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n", device, snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_any (globals.audio_stream_out, hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_any(globals.audio_stream_out, hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_access (globals.audio_stream_out, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_access(globals.audio_stream_out, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_format (globals.audio_stream_out, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_format(globals.audio_stream_out, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_rate_near (globals.audio_stream_out, hw_params, &sample_rate, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_rate_near(globals.audio_stream_out, hw_params, &sample_rate, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_channels (globals.audio_stream_out, hw_params, 1)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_channels(globals.audio_stream_out, hw_params, 1)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params (globals.audio_stream_out, hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params(globals.audio_stream_out, hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n", snd_strerror(err));
goto fail;
}
-
-
- snd_pcm_hw_params_free (hw_params);
+
+
+ snd_pcm_hw_params_free(hw_params);
hw_params = NULL;
- if ((err = snd_pcm_open (&globals.audio_stream_in, device, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n",
- device,
- snd_strerror (err));
+ if ((err = snd_pcm_open(&globals.audio_stream_in, device, SND_PCM_STREAM_CAPTURE, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot open audio device %s (%s)\n", device, snd_strerror(err));
goto fail;
- }
+ }
- if ((err = snd_pcm_hw_params_malloc (&hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot allocate hardware parameter structure (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_any (globals.audio_stream_in, hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_any(globals.audio_stream_in, hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot initialize hardware parameter structure (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_access (globals.audio_stream_in, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_access(globals.audio_stream_in, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set access type (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_format (globals.audio_stream_in, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_format(globals.audio_stream_in, hw_params, SND_PCM_FORMAT_S16_LE)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample format (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_rate_near (globals.audio_stream_in, hw_params, &sample_rate, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_rate_near(globals.audio_stream_in, hw_params, &sample_rate, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set sample rate (%s)\n", snd_strerror(err));
goto fail;
}
-
- if ((err = snd_pcm_hw_params_set_channels (globals.audio_stream_in, hw_params, 1)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n",
- snd_strerror (err));
+
+ if ((err = snd_pcm_hw_params_set_channels(globals.audio_stream_in, hw_params, 1)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set channel count (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_hw_params_set_period_time (globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_frame, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period time (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_hw_params_set_period_time(globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_frame, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period time (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_hw_params_set_period_size (globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_frame, 0)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period size (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_hw_params_set_period_size(globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_frame, 0)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period size (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_hw_params (globals.audio_stream_in, hw_params)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_hw_params(globals.audio_stream_in, hw_params)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set parameters (%s)\n", snd_strerror(err));
goto fail;
}
-
+
if (hw_params) {
- snd_pcm_hw_params_free (hw_params);
+ snd_pcm_hw_params_free(hw_params);
hw_params = NULL;
}
- if ((err = snd_pcm_prepare (globals.audio_stream_out)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_prepare(globals.audio_stream_out)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_start (globals.audio_stream_out)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_start(globals.audio_stream_out)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_prepare (globals.audio_stream_in)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_prepare(globals.audio_stream_in)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot prepare audio interface for use (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_start (globals.audio_stream_in)) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n",
- snd_strerror (err));
+ if ((err = snd_pcm_start(globals.audio_stream_in)) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot start audio interface for use (%s)\n", snd_strerror(err));
goto fail;
}
-
+
switch_mutex_unlock(globals.device_lock);
return SWITCH_STATUS_SUCCESS;
- fail:
+ fail:
if (hw_params) {
- snd_pcm_hw_params_free (hw_params);
+ snd_pcm_hw_params_free(hw_params);
hw_params = NULL;
}
switch_mutex_unlock(globals.device_lock);
if (globals.audio_stream_in) {
- snd_pcm_close (globals.audio_stream_in);
+ snd_pcm_close(globals.audio_stream_in);
}
if (globals.audio_stream_out) {
- snd_pcm_close (globals.audio_stream_out);
+ snd_pcm_close(globals.audio_stream_out);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device!\n");
switch_core_codec_destroy(&globals.read_codec);
switch_core_codec_destroy(&globals.write_codec);
-
- return SWITCH_STATUS_FALSE;
+
+ return SWITCH_STATUS_FALSE;
@@ -1189,8 +1161,8 @@
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
char *dtmf_str = argv[0];
- switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
-
+ switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+
if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
@@ -1198,7 +1170,7 @@
if (globals.call_list) {
switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
char *p = dtmf_str;
- while(p && *p) {
+ while (p && *p) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
@@ -1250,7 +1222,7 @@
stream->write_function(stream, "NO SUCH CALL\n");
}
- done:
+ done:
switch_mutex_unlock(globals.pvt_lock);
return SWITCH_STATUS_SUCCESS;
@@ -1317,7 +1289,7 @@
break;
}
}
- done:
+ done:
switch_mutex_unlock(globals.pvt_lock);
stream->write_function(stream, "Answered %d channels.\n", x);
@@ -1371,7 +1343,7 @@
goto bad;
}
- desc:
+ desc:
x = 0;
stream->write_function(stream, "FLAGS: ");
if (switch_test_flag((&globals), GFLAG_EAR)) {
@@ -1388,9 +1360,9 @@
goto done;
- bad:
+ bad:
stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
- done:
+ done:
return SWITCH_STATUS_SUCCESS;
}
@@ -1487,12 +1459,9 @@
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
NULL,
- dialplan, cid_name, cid_num,
- ip, NULL, NULL, NULL, (char *) modname, NULL,
- dest)) != 0) {
+ dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, (char *) modname, NULL, dest)) != 0) {
char name[128];
- snprintf(name, sizeof(name), "Alsa/%s",
- tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
+ snprintf(name, sizeof(name), "Alsa/%s", tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
@@ -1504,7 +1473,7 @@
switch_channel_set_state(channel, CS_INIT);
if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
switch_core_session_destroy(&session);
stream->write_function(stream, "FAIL:Thread Error!\n");
} else {
@@ -1536,7 +1505,7 @@
http = switch_event_get_header(stream->param_event, "http-host");
}
-
+
const char *usage_string = "USAGE:\n"
"--------------------------------------------------------------------------------\n"
"alsa help\n"
@@ -1546,8 +1515,7 @@
"alsa list\n"
"alsa switch [<call_id>|none]\n"
"alsa dtmf <digit string>\n"
- "alsa flags [on|off] [ear] [mouth]\n"
- "--------------------------------------------------------------------------------\n";
+ "alsa flags [on|off] [ear] [mouth]\n" "--------------------------------------------------------------------------------\n";
if (http) {
#if 0
@@ -1638,14 +1606,13 @@
stream->write_function(stream, "Unknown Command [%s]\n", argv[0]);
}
- done:
+ done:
if (http) {
stream->write_function(stream,
"<br><br><table align=center><tr><td><center><form method=post>\n"
"<input type=text name=wcmd size=40><br><br>\n"
-
"<input name=action type=submit value=\"call\"> "
"<input name=action type=submit value=\"hangup\"> "
"<input name=action type=submit value=\"list\"> "
@@ -1658,25 +1625,18 @@
"<td><input name=action type=submit value=\"2\"></td>"
"<td><input name=action type=submit value=\"3\"></td>\n"
"<td><input name=action type=submit value=\"A\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"4\"></td>"
"<td><input name=action type=submit value=\"5\"></td>"
"<td><input name=action type=submit value=\"6\"></td>\n"
"<td><input name=action type=submit value=\"B\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"7\"></td>"
"<td><input name=action type=submit value=\"8\"></td>"
"<td><input name=action type=submit value=\"9\"></td>\n"
"<td><input name=action type=submit value=\"C\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"*\"></td>"
"<td><input name=action type=submit value=\"0\"></td>"
"<td><input name=action type=submit value=\"#\"></td>\n"
- "<td><input name=action type=submit value=\"D\"></td></tr>\n"
- "</table>"
-
- "</form><br></center></td></tr></table>\n"
- );
+ "<td><input name=action type=submit value=\"D\"></td></tr>\n" "</table>" "</form><br></center></td></tr></table>\n");
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c Tue May 27 07:24:06 2008
@@ -53,11 +53,7 @@
static char sub_sql[] =
"CREATE TABLE jabber_subscriptions (\n"
- " sub_from VARCHAR(255),\n"
- " sub_to VARCHAR(255),\n"
- " show_pres VARCHAR(255),\n"
- " status VARCHAR(255)\n"
- ");\n";
+ " sub_from VARCHAR(255),\n" " sub_to VARCHAR(255),\n" " show_pres VARCHAR(255),\n" " status VARCHAR(255)\n" ");\n";
typedef enum {
@@ -215,9 +211,9 @@
static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
-static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal,
+static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal,
char *to, char *from, char *subject, char *msg);
-static ldl_status handle_response(ldl_handle_t * handle, char *id);
+static ldl_status handle_response(ldl_handle_t *handle, char *id);
static switch_status_t load_config(void);
static int sin_callback(void *pArg, int argc, char **argv, char **columnNames);
@@ -270,9 +266,8 @@
if (mutex) {
switch_mutex_lock(mutex);
}
-
#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
SQLHSTMT stmt;
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
@@ -292,11 +287,11 @@
switch_core_db_close(db);
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
- end:
+ end:
if (mutex) {
switch_mutex_unlock(mutex);
}
@@ -304,22 +299,18 @@
static switch_bool_t mdl_execute_sql_callback(mdl_profile_t *profile,
- switch_mutex_t *mutex,
- char *sql,
- switch_core_db_callback_func_t callback,
- void *pdata)
+ switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
switch_bool_t ret = SWITCH_FALSE;
switch_core_db_t *db;
char *errmsg = NULL;
-
- if (mutex) {
- switch_mutex_lock(mutex);
- }
+ if (mutex) {
+ switch_mutex_lock(mutex);
+ }
#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
} else {
#endif
@@ -331,7 +322,7 @@
goto end;
}
-
+
switch_core_db_exec(db, sql, callback, pdata, &errmsg);
if (errmsg) {
@@ -342,18 +333,17 @@
if (db) {
switch_core_db_close(db);
}
-
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
- end:
+ end:
if (mutex) {
- switch_mutex_unlock(mutex);
- }
-
+ switch_mutex_unlock(mutex);
+ }
+
return ret;
@@ -418,11 +408,11 @@
char *rpid = switch_event_get_header(event, "rpid");
char *type = switch_event_get_header(event, "event_subtype");
char *sql;
-
- if (globals.running != 1) {
- return;
- }
-
+
+ if (globals.running != 1) {
+ return;
+ }
+
if (!proto) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'proto' header\n");
return;
@@ -481,7 +471,8 @@
}
- sql = switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
+ sql =
+ switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to like '%%%q'", type, rpid, status, proto, from);
for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -495,7 +486,7 @@
if (sql) {
switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, sub_callback, profile);
-
+
if (!worked) {
continue;
}
@@ -564,9 +555,9 @@
void *val;
char *sql;
- if (globals.running != 1) {
- return;
- }
+ if (globals.running != 1) {
+ return;
+ }
if (status && !strcasecmp(status, "n/a")) {
status = NULL;
@@ -697,7 +688,7 @@
tech_pvt = switch_core_session_get_private(*session);
-
+
if (tech_pvt && tech_pvt->profile && tech_pvt->profile->ip && tech_pvt->local_port) {
switch_rtp_release_port(tech_pvt->profile->ip, tech_pvt->local_port);
}
@@ -748,8 +739,7 @@
xml = switch_xml_parse_str(xmltxt, strlen(xmltxt));
form = switch_xml_toxml(xml, SWITCH_FALSE);
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level,
- "%s:\n-------------------------------------------------------------------------------\n"
- "%s\n", ll, form);
+ "%s:\n-------------------------------------------------------------------------------\n" "%s\n", ll, form);
switch_xml_free(xml);
free(data);
}
@@ -774,8 +764,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return 0;
}
- } else if (((tech_pvt->num_codecs =
- switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
+ } else if (((tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, SWITCH_MAX_CODECS))) <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO codecs?\n");
return 0;
}
@@ -786,7 +775,7 @@
-static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj)
{
ldl_handle_t *handle = obj;
mdl_profile_t *profile = NULL;
@@ -805,7 +794,7 @@
return NULL;
}
-static void handle_thread_launch(ldl_handle_t * handle)
+static void handle_thread_launch(ldl_handle_t *handle)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -873,7 +862,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SETUP RTP %s:%d -> %s:%d\n", tech_pvt->profile->ip,
tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
-
+
flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
@@ -1089,8 +1078,7 @@
while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) &&
switch_test_flag(tech_pvt, TFLAG_RTP_READY) &&
switch_test_flag(tech_pvt, TFLAG_ANSWER) && switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT) &&
- tech_pvt->remote_ip && tech_pvt->remote_port
- && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
+ tech_pvt->remote_ip && tech_pvt->remote_port && switch_test_flag(tech_pvt, TFLAG_TRANSPORT))) {
now = switch_timestamp_now();
elapsed = (unsigned int) ((now - started) / 1000);
@@ -1140,9 +1128,9 @@
goto done;
- out:
+ out:
terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- done:
+ done:
return ret;
}
@@ -1222,7 +1210,7 @@
/* Dunno why, but if googletalk calls us for the first time, as soon as the call ends
they think we are offline for no reason so we send this presence packet to stop it from happening
We should find out why.....
- */
+ */
if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) {
ldl_handle_send_presence(tech_pvt->profile->handle, tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call", tech_pvt->profile->avatar);
}
@@ -1497,21 +1485,21 @@
break;
case SWITCH_MESSAGE_INDICATE_BRIDGE:
/*
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
- switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
- //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
- }
- */
+ if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
+ switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
+ //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+ }
+ */
break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
/*
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
- switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
- //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
- }
- */
+ if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
+ switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
+ //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+ }
+ */
break;
default:
break;
@@ -1618,7 +1606,7 @@
} else {
if (!user) {
const char *id_num;
-
+
if (!(id_num = outbound_profile->caller_id_number)) {
if (!(id_num = outbound_profile->caller_id_name)) {
id_num = "nobody";
@@ -1810,7 +1798,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static ldl_status handle_loop(ldl_handle_t * handle)
+static ldl_status handle_loop(ldl_handle_t *handle)
{
if (!globals.running) {
return LDL_STATUS_FALSE;
@@ -1829,7 +1817,7 @@
if (!(profile->login && profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n"
+ "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n"
"message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n",
profile->login, profile->password, profile->dialplan, profile->message, profile->ip, profile->name, profile->exten);
@@ -1886,7 +1874,8 @@
static void set_profile_val(mdl_profile_t *profile, char *var, char *val)
{
- if (!var) return;
+ if (!var)
+ return;
if (!strcasecmp(var, "login")) {
profile->login = switch_core_strdup(module_pool, val);
@@ -1903,8 +1892,7 @@
*profile->odbc_pass++ = '\0';
}
}
-
-
+
#else
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
#endif
@@ -1912,7 +1900,7 @@
switch_set_flag(profile, TFLAG_TIMER);
} else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
profile->dialplan = switch_core_strdup(module_pool, val);
-#ifdef AUTO_REPLY // gotta fix looping on this
+#ifdef AUTO_REPLY // gotta fix looping on this
} else if (!strcasecmp(var, "auto-reply")) {
profile->auto_reply = switch_core_strdup(module_pool, val);
#endif
@@ -2182,7 +2170,7 @@
if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
continue;
-
+
}
if (switch_odbc_handle_connect(profile->master_odbc) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
@@ -2292,7 +2280,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
}
- end:
+ end:
switch_event_destroy(¶ms);
@@ -2307,8 +2295,7 @@
switch_safe_free(xmlstr);
}
-static ldl_status handle_signalling(ldl_handle_t * handle, ldl_session_t * dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject,
- char *msg)
+static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, char *msg)
{
mdl_profile_t *profile = NULL;
switch_core_session_t *session = NULL;
@@ -2350,11 +2337,8 @@
mdl_execute_sql(profile, sql, NULL);
switch_core_db_free(sql);
}
- if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n",
- switch_str_nil(from),
- switch_str_nil(to),
- switch_str_nil(msg),
- switch_str_nil(subject)))) {
+ if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n",
+ switch_str_nil(from), switch_str_nil(to), switch_str_nil(msg), switch_str_nil(subject)))) {
mdl_execute_sql(profile, sql, NULL);
switch_core_db_free(sql);
}
@@ -2362,7 +2346,8 @@
if (is_special(to)) {
ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar);
} else {
- ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com", profile->avatar);
+ ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com",
+ profile->avatar);
}
#if 0
if (is_special(to)) {
@@ -2400,7 +2385,7 @@
break;
case LDL_SIGNAL_PRESENCE_IN:
- if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
+ if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) {
mdl_execute_sql(profile, sql, profile->mutex);
switch_core_db_free(sql);
@@ -2435,7 +2420,7 @@
case LDL_SIGNAL_PRESENCE_OUT:
- if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
+ if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'",
switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) {
mdl_execute_sql(profile, sql, profile->mutex);
switch_core_db_free(sql);
@@ -2454,45 +2439,45 @@
switch (dl_signal) {
case LDL_SIGNAL_MSG:{
- switch_chat_interface_t *ci;
- char *proto = MDL_CHAT_PROTO;
- char *pproto = NULL, *ffrom = NULL;
- char *hint;
+ switch_chat_interface_t *ci;
+ char *proto = MDL_CHAT_PROTO;
+ char *pproto = NULL, *ffrom = NULL;
+ char *hint;
#ifdef AUTO_REPLY
- if (profile->auto_reply) {
- ldl_handle_send_msg(handle,
- (profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "",
- profile->auto_reply);
- }
+ if (profile->auto_reply) {
+ ldl_handle_send_msg(handle,
+ (profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "",
+ profile->auto_reply);
+ }
#endif
- if (strchr(to, '+')) {
- pproto = strdup(to);
- if ((to = strchr(pproto, '+'))) {
- *to++ = '\0';
+ if (strchr(to, '+')) {
+ pproto = strdup(to);
+ if ((to = strchr(pproto, '+'))) {
+ *to++ = '\0';
+ }
+ proto = pproto;
}
- proto = pproto;
- }
- hint = from;
+ hint = from;
- if (strchr(from, '/') && (ffrom = strdup(from))) {
- char *p;
- if ((p = strchr(ffrom, '/'))) {
- *p = '\0';
+ if (strchr(from, '/') && (ffrom = strdup(from))) {
+ char *p;
+ if ((p = strchr(ffrom, '/'))) {
+ *p = '\0';
+ }
+ from = ffrom;
}
- from = ffrom;
- }
- if ((ci = switch_loadable_module_get_chat_interface(proto))) {
- ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto);
- }
+ if ((ci = switch_loadable_module_get_chat_interface(proto))) {
+ ci->chat_send(MDL_CHAT_PROTO, from, to, subject, msg, hint);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Chat Interface [%s]!\n", proto);
+ }
- switch_safe_free(pproto);
- switch_safe_free(ffrom);
- }
+ switch_safe_free(pproto);
+ switch_safe_free(ffrom);
+ }
break;
case LDL_SIGNAL_LOGIN_SUCCESS:
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) {
@@ -2547,7 +2532,7 @@
}
if ((session = switch_core_session_request(dingaling_endpoint_interface, NULL)) != 0) {
switch_core_session_add_stream(session, NULL);
-
+
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) {
char *exten;
char *context;
@@ -2641,10 +2626,7 @@
ldl_session_get_ip(dlsession),
ldl_session_get_value(dlsession, "ani"),
ldl_session_get_value(dlsession, "aniii"),
- ldl_session_get_value(dlsession, "rdnis"),
- modname,
- context,
- exten)) != 0) {
+ ldl_session_get_value(dlsession, "rdnis"), modname, context, exten)) != 0) {
char name[128];
switch_snprintf(name, sizeof(name), "DingaLing/%s", tech_pvt->caller_profile->destination_number);
switch_channel_set_name(channel, name);
@@ -2669,8 +2651,8 @@
if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- status = LDL_STATUS_FALSE;
- goto done;
+ status = LDL_STATUS_FALSE;
+ goto done;
}
} else {
status = LDL_STATUS_FALSE;
@@ -2832,7 +2814,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%u candidates\n", len);
-
+
if (profile->acl_count) {
for (x = 0; x < len; x++) {
uint32_t y = 0;
@@ -2843,18 +2825,18 @@
}
if (ok) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n",
candidates[x].address, candidates[x].port, profile->acl[y]);
break;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n",
candidates[x].address, candidates[x].port, profile->acl[y]);
}
}
}
} else {
for (x = 0; x < len; x++) {
-
+
if (profile->lanaddr) {
lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1;
}
@@ -2879,9 +2861,8 @@
strncasecmp(candidates[x].address, "172.2", 5) &&
strncasecmp(candidates[x].address, "172.30.", 7) &&
strncasecmp(candidates[x].address, "172.31.", 7) &&
- strncasecmp(candidates[x].address, "192.0.2.", 8) &&
- strncasecmp(candidates[x].address, "169.254.", 8)
- ))) {
+ strncasecmp(candidates[x].address, "192.0.2.", 8) && strncasecmp(candidates[x].address, "169.254.", 8)
+ ))) {
choice = x;
ok = 1;
}
@@ -2893,7 +2874,7 @@
memset(payloads, 0, sizeof(payloads));
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Acceptable Candidate %s:%d\n", candidates[choice].address, candidates[choice].port);
if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@@ -2934,7 +2915,7 @@
status = LDL_STATUS_SUCCESS;
}
- goto done;
+ goto done;
}
break;
@@ -2961,14 +2942,14 @@
break;
}
-
- done:
+
+ done:
return status;
}
-static ldl_status handle_response(ldl_handle_t * handle, char *id)
+static ldl_status handle_response(ldl_handle_t *handle, char *id)
{
return LDL_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax-mutex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax-mutex.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax-mutex.c Tue May 27 07:24:06 2008
@@ -47,7 +47,7 @@
#endif
mutex_t *check = NULL;
- check = (mutex_t *)malloc(sizeof(**mutex));
+ check = (mutex_t *) malloc(sizeof(**mutex));
if (!check)
goto done;
#ifdef WIN32
@@ -64,16 +64,16 @@
goto success;
-fail:
- pthread_mutexattr_destroy(&attr);
- goto done;
+ fail:
+ pthread_mutexattr_destroy(&attr);
+ goto done;
-success:
+ success:
#endif
*mutex = check;
status = MUTEX_SUCCESS;
-done:
+ done:
return status;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c Tue May 27 07:24:06 2008
@@ -1,16 +1,16 @@
/*
- * libiax: An implementation of Inter-Asterisk eXchange
- *
- * Copyright (C) 2001, Linux Support Services, Inc.
- *
- * Mark Spencer <markster(a)linux-support.net>
- *
- * This program is free software, distributed under the terms of
- * the GNU Lesser (Library) General Public License
- */
-
+ * libiax: An implementation of Inter-Asterisk eXchange
+ *
+ * Copyright (C) 2001, Linux Support Services, Inc.
+ *
+ * Mark Spencer <markster(a)linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU Lesser (Library) General Public License
+ */
+
#ifdef WIN32
-#undef __STRICT_ANSI__ //for strdup with ms
+#undef __STRICT_ANSI__ //for strdup with ms
#include <string.h>
#include <process.h>
@@ -35,7 +35,7 @@
#define strdup _strdup
#endif
-void gettimeofday(struct timeval *tv, void /*struct timezone*/ *tz);
+void gettimeofday(struct timeval *tv, void /*struct timezone */ *tz);
#include "winpoop.h"
#else
@@ -56,7 +56,7 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <time.h>
-
+
#endif
#include "iax2.h"
@@ -79,13 +79,13 @@
/* Define socket options for IAX2 sockets, based on platform
* availability of flags */
#ifdef WIN32
- #define IAX_SOCKOPTS 0
+#define IAX_SOCKOPTS 0
#else
- #ifdef LINUX
- #define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL
- #else
- #define IAX_SOCKOPTS MSG_DONTWAIT
- #endif
+#ifdef LINUX
+#define IAX_SOCKOPTS MSG_DONTWAIT | MSG_NOSIGNAL
+#else
+#define IAX_SOCKOPTS MSG_DONTWAIT
+#endif
#endif
@@ -141,12 +141,12 @@
static int maxretries = 10;
/* configurable jitterbuffer options */
-static long jb_target_extra = -1;
+static long jb_target_extra = -1;
static int do_shutdown = 0;
/* external global networking replacements */
-static sendto_t iax_sendto = (sendto_t) sendto;
+static sendto_t iax_sendto = (sendto_t) sendto;
static recvfrom_t iax_recvfrom = (recvfrom_t) recvfrom;
/* ping interval (seconds) */
@@ -162,7 +162,7 @@
int quelch;
/* Codec Pref Order */
char codec_order[32];
- /* Codec Pref Order Index*/
+ /* Codec Pref Order Index */
int codec_order_len;
/* Last received voice format */
int voiceformat;
@@ -238,14 +238,14 @@
/* ping scheduler id */
int pingid;
-
+
/* Transfer stuff */
struct sockaddr_in transfer;
int transferring;
int transfercallno;
int transferid;
- int transferpeer; /* for attended transfer */
- int transfer_moh; /* for music on hold while performing attended transfer */
+ int transferpeer; /* for attended transfer */
+ int transfer_moh; /* for music on hold while performing attended transfer */
#ifdef NEWJB
jitterbuf *jb;
@@ -261,7 +261,7 @@
static void destroy_session(struct iax_session *session);
-#define IAXERROR snprintf(iax_errstr, sizeof(iax_errstr),
+#define IAXERROR snprintf(iax_errstr, sizeof(iax_errstr),
#ifdef DEBUG_SUPPORT
@@ -281,15 +281,15 @@
debug = 0;
}
-/* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */
+/* This is a little strange, but to debug you call DEBU(G "Hello World!\n"); */
#ifdef WIN32
-#define G __FILE__, __LINE__, __FUNCTION__,
+#define G __FILE__, __LINE__, __FUNCTION__,
#else
-#define G __FILE__, __LINE__, (const char *)__func__,
+#define G __FILE__, __LINE__, (const char *)__func__,
#endif
-#define DEBU __debug
-static int __debug(char *file, int lineno, const char *func, char *fmt, ...)
+#define DEBU __debug
+static int __debug(char *file, int lineno, const char *func, char *fmt, ...)
{
va_list args;
va_start(args, fmt);
@@ -311,7 +311,7 @@
#define G
#endif
-typedef void (*sched_func)(void *);
+typedef void (*sched_func) (void *);
struct iax_sched {
/* These are scheduled things to be delivered */
@@ -396,16 +396,16 @@
/* Schedule event to be delivered to the client
in ms milliseconds from now, or a reliable frame to be retransmitted */
struct iax_sched *sched, *cur, *prev = NULL;
-
+
if (!event && !frame && !func) {
DEBU(G "No event, no frame, no func? what are we scheduling?\n");
return -1;
}
-
- sched = (struct iax_sched*)malloc(sizeof(struct iax_sched));
+
+ sched = (struct iax_sched *) malloc(sizeof(struct iax_sched));
if (sched) {
- memset(sched, 0, sizeof(struct iax_sched));
+ memset(sched, 0, sizeof(struct iax_sched));
sched->when = current_time_in_ms() + ms;
sched->event = event;
sched->frame = frame;
@@ -414,7 +414,7 @@
/* Put it in the list, in order */
iax_mutex_lock(sched_mutex);
cur = schedq;
- while(cur && cur->when <= sched->when) {
+ while (cur && cur->when <= sched->when) {
prev = cur;
cur = cur->next;
}
@@ -446,7 +446,7 @@
else
schedq = cur->next;
tmp = cur;
- cur = cur->next;
+ cur = cur->next;
free(tmp);
if (!all) {
ret = -1;
@@ -457,7 +457,7 @@
cur = cur->next;
}
}
- done:
+ done:
iax_mutex_unlock(sched_mutex);
return 0;
@@ -469,7 +469,7 @@
{
struct iax_sched *cur = NULL;
time_in_ms_t minimum = 999999999;
-
+
iax_mutex_lock(sched_mutex);
cur = schedq;
@@ -478,7 +478,7 @@
iax_mutex_unlock(sched_mutex);
return -1;
}
- while(cur) {
+ while (cur) {
if (cur->when < minimum) {
minimum = cur->when;
}
@@ -498,7 +498,7 @@
struct iax_session *iax_session_new(void)
{
struct iax_session *s;
- s = (struct iax_session *)malloc(sizeof(struct iax_session));
+ s = (struct iax_session *) malloc(sizeof(struct iax_session));
if (s) {
memset(s, 0, sizeof(struct iax_session));
/* Initialize important fields */
@@ -507,12 +507,12 @@
/* Default pingtime to 30 ms */
s->pingtime = 30;
/* XXX Not quite right -- make sure it's not in use, but that won't matter
- unless you've had at least 65k calls. XXX */
+ unless you've had at least 65k calls. XXX */
s->callno = callnums++;
if (callnums > 32767)
callnums = 1;
s->peercallno = 0;
- s->transferpeer = 0; /* for attended transfer */
+ s->transferpeer = 0; /* for attended transfer */
s->sendto = iax_sendto;
s->pingid = -1;
@@ -542,7 +542,7 @@
iax_mutex_lock(session_mutex);
cur = sessions;
- while(cur) {
+ while (cur) {
if (session == cur) {
iax_mutex_unlock(session_mutex);
return -1;
@@ -554,31 +554,34 @@
return 0;
}
-int iax_get_netstats(struct iax_session *session, time_in_ms_t *rtt, struct iax_netstat *local, struct iax_netstat *remote) {
+int iax_get_netstats(struct iax_session *session, time_in_ms_t *rtt, struct iax_netstat *local, struct iax_netstat *remote)
+{
- if(!iax_session_valid(session)) return -1;
+ if (!iax_session_valid(session))
+ return -1;
- *rtt = session->pingtime;
+ *rtt = session->pingtime;
- *remote = session->remote_netstats;
+ *remote = session->remote_netstats;
#ifdef NEWJB
- {
- jb_info stats;
- jb_getinfo(session->jb, &stats);
-
- local->jitter = stats.jitter;
- /* XXX: should be short-term loss pct.. */
- if(stats.frames_in == 0) stats.frames_in = 1;
- local->losspct = stats.losspct/1000;
- local->losscnt = stats.frames_lost;
- local->packets = stats.frames_in;
- local->delay = stats.current - stats.min;
- local->dropped = stats.frames_dropped;
- local->ooo = stats.frames_ooo;
- }
+ {
+ jb_info stats;
+ jb_getinfo(session->jb, &stats);
+
+ local->jitter = stats.jitter;
+ /* XXX: should be short-term loss pct.. */
+ if (stats.frames_in == 0)
+ stats.frames_in = 1;
+ local->losspct = stats.losspct / 1000;
+ local->losscnt = stats.frames_lost;
+ local->packets = stats.frames_in;
+ local->delay = stats.current - stats.min;
+ local->dropped = stats.frames_dropped;
+ local->ooo = stats.frames_ooo;
+ }
#endif
- return 0;
+ return 0;
}
static time_in_ms_t calc_timestamp(struct iax_session *session, time_in_ms_t ts, struct ast_frame *f)
@@ -587,13 +590,13 @@
time_in_ms_t time_in_ms;
int voice = 0;
int genuine = 0;
-
+
if (f && f->frametype == AST_FRAME_VOICE) {
voice = 1;
} else if (!f || f->frametype == AST_FRAME_IAX) {
genuine = 1;
}
-
+
/* If this is the first packet we're sending, get our
offset now. */
if (!session->offset) {
@@ -616,34 +619,34 @@
ms = 0;
}
- if(voice) {
+ if (voice) {
#ifdef USE_VOICE_TS_PREDICTION
/* If we haven't most recently sent silence, and we're
* close in time, use predicted time */
- if(session->notsilenttx && iax_abs(ms - session->nextpred) <= 240) {
- /* Adjust our txcore, keeping voice and non-voice
- * synchronized */
- session->offset += (int)(ms - session->nextpred)/10;
-
- if(!session->nextpred) {
- session->nextpred = ms;
+ if (session->notsilenttx && iax_abs(ms - session->nextpred) <= 240) {
+ /* Adjust our txcore, keeping voice and non-voice
+ * synchronized */
+ session->offset += (int) (ms - session->nextpred) / 10;
+
+ if (!session->nextpred) {
+ session->nextpred = ms;
}
- ms = session->nextpred;
+ ms = session->nextpred;
} else {
- /* in this case, just use the actual time, since
- * we're either way off (shouldn't happen), or we're
- * ending a silent period -- and seed the next predicted
- * time. Also, round ms to the next multiple of
- * frame size (so our silent periods are multiples
- * of frame size too) */
- time_in_ms_t diff = ms % (f->samples / 8);
- if(diff)
- ms += f->samples/8 - diff;
- session->nextpred = ms;
+ /* in this case, just use the actual time, since
+ * we're either way off (shouldn't happen), or we're
+ * ending a silent period -- and seed the next predicted
+ * time. Also, round ms to the next multiple of
+ * frame size (so our silent periods are multiples
+ * of frame size too) */
+ time_in_ms_t diff = ms % (f->samples / 8);
+ if (diff)
+ ms += f->samples / 8 - diff;
+ session->nextpred = ms;
}
#else
- if(ms <= session->lastsent)
+ if (ms <= session->lastsent)
ms = session->lastsent + 3;
#endif
session->notsilenttx = 1;
@@ -656,7 +659,7 @@
} else if (iax_abs(ms - session->lastsent) <= 240) {
ms = session->lastsent + 3;
}
-
+
}
/* Record the last sent packet for future reference */
@@ -666,8 +669,8 @@
#ifdef USE_VOICE_TS_PREDICTION
/* set next predicted ts based on 8khz samples */
- if(voice)
- session->nextpred = session->nextpred + f->samples / 8;
+ if (voice)
+ session->nextpred = session->nextpred + f->samples / 8;
#endif
return ms;
@@ -676,44 +679,42 @@
#ifdef NEWJB
static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
{
- int byte = bit / 8; /* byte containing first bit */
- int rem = 8 - (bit % 8); /* remaining bits in first byte */
+ int byte = bit / 8; /* byte containing first bit */
+ int rem = 8 - (bit % 8); /* remaining bits in first byte */
unsigned char ret = 0;
-
+
if (n <= 0 || n > 8)
return 0;
if (rem < n) {
- ret = (unsigned char)(data[byte] << (n - rem));
+ ret = (unsigned char) (data[byte] << (n - rem));
ret |= (data[byte + 1] >> (8 - n + rem));
} else {
- ret = (unsigned char)(data[byte] >> (rem - n));
+ ret = (unsigned char) (data[byte] >> (rem - n));
}
- return (unsigned char)(ret & (0xff >> (8 - n)));
+ return (unsigned char) (ret & (0xff >> (8 - n)));
}
static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
{
static int SpeexWBSubModeSz[] = {
0, 36, 112, 192,
- 352, 0, 0, 0 };
+ 352, 0, 0, 0
+ };
int off = bit;
unsigned char c;
/* skip up to two wideband frames */
- if (((len * 8 - off) >= 5) &&
- get_n_bits_at(data, 1, off)) {
+ if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
c = get_n_bits_at(data, 3, off + 1);
off += SpeexWBSubModeSz[c];
- if (((len * 8 - off) >= 5) &&
- get_n_bits_at(data, 1, off)) {
+ if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
c = get_n_bits_at(data, 3, off + 1);
off += SpeexWBSubModeSz[c];
- if (((len * 8 - off) >= 5) &&
- get_n_bits_at(data, 1, off)) {
+ if (((len * 8 - off) >= 5) && get_n_bits_at(data, 1, off)) {
/* too many in a row */
DEBU(G "\tCORRUPT too many wideband streams in a row\n");
return -1;
@@ -727,15 +728,17 @@
static int speex_get_samples(unsigned char *data, int len)
{
static int SpeexSubModeSz[] = {
- 0, 43, 119, 160,
- 220, 300, 364, 492,
+ 0, 43, 119, 160,
+ 220, 300, 364, 492,
79, 0, 0, 0,
- 0, 0, 0, 0 };
- static int SpeexInBandSz[] = {
+ 0, 0, 0, 0
+ };
+ static int SpeexInBandSz[] = {
1, 1, 4, 4,
4, 4, 4, 4,
8, 8, 16, 16,
- 32, 32, 64, 64 };
+ 32, 32, 64, 64
+ };
int bit = 0;
int cnt = 0;
int off = 0;
@@ -745,7 +748,7 @@
while ((len * 8 - bit) >= 5) {
/* skip wideband frames */
off = speex_get_wb_sz_at(data, len, bit);
- if (off < 0) {
+ if (off < 0) {
DEBU(G "\tERROR reading wideband frames\n");
break;
}
@@ -761,7 +764,7 @@
DEBU(G "\tCONTROL: %d at %d\n", c, bit);
bit += 5;
- if (c == 15) {
+ if (c == 15) {
DEBU(G "\tTERMINATOR\n");
break;
} else if (c == 14) {
@@ -784,7 +787,7 @@
DEBU(G "\tSUBMODE %d %d bits\n", c, SpeexSubModeSz[c]);
bit += SpeexSubModeSz[c] - 5;
- cnt += 160; /* new frame */
+ cnt += 160; /* new frame */
}
}
DEBU(G "\tSAMPLES: %d\n", cnt);
@@ -803,42 +806,42 @@
/*
* In the case of zero length frames, do not return a cnt of 0
*/
- if ( e->datalen == 0 ) {
- return get_interp_len( e->subclass ) * 8;
+ if (e->datalen == 0) {
+ return get_interp_len(e->subclass) * 8;
}
switch (e->subclass) {
- case AST_FORMAT_SPEEX:
- cnt = speex_get_samples(e->data, e->datalen);
- break;
- case AST_FORMAT_G723_1:
- cnt = 240; /* FIXME Not always the case */
- break;
- case AST_FORMAT_ILBC:
- cnt = 240 * (e->datalen / 50);
- break;
- case AST_FORMAT_GSM:
- cnt = 160 * (e->datalen / 33);
- break;
- case AST_FORMAT_G729A:
- cnt = 160 * (e->datalen / 20);
- break;
- case AST_FORMAT_SLINEAR:
- cnt = e->datalen / 2;
- break;
- case AST_FORMAT_LPC10:
- cnt = 22 * 8 + (((char *)(e->data))[7] & 0x1) * 8;
- break;
- case AST_FORMAT_ULAW:
- case AST_FORMAT_ALAW:
- cnt = e->datalen;
- break;
- case AST_FORMAT_ADPCM:
- case AST_FORMAT_G726:
- cnt = e->datalen * 2;
- break;
- default:
- return 0;
+ case AST_FORMAT_SPEEX:
+ cnt = speex_get_samples(e->data, e->datalen);
+ break;
+ case AST_FORMAT_G723_1:
+ cnt = 240; /* FIXME Not always the case */
+ break;
+ case AST_FORMAT_ILBC:
+ cnt = 240 * (e->datalen / 50);
+ break;
+ case AST_FORMAT_GSM:
+ cnt = 160 * (e->datalen / 33);
+ break;
+ case AST_FORMAT_G729A:
+ cnt = 160 * (e->datalen / 20);
+ break;
+ case AST_FORMAT_SLINEAR:
+ cnt = e->datalen / 2;
+ break;
+ case AST_FORMAT_LPC10:
+ cnt = 22 * 8 + (((char *) (e->data))[7] & 0x1) * 8;
+ break;
+ case AST_FORMAT_ULAW:
+ case AST_FORMAT_ALAW:
+ cnt = e->datalen;
+ break;
+ case AST_FORMAT_ADPCM:
+ case AST_FORMAT_G726:
+ cnt = e->datalen * 2;
+ break;
+ default:
+ return 0;
}
return cnt;
}
@@ -850,16 +853,13 @@
#ifdef DEBUG_SUPPORT
struct ast_iax2_full_hdr *h = (f->data);
if (ntohs(h->scallno) & IAX_FLAG_FULL)
- iax_showframe(f, NULL, 0, f->transfer ?
- &(f->session->transfer) :
- &(f->session->peeraddr), f->datalen - sizeof(struct ast_iax2_full_hdr));
+ iax_showframe(f, NULL, 0, f->transfer ? &(f->session->transfer) : &(f->session->peeraddr), f->datalen - sizeof(struct ast_iax2_full_hdr));
#endif
return f->session->sendto(netfd, (const char *) f->data, f->datalen,
- IAX_SOCKOPTS,
- f->transfer ?
- (struct sockaddr *)&(f->session->transfer) :
- (struct sockaddr *)&(f->session->peeraddr), sizeof(f->session->peeraddr));
+ IAX_SOCKOPTS,
+ f->transfer ?
+ (struct sockaddr *) &(f->session->transfer) : (struct sockaddr *) &(f->session->peeraddr), sizeof(f->session->peeraddr));
}
static int iax_reliable_xmit(struct iax_frame *f)
@@ -869,9 +869,9 @@
fh = (struct ast_iax2_full_hdr *) f->data;
if (!fh->type) {
DEBU(G "Asked to reliably transmit a non-packet. Crashing.\n");
- *((char *)0)=0;
+ *((char *) 0) = 0;
}
- fc = (struct iax_frame *)malloc(sizeof(struct iax_frame));
+ fc = (struct iax_frame *) malloc(sizeof(struct iax_frame));
if (fc) {
/* Make a copy of the frame */
memcpy(fc, f, sizeof(struct iax_frame));
@@ -881,7 +881,7 @@
DEBU(G "No frame data?\n");
return -1;
} else {
- fc->data = (char *)malloc(fc->datalen);
+ fc->data = (char *) malloc(fc->datalen);
if (!fc->data) {
DEBU(G "Out of memory\n");
IAXERROR "Out of memory\n");
@@ -895,40 +895,38 @@
return -1;
}
-void iax_set_networking(sendto_t st, recvfrom_t rf)
-{
+void iax_set_networking(sendto_t st, recvfrom_t rf) {
init_time();
iax_sendto = st;
iax_recvfrom = rf;
}
-int __iax_shutdown(void)
-{
+int __iax_shutdown(void) {
struct iax_sched *sp, *fp;
/* Hangup Calls */
if (sessions) {
struct iax_session *sp = NULL, *fp = NULL;
- iax_mutex_lock(session_mutex);
- for(sp = sessions; sp ;) {
+ iax_mutex_lock(session_mutex);
+ for (sp = sessions; sp;) {
iax_hangup(sp, "System Shutdown");
fp = sp;
sp = sp->next;
destroy_session(fp);
}
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
}
/* Clear Scheduler */
iax_mutex_lock(sched_mutex);
- for(sp = schedq; sp ;) {
+ for (sp = schedq; sp;) {
fp = sp;
sp = sp->next;
free(fp);
}
iax_mutex_unlock(sched_mutex);
-
+
if (netfd > -1) {
shutdown(netfd, 2);
close(netfd);
@@ -942,19 +940,16 @@
return 0;
}
-int iax_shutdown(void)
-{
+int iax_shutdown(void) {
return do_shutdown++;
}
-void iax_set_jb_target_extra( long value )
-{
+void iax_set_jb_target_extra(long value) {
/* store in jb_target_extra, a static global */
- jb_target_extra = value ;
+ jb_target_extra = value;
}
-int iax_init(char *ip, int preferredportno)
-{
+int iax_init(char *ip, int preferredportno) {
int portno = preferredportno;
struct sockaddr_in sin;
#ifdef WIN32
@@ -969,102 +964,98 @@
iax_mutex_create(&sched_mutex);
iax_mutex_create(&session_mutex);
- if(iax_recvfrom == (recvfrom_t) recvfrom) {
- if (netfd > -1) {
- /* Sokay, just don't do anything */
- DEBU(G "Already initialized.");
- return 0;
- }
- netfd = (int)socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
- if (netfd < 0) {
- DEBU(G "Unable to allocate UDP socket\n");
- IAXERROR "Unable to allocate UDP socket\n");
- return -1;
- }
-
- if (preferredportno == 0) preferredportno = IAX_DEFAULT_PORTNO;
- if (preferredportno < 0) preferredportno = 0;
+ if (iax_recvfrom == (recvfrom_t) recvfrom) {
+ if (netfd > -1) {
+ /* Sokay, just don't do anything */
+ DEBU(G "Already initialized.");
+ return 0;
+ }
+ netfd = (int) socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+ if (netfd < 0) {
+ DEBU(G "Unable to allocate UDP socket\n");
+ IAXERROR "Unable to allocate UDP socket\n");
+ return -1;
+ }
+
+ if (preferredportno == 0)
+ preferredportno = IAX_DEFAULT_PORTNO;
+ if (preferredportno < 0)
+ preferredportno = 0;
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = 0;
- sin.sin_port = htons((short)preferredportno);
- if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
- {
+ sin.sin_port = htons((short) preferredportno);
+ if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
#if defined(WIN32) || defined(_WIN32_WCE)
if (WSAGetLastError() == WSAEADDRINUSE)
#else
if (errno == EADDRINUSE)
#endif
{
- /*the port is already in use, so bind to a free port chosen by the IP stack*/
+ /*the port is already in use, so bind to a free port chosen by the IP stack */
DEBU(G "Unable to bind to preferred port - port is in use. Trying to bind to a free one");
- sin.sin_port = htons((short)0);
- if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0)
- {
+ sin.sin_port = htons((short) 0);
+ if (bind(netfd, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
IAXERROR "Unable to bind UDP socket\n");
return -1;
}
- } else
- {
+ } else {
IAXERROR "Unable to bind UDP socket\n");
return -1;
}
}
sinlen = sizeof(sin);
- if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) {
- close(netfd);
- netfd = -1;
- DEBU(G "Unable to figure out what I'm bound to.");
- IAXERROR "Unable to determine bound port number.");
- }
+ if (getsockname(netfd, (struct sockaddr *) &sin, &sinlen) < 0) {
+ close(netfd);
+ netfd = -1;
+ DEBU(G "Unable to figure out what I'm bound to.");
+ IAXERROR "Unable to determine bound port number.");
+ }
#ifdef WIN32
- flags = 1;
- if (ioctlsocket(netfd,FIONBIO,(unsigned long *) &flags)) {
- closesocket(netfd);
- netfd = -1;
- DEBU(G "Unable to set non-blocking mode.");
- IAXERROR "Unable to set non-blocking mode.");
- }
-
+ flags = 1;
+ if (ioctlsocket(netfd, FIONBIO, (unsigned long *) &flags)) {
+ closesocket(netfd);
+ netfd = -1;
+ DEBU(G "Unable to set non-blocking mode.");
+ IAXERROR "Unable to set non-blocking mode.");
+ }
#else
- if ((flags = fcntl(netfd, F_GETFL)) < 0) {
- close(netfd);
- netfd = -1;
- DEBU(G "Unable to retrieve socket flags.");
- IAXERROR "Unable to retrieve socket flags.");
- }
- if (fcntl(netfd, F_SETFL, flags | O_NONBLOCK) < 0) {
- close(netfd);
- netfd = -1;
- DEBU(G "Unable to set non-blocking mode.");
- IAXERROR "Unable to set non-blocking mode.");
- }
+ if ((flags = fcntl(netfd, F_GETFL)) < 0) {
+ close(netfd);
+ netfd = -1;
+ DEBU(G "Unable to retrieve socket flags.");
+ IAXERROR "Unable to retrieve socket flags.");
+ }
+ if (fcntl(netfd, F_SETFL, flags | O_NONBLOCK) < 0) {
+ close(netfd);
+ netfd = -1;
+ DEBU(G "Unable to set non-blocking mode.");
+ IAXERROR "Unable to set non-blocking mode.");
+ }
#endif
- portno = ntohs(sin.sin_port);
+ portno = ntohs(sin.sin_port);
}
- srand((unsigned int)time(NULL));
+ srand((unsigned int) time(NULL));
callnums = rand() % 32767 + 1;
transfer_id = rand() % 32767 + 1;
DEBU(G "Started on port %d\n", portno);
- return portno;
+ return portno;
}
-static void convert_reply(char *out, unsigned char *in)
-{
+static void convert_reply(char *out, unsigned char *in) {
int x;
- for (x=0;x<16;x++)
- out += sprintf(out, "%2.2x", (int)in[x]);
+ for (x = 0; x < 16; x++)
+ out += sprintf(out, "%2.2x", (int) in[x]);
}
-static unsigned char compress_subclass(int subclass)
-{
+static unsigned char compress_subclass(int subclass) {
int x;
- int power=-1;
+ int power = -1;
/* If it's 128 or smaller, just return it */
if (subclass < IAX_FLAG_SC_LOG)
- return (unsigned char)subclass;
+ return (unsigned char) subclass;
/* Otherwise find its power */
for (x = 0; x < IAX_MAX_SHIFT; x++) {
if (subclass & (1 << x)) {
@@ -1075,45 +1066,45 @@
power = x;
}
}
- return (unsigned char)(power | IAX_FLAG_SC_LOG);
+ return (unsigned char) (power | IAX_FLAG_SC_LOG);
}
-static int iax_send(struct iax_session *pvt, struct ast_frame *f, time_in_ms_t ts, int seqno, int now, int transfer, int final)
-{
+static int iax_send(struct iax_session *pvt, struct ast_frame *f, time_in_ms_t ts, int seqno, int now, int transfer, int final) {
/* Queue a packet for delivery on a given private structure. Use "ts" for
timestamp, or calculate if ts is 0. Send immediately without retransmission
or delayed, with retransmission */
struct ast_iax2_full_hdr *fh;
struct ast_iax2_mini_hdr *mh;
- unsigned char buf[5120];
+ unsigned char buf[5120];
struct iax_frame *fr;
int res;
- int sendmini=0;
+ int sendmini = 0;
time_in_ms_t lastsent;
time_in_ms_t fts;
-
+
if (!pvt) {
IAXERROR "No private structure for packet?\n");
return -1;
}
-
+
/* this must come before the next call to calc_timestamp() since
- calc_timestamp() will change lastsent to the returned value */
+ calc_timestamp() will change lastsent to the returned value */
lastsent = pvt->lastsent;
/* Calculate actual timestamp */
fts = calc_timestamp(pvt, ts, f);
if (((fts & 0xFFFF0000L) == (lastsent & 0xFFFF0000L))
- /* High two bits are the same on timestamp, or sending on a trunk */ &&
- (f->frametype == AST_FRAME_VOICE)
- /* is a voice frame */ &&
- (f->subclass == pvt->svoiceformat)
- /* is the same type */ ) {
- /* Force immediate rather than delayed transmission */
- now = 1;
- /* Mark that mini-style frame is appropriate */
- sendmini = 1;
+ /* High two bits are the same on timestamp, or sending on a trunk */
+ && (f->frametype == AST_FRAME_VOICE)
+ /* is a voice frame */
+ && (f->subclass == pvt->svoiceformat)
+ /* is the same type */
+ ) {
+ /* Force immediate rather than delayed transmission */
+ now = 1;
+ /* Mark that mini-style frame is appropriate */
+ sendmini = 1;
}
/* Allocate an iax_frame */
if (now) {
@@ -1135,7 +1126,7 @@
return -1;
}
- fr->callno = (unsigned short)pvt->callno;
+ fr->callno = (unsigned short) pvt->callno;
fr->transfer = transfer;
fr->final = final;
fr->session = pvt;
@@ -1146,22 +1137,22 @@
else
fr->oseqno = pvt->oseqno++;
fr->iseqno = pvt->iseqno;
- fh = (struct ast_iax2_full_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_full_hdr));
+ fh = (struct ast_iax2_full_hdr *) (((char *) fr->af.data) - sizeof(struct ast_iax2_full_hdr));
fh->scallno = htons(fr->callno | IAX_FLAG_FULL);
- fh->ts = htonl((long)(fr->ts));
- fh->oseqno = (unsigned char)fr->oseqno;
+ fh->ts = htonl((long) (fr->ts));
+ fh->oseqno = (unsigned char) fr->oseqno;
if (transfer) {
fh->iseqno = 0;
} else
- fh->iseqno = (unsigned char)fr->iseqno;
+ fh->iseqno = (unsigned char) fr->iseqno;
/* Keep track of the last thing we've acknowledged */
- pvt->aseqno = (unsigned char)fr->iseqno;
- fh->type = (char)(fr->af.frametype & 0xFF);
+ pvt->aseqno = (unsigned char) fr->iseqno;
+ fh->type = (char) (fr->af.frametype & 0xFF);
fh->csub = compress_subclass(fr->af.subclass);
if (transfer) {
- fr->dcallno = (unsigned short)pvt->transfercallno;
+ fr->dcallno = (unsigned short) pvt->transfercallno;
} else
- fr->dcallno = (unsigned short)pvt->peercallno;
+ fr->dcallno = (unsigned short) pvt->peercallno;
fh->dcallno = htons(fr->dcallno);
fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_full_hdr);
fr->data = fh;
@@ -1187,22 +1178,21 @@
fr->oseqno = -1;
fr->iseqno = -1;
/* Mini frame will do */
- mh = (struct ast_iax2_mini_hdr *)(((char *)fr->af.data) - sizeof(struct ast_iax2_mini_hdr));
+ mh = (struct ast_iax2_mini_hdr *) (((char *) fr->af.data) - sizeof(struct ast_iax2_mini_hdr));
mh->callno = htons(fr->callno);
- mh->ts = htons((short)(fr->ts & 0xFFFF));
+ mh->ts = htons((short) (fr->ts & 0xFFFF));
fr->datalen = fr->af.datalen + sizeof(struct ast_iax2_mini_hdr);
fr->data = mh;
fr->retries = -1;
res = iax_xmit_frame(fr);
}
- if( !now && fr!=NULL )
- iax_frame_free( fr );
+ if (!now && fr != NULL)
+ iax_frame_free(fr);
return res;
}
#if 0
-static int iax_predestroy(struct iax_session *pvt)
-{
+static int iax_predestroy(struct iax_session *pvt) {
if (!pvt) {
return -1;
}
@@ -1226,9 +1216,8 @@
}
#endif
-static int __send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno,
- int now, int transfer, int final, int samples)
-{
+static int __send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno,
+ int now, int transfer, int final, int samples) {
struct ast_frame f;
f.frametype = type;
f.subclass = command;
@@ -1245,77 +1234,69 @@
return iax_send(i, &f, ts, seqno, now, transfer, final);
}
-static int send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command(struct iax_session *i, char type, int command, time_in_ms_t ts, unsigned char *data, int datalen, int seqno) {
return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, 0);
}
-static int send_command_final(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command_final(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) {
#if 0
/* It is assumed that the callno has already been locked */
iax_predestroy(i);
-#endif
+#endif
int r;
r = __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 1, 0);
if (r >= 0) {
- iax_mutex_lock(session_mutex);
+ iax_mutex_lock(session_mutex);
destroy_session(i);
iax_mutex_unlock(session_mutex);
}
return r;
}
-static int send_command_immediate(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno)
-{
+static int send_command_immediate(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno) {
return __send_command(i, type, command, ts, data, datalen, seqno, 1, 0, 0, 0);
}
-static int send_command_transfer(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen)
-{
+static int send_command_transfer(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen) {
return __send_command(i, type, command, ts, data, datalen, 0, 0, 1, 0, 0);
}
-static int send_command_samples(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int samples)
-{
+static int send_command_samples(struct iax_session *i, char type, int command, unsigned int ts, unsigned char *data, int datalen, int seqno, int samples) {
return __send_command(i, type, command, ts, data, datalen, seqno, 0, 0, 0, samples);
}
-int iax_transfer(struct iax_session *session, char *number)
-{
+int iax_transfer(struct iax_session *session, char *number) {
static int res; //Return Code
- struct iax_ie_data ied; //IE Data Structure (Stuff To Send)
+ struct iax_ie_data ied; //IE Data Structure (Stuff To Send)
// Clear The Memory Used For IE Buffer
memset(&ied, 0, sizeof(ied));
-
+
// Copy The Transfer Destination Into The IE Structure
iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
-
- // Send The Transfer Command - Asterisk Will Handle The Rest!
+
+ // Send The Transfer Command - Asterisk Will Handle The Rest!
res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_TRANSFER, 0, ied.buf, ied.pos, -1);
-
+
// Return Success
- return 0;
+ return 0;
}
-static void stop_transfer(struct iax_session *session)
-{
+static void stop_transfer(struct iax_session *session) {
struct iax_sched *sch;
iax_mutex_lock(sched_mutex);
sch = schedq;
- while(sch) {
+ while (sch) {
if (sch->frame && (sch->frame->session == session))
- sch->frame->retries = -1;
+ sch->frame->retries = -1;
sch = sch->next;
}
iax_mutex_unlock(sched_mutex);
-} /* stop_transfer */
+} /* stop_transfer */
-static void complete_transfer(struct iax_session *session, int peercallno, int xfr2peer, int preserveSeq)
-{
+static void complete_transfer(struct iax_session *session, int peercallno, int xfr2peer, int preserveSeq) {
session->peercallno = peercallno;
/* Change from transfer to session now */
if (xfr2peer) {
@@ -1331,20 +1312,19 @@
session->rxcore = session->offset = 0;
memset(&session->history, 0, sizeof(session->history));
#ifdef NEWJB
- { /* Reset jitterbuffer */
- jb_frame frame;
- while(jb_getall(session->jb,&frame) == JB_OK)
- iax_event_free(frame.data);
-
- jb_reset(session->jb);
+ { /* Reset jitterbuffer */
+ jb_frame frame;
+ while (jb_getall(session->jb, &frame) == JB_OK)
+ iax_event_free(frame.data);
+
+ jb_reset(session->jb);
}
#endif
session->jitterbuffer = 0;
session->jitter = 0;
session->lag = 0;
- if (! preserveSeq)
- {
+ if (!preserveSeq) {
/* Reset sequence numbers */
session->aseqno = 0;
session->oseqno = 0;
@@ -1358,10 +1338,9 @@
/* We have to dump anything we were going to (re)transmit now that we've been
transferred since they're all invalid and for the old host. */
stop_transfer(session);
-} /* complete_transfer */
+} /* complete_transfer */
-int iax_setup_transfer(struct iax_session *org_session, struct iax_session *new_session)
-{
+int iax_setup_transfer(struct iax_session *org_session, struct iax_session *new_session) {
int res;
struct iax_ie_data ied0;
struct iax_ie_data ied1;
@@ -1374,11 +1353,11 @@
/* reversed setup */
iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &s1->peeraddr);
- iax_ie_append_short(&ied0, IAX_IE_CALLNO, (unsigned short)s1->peercallno);
+ iax_ie_append_short(&ied0, IAX_IE_CALLNO, (unsigned short) s1->peercallno);
iax_ie_append_int(&ied0, IAX_IE_TRANSFERID, transfer_id);
iax_ie_append_addr(&ied1, IAX_IE_APPARENT_ADDR, &s0->peeraddr);
- iax_ie_append_short(&ied1, IAX_IE_CALLNO, (unsigned short)s0->peercallno);
+ iax_ie_append_short(&ied1, IAX_IE_CALLNO, (unsigned short) s0->peercallno);
iax_ie_append_int(&ied1, IAX_IE_TRANSFERID, transfer_id);
s0->transfer = s1->peeraddr;
@@ -1414,8 +1393,7 @@
return 0;
}
-static int iax_finish_transfer(struct iax_session *s, short new_peer)
-{
+static int iax_finish_transfer(struct iax_session *s, short new_peer) {
int res;
struct iax_ie_data ied;
@@ -1431,28 +1409,26 @@
}
-static struct iax_session *iax_find_session2(short callno)
-{
+static struct iax_session *iax_find_session2(short callno) {
struct iax_session *cur;
- iax_mutex_lock(session_mutex);
+ iax_mutex_lock(session_mutex);
cur = sessions;
- while(cur) {
- if (callno == cur->callno && callno != 0) {
- iax_mutex_unlock(session_mutex);
+ while (cur) {
+ if (callno == cur->callno && callno != 0) {
+ iax_mutex_unlock(session_mutex);
return cur;
}
cur = cur->next;
}
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
return NULL;
}
-static int iax_handle_txready(struct iax_session *s)
-{
+static int iax_handle_txready(struct iax_session *s) {
struct iax_session *s0, *s1;
- short s0_org_peer, s1_org_peer;
+ short s0_org_peer, s1_org_peer;
if (s->transfer_moh) {
s->transfer_moh = 0;
@@ -1464,15 +1440,12 @@
s->transferring = TRANSFER_REL;
s0 = s;
- s1 = iax_find_session2((short)s0->transferpeer);
+ s1 = iax_find_session2((short) s0->transferpeer);
- if (s1 != NULL &&
- s1->callno == s0->transferpeer &&
- s0->transferring == TRANSFER_REL &&
- s1->transferring == TRANSFER_REL) {
+ if (s1 != NULL && s1->callno == s0->transferpeer && s0->transferring == TRANSFER_REL && s1->transferring == TRANSFER_REL) {
- s0_org_peer = (short)s0->peercallno;
- s1_org_peer = (short)s1->peercallno;
+ s0_org_peer = (short) s0->peercallno;
+ s1_org_peer = (short) s1->peercallno;
iax_finish_transfer(s0, s1_org_peer);
iax_finish_transfer(s1, s0_org_peer);
@@ -1482,15 +1455,12 @@
return 0;
}
-static void iax_handle_txreject(struct iax_session *s)
-{
+static void iax_handle_txreject(struct iax_session *s) {
struct iax_session *s0, *s1;
s0 = s;
- s1 = iax_find_session2((short)s0->transferpeer);
- if (s1 != NULL &&
- s0->transferpeer == s1->callno &&
- s1->transferring) {
+ s1 = iax_find_session2((short) s0->transferpeer);
+ if (s1 != NULL && s0->transferpeer == s1->callno && s1->transferring) {
if (s1->transfer_moh) {
s1->transfer_moh = 0;
send_command_immediate(s1, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, s1->iseqno);
@@ -1507,15 +1477,14 @@
s->transfer_moh = 0;
}
-static void destroy_session(struct iax_session *session)
-{
- struct iax_session *cur, *prev=NULL;
- struct iax_sched *curs, *prevs=NULL, *nexts=NULL;
- int loop_cnt=0;
+static void destroy_session(struct iax_session *session) {
+ struct iax_session *cur, *prev = NULL;
+ struct iax_sched *curs, *prevs = NULL, *nexts = NULL;
+ int loop_cnt = 0;
iax_mutex_lock(sched_mutex);
curs = schedq;
- while(curs) {
+ while (curs) {
nexts = curs->next;
if (curs->frame && curs->frame->session == session) {
/* Just mark these frames as if they've been sent */
@@ -1535,10 +1504,10 @@
loop_cnt++;
}
iax_mutex_unlock(sched_mutex);
-
+
cur = sessions;
- while(cur) {
+ while (cur) {
if (cur == session) {
if (prev)
prev->next = session->next;
@@ -1546,11 +1515,11 @@
sessions = session->next;
#ifdef NEWJB
{
- jb_frame frame;
- while(jb_getall(session->jb,&frame) == JB_OK)
- iax_event_free(frame.data);
-
- jb_destroy(session->jb);
+ jb_frame frame;
+ while (jb_getall(session->jb, &frame) == JB_OK)
+ iax_event_free(frame.data);
+
+ jb_destroy(session->jb);
}
#endif
free(session);
@@ -1564,15 +1533,14 @@
static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts);
static int iax_send_pong(struct iax_session *session, time_in_ms_t ts);
-static struct iax_event *handle_event(struct iax_event *event)
-{
+static struct iax_event *handle_event(struct iax_event *event) {
/* We have a candidate event to be delievered. Be sure
the session still exists. */
if (event) {
if (iax_session_valid(event->session)) {
/* Lag requests are never actually sent to the client, but
other than that are handled as normal packets */
- switch(event->etype) {
+ switch (event->etype) {
/* the user on the outside may need to look at the session so we will not free
it here anymore we will test for hangup event in iax_event_free and do it
there.
@@ -1595,48 +1563,42 @@
iax_send_pong(event->session, event->ts);
iax_destroy(event->session);
iax_event_free(event);
- break;
+ break;
default:
return event;
}
- } else
+ } else
iax_event_free(event);
}
return NULL;
}
-static int iax2_vnak(struct iax_session *session)
-{
+static int iax2_vnak(struct iax_session *session) {
return send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_VNAK, 0, NULL, 0, session->iseqno);
}
-int iax_send_dtmf(struct iax_session *session, char digit)
-{
+int iax_send_dtmf(struct iax_session *session, char digit) {
return send_command(session, AST_FRAME_DTMF, digit, 0, NULL, 0, -1);
}
-int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples)
-{
+int iax_send_voice(struct iax_session *session, int format, unsigned char *data, int datalen, int samples) {
/* Send a (possibly compressed) voice frame */
if (!session->quelch)
return send_command_samples(session, AST_FRAME_VOICE, format, 0, data, datalen, -1, samples);
return 0;
}
-int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen)
-{
+int iax_send_cng(struct iax_session *session, int level, unsigned char *data, int datalen) {
session->notsilenttx = 0;
return send_command(session, AST_FRAME_CNG, level, 0, data, datalen, -1);
}
-int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen)
-{
+int iax_send_image(struct iax_session *session, int format, unsigned char *data, int datalen) {
/* Send an image frame */
return send_command(session, AST_FRAME_IMAGE, format, 0, data, datalen, -1);
}
-int iax_register(struct iax_session *session, char *server, char *peer, char *secret, int refresh)
-{
+int iax_register(struct iax_session *session, char *server, char *peer, char *secret, int refresh) {
/* Send a registration request */
char tmp[256];
char *p;
@@ -1644,15 +1606,15 @@
int portno = IAX_DEFAULT_PORTNO;
struct iax_ie_data ied;
struct hostent *hp;
-
+
tmp[255] = '\0';
strncpy(tmp, server, sizeof(tmp) - 1);
p = strchr(tmp, ':');
if (p) {
*p = '\0';
- portno = atoi(p+1);
+ portno = atoi(p + 1);
}
-
+
memset(&ied, 0, sizeof(ied));
if (secret)
strncpy(session->secret, secret, sizeof(session->secret) - 1);
@@ -1666,44 +1628,39 @@
return -1;
}
memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr));
- session->peeraddr.sin_port = htons((unsigned short)portno);
+ session->peeraddr.sin_port = htons((unsigned short) portno);
session->peeraddr.sin_family = AF_INET;
strncpy(session->username, peer, sizeof(session->username) - 1);
session->refresh = refresh;
iax_ie_append_str(&ied, IAX_IE_USERNAME, (unsigned char *) peer);
- iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short)refresh);
+ iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short) refresh);
res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_REGREQ, 0, ied.buf, ied.pos, -1);
return res;
}
-int iax_reject_registration(struct iax_session *session, char *reason)
-{
+int iax_reject_registration(struct iax_session *session, char *reason) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? (unsigned char *) reason : (unsigned char *) "Unspecified");
return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGREJ, 0, ied.buf, ied.pos, -1);
}
-int iax_ack_registration(struct iax_session *session)
-{
+int iax_ack_registration(struct iax_session *session) {
return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGACK, 0, NULL, 0, -1);
}
-int iax_auth_registration(struct iax_session *session)
-{
+int iax_auth_registration(struct iax_session *session) {
return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REGAUTH, 0, NULL, 0, -1);
}
-int iax_reject(struct iax_session *session, const char *reason)
-{
+int iax_reject(struct iax_session *session, const char *reason) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_CAUSE, reason ? (unsigned char *) reason : (unsigned char *) "Unspecified");
return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_REJECT, 0, ied.buf, ied.pos, -1);
}
-int iax_hangup(struct iax_session *session, char *byemsg)
-{
+int iax_hangup(struct iax_session *session, char *byemsg) {
struct iax_ie_data ied;
iax_sched_del(NULL, NULL, send_ping, (void *) session, 1);
memset(&ied, 0, sizeof(ied));
@@ -1711,159 +1668,139 @@
return send_command_final(session, AST_FRAME_IAX, IAX_COMMAND_HANGUP, 0, ied.buf, ied.pos, -1);
}
-int iax_sendurl(struct iax_session *session, char *url)
-{
- return send_command(session, AST_FRAME_HTML, AST_HTML_URL, 0, (unsigned char *) url, (int)strlen(url), -1);
+int iax_sendurl(struct iax_session *session, char *url) {
+ return send_command(session, AST_FRAME_HTML, AST_HTML_URL, 0, (unsigned char *) url, (int) strlen(url), -1);
}
-int iax_ring_announce(struct iax_session *session)
-{
+int iax_ring_announce(struct iax_session *session) {
return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_RINGING, 0, NULL, 0, -1);
}
-int iax_lag_request(struct iax_session *session)
-{
+int iax_lag_request(struct iax_session *session) {
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
}
-int iax_busy(struct iax_session *session)
-{
+int iax_busy(struct iax_session *session) {
return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_BUSY, 0, NULL, 0, -1);
}
-int iax_congestion(struct iax_session *session)
-{
+int iax_congestion(struct iax_session *session) {
return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_CONGESTION, 0, NULL, 0, -1);
}
-int iax_accept(struct iax_session *session, int format)
-{
+int iax_accept(struct iax_session *session, int format) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_int(&ied, IAX_IE_FORMAT, format);
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_ACCEPT, 0, ied.buf, ied.pos, -1);
}
-int iax_answer(struct iax_session *session)
-{
+int iax_answer(struct iax_session *session) {
return send_command(session, AST_FRAME_CONTROL, AST_CONTROL_ANSWER, 0, NULL, 0, -1);
}
-int iax_load_complete(struct iax_session *session)
-{
+int iax_load_complete(struct iax_session *session) {
return send_command(session, AST_FRAME_HTML, AST_HTML_LDCOMPLETE, 0, NULL, 0, -1);
}
-int iax_send_url(struct iax_session *session, char *url, int link)
-{
- return send_command(session, AST_FRAME_HTML, link ? AST_HTML_LINKURL : AST_HTML_URL, 0, (unsigned char *) url, (int)strlen(url), -1);
+int iax_send_url(struct iax_session *session, char *url, int link) {
+ return send_command(session, AST_FRAME_HTML, link ? AST_HTML_LINKURL : AST_HTML_URL, 0, (unsigned char *) url, (int) strlen(url), -1);
}
-int iax_send_text(struct iax_session *session, char *text)
-{
- return send_command(session, AST_FRAME_TEXT, 0, 0, (unsigned char *) text, (int)strlen(text) + 1, -1);
+int iax_send_text(struct iax_session *session, char *text) {
+ return send_command(session, AST_FRAME_TEXT, 0, 0, (unsigned char *) text, (int) strlen(text) + 1, -1);
}
-int iax_send_unlink(struct iax_session *session)
-{
+int iax_send_unlink(struct iax_session *session) {
return send_command(session, AST_FRAME_HTML, AST_HTML_UNLINK, 0, NULL, 0, -1);
}
-int iax_send_link_reject(struct iax_session *session)
-{
+int iax_send_link_reject(struct iax_session *session) {
return send_command(session, AST_FRAME_HTML, AST_HTML_LINKREJECT, 0, NULL, 0, -1);
}
-static int iax_send_pong(struct iax_session *session, time_in_ms_t ts)
-{
- struct iax_ie_data ied;
+static int iax_send_pong(struct iax_session *session, time_in_ms_t ts) {
+ struct iax_ie_data ied;
- memset(&ied, 0, sizeof(ied));
+ memset(&ied, 0, sizeof(ied));
#ifdef NEWJB
{
- jb_info stats;
- jb_getinfo(session->jb, &stats);
+ jb_info stats;
+ jb_getinfo(session->jb, &stats);
- iax_ie_append_int(&ied,IAX_IE_RR_JITTER, (int)stats.jitter);
- /* XXX: should be short-term loss pct.. */
- if(stats.frames_in == 0) stats.frames_in = 1;
- iax_ie_append_int(&ied,IAX_IE_RR_LOSS,
- ((0xff & (stats.losspct/1000)) << 24 | (stats.frames_lost & 0x00ffffff)));
- iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in);
- iax_ie_append_short(&ied,IAX_IE_RR_DELAY, (unsigned short)(stats.current - stats.min));
- iax_ie_append_int(&ied,IAX_IE_RR_DROPPED, stats.frames_dropped);
- iax_ie_append_int(&ied,IAX_IE_RR_OOO, stats.frames_ooo);
+ iax_ie_append_int(&ied, IAX_IE_RR_JITTER, (int) stats.jitter);
+ /* XXX: should be short-term loss pct.. */
+ if (stats.frames_in == 0)
+ stats.frames_in = 1;
+ iax_ie_append_int(&ied, IAX_IE_RR_LOSS, ((0xff & (stats.losspct / 1000)) << 24 | (stats.frames_lost & 0x00ffffff)));
+ iax_ie_append_int(&ied, IAX_IE_RR_PKTS, stats.frames_in);
+ iax_ie_append_short(&ied, IAX_IE_RR_DELAY, (unsigned short) (stats.current - stats.min));
+ iax_ie_append_int(&ied, IAX_IE_RR_DROPPED, stats.frames_dropped);
+ iax_ie_append_int(&ied, IAX_IE_RR_OOO, stats.frames_ooo);
}
#else
- iax_ie_append_int(&ied,IAX_IE_RR_JITTER, session->jitter);
- /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 0); */
- /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in); */
- /* don't know, don't send! iax_ie_append_short(&ied,IAX_IE_RR_DELAY, stats.current - stats.min); */
+ iax_ie_append_int(&ied, IAX_IE_RR_JITTER, session->jitter);
+ /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_LOSS, 0); */
+ /* don't know, don't send! iax_ie_append_int(&ied,IAX_IE_RR_PKTS, stats.frames_in); */
+ /* don't know, don't send! iax_ie_append_short(&ied,IAX_IE_RR_DELAY, stats.current - stats.min); */
#endif
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PONG, ts, ied.buf, ied.pos, -1);
}
/* external API; deprecated since we send pings ourselves now (finally) */
-int iax_send_ping(struct iax_session *session)
-{
+int iax_send_ping(struct iax_session *session) {
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
}
/* scheduled ping sender; sends ping, then reschedules */
-static void send_ping(void *s)
-{
- struct iax_session *session = (struct iax_session *)s;
+static void send_ping(void *s) {
+ struct iax_session *session = (struct iax_session *) s;
/* important, eh? */
- if(!iax_session_valid(session)) return;
+ if (!iax_session_valid(session))
+ return;
send_command(session, AST_FRAME_IAX, IAX_COMMAND_PING, 0, NULL, 0, -1);
- session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, ping_time * 1000);
+ session->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) session, ping_time * 1000);
return;
}
-static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts)
-{
+static int iax_send_lagrp(struct iax_session *session, time_in_ms_t ts) {
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_LAGRP, ts, NULL, 0, -1);
}
-static int iax_send_txcnt(struct iax_session *session)
-{
+static int iax_send_txcnt(struct iax_session *session) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXCNT, 0, ied.buf, ied.pos);
}
-static int iax_send_txrej(struct iax_session *session)
-{
+static int iax_send_txrej(struct iax_session *session) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXREJ, 0, ied.buf, ied.pos);
}
-static int iax_send_txaccept(struct iax_session *session)
-{
+static int iax_send_txaccept(struct iax_session *session) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_int(&ied, IAX_IE_TRANSFERID, session->transferid);
return send_command_transfer(session, AST_FRAME_IAX, IAX_COMMAND_TXACC, 0, ied.buf, ied.pos);
}
-static int iax_send_txready(struct iax_session *session)
-{
+static int iax_send_txready(struct iax_session *session) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
/* see asterisk chan_iax2.c */
- iax_ie_append_short(&ied, IAX_IE_CALLNO, (unsigned short)session->callno);
+ iax_ie_append_short(&ied, IAX_IE_CALLNO, (unsigned short) session->callno);
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_TXREADY, 0, ied.buf, ied.pos, -1);
}
-int iax_auth_reply(struct iax_session *session, char *password, char *challenge, int methods)
-{
+int iax_auth_reply(struct iax_session *session, char *password, char *challenge, int methods) {
char reply[16];
struct MD5Context md5;
char realreply[256];
@@ -1871,8 +1808,8 @@
memset(&ied, 0, sizeof(ied));
if ((methods & IAX_AUTH_MD5) && challenge) {
MD5Init(&md5);
- MD5Update(&md5, (const unsigned char *) challenge, (unsigned int)strlen(challenge));
- MD5Update(&md5, (const unsigned char *) password, (unsigned int)strlen(password));
+ MD5Update(&md5, (const unsigned char *) challenge, (unsigned int) strlen(challenge));
+ MD5Update(&md5, (const unsigned char *) password, (unsigned int) strlen(password));
MD5Final((unsigned char *) reply, &md5);
memset(realreply, 0, sizeof(realreply));
convert_reply(realreply, (unsigned char *) reply);
@@ -1883,19 +1820,18 @@
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_AUTHREP, 0, ied.buf, ied.pos, -1);
}
-static int iax_regauth_reply(struct iax_session *session, char *password, char *challenge, int methods)
-{
+static int iax_regauth_reply(struct iax_session *session, char *password, char *challenge, int methods) {
char reply[16];
struct MD5Context md5;
char realreply[256];
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_USERNAME, (unsigned char *) session->username);
- iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short)session->refresh);
+ iax_ie_append_short(&ied, IAX_IE_REFRESH, (unsigned short) session->refresh);
if ((methods & IAX_AUTHMETHOD_MD5) && challenge) {
MD5Init(&md5);
- MD5Update(&md5, (const unsigned char *) challenge, (unsigned int)strlen(challenge));
- MD5Update(&md5, (const unsigned char *) password, (unsigned int)strlen(password));
+ MD5Update(&md5, (const unsigned char *) challenge, (unsigned int) strlen(challenge));
+ MD5Update(&md5, (const unsigned char *) password, (unsigned int) strlen(password));
MD5Final((unsigned char *) reply, &md5);
memset(realreply, 0, sizeof(realreply));
convert_reply(realreply, (unsigned char *) reply);
@@ -1907,63 +1843,56 @@
}
-int iax_dial(struct iax_session *session, char *number)
-{
+int iax_dial(struct iax_session *session, char *number) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DIAL, 0, ied.buf, ied.pos, -1);
}
-int iax_quelch(struct iax_session *session)
-{
+int iax_quelch(struct iax_session *session) {
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, NULL, 0, -1);
}
-int iax_unquelch(struct iax_session *session)
-{
+int iax_unquelch(struct iax_session *session) {
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_UNQUELCH, 0, NULL, 0, -1);
}
-int iax_dialplan_request(struct iax_session *session, char *number)
-{
+int iax_dialplan_request(struct iax_session *session, char *number) {
struct iax_ie_data ied;
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_CALLED_NUMBER, (unsigned char *) number);
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_DPREQ, 0, ied.buf, ied.pos, -1);
}
-static inline int which_bit(unsigned int i)
-{
- unsigned char x;
- for(x = 0; x < 32; x++) {
- if ((unsigned)(1 << x) == i) {
- return x + 1;
- }
- }
- return 0;
+static inline int which_bit(unsigned int i) {
+ unsigned char x;
+ for (x = 0; x < 32; x++) {
+ if ((unsigned) (1 << x) == i) {
+ return x + 1;
+ }
+ }
+ return 0;
}
-char iax_pref_codec_add(struct iax_session *session, unsigned int format)
-{
+char iax_pref_codec_add(struct iax_session *session, unsigned int format) {
int diff = (int) 'A';
- session->codec_order[session->codec_order_len++] = (char)((which_bit(format)) + diff);
+ session->codec_order[session->codec_order_len++] = (char) ((which_bit(format)) + diff);
session->codec_order[session->codec_order_len] = '\0';
- return session->codec_order[session->codec_order_len-1];
+ return session->codec_order[session->codec_order_len - 1];
}
-void iax_pref_codec_del(struct iax_session *session, unsigned int format)
-{
+void iax_pref_codec_del(struct iax_session *session, unsigned int format) {
int diff = (int) 'A';
size_t x;
char old[32];
- char remove = (char)(which_bit(format) + diff);
+ char remove = (char) (which_bit(format) + diff);
strncpy(old, session->codec_order, sizeof(old));
session->codec_order_len = 0;
- for (x = 0; x < strlen(old) ; x++) {
+ for (x = 0; x < strlen(old); x++) {
if (old[x] != remove) {
session->codec_order[session->codec_order_len++] = old[x];
}
@@ -1971,11 +1900,10 @@
session->codec_order[session->codec_order_len] = '\0';
}
-int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len)
-{
+int iax_pref_codec_get(struct iax_session *session, unsigned int *array, int len) {
int diff = (int) 'A';
int x;
-
+
for (x = 0; x < session->codec_order_len && x < len; x++) {
array[x] = (1 << (session->codec_order[x] - diff - 1));
}
@@ -1983,15 +1911,13 @@
return x;
}
-void iax_set_samplerate(struct iax_session *session, unsigned short samplemask)
-{
+void iax_set_samplerate(struct iax_session *session, unsigned short samplemask) {
session->samplemask = samplemask;
}
-int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int formats, int capabilities)
-{
- char tmp[256]="";
+int iax_call(struct iax_session *session, const char *cidnum, const char *cidname, char *ich, char *lang, int wait, int formats, int capabilities) {
+ char tmp[256] = "";
char *part1, *part2;
int res;
int portno;
@@ -2006,10 +1932,10 @@
return -1;
}
memset(&ied, 0, sizeof(ied));
- strncpy(tmp, ich, sizeof(tmp) - 1);
+ strncpy(tmp, ich, sizeof(tmp) - 1);
iax_ie_append_short(&ied, IAX_IE_VERSION, IAX_PROTO_VERSION);
- if (session->samplemask) {
+ if (session->samplemask) {
iax_ie_append_short(&ied, IAX_IE_SAMPLINGRATE, session->samplemask);
}
if (cidnum)
@@ -2022,20 +1948,20 @@
}
session->capability = capabilities;
- session->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)session, 2 * 1000);
+ session->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) session, 2 * 1000);
/* XXX We should have a preferred format XXX */
iax_ie_append_int(&ied, IAX_IE_FORMAT, formats);
iax_ie_append_int(&ied, IAX_IE_CAPABILITY, capabilities);
if (lang)
iax_ie_append_str(&ied, IAX_IE_LANGUAGE, (unsigned char *) lang);
-
+
/* Part 1 is [user[:password]@]peer[:port] */
part1 = strtok(tmp, "/");
/* Part 2 is exten[@context] if it is anything all */
part2 = strtok(NULL, "/");
-
+
if (strchr(part1, '@')) {
username = strtok(part1, "@");
hostname = strtok(NULL, "@");
@@ -2043,19 +1969,19 @@
username = NULL;
hostname = part1;
}
-
+
if (username && strchr(username, ':')) {
username = strtok(username, ":");
secret = strtok(NULL, ":");
} else
secret = NULL;
- if(username)
- strncpy(session->username, username, sizeof(session->username) - 1);
+ if (username)
+ strncpy(session->username, username, sizeof(session->username) - 1);
+
+ if (secret)
+ strncpy(session->secret, secret, sizeof(session->secret) - 1);
- if(secret)
- strncpy(session->secret, secret, sizeof(session->secret) - 1);
-
if (strchr(hostname, ':')) {
strtok(hostname, ":");
portno = atoi(strtok(NULL, ":"));
@@ -2087,7 +2013,7 @@
return -1;
}
memcpy(&session->peeraddr.sin_addr, hp->h_addr, sizeof(session->peeraddr.sin_addr));
- session->peeraddr.sin_port = htons((unsigned short)portno);
+ session->peeraddr.sin_port = htons((unsigned short) portno);
session->peeraddr.sin_family = AF_INET;
res = send_command(session, AST_FRAME_IAX, IAX_COMMAND_NEW, 0, ied.buf, ied.pos, -1);
if (res < 0)
@@ -2099,8 +2025,7 @@
return res;
}
-static time_in_ms_t calc_rxstamp(struct iax_session *session)
-{
+static time_in_ms_t calc_rxstamp(struct iax_session *session) {
time_in_ms_t time_in_ms;
time_in_ms = current_time_in_ms();
@@ -2113,20 +2038,16 @@
}
#ifdef notdef_cruft
-static int match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur)
-{
- if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->peeraddr.sin_port == sin->sin_port)) {
+static int match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) {
+ if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
/* This is the main host */
- if ((cur->peercallno == callno) ||
- ((dcallno == cur->callno) && !cur->peercallno)) {
+ if ((cur->peercallno == callno) || ((dcallno == cur->callno) && !cur->peercallno)) {
/* That's us. Be sure we keep track of the peer call number */
cur->peercallno = callno;
return 1;
}
}
- if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+ if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
/* We're transferring */
if (dcallno == cur->callno)
return 1;
@@ -2141,21 +2062,17 @@
same peercallno (from two different asterisks) exist in more than
one session.
*/
-static int forward_match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur)
-{
- if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+static int forward_match(struct sockaddr_in *sin, short callno, short dcallno, struct iax_session *cur) {
+ if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
/* We're transferring */
- if (dcallno == cur->callno)
- {
+ if (dcallno == cur->callno) {
return 1;
}
}
- if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->peeraddr.sin_port == sin->sin_port)) {
- if (dcallno == cur->callno && dcallno != 0) {
- /* That's us. Be sure we keep track of the peer call number */
+ if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
+ if (dcallno == cur->callno && dcallno != 0) {
+ /* That's us. Be sure we keep track of the peer call number */
if (cur->peercallno == 0) {
cur->peercallno = callno;
}
@@ -2166,18 +2083,15 @@
return 0;
}
-static int reverse_match(struct sockaddr_in *sin, short callno, struct iax_session *cur)
-{
- if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
+static int reverse_match(struct sockaddr_in *sin, short callno, struct iax_session *cur) {
+ if ((cur->transfer.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->transfer.sin_port == sin->sin_port) && (cur->transferring)) {
/* We're transferring */
- if (callno == cur->peercallno) {
+ if (callno == cur->peercallno) {
return 1;
}
}
- if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) &&
- (cur->peeraddr.sin_port == sin->sin_port)) {
- if (callno == cur->peercallno) {
+ if ((cur->peeraddr.sin_addr.s_addr == sin->sin_addr.s_addr) && (cur->peeraddr.sin_port == sin->sin_port)) {
+ if (callno == cur->peercallno) {
return 1;
}
}
@@ -2185,33 +2099,29 @@
return 0;
}
-static struct iax_session *iax_find_session(struct sockaddr_in *sin,
- short callno,
- short dcallno,
- int makenew)
-{
+static struct iax_session *iax_find_session(struct sockaddr_in *sin, short callno, short dcallno, int makenew) {
struct iax_session *cur;
- iax_mutex_lock(session_mutex);
+ iax_mutex_lock(session_mutex);
cur = sessions;
- while(cur) {
+ while (cur) {
if (forward_match(sin, callno, dcallno, cur)) {
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
return cur;
}
cur = cur->next;
}
cur = sessions;
- while(cur) {
+ while (cur) {
if (reverse_match(sin, callno, cur)) {
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
return cur;
}
cur = cur->next;
}
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
if (makenew && !dcallno) {
cur = iax_session_new();
@@ -2219,18 +2129,17 @@
cur->peeraddr.sin_addr.s_addr = sin->sin_addr.s_addr;
cur->peeraddr.sin_port = sin->sin_port;
cur->peeraddr.sin_family = AF_INET;
- cur->pingid = iax_sched_add(NULL,NULL, send_ping, (void *)cur, 2 * 1000);
+ cur->pingid = iax_sched_add(NULL, NULL, send_ping, (void *) cur, 2 * 1000);
DEBU(G "Making new session, peer callno %d, our callno %d\n", callno, cur->callno);
} else {
DEBU(G "No session, peer = %d, us = %d\n", callno, dcallno);
}
- return cur;
+ return cur;
}
#ifdef EXTREME_DEBUG
-static int display_time(int ms)
-{
+static int display_time(int ms) {
static int oldms = -1;
if (oldms < 0) {
DEBU(G "First measure\n");
@@ -2247,36 +2156,34 @@
#ifdef NEWJB
/* From chan_iax2/steve davies: need to get permission from steve or digium, I guess */
-static time_in_ms_t unwrap_timestamp(time_in_ms_t ts, time_in_ms_t last)
-{
- time_in_ms_t x;
+static time_in_ms_t unwrap_timestamp(time_in_ms_t ts, time_in_ms_t last) {
+ time_in_ms_t x;
- if ( (ts & 0xFFFF0000) == (last & 0xFFFF0000) ) {
- x = ts - last;
- if (x < -50000) {
- /* Sudden big jump backwards in timestamp:
- What likely happened here is that miniframe timestamp has circled but we haven't
- gotten the update from the main packet. We'll just pretend that we did, and
- update the timestamp appropriately. */
- ts = ( (last & 0xFFFF0000) + 0x10000) | (ts & 0xFFFF);
- DEBU(G "schedule_delivery: pushed forward timestamp\n");
- }
- if (x > 50000) {
- /* Sudden apparent big jump forwards in timestamp:
- What's likely happened is this is an old miniframe belonging to the previous
- top-16-bit timestamp that has turned up out of order.
- Adjust the timestamp appropriately. */
- ts = ( (last & 0xFFFF0000) - 0x10000) | (ts & 0xFFFF);
- DEBU(G "schedule_delivery: pushed back timestamp\n");
- }
- }
+ if ((ts & 0xFFFF0000) == (last & 0xFFFF0000)) {
+ x = ts - last;
+ if (x < -50000) {
+ /* Sudden big jump backwards in timestamp:
+ What likely happened here is that miniframe timestamp has circled but we haven't
+ gotten the update from the main packet. We'll just pretend that we did, and
+ update the timestamp appropriately. */
+ ts = ((last & 0xFFFF0000) + 0x10000) | (ts & 0xFFFF);
+ DEBU(G "schedule_delivery: pushed forward timestamp\n");
+ }
+ if (x > 50000) {
+ /* Sudden apparent big jump forwards in timestamp:
+ What's likely happened is this is an old miniframe belonging to the previous
+ top-16-bit timestamp that has turned up out of order.
+ Adjust the timestamp appropriately. */
+ ts = ((last & 0xFFFF0000) - 0x10000) | (ts & 0xFFFF);
+ DEBU(G "schedule_delivery: pushed back timestamp\n");
+ }
+ }
return ts;
}
#endif
-static struct iax_event *schedule_delivery(struct iax_event *e, time_in_ms_t ts, int updatehistory)
-{
+static struct iax_event *schedule_delivery(struct iax_event *e, time_in_ms_t ts, int updatehistory) {
/*
* This is the core of the IAX jitterbuffer delivery mechanism:
* Dynamically adjust the jitterbuffer and decide how time_in_ms_t to wait
@@ -2285,21 +2192,21 @@
#ifndef NEWJB
int ms, x;
int drops[MEMORY_SIZE];
- int min, max=0, maxone=0, y, z, match;
+ int min, max = 0, maxone = 0, y, z, match;
#endif
-#ifdef EXTREME_DEBUG
+#ifdef EXTREME_DEBUG
DEBU(G "[%p] We are at %d, packet is for %d\n", e->session, calc_rxstamp(e->session), ts);
#endif
-
+
#ifdef VOICE_SMOOTHING
if (e->etype == IAX_EVENT_VOICE) {
/* Smooth voices if we know enough about the format */
- switch(e->event.voice.format) {
+ switch (e->event.voice.format) {
case AST_FORMAT_GSM:
/* GSM frames are 20 ms long, although there could be periods of
silence. If the time is < 50 ms, assume it ought to be 20 ms */
- if (ts - e->session->lastts < 50)
+ if (ts - e->session->lastts < 50)
ts = e->session->lastts + 20;
#ifdef EXTREME_DEBUG
display_time(ts);
@@ -2314,38 +2221,38 @@
#ifdef NEWJB
{
- int type = JB_TYPE_CONTROL;
- int len = 0;
+ int type = JB_TYPE_CONTROL;
+ int len = 0;
+
+ if (e->etype == IAX_EVENT_VOICE) {
+ type = JB_TYPE_VOICE;
+ len = get_sample_cnt(e) / 8;
+ } else if (e->etype == IAX_EVENT_CNG) {
+ type = JB_TYPE_SILENCE;
+ }
+
+ /* unwrap timestamp */
+ ts = unwrap_timestamp(ts, e->session->last_ts);
- if(e->etype == IAX_EVENT_VOICE) {
- type = JB_TYPE_VOICE;
- len = get_sample_cnt(e) / 8;
- } else if(e->etype == IAX_EVENT_CNG) {
- type = JB_TYPE_SILENCE;
- }
-
- /* unwrap timestamp */
- ts = unwrap_timestamp(ts,e->session->last_ts);
-
- /* move forward last_ts if it's greater. We do this _after_ unwrapping, because
- * asterisk _still_ has cases where it doesn't send full frames when it ought to */
- if(ts > e->session->last_ts) {
- e->session->last_ts = ts;
- }
-
-
- /* insert into jitterbuffer */
- /* TODO: Perhaps we could act immediately if it's not droppable and late */
- if(jb_put(e->session->jb, e, type, len, ts, calc_rxstamp(e->session)) == JB_DROP) {
- iax_event_free(e);
- }
+ /* move forward last_ts if it's greater. We do this _after_ unwrapping, because
+ * asterisk _still_ has cases where it doesn't send full frames when it ought to */
+ if (ts > e->session->last_ts) {
+ e->session->last_ts = ts;
+ }
+
+
+ /* insert into jitterbuffer */
+ /* TODO: Perhaps we could act immediately if it's not droppable and late */
+ if (jb_put(e->session->jb, e, type, len, ts, calc_rxstamp(e->session)) == JB_DROP) {
+ iax_event_free(e);
+ }
}
#else
-
+
/* How many ms from now should this packet be delivered? (remember
this can be a negative number, too */
- ms = (int)(calc_rxstamp(e->session) - ts);
+ ms = (int) (calc_rxstamp(e->session) - ts);
/*
Drop voice frame if timestamp is way off
@@ -2354,7 +2261,7 @@
free(e);
return NULL;
}
- */
+ */
/* Adjust if voice frame timestamp is off by a step */
if (ms > 32768) {
@@ -2368,33 +2275,32 @@
time frame */
ms += 65536;
}
-
-#if 0
+#if 0
printf("rxstamp is %d, timestamp is %d, ms is %d\n", calc_rxstamp(e->session), ts, ms);
#endif
/* Rotate history queue. Leading 0's are irrelevant. */
if (updatehistory) {
- for (x=0; x < MEMORY_SIZE - 1; x++)
- e->session->history[x] = e->session->history[x+1];
-
- /* Add new entry for this time */
- e->session->history[x] = ms;
+ for (x = 0; x < MEMORY_SIZE - 1; x++)
+ e->session->history[x] = e->session->history[x + 1];
+
+ /* Add new entry for this time */
+ e->session->history[x] = ms;
}
-
+
/* We have to find the maximum and minimum time delay we've had to deliver. */
min = e->session->history[0];
- for (z=0;z < iax_dropcount + 1; z++) {
+ for (z = 0; z < iax_dropcount + 1; z++) {
/* We drop the top iax_dropcount entries. iax_dropcount represents
a tradeoff between quality of voice and latency. 3% drop seems to
be unnoticable to the client and can significantly improve latency.
We add one more to our droplist, but that's the one we actually use,
and don't drop. */
max = -99999999;
- for (x=0;x<MEMORY_SIZE;x++) {
+ for (x = 0; x < MEMORY_SIZE; x++) {
if (max < e->session->history[x]) {
/* New candidate value. Make sure we haven't dropped it. */
- match=0;
- for(y=0;!match && (y<z); y++)
+ match = 0;
+ for (y = 0; !match && (y < z); y++)
match |= (drops[y] == x);
/* If there is no match, this is our new maximum */
if (!match) {
@@ -2413,7 +2319,7 @@
/* Again, just for reference. The "jitter buffer" is the max. The difference
is the perceived jitter correction. */
e->session->jitter = max - min;
-
+
/* If the jitter buffer is substantially too large, shrink it, slowly enough
that the client won't notice ;-) . */
if (max < e->session->jitterbuffer - max_extra_jitterbuffer) {
@@ -2422,27 +2328,27 @@
#endif
e->session->jitterbuffer -= 1;
}
-
+
/* Keep the jitter buffer from becoming unreasonably large */
if (max > min + max_jitterbuffer) {
DEBU(G "Constraining jitter buffer (min = %d, max = %d)...\n", min, max);
max = min + max_jitterbuffer;
}
-
+
/* If the jitter buffer is too small, we immediately grow our buffer to
accomodate */
if (max > e->session->jitterbuffer)
e->session->jitterbuffer = max;
-
+
/* Start with our jitter buffer delay, and subtract the lateness (or earliness).
Remember these times are all relative to the first packet, so their absolute
values are really irrelevant. */
ms = e->session->jitterbuffer - ms - IAX_SCHEDULE_FUZZ;
-
+
/* If the jitterbuffer is disabled, always deliver immediately */
if (!iax_use_jitterbuffer)
ms = 0;
-
+
if (ms < 1) {
#ifdef EXTREME_DEBUG
DEBU(G "Calculated delay is only %d\n", ms);
@@ -2469,11 +2375,10 @@
#endif
#endif /* NEWJB */
return NULL;
-
+
}
-static int uncompress_subclass(unsigned char csub)
-{
+static int uncompress_subclass(unsigned char csub) {
/* If the SC_LOG flag is set, return 2^csub otherwise csub */
if (csub & IAX_FLAG_SC_LOG)
return 1 << (csub & ~IAX_FLAG_SC_LOG & IAX_MAX_SHIFT);
@@ -2481,8 +2386,7 @@
return csub;
}
-static inline char *extract(char *src, char *string)
-{
+static inline char *extract(char *src, char *string) {
/* Extract and duplicate what we need from a string */
char *s, *t;
s = strstr(src, string);
@@ -2496,13 +2400,10 @@
}
}
return s;
-
+
}
-static struct iax_event *iax_header_to_event(struct iax_session *session,
- struct ast_iax2_full_hdr *fh,
- int datalen, struct sockaddr_in *sin)
-{
+static struct iax_event *iax_header_to_event(struct iax_session *session, struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin) {
struct iax_event *e;
struct iax_sched *sch;
unsigned int ts;
@@ -2512,14 +2413,10 @@
ts = ntohl(fh->ts);
/* don't run last_ts backwards; i.e. for retransmits and the like */
if (ts > session->last_ts &&
- (fh->type == AST_FRAME_IAX &&
- subclass != IAX_COMMAND_ACK &&
- subclass != IAX_COMMAND_PONG &&
- subclass != IAX_COMMAND_LAGRP)) {
- session->last_ts = ts;
+ (fh->type == AST_FRAME_IAX && subclass != IAX_COMMAND_ACK && subclass != IAX_COMMAND_PONG && subclass != IAX_COMMAND_LAGRP)) {
+ session->last_ts = ts;
}
-
#ifdef DEBUG_SUPPORT
iax_showframe(NULL, fh, 1, sin, datalen);
#endif
@@ -2527,89 +2424,75 @@
/* Get things going with it, timestamp wise, if we
haven't already. */
- /* Handle implicit ACKing unless this is an INVAL, and only if this is
- from the real peer, not the transfer peer */
- if (!inaddrcmp(sin, &session->peeraddr) &&
- (((subclass != IAX_COMMAND_INVAL)) ||
- (fh->type != AST_FRAME_IAX))) {
- unsigned char x;
- /* XXX This code is not very efficient. Surely there is a better way which still
- properly handles boundary conditions? XXX */
- /* First we have to qualify that the ACKed value is within our window */
- for (x=session->rseqno; x != session->oseqno; x++)
- if (fh->iseqno == x)
- break;
- if ((x != session->oseqno) || (session->oseqno == fh->iseqno)) {
- /* The acknowledgement is within our window. Time to acknowledge everything
- that it says to */
- for (x=session->rseqno; x != fh->iseqno; x++) {
- /* Ack the packet with the given timestamp */
- DEBU(G "Cancelling transmission of packet %d\n", x);
- iax_mutex_lock(sched_mutex);
- sch = schedq;
- while(sch) {
- if (sch->frame && (sch->frame->session == session) &&
- (sch->frame->oseqno == x))
- sch->frame->retries = -1;
- sch = sch->next;
- }
- iax_mutex_unlock(sched_mutex);
+ /* Handle implicit ACKing unless this is an INVAL, and only if this is
+ from the real peer, not the transfer peer */
+ if (!inaddrcmp(sin, &session->peeraddr) && (((subclass != IAX_COMMAND_INVAL)) || (fh->type != AST_FRAME_IAX))) {
+ unsigned char x;
+ /* XXX This code is not very efficient. Surely there is a better way which still
+ properly handles boundary conditions? XXX */
+ /* First we have to qualify that the ACKed value is within our window */
+ for (x = session->rseqno; x != session->oseqno; x++)
+ if (fh->iseqno == x)
+ break;
+ if ((x != session->oseqno) || (session->oseqno == fh->iseqno)) {
+ /* The acknowledgement is within our window. Time to acknowledge everything
+ that it says to */
+ for (x = session->rseqno; x != fh->iseqno; x++) {
+ /* Ack the packet with the given timestamp */
+ DEBU(G "Cancelling transmission of packet %d\n", x);
+ iax_mutex_lock(sched_mutex);
+ sch = schedq;
+ while (sch) {
+ if (sch->frame && (sch->frame->session == session) && (sch->frame->oseqno == x))
+ sch->frame->retries = -1;
+ sch = sch->next;
}
- /* Note how much we've received acknowledgement for */
- session->rseqno = fh->iseqno;
- } else
- DEBU(G "Received iseqno %d not within window %d->%d\n", fh->iseqno, session->rseqno, session->oseqno);
- }
+ iax_mutex_unlock(sched_mutex);
+ }
+ /* Note how much we've received acknowledgement for */
+ session->rseqno = fh->iseqno;
+ } else
+ DEBU(G "Received iseqno %d not within window %d->%d\n", fh->iseqno, session->rseqno, session->oseqno);
+ }
/* Check where we are */
- if ((ntohs(fh->dcallno) & IAX_FLAG_RETRANS) || (fh->type != AST_FRAME_VOICE))
- updatehistory = 0;
- if ((session->iseqno != fh->oseqno) &&
- (session->iseqno ||
- ((subclass != IAX_COMMAND_TXREADY) &&
- (subclass != IAX_COMMAND_TXREL) &&
- (subclass != IAX_COMMAND_TXCNT) &&
- (subclass != IAX_COMMAND_TXACC)) ||
- (fh->type != AST_FRAME_IAX))) {
- if (
- ((subclass != IAX_COMMAND_ACK) &&
- (subclass != IAX_COMMAND_INVAL) &&
- (subclass != IAX_COMMAND_TXREADY) &&
- (subclass != IAX_COMMAND_TXREL) &&
- (subclass != IAX_COMMAND_TXCNT) &&
- (subclass != IAX_COMMAND_TXACC) &&
- (subclass != IAX_COMMAND_VNAK)) ||
- (fh->type != AST_FRAME_IAX)) {
- /* If it's not an ACK packet, it's out of order. */
- DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
- session->iseqno, fh->oseqno, fh->type, subclass);
- if (session->iseqno > fh->oseqno) {
- /* If we've already seen it, ack it XXX There's a border condition here XXX */
- if ((fh->type != AST_FRAME_IAX) ||
- ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) {
- DEBU(G "Acking anyway\n");
- /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
- we have anything to send, we'll retransmit and get an ACK back anyway XXX */
- send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0,fh->iseqno);
- }
- } else {
- /* Send a VNAK requesting retransmission */
- iax2_vnak(session);
+ if ((ntohs(fh->dcallno) & IAX_FLAG_RETRANS) || (fh->type != AST_FRAME_VOICE))
+ updatehistory = 0;
+ if ((session->iseqno != fh->oseqno) &&
+ (session->iseqno ||
+ ((subclass != IAX_COMMAND_TXREADY) &&
+ (subclass != IAX_COMMAND_TXREL) && (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC)) || (fh->type != AST_FRAME_IAX))) {
+ if (((subclass != IAX_COMMAND_ACK) &&
+ (subclass != IAX_COMMAND_INVAL) &&
+ (subclass != IAX_COMMAND_TXREADY) &&
+ (subclass != IAX_COMMAND_TXREL) &&
+ (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX)) {
+ /* If it's not an ACK packet, it's out of order. */
+ DEBU(G "Packet arrived out of order (expecting %d, got %d) (frametype = %d, subclass = %d)\n",
+ session->iseqno, fh->oseqno, fh->type, subclass);
+ if (session->iseqno > fh->oseqno) {
+ /* If we've already seen it, ack it XXX There's a border condition here XXX */
+ if ((fh->type != AST_FRAME_IAX) || ((subclass != IAX_COMMAND_ACK) && (subclass != IAX_COMMAND_INVAL))) {
+ DEBU(G "Acking anyway\n");
+ /* XXX Maybe we should handle its ack to us, but then again, it's probably outdated anyway, and if
+ we have anything to send, we'll retransmit and get an ACK back anyway XXX */
+ send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
}
- return NULL;
+ } else {
+ /* Send a VNAK requesting retransmission */
+ iax2_vnak(session);
}
- } else {
- /* Increment unless it's an ACK or VNAK */
- if (((subclass != IAX_COMMAND_ACK) &&
- (subclass != IAX_COMMAND_INVAL) &&
- (subclass != IAX_COMMAND_TXCNT) &&
- (subclass != IAX_COMMAND_TXACC) &&
- (subclass != IAX_COMMAND_VNAK)) ||
- (fh->type != AST_FRAME_IAX))
- session->iseqno++;
+ return NULL;
}
-
- e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen + 1);
+ } else {
+ /* Increment unless it's an ACK or VNAK */
+ if (((subclass != IAX_COMMAND_ACK) &&
+ (subclass != IAX_COMMAND_INVAL) &&
+ (subclass != IAX_COMMAND_TXCNT) && (subclass != IAX_COMMAND_TXACC) && (subclass != IAX_COMMAND_VNAK)) || (fh->type != AST_FRAME_IAX))
+ session->iseqno++;
+ }
+
+ e = (struct iax_event *) malloc(sizeof(struct iax_event) + datalen + 1);
if (e) {
memset(e, 0, sizeof(struct iax_event) + datalen);
@@ -2618,14 +2501,14 @@
*/
e->etype = -1;
e->session = session;
- switch(fh->type) {
+ switch (fh->type) {
case AST_FRAME_DTMF:
e->etype = IAX_EVENT_DTMF;
e->subclass = subclass;
/*
- We want the DTMF event deliver immediately so all I/O can be
- terminate quickly in an IVR system.
- e = schedule_delivery(e, ts, updatehistory); */
+ We want the DTMF event deliver immediately so all I/O can be
+ terminate quickly in an IVR system.
+ e = schedule_delivery(e, ts, updatehistory); */
break;
case AST_FRAME_VOICE:
e->etype = IAX_EVENT_VOICE;
@@ -2640,12 +2523,12 @@
case AST_FRAME_CNG:
e->etype = IAX_EVENT_CNG;
e->subclass = subclass;
- if (datalen) {
- memcpy(e->data, fh->iedata, datalen);
- e->datalen = datalen;
- }
- e = schedule_delivery(e, ts, updatehistory);
- break;
+ if (datalen) {
+ memcpy(e->data, fh->iedata, datalen);
+ e->datalen = datalen;
+ }
+ e = schedule_delivery(e, ts, updatehistory);
+ break;
case AST_FRAME_IAX:
/* Parse IE's */
if (datalen) {
@@ -2658,14 +2541,14 @@
e = NULL;
break;
}
- switch(subclass) {
+ switch (subclass) {
case IAX_COMMAND_NEW:
/* This is a new, incoming call */
/* save the capability for validation */
session->capability = e->ies.capability;
if (e->ies.codec_prefs) {
strncpy(session->codec_order, e->ies.codec_prefs, sizeof(session->codec_order));
- session->codec_order_len = (int)strlen(session->codec_order);
+ session->codec_order_len = (int) strlen(session->codec_order);
}
e->etype = IAX_EVENT_CONNECT;
e = schedule_delivery(e, ts, updatehistory);
@@ -2673,13 +2556,12 @@
case IAX_COMMAND_AUTHREQ:
/* This is a request for a call */
e->etype = IAX_EVENT_AUTHRQ;
- if (strlen(session->username) && !strcmp(e->ies.username, session->username) &&
- strlen(session->secret)) {
- /* Hey, we already know this one */
- iax_auth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods);
- free(e);
- e = NULL;
- break;
+ if (strlen(session->username) && !strcmp(e->ies.username, session->username) && strlen(session->secret)) {
+ /* Hey, we already know this one */
+ iax_auth_reply(session, session->secret, e->ies.challenge, e->ies.authmethods);
+ free(e);
+ e = NULL;
+ break;
}
e = schedule_delivery(e, ts, updatehistory);
break;
@@ -2717,7 +2599,7 @@
case IAX_COMMAND_PONG:
e->etype = IAX_EVENT_PONG;
/* track weighted average of ping time */
- session->pingtime = ((2 * session->pingtime) + (calc_timestamp(session,0,NULL) - ts)) / 3;
+ session->pingtime = ((2 * session->pingtime) + (calc_timestamp(session, 0, NULL) - ts)) / 3;
session->remote_netstats.jitter = e->ies.rr_jitter;
session->remote_netstats.losspct = e->ies.rr_loss >> 24;;
session->remote_netstats.losscnt = e->ies.rr_loss & 0xffffff;
@@ -2729,13 +2611,12 @@
case IAX_COMMAND_ACCEPT:
if (e->ies.format & session->capability) {
e->etype = IAX_EVENT_ACCEPT;
- }
- else {
+ } else {
struct iax_ie_data ied;
/* Although this should not happen, we added this to make sure
the negotiation protocol is enforced.
- For lack of event to notify the application we use the defined
- REJECT event.
+ For lack of event to notify the application we use the defined
+ REJECT event.
*/
memset(&ied, 0, sizeof(ied));
iax_ie_append_str(&ied, IAX_IE_CAUSE, (unsigned char *) "Unable to negotiate codec");
@@ -2779,15 +2660,15 @@
* apparent transfer address
*/
if (e->ies.apparent_addr != NULL) {
- /* so a full voice frame is sent on the
- next voice output */
- session->svoiceformat = -1;
- session->transfer = *e->ies.apparent_addr;
- session->transfer.sin_family = AF_INET;
- session->transfercallno = e->ies.callno;
- session->transferring = TRANSFER_BEGIN;
- session->transferid = e->ies.transferid;
- iax_send_txcnt(session);
+ /* so a full voice frame is sent on the
+ next voice output */
+ session->svoiceformat = -1;
+ session->transfer = *e->ies.apparent_addr;
+ session->transfer.sin_family = AF_INET;
+ session->transfercallno = e->ies.callno;
+ session->transferring = TRANSFER_BEGIN;
+ session->transferid = e->ies.transferid;
+ iax_send_txcnt(session);
}
free(e);
e = NULL;
@@ -2798,7 +2679,7 @@
/* Return immediately, makes no sense to schedule */
break;
case IAX_COMMAND_TXCNT:
- if (session->transferring) {
+ if (session->transferring) {
session->transfer = *sin;
iax_send_txaccept(session);
}
@@ -2816,11 +2697,10 @@
break;
case IAX_COMMAND_TXREL:
/* Release the transfer */
- send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, fh->ts, NULL, 0, fh->iseqno);
+ send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, fh->ts, NULL, 0, fh->iseqno);
if (session->transferring) {
complete_transfer(session, e->ies.callno, 1, 0);
- }
- else {
+ } else {
complete_transfer(session, session->peercallno, 0, 1);
}
e->etype = IAX_EVENT_TRANSFER;
@@ -2844,8 +2724,7 @@
send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
if (iax_handle_txready(session)) {
e->etype = IAX_EVENT_TXREADY;
- }
- else {
+ } else {
free(e);
e = NULL;
}
@@ -2857,7 +2736,7 @@
}
break;
case AST_FRAME_CONTROL:
- switch(subclass) {
+ switch (subclass) {
case AST_CONTROL_ANSWER:
e->etype = IAX_EVENT_ANSWER;
e = schedule_delivery(e, ts, updatehistory);
@@ -2895,7 +2774,7 @@
break;
case AST_FRAME_HTML:
- switch(fh->csub) {
+ switch (fh->csub) {
case AST_HTML_LINKURL:
e->etype = IAX_EVENT_LINKURL;
/* Fall through */
@@ -2934,22 +2813,19 @@
}
} else
DEBU(G "Out of memory\n");
-
+
/* Already ack'd iax frames */
if (session->aseqno != session->iseqno) {
- send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
+ send_command_immediate(session, AST_FRAME_IAX, IAX_COMMAND_ACK, ts, NULL, 0, fh->iseqno);
}
return e;
}
-static struct iax_event *iax_miniheader_to_event(struct iax_session *session,
- struct ast_iax2_mini_hdr *mh,
- int datalen)
-{
+static struct iax_event *iax_miniheader_to_event(struct iax_session *session, struct ast_iax2_mini_hdr *mh, int datalen) {
struct iax_event *e;
time_in_ms_t ts;
int updatehistory = 1;
- e = (struct iax_event *)malloc(sizeof(struct iax_event) + datalen);
+ e = (struct iax_event *) malloc(sizeof(struct iax_event) + datalen);
if (e) {
if (session->voiceformat > 0) {
e->etype = IAX_EVENT_VOICE;
@@ -2974,15 +2850,13 @@
return e;
}
-void iax_destroy(struct iax_session *session)
-{
- iax_mutex_lock(session_mutex);
+void iax_destroy(struct iax_session *session) {
+ iax_mutex_lock(session_mutex);
destroy_session(session);
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
}
-static struct iax_event *iax_net_read(void)
-{
+static struct iax_event *iax_net_read(void) {
unsigned char buf[65536];
int res;
#ifndef __Linux__
@@ -2993,7 +2867,7 @@
struct sockaddr_in sin;
sinlen = sizeof(sin);
- res = iax_recvfrom(netfd, (char *)buf, sizeof(buf), 0, (struct sockaddr *) &sin, &sinlen);
+ res = iax_recvfrom(netfd, (char *) buf, sizeof(buf), 0, (struct sockaddr *) &sin, &sinlen);
if (res < 0) {
#ifdef WIN32
@@ -3012,48 +2886,44 @@
return iax_net_process(buf, res, &sin);
}
-static struct iax_session *iax_txcnt_session(struct ast_iax2_full_hdr *fh, int datalen,
- struct sockaddr_in *sin, short callno, short dcallno)
-{
+static struct iax_session *iax_txcnt_session(struct ast_iax2_full_hdr *fh, int datalen, struct sockaddr_in *sin, short callno, short dcallno) {
int subclass = uncompress_subclass(fh->csub);
- unsigned char buf[ 65536 ]; /* allocated on stack with same size as iax_net_read() */
+ unsigned char buf[65536]; /* allocated on stack with same size as iax_net_read() */
struct iax_ies ies;
struct iax_session *cur;
if ((fh->type != AST_FRAME_IAX) || (subclass != IAX_COMMAND_TXCNT) || (!datalen)) {
- return NULL; /* special handling for TXCNT only */
+ return NULL; /* special handling for TXCNT only */
}
memcpy(buf, fh->iedata, datalen); /* prepare local buf for iax_parse_ies() */
if (iax_parse_ies(&ies, buf, datalen)) {
- return NULL; /* Unable to parse IE's */
+ return NULL; /* Unable to parse IE's */
}
if (!ies.transferid) {
- return NULL; /* TXCNT without proper IAX_IE_TRANSFERID */
+ return NULL; /* TXCNT without proper IAX_IE_TRANSFERID */
}
- iax_mutex_lock(session_mutex);
- for( cur=sessions; cur; cur=cur->next ) {
- if ((cur->transferring) && (cur->transferid == (int)ies.transferid) &&
- (cur->callno == dcallno) && (cur->transfercallno == callno)) {
+ iax_mutex_lock(session_mutex);
+ for (cur = sessions; cur; cur = cur->next) {
+ if ((cur->transferring) && (cur->transferid == (int) ies.transferid) && (cur->callno == dcallno) && (cur->transfercallno == callno)) {
/* We're transferring ---
- * skip address/port checking which would fail while remote peer behind symmetric NAT
- * verify transferid instead
+ * skip address/port checking which would fail while remote peer behind symmetric NAT
+ * verify transferid instead
*/
cur->transfer.sin_addr.s_addr = sin->sin_addr.s_addr; /* setup for further handling */
cur->transfer.sin_port = sin->sin_port;
- break;
+ break;
}
}
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
return cur;
}
-struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin)
-{
- struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *)buf;
- struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *)buf;
+struct iax_event *iax_net_process(unsigned char *buf, int len, struct sockaddr_in *sin) {
+ struct ast_iax2_full_hdr *fh = (struct ast_iax2_full_hdr *) buf;
+ struct ast_iax2_mini_hdr *mh = (struct ast_iax2_mini_hdr *) buf;
struct iax_session *session;
-
+
if (ntohs(fh->scallno) & IAX_FLAG_FULL) {
int subclass = uncompress_subclass(fh->csub);
int makenew = 0;
@@ -3066,17 +2936,17 @@
}
/* Only allow it to make new sessions on types where that makes sense */
if ((fh->type == AST_FRAME_IAX) && ((subclass == IAX_COMMAND_NEW) ||
- (subclass == IAX_COMMAND_POKE) ||
- (subclass == IAX_COMMAND_REGREL) ||
- (subclass == IAX_COMMAND_REGREQ))) {
+ (subclass == IAX_COMMAND_POKE) || (subclass == IAX_COMMAND_REGREL) || (subclass == IAX_COMMAND_REGREQ))) {
makenew = 1;
}
/* We have a full header, process appropriately */
session = iax_find_session(sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, makenew);
if (!session)
- session = iax_txcnt_session(fh, len-sizeof(struct ast_iax2_full_hdr), sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS);
- if (session)
+ session =
+ iax_txcnt_session(fh, len - sizeof(struct ast_iax2_full_hdr), sin, ntohs(fh->scallno) & ~IAX_FLAG_FULL,
+ ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS);
+ if (session)
return iax_header_to_event(session, fh, len - sizeof(struct ast_iax2_full_hdr), sin);
/* if we get here, the frame was invalid for some reason, we should probably send IAX_COMMAND_INVAL (as long as the subclass was not already IAX_COMMAND_INVAL) */
DEBU(G "No session?\n");
@@ -3096,13 +2966,12 @@
}
}
-static struct iax_sched *iax_get_sched(time_in_ms_t time_in_ms)
-{
- struct iax_sched *cur, *prev=NULL;
+static struct iax_sched *iax_get_sched(time_in_ms_t time_in_ms) {
+ struct iax_sched *cur, *prev = NULL;
iax_mutex_lock(sched_mutex);
cur = schedq;
/* Check the event schedule first. */
- while(cur) {
+ while (cur) {
if (time_in_ms > cur->when) {
/* Take it out of the event queue */
if (prev) {
@@ -3119,20 +2988,19 @@
return NULL;
}
-struct iax_event *iax_get_event(int blocking)
-{
+struct iax_event *iax_get_event(int blocking) {
struct iax_event *event;
struct iax_frame *frame;
time_in_ms_t time_in_ms;
struct iax_sched *cur;
-
+
if (do_shutdown) {
__iax_shutdown();
do_shutdown = 0;
return NULL;
}
time_in_ms = current_time_in_ms();
- while((cur = iax_get_sched(time_in_ms))) {
+ while ((cur = iax_get_sched(time_in_ms))) {
event = cur->event;
frame = cur->frame;
@@ -3144,15 +3012,15 @@
free(cur);
return event;
}
- } else if(frame) {
+ } else if (frame) {
/* It's a frame, transmit it and schedule a retry */
if (frame->retries < 0) {
/* It's been acked. No need to send it. Destroy the old
frame. If final, destroy the session. */
if (frame->final) {
- iax_mutex_lock(session_mutex);
+ iax_mutex_lock(session_mutex);
destroy_session(frame->session);
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
}
if (frame->data)
free(frame->data);
@@ -3170,14 +3038,14 @@
/* We haven't been able to get an ACK on this packet. If a
final frame, destroy the session, otherwise, pass up timeout */
if (frame->final) {
- iax_mutex_lock(session_mutex);
+ iax_mutex_lock(session_mutex);
destroy_session(frame->session);
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
if (frame->data)
free(frame->data);
free(frame);
} else {
- event = (struct iax_event *)malloc(sizeof(struct iax_event));
+ event = (struct iax_event *) malloc(sizeof(struct iax_event));
if (event) {
event->etype = IAX_EVENT_TIMEOUT;
event->session = frame->session;
@@ -3201,7 +3069,7 @@
frame->retrytime = MAX_RETRY_TIME;
} else if (frame->retrytime > 1000)
frame->retrytime = 1000;
- fh = (struct ast_iax2_full_hdr *)(frame->data);
+ fh = (struct ast_iax2_full_hdr *) (frame->data);
fh->dcallno = htons(IAX_FLAG_RETRANS | frame->dcallno);
iax_xmit_frame(frame);
/* Schedule another retransmission */
@@ -3209,7 +3077,7 @@
iax_sched_add(NULL, frame, NULL, NULL, frame->retrytime);
}
} else if (cur->func) {
- cur->func(cur->arg);
+ cur->func(cur->arg);
}
free(cur);
}
@@ -3217,20 +3085,20 @@
#ifdef NEWJB
/* get jitterbuffer-scheduled events */
{
- struct iax_session *cur;
- jb_frame frame;
- iax_mutex_lock(session_mutex);
- for(cur=sessions; cur; cur=cur->next) {
+ struct iax_session *cur;
+ jb_frame frame;
+ iax_mutex_lock(session_mutex);
+ for (cur = sessions; cur; cur = cur->next) {
int ret;
time_in_ms_t now;
time_in_ms_t next;
now = time_in_ms - cur->rxcore;
- if(now > (next = jb_next(cur->jb))) {
- ret = jb_get(cur->jb,&frame,now,get_interp_len(cur->voiceformat));
- switch(ret) {
+ if (now > (next = jb_next(cur->jb))) {
+ ret = jb_get(cur->jb, &frame, now, get_interp_len(cur->voiceformat));
+ switch (ret) {
case JB_OK:
- // if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+ // if(frame.type == JB_TYPE_VOICE && next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
event = frame.data;
event = handle_event(event);
if (event) {
@@ -3239,25 +3107,25 @@
}
break;
case JB_INTERP:
- // if(next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
+ // if(next + 20 != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not %ld+20!\n", jb_next(cur->jb), next);
/* create an interpolation frame */
//fprintf(stderr, "Making Interpolation frame\n");
- event = (struct iax_event *)malloc(sizeof(struct iax_event));
+ event = (struct iax_event *) malloc(sizeof(struct iax_event));
if (event) {
- event->etype = IAX_EVENT_VOICE;
+ event->etype = IAX_EVENT_VOICE;
event->subclass = cur->voiceformat;
- event->ts = now; /* XXX: ??? applications probably ignore this anyway */
- event->session = cur;
- event->datalen = 0;
+ event->ts = now; /* XXX: ??? applications probably ignore this anyway */
+ event->session = cur;
+ event->datalen = 0;
event = handle_event(event);
- if(event) {
+ if (event) {
iax_mutex_unlock(session_mutex);
return event;
}
}
break;
case JB_DROP:
- // if(next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
+ // if(next != jb_next(cur->jb)) fprintf(stderr, "NEXT %ld is not next %ld!\n", jb_next(cur->jb), next);
iax_event_free(frame.data);
break;
case JB_NOFRAME:
@@ -3269,7 +3137,7 @@
break;
}
}
- }
+ }
iax_mutex_unlock(session_mutex);
}
@@ -3279,97 +3147,89 @@
/* Block until there is data if desired */
fd_set fds;
time_in_ms_t nextEventTime;
-
+
FD_ZERO(&fds);
FD_SET(netfd, &fds);
- nextEventTime = iax_time_to_next_event();
- if(nextEventTime < 0 && blocking > 1) {
+ nextEventTime = iax_time_to_next_event();
+ if (nextEventTime < 0 && blocking > 1) {
nextEventTime = blocking;
}
- if(nextEventTime < 0)
+ if (nextEventTime < 0)
select(netfd + 1, &fds, NULL, NULL, NULL);
- else
- {
- struct timeval nextEvent;
+ else {
+ struct timeval nextEvent;
- nextEvent.tv_sec = (long)(nextEventTime / 1000);
- nextEvent.tv_usec = (long)((nextEventTime % 1000) * 1000);
+ nextEvent.tv_sec = (long) (nextEventTime / 1000);
+ nextEvent.tv_usec = (long) ((nextEventTime % 1000) * 1000);
- select(netfd + 1, &fds, NULL, NULL, &nextEvent);
- }
+ select(netfd + 1, &fds, NULL, NULL, &nextEvent);
+ }
}
event = iax_net_read();
-
+
return handle_event(event);
}
-struct sockaddr_in iax_get_peer_addr(struct iax_session *session)
-{
+struct sockaddr_in iax_get_peer_addr(struct iax_session *session) {
return session->peeraddr;
}
-char *iax_get_peer_ip(struct iax_session *session)
-{
+char *iax_get_peer_ip(struct iax_session *session) {
return inet_ntoa(session->peeraddr.sin_addr);
}
-char *iax_event_get_apparent_ip(struct iax_event *event)
-{
+char *iax_event_get_apparent_ip(struct iax_event *event) {
return inet_ntoa(event->ies.apparent_addr->sin_addr);
}
-void iax_session_destroy(struct iax_session **session)
-{
- iax_mutex_lock(session_mutex);
+void iax_session_destroy(struct iax_session **session) {
+ iax_mutex_lock(session_mutex);
destroy_session(*session);
*session = NULL;
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
}
-void iax_event_free(struct iax_event *event)
-{
+void iax_event_free(struct iax_event *event) {
/*
We gave the user a chance to play with the session now we need to destroy it
if you are not calling this function on every event you read you are now going
to leak sessions as well as events!
- */
- switch(event->etype) {
+ */
+ switch (event->etype) {
case IAX_EVENT_REJECT:
case IAX_EVENT_HANGUP:
/* Destroy this session -- it's no longer valid */
- if (event->session) { /* maybe the user did it already */
- iax_mutex_lock(session_mutex);
+ if (event->session) { /* maybe the user did it already */
+ iax_mutex_lock(session_mutex);
destroy_session(event->session);
- iax_mutex_unlock(session_mutex);
+ iax_mutex_unlock(session_mutex);
}
break;
}
free(event);
}
-int iax_get_fd(void)
-{
+int iax_get_fd(void) {
/* Return our network file descriptor. The client can select on this (probably with other
things, or can add it to a network add sort of gtk_input_add for example */
return netfd;
}
-int iax_quelch_moh(struct iax_session *session, int MOH)
-{
-
- struct iax_ie_data ied; //IE Data Structure (Stuff To Send)
- memset(&ied, 0, sizeof(ied));
-
+int iax_quelch_moh(struct iax_session *session, int MOH) {
+
+ struct iax_ie_data ied; //IE Data Structure (Stuff To Send)
+ memset(&ied, 0, sizeof(ied));
+
// You can't quelch the quelched
if (session->quelch == 1)
return -1;
-
+
if (MOH) {
iax_ie_append(&ied, IAX_IE_MUSICONHOLD);
session->transfer_moh = 1;
}
-
+
return send_command(session, AST_FRAME_IAX, IAX_COMMAND_QUELCH, 0, ied.buf, ied.pos, -1);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax2-parser.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax2-parser.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax2-parser.c Tue May 27 07:24:06 2008
@@ -40,12 +40,12 @@
#ifdef ALIGN32
static unsigned int get_uint32(unsigned char *p)
{
- return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
static unsigned short get_uint16(unsigned char *p)
{
- return (p[0] << 8) | p[1] ;
+ return (p[0] << 8) | p[1];
}
#else
@@ -64,8 +64,8 @@
fprintf(stderr, "WARNING: %s", str);
}
-static void (*outputf)(const char *str) = internaloutput;
-static void (*errorf)(const char *str) = internalerror;
+static void (*outputf) (const char *str) = internaloutput;
+static void (*errorf) (const char *str) = internalerror;
static void dump_addr(char *output, int maxlen, void *value, int len)
{
@@ -83,21 +83,21 @@
maxlen--;
if (maxlen > len)
maxlen = len;
- strncpy(output,value, maxlen);
+ strncpy(output, value, maxlen);
output[maxlen] = '\0';
}
static void dump_int(char *output, int maxlen, void *value, int len)
{
- if (len == (int)sizeof(unsigned int))
- snprintf(output, maxlen, "%lu", (unsigned long)ntohl(get_uint32(value)));
+ if (len == (int) sizeof(unsigned int))
+ snprintf(output, maxlen, "%lu", (unsigned long) ntohl(get_uint32(value)));
else
snprintf(output, maxlen, "Invalid INT");
}
static void dump_short(char *output, int maxlen, void *value, int len)
{
- if (len == (int)sizeof(unsigned short))
+ if (len == (int) sizeof(unsigned short))
snprintf(output, maxlen, "%d", ntohs(get_uint16(value)));
else
snprintf(output, maxlen, "Invalid SHORT");
@@ -105,8 +105,8 @@
static void dump_byte(char *output, int maxlen, void *value, int len)
{
- if (len == (int)sizeof(unsigned char))
- snprintf(output, maxlen, "%d", *((unsigned char *)value));
+ if (len == (int) sizeof(unsigned char))
+ snprintf(output, maxlen, "%d", *((unsigned char *) value));
else
snprintf(output, maxlen, "Invalid BYTE");
}
@@ -115,7 +115,7 @@
static void dump_ipaddr(char *output, int maxlen, void *value, int len)
{
struct sockaddr_in sin;
- if (len == (int)sizeof(unsigned int)) {
+ if (len == (int) sizeof(unsigned int)) {
memcpy(&sin.sin_addr, value, len);
snprintf(output, maxlen, "%s", inet_ntoa(sin.sin_addr));
} else
@@ -124,9 +124,8 @@
static void dump_prov_flags(char *output, int maxlen, void *value, int len)
{
- if (len == (int)sizeof(unsigned int))
- snprintf(output, maxlen, "%lu (%s)", (unsigned long)ntohl(get_uint32(value)),
- "PROVISION_PARSING_NOT_IMPLEMENTED");
+ if (len == (int) sizeof(unsigned int))
+ snprintf(output, maxlen, "%lu (%s)", (unsigned long) ntohl(get_uint32(value)), "PROVISION_PARSING_NOT_IMPLEMENTED");
else
snprintf(output, maxlen, "Invalid INT");
}
@@ -134,10 +133,10 @@
static void dump_samprate(char *output, int maxlen, void *value, int len)
{
- char tmp[256]="";
+ char tmp[256] = "";
int sr;
- if (len == (int)sizeof(unsigned short)) {
- sr = ntohs(*((unsigned short *)value));
+ if (len == (int) sizeof(unsigned short)) {
+ sr = ntohs(*((unsigned short *) value));
if (sr & IAX_RATE_8KHZ)
strcat(tmp, ",8khz");
if (sr & IAX_RATE_11KHZ)
@@ -170,61 +169,61 @@
static struct iax2_ie {
int ie;
char *name;
- void (*dump)(char *output, int maxlen, void *value, int len);
+ void (*dump) (char *output, int maxlen, void *value, int len);
} ies[] = {
- { IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string },
- { IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string },
- { IAX_IE_CALLING_ANI, "ANI", dump_string },
- { IAX_IE_CALLING_NAME, "CALLING NAME", dump_string },
- { IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string },
- { IAX_IE_USERNAME, "USERNAME", dump_string },
- { IAX_IE_PASSWORD, "PASSWORD", dump_string },
- { IAX_IE_CAPABILITY, "CAPABILITY", dump_int },
- { IAX_IE_FORMAT, "FORMAT", dump_int },
- { IAX_IE_LANGUAGE, "LANGUAGE", dump_string },
- { IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string },
- { IAX_IE_VERSION, "VERSION", dump_short },
- { IAX_IE_ADSICPE, "ADSICPE", dump_short },
- { IAX_IE_DNID, "DNID", dump_string },
- { IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short },
- { IAX_IE_CHALLENGE, "CHALLENGE", dump_string },
- { IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string },
- { IAX_IE_RSA_RESULT, "RSA RESULT", dump_string },
- { IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr },
- { IAX_IE_REFRESH, "REFRESH", dump_short },
- { IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short },
- { IAX_IE_CALLNO, "CALL NUMBER", dump_short },
- { IAX_IE_CAUSE, "CAUSE", dump_string },
- { IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte },
- { IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short },
- { IAX_IE_AUTOANSWER, "AUTO ANSWER REQ" },
- { IAX_IE_TRANSFERID, "TRANSFER ID", dump_int },
- { IAX_IE_RDNIS, "REFERRING DNIS", dump_string },
- { IAX_IE_PROVISIONING, "PROVISIONING", dump_prov },
- { IAX_IE_AESPROVISIONING, "AES PROVISIONG" },
- { IAX_IE_DATETIME, "DATE TIME", dump_int },
- { IAX_IE_DEVICETYPE, "DEVICE TYPE", dump_string },
- { IAX_IE_SERVICEIDENT, "SERVICE IDENT", dump_string },
- { IAX_IE_FIRMWAREVER, "FIRMWARE VER", dump_short },
- { IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int },
- { IAX_IE_FWBLOCKDATA, "FW BLOCK DATA" },
- { IAX_IE_PROVVER, "PROVISIONG VER", dump_int },
- { IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte },
- { IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte },
- { IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short },
- { IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate },
- { IAX_IE_RR_JITTER, "RR_JITTER", dump_int },
- { IAX_IE_RR_LOSS, "RR_LOSS", dump_int },
- { IAX_IE_RR_PKTS, "RR_PKTS", dump_int },
- { IAX_IE_RR_DELAY, "RR_DELAY", dump_short },
- { IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int },
- { IAX_IE_RR_OOO, "RR_OOO", dump_int },
-};
+ {
+ IAX_IE_CALLED_NUMBER, "CALLED NUMBER", dump_string}, {
+ IAX_IE_CALLING_NUMBER, "CALLING NUMBER", dump_string}, {
+ IAX_IE_CALLING_ANI, "ANI", dump_string}, {
+ IAX_IE_CALLING_NAME, "CALLING NAME", dump_string}, {
+ IAX_IE_CALLED_CONTEXT, "CALLED CONTEXT", dump_string}, {
+ IAX_IE_USERNAME, "USERNAME", dump_string}, {
+ IAX_IE_PASSWORD, "PASSWORD", dump_string}, {
+ IAX_IE_CAPABILITY, "CAPABILITY", dump_int}, {
+ IAX_IE_FORMAT, "FORMAT", dump_int}, {
+ IAX_IE_LANGUAGE, "LANGUAGE", dump_string}, {
+ IAX_IE_CODEC_PREFS, "CODEC_PREFS", dump_string}, {
+ IAX_IE_VERSION, "VERSION", dump_short}, {
+ IAX_IE_ADSICPE, "ADSICPE", dump_short}, {
+ IAX_IE_DNID, "DNID", dump_string}, {
+ IAX_IE_AUTHMETHODS, "AUTHMETHODS", dump_short}, {
+ IAX_IE_CHALLENGE, "CHALLENGE", dump_string}, {
+ IAX_IE_MD5_RESULT, "MD5 RESULT", dump_string}, {
+ IAX_IE_RSA_RESULT, "RSA RESULT", dump_string}, {
+ IAX_IE_APPARENT_ADDR, "APPARENT ADDRESS", dump_addr}, {
+ IAX_IE_REFRESH, "REFRESH", dump_short}, {
+ IAX_IE_DPSTATUS, "DIALPLAN STATUS", dump_short}, {
+ IAX_IE_CALLNO, "CALL NUMBER", dump_short}, {
+ IAX_IE_CAUSE, "CAUSE", dump_string}, {
+ IAX_IE_IAX_UNKNOWN, "UNKNOWN IAX CMD", dump_byte}, {
+ IAX_IE_MSGCOUNT, "MESSAGE COUNT", dump_short}, {
+ IAX_IE_AUTOANSWER, "AUTO ANSWER REQ"}, {
+ IAX_IE_TRANSFERID, "TRANSFER ID", dump_int}, {
+ IAX_IE_RDNIS, "REFERRING DNIS", dump_string}, {
+ IAX_IE_PROVISIONING, "PROVISIONING", dump_prov}, {
+ IAX_IE_AESPROVISIONING, "AES PROVISIONG"}, {
+ IAX_IE_DATETIME, "DATE TIME", dump_int}, {
+ IAX_IE_DEVICETYPE, "DEVICE TYPE", dump_string}, {
+ IAX_IE_SERVICEIDENT, "SERVICE IDENT", dump_string}, {
+ IAX_IE_FIRMWAREVER, "FIRMWARE VER", dump_short}, {
+ IAX_IE_FWBLOCKDESC, "FW BLOCK DESC", dump_int}, {
+ IAX_IE_FWBLOCKDATA, "FW BLOCK DATA"}, {
+ IAX_IE_PROVVER, "PROVISIONG VER", dump_int}, {
+ IAX_IE_CALLINGPRES, "CALLING PRESNTN", dump_byte}, {
+ IAX_IE_CALLINGTON, "CALLING TYPEOFNUM", dump_byte}, {
+ IAX_IE_CALLINGTNS, "CALLING TRANSITNET", dump_short}, {
+ IAX_IE_SAMPLINGRATE, "SAMPLINGRATE", dump_samprate}, {
+ IAX_IE_RR_JITTER, "RR_JITTER", dump_int}, {
+ IAX_IE_RR_LOSS, "RR_LOSS", dump_int}, {
+ IAX_IE_RR_PKTS, "RR_PKTS", dump_int}, {
+ IAX_IE_RR_DELAY, "RR_DELAY", dump_short}, {
+ IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int}, {
+IAX_IE_RR_OOO, "RR_OOO", dump_int},};
const char *iax_ie2str(int ie)
{
int x;
- for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) {
+ for (x = 0; x < (int) sizeof(ies) / (int) sizeof(ies[0]); x++) {
if (ies[x].ie == ie)
return ies[x].name;
}
@@ -240,22 +239,25 @@
char tmp[256];
if (len < 2)
return;
- strcpy(output, "\n");
- maxlen -= (int)strlen(output); output += strlen(output);
- while(len > 2) {
+ strcpy(output, "\n");
+ maxlen -= (int) strlen(output);
+ output += strlen(output);
+ while (len > 2) {
ie = iedata[0];
ielen = iedata[1];
- if (ielen + 2> len) {
- snprintf(tmp, (int)sizeof(tmp), "Total Prov IE length of %d bytes exceeds remaining prov frame length of %d bytes\n", ielen + 2, len);
+ if (ielen + 2 > len) {
+ snprintf(tmp, (int) sizeof(tmp), "Total Prov IE length of %d bytes exceeds remaining prov frame length of %d bytes\n", ielen + 2, len);
strncpy(output, tmp, maxlen - 1);
- maxlen -= (int)strlen(output); output += strlen(output);
+ maxlen -= (int) strlen(output);
+ output += strlen(output);
return;
}
found = 0;
if (!found) {
- snprintf(tmp, (int)sizeof(tmp), " Unknown Prov IE %03d : Present\n", ie);
+ snprintf(tmp, (int) sizeof(tmp), " Unknown Prov IE %03d : Present\n", ie);
strncpy(output, tmp, maxlen - 1);
- maxlen -= (int)strlen(output); output += strlen(output);
+ maxlen -= (int) strlen(output);
+ output += strlen(output);
}
iedata += (2 + ielen);
len -= (2 + ielen);
@@ -272,34 +274,34 @@
char tmp[1024];
if (len < 2)
return;
- while(len > 2) {
+ while (len > 2) {
ie = iedata[0];
ielen = iedata[1];
- if (ielen + 2> len) {
- snprintf(tmp, (int)sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len);
+ if (ielen + 2 > len) {
+ snprintf(tmp, (int) sizeof(tmp), "Total IE length of %d bytes exceeds remaining frame length of %d bytes\n", ielen + 2, len);
outputf(tmp);
return;
}
found = 0;
- for (x=0;x<(int)sizeof(ies) / (int)sizeof(ies[0]); x++) {
+ for (x = 0; x < (int) sizeof(ies) / (int) sizeof(ies[0]); x++) {
if (ies[x].ie == ie) {
if (ies[x].dump) {
- ies[x].dump(interp, (int)sizeof(interp), iedata + 2, ielen);
- snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp);
+ ies[x].dump(interp, (int) sizeof(interp), iedata + 2, ielen);
+ snprintf(tmp, (int) sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp);
outputf(tmp);
} else {
if (ielen)
- snprintf(interp, (int)sizeof(interp), "%d bytes", ielen);
+ snprintf(interp, (int) sizeof(interp), "%d bytes", ielen);
else
strcpy(interp, "Present");
- snprintf(tmp, (int)sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp);
+ snprintf(tmp, (int) sizeof(tmp), " %-15.15s : %s\n", ies[x].name, interp);
outputf(tmp);
}
found++;
}
}
if (!found) {
- snprintf(tmp, (int)sizeof(tmp), " Unknown IE %03d : Present\n", ie);
+ snprintf(tmp, (int) sizeof(tmp), " Unknown IE %03d : Present\n", ie);
outputf(tmp);
}
iedata += (2 + ielen);
@@ -319,7 +321,8 @@
"NULL ",
"IAX ",
"TEXT ",
- "IMAGE " };
+ "IMAGE "
+ };
const char *iaxs[] = {
"(0?)",
"NEW ",
@@ -368,7 +371,8 @@
"ANSWER ",
"BUSY ",
"TKOFFHK ",
- "OFFHOOK" };
+ "OFFHOOK"
+ };
struct ast_iax2_full_hdr *fh;
char retries[20];
char class2[20];
@@ -379,7 +383,7 @@
if (f) {
fh = f->data;
- snprintf(retries, (int)sizeof(retries), "%03d", f->retries);
+ snprintf(retries, (int) sizeof(retries), "%03d", f->retries);
} else {
fh = fhi;
if (ntohs(fh->dcallno) & IAX_FLAG_RETRANS)
@@ -391,43 +395,41 @@
/* Don't mess with mini-frames */
return;
}
- if (fh->type > ((int)sizeof(frames)/(int)sizeof(char *)) - 1) {
- snprintf(class2, (int)sizeof(class2), "(%d?)", fh->type);
+ if (fh->type > ((int) sizeof(frames) / (int) sizeof(char *)) - 1) {
+ snprintf(class2, (int) sizeof(class2), "(%d?)", fh->type);
class = class2;
} else {
- class = frames[(int)fh->type];
+ class = frames[(int) fh->type];
}
if (fh->type == AST_FRAME_DTMF) {
sprintf(subclass2, "%c", fh->csub);
subclass = subclass2;
} else if (fh->type == AST_FRAME_IAX) {
- if (fh->csub >= (int)sizeof(iaxs)/(int)sizeof(iaxs[0])) {
- snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
+ if (fh->csub >= (int) sizeof(iaxs) / (int) sizeof(iaxs[0])) {
+ snprintf(subclass2, (int) sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2;
} else {
- subclass = iaxs[(int)fh->csub];
+ subclass = iaxs[(int) fh->csub];
}
} else if (fh->type == AST_FRAME_CONTROL) {
- if (fh->csub > (int)sizeof(cmds)/(int)sizeof(char *)) {
- snprintf(subclass2, (int)sizeof(subclass2), "(%d?)", fh->csub);
+ if (fh->csub > (int) sizeof(cmds) / (int) sizeof(char *)) {
+ snprintf(subclass2, (int) sizeof(subclass2), "(%d?)", fh->csub);
subclass = subclass2;
} else {
- subclass = cmds[(int)fh->csub];
+ subclass = cmds[(int) fh->csub];
}
} else {
- snprintf(subclass2, (int)sizeof(subclass2), "%d", fh->csub);
+ snprintf(subclass2, (int) sizeof(subclass2), "%d", fh->csub);
subclass = subclass2;
}
-snprintf(tmp, (int)sizeof(tmp),
-"%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n",
- (rx ? "Rx" : "Tx"),
- retries, fh->oseqno, fh->iseqno, class, subclass);
+ snprintf(tmp, (int) sizeof(tmp),
+ "%s-Frame Retry[%s] -- OSeqno: %3.3d ISeqno: %3.3d Type: %s Subclass: %s\n",
+ (rx ? "Rx" : "Tx"), retries, fh->oseqno, fh->iseqno, class, subclass);
outputf(tmp);
-snprintf(tmp, (int)sizeof(tmp),
-" Timestamp: %05lums SCall: %5.5d DCall: %5.5d [%s:%d]\n",
- (unsigned long)ntohl(fh->ts),
- ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS,
- inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
+ snprintf(tmp, (int) sizeof(tmp),
+ " Timestamp: %05lums SCall: %5.5d DCall: %5.5d [%s:%d]\n",
+ (unsigned long) ntohl(fh->ts),
+ ntohs(fh->scallno) & ~IAX_FLAG_FULL, ntohs(fh->dcallno) & ~IAX_FLAG_RETRANS, inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
outputf(tmp);
if (fh->type == AST_FRAME_IAX)
dump_ies(fh->iedata, datalen);
@@ -436,13 +438,14 @@
int iax_ie_append_raw(struct iax_ie_data *ied, unsigned char ie, const void *data, int datalen)
{
char tmp[256];
- if (datalen > ((int)sizeof(ied->buf) - ied->pos)) {
- snprintf(tmp, (int)sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen, (int)sizeof(ied->buf) - ied->pos);
+ if (datalen > ((int) sizeof(ied->buf) - ied->pos)) {
+ snprintf(tmp, (int) sizeof(tmp), "Out of space for ie '%s' (%d), need %d have %d\n", iax_ie2str(ie), ie, datalen,
+ (int) sizeof(ied->buf) - ied->pos);
errorf(tmp);
return -1;
}
ied->buf[ied->pos++] = ie;
- ied->buf[ied->pos++] = (unsigned char)datalen;
+ ied->buf[ied->pos++] = (unsigned char) datalen;
memcpy(ied->buf + ied->pos, data, datalen);
ied->pos += datalen;
return 0;
@@ -450,26 +453,26 @@
int iax_ie_append_addr(struct iax_ie_data *ied, unsigned char ie, struct sockaddr_in *sin)
{
- return iax_ie_append_raw(ied, ie, sin, (int)sizeof(struct sockaddr_in));
+ return iax_ie_append_raw(ied, ie, sin, (int) sizeof(struct sockaddr_in));
}
-int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
+int iax_ie_append_int(struct iax_ie_data *ied, unsigned char ie, unsigned int value)
{
unsigned int newval;
newval = htonl(value);
- return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
+ return iax_ie_append_raw(ied, ie, &newval, (int) sizeof(newval));
}
-int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value)
+int iax_ie_append_short(struct iax_ie_data *ied, unsigned char ie, unsigned short value)
{
unsigned short newval;
newval = htons(value);
- return iax_ie_append_raw(ied, ie, &newval, (int)sizeof(newval));
+ return iax_ie_append_raw(ied, ie, &newval, (int) sizeof(newval));
}
int iax_ie_append_str(struct iax_ie_data *ied, unsigned char ie, const unsigned char *str)
{
- return iax_ie_append_raw(ied, ie, str, (int)strlen((char *) str));
+ return iax_ie_append_raw(ied, ie, str, (int) strlen((char *) str));
}
int iax_ie_append_byte(struct iax_ie_data *ied, unsigned char ie, unsigned char dat)
@@ -477,17 +480,17 @@
return iax_ie_append_raw(ied, ie, &dat, 1);
}
-int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
+int iax_ie_append(struct iax_ie_data *ied, unsigned char ie)
{
return iax_ie_append_raw(ied, ie, NULL, 0);
}
-void iax_set_output(void (*func)(const char *))
+void iax_set_output(void (*func) (const char *))
{
outputf = func;
}
-void iax_set_error(void (*func)(const char *))
+void iax_set_error(void (*func) (const char *))
{
errorf = func;
}
@@ -498,21 +501,21 @@
int len;
int ie;
char tmp[256];
- memset(my_ies, 0, (int)sizeof(struct iax_ies));
+ memset(my_ies, 0, (int) sizeof(struct iax_ies));
my_ies->msgcount = -1;
my_ies->firmwarever = -1;
my_ies->calling_ton = -1;
my_ies->calling_tns = -1;
my_ies->calling_pres = -1;
my_ies->samprate = IAX_RATE_8KHZ;
- while(datalen >= 2) {
+ while (datalen >= 2) {
ie = data[0];
len = data[1];
if (len > datalen - 2) {
errorf("Information element length exceeds message size\n");
return -1;
}
- switch(ie) {
+ switch (ie) {
case IAX_IE_CALLED_NUMBER:
my_ies->called_number = (char *) data + 2;
break;
@@ -535,15 +538,15 @@
my_ies->password = (char *) data + 2;
break;
case IAX_IE_CAPABILITY:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting capability to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else
my_ies->capability = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FORMAT:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting format to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else
my_ies->format = ntohl(get_uint32(data + 2));
@@ -555,22 +558,22 @@
my_ies->codec_prefs = (char *) data + 2;
break;
case IAX_IE_VERSION:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting version to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting version to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->version = ntohs(get_uint16(data + 2));
break;
case IAX_IE_ADSICPE:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting adsicpe to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->adsicpe = ntohs(get_uint16(data + 2));
break;
case IAX_IE_SAMPLINGRATE:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting samplingrate to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->samprate = ntohs(get_uint16(data + 2));
@@ -582,8 +585,8 @@
my_ies->rdnis = (char *) data + 2;
break;
case IAX_IE_AUTHMETHODS:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting authmethods to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->authmethods = ntohs(get_uint16(data + 2));
@@ -598,25 +601,25 @@
my_ies->rsa_result = (char *) data + 2;
break;
case IAX_IE_APPARENT_ADDR:
- my_ies->apparent_addr = ((struct sockaddr_in *)(data + 2));
+ my_ies->apparent_addr = ((struct sockaddr_in *) (data + 2));
break;
case IAX_IE_REFRESH:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting refresh to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting refresh to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->refresh = ntohs(get_uint16(data + 2));
break;
case IAX_IE_DPSTATUS:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting dpstatus to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting dpstatus to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->dpstatus = ntohs(get_uint16(data + 2));
break;
case IAX_IE_CALLNO:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting callno to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting callno to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
my_ies->callno = ntohs(get_uint16(data + 2));
@@ -626,7 +629,7 @@
break;
case IAX_IE_CAUSECODE:
if (len != 1) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting causecode to be single byte but was %d\n", len);
+ snprintf(tmp, (int) sizeof(tmp), "Expecting causecode to be single byte but was %d\n", len);
errorf(tmp);
} else {
my_ies->causecode = data[2];
@@ -636,16 +639,16 @@
if (len == 1)
my_ies->iax_unknown = data[2];
else {
- snprintf(tmp, (int)sizeof(tmp), "Expected single byte Unknown command, but was %d long\n", len);
+ snprintf(tmp, (int) sizeof(tmp), "Expected single byte Unknown command, but was %d long\n", len);
errorf(tmp);
}
break;
case IAX_IE_MSGCOUNT:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting msgcount to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
- my_ies->msgcount = ntohs(get_uint16(data + 2));
+ my_ies->msgcount = ntohs(get_uint16(data + 2));
break;
case IAX_IE_AUTOANSWER:
my_ies->autoanswer = 1;
@@ -654,25 +657,25 @@
my_ies->musiconhold = 1;
break;
case IAX_IE_TRANSFERID:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting transferid to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else
my_ies->transferid = ntohl(get_uint32(data + 2));
break;
case IAX_IE_DATETIME:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting date/time to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else
my_ies->datetime = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FIRMWAREVER:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting firmwarever to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
- my_ies->firmwarever = ntohs(get_uint16(data + 2));
+ my_ies->firmwarever = ntohs(get_uint16(data + 2));
break;
case IAX_IE_DEVICETYPE:
my_ies->devicetype = (char *) data + 2;
@@ -681,19 +684,19 @@
my_ies->serviceident = (char *) data + 2;
break;
case IAX_IE_FWBLOCKDESC:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected block desc to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else
my_ies->fwdesc = ntohl(get_uint32(data + 2));
break;
case IAX_IE_FWBLOCKDATA:
my_ies->fwdata = data + 2;
- my_ies->fwdatalen = (unsigned char)len;
+ my_ies->fwdatalen = (unsigned char) len;
break;
case IAX_IE_PROVVER:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected provisioning version to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected provisioning version to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->provverpres = 1;
@@ -704,7 +707,7 @@
if (len == 1)
my_ies->calling_pres = data[2];
else {
- snprintf(tmp, (int)sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
+ snprintf(tmp, (int) sizeof(tmp), "Expected single byte callingpres, but was %d long\n", len);
errorf(tmp);
}
break;
@@ -712,67 +715,67 @@
if (len == 1)
my_ies->calling_ton = data[2];
else {
- snprintf(tmp, (int)sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
+ snprintf(tmp, (int) sizeof(tmp), "Expected single byte callington, but was %d long\n", len);
errorf(tmp);
}
break;
case IAX_IE_CALLINGTNS:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expecting callingtns to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else
- my_ies->calling_tns = ntohs(get_uint16(data + 2));
+ my_ies->calling_tns = ntohs(get_uint16(data + 2));
break;
case IAX_IE_RR_JITTER:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected jitter rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected jitter rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->rr_jitter = ntohl(get_uint32(data + 2));
}
break;
case IAX_IE_RR_LOSS:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->rr_loss = ntohl(get_uint32(data + 2));
}
break;
case IAX_IE_RR_PKTS:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->rr_pkts = ntohl(get_uint32(data + 2));
}
break;
case IAX_IE_RR_DELAY:
- if (len != (int)sizeof(unsigned short)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int)sizeof(unsigned short), len);
+ if (len != (int) sizeof(unsigned short)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected loss rr to be %d bytes long but was %d\n", (int) sizeof(unsigned short), len);
errorf(tmp);
} else {
my_ies->rr_delay = ntohs(get_uint16(data + 2));
}
break;
case IAX_IE_RR_DROPPED:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->rr_dropped = ntohl(get_uint32(data + 2));
}
break;
case IAX_IE_RR_OOO:
- if (len != (int)sizeof(unsigned int)) {
- snprintf(tmp, (int)sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int)sizeof(unsigned int), len);
+ if (len != (int) sizeof(unsigned int)) {
+ snprintf(tmp, (int) sizeof(tmp), "Expected packets rr to be %d bytes long but was %d\n", (int) sizeof(unsigned int), len);
errorf(tmp);
} else {
my_ies->rr_ooo = ntohl(get_uint32(data + 2));
}
break;
default:
- snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
+ snprintf(tmp, (int) sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
outputf(tmp);
}
/* Overwrite information element with 0, to null terminate previous portion */
@@ -793,20 +796,20 @@
{
fr->af.frametype = f->frametype;
fr->af.subclass = f->subclass;
- fr->af.mallocd = 0; /* Our frame is static relative to the container */
+ fr->af.mallocd = 0; /* Our frame is static relative to the container */
fr->af.datalen = f->datalen;
fr->af.samples = f->samples;
fr->af.offset = AST_FRIENDLY_OFFSET;
fr->af.src = f->src;
fr->af.data = fr->afdata;
- if (fr->af.datalen)
+ if (fr->af.datalen)
memcpy(fr->af.data, f->data, fr->af.datalen);
}
struct iax_frame *iax_frame_new(int direction, int datalen)
{
struct iax_frame *fr;
- fr = malloc((int)sizeof(struct iax_frame) + datalen);
+ fr = malloc((int) sizeof(struct iax_frame) + datalen);
if (fr) {
fr->direction = direction;
fr->retrans = -1;
@@ -835,6 +838,15 @@
frame_count--;
}
-int iax_get_frames(void) { return frame_count; }
-int iax_get_iframes(void) { return iframes; }
-int iax_get_oframes(void) { return oframes; }
+int iax_get_frames(void)
+{
+ return frame_count;
+}
+int iax_get_iframes(void)
+{
+ return iframes;
+}
+int iax_get_oframes(void)
+{
+ return oframes;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/jitterbuf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/jitterbuf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/jitterbuf.c Tue May 27 07:24:06 2008
@@ -32,9 +32,9 @@
#define jb_dbg if (dbgf) dbgf
#ifdef DEEP_DEBUG
- #define jb_dbg2 if (dbgf) dbgf
+#define jb_dbg2 if (dbgf) dbgf
#else
- #define jb_dbg2 if (0) dbgf
+#define jb_dbg2 if (0) dbgf
#endif
#else
@@ -60,17 +60,17 @@
dbgf = dbg;
}
-static void increment_losspct(jitterbuf *jb)
+static void increment_losspct(jitterbuf * jb)
{
- jb->info.losspct = (100000 + 499 * jb->info.losspct)/500;
+ jb->info.losspct = (100000 + 499 * jb->info.losspct) / 500;
}
-static void decrement_losspct(jitterbuf *jb)
+static void decrement_losspct(jitterbuf * jb)
{
- jb->info.losspct = (499 * jb->info.losspct)/500;
+ jb->info.losspct = (499 * jb->info.losspct) / 500;
}
-void jb_reset(jitterbuf *jb)
+void jb_reset(jitterbuf * jb)
{
/* only save settings */
jb_conf s = jb->info.conf;
@@ -82,11 +82,12 @@
jb->info.silence_begin_ts = -1;
}
-jitterbuf * jb_new()
+jitterbuf *jb_new()
{
- jitterbuf *jb = (jitterbuf *)malloc(sizeof(*jb));
+ jitterbuf *jb = (jitterbuf *) malloc(sizeof(*jb));
- if (!jb) return NULL;
+ if (!jb)
+ return NULL;
jb->info.conf.target_extra = JB_TARGET_EXTRA;
@@ -95,7 +96,7 @@
return jb;
}
-void jb_destroy(jitterbuf *jb)
+void jb_destroy(jitterbuf * jb)
{
jb_frame *frame;
@@ -116,7 +117,7 @@
#if 0
static int longcmp(const void *a, const void *b)
{
- return *(long *)a - *(long *)b;
+ return *(long *) a - *(long *) b;
}
#endif
@@ -124,7 +125,7 @@
/* maybe later we can make the history buckets variable size, or something? */
/* drop parameter determines whether we will drop outliers to minimize
* delay */
-static int history_put(jitterbuf *jb, time_in_ms_t ts, time_in_ms_t now)
+static int history_put(jitterbuf * jb, time_in_ms_t ts, time_in_ms_t now)
{
time_in_ms_t delay = now - (ts - jb->info.resync_offset);
time_in_ms_t threshold = 2 * jb->info.jitter + jb->info.conf.resync_threshold;
@@ -144,9 +145,10 @@
jb->hist_ptr = 0;
jb->hist_maxbuf_valid = 0;
- jb_warn("Resyncing the jb. last_delay %ld, this delay %ld, threshold %ld, new offset %ld\n", jb->info.last_delay, delay, threshold, ts - now);
+ jb_warn("Resyncing the jb. last_delay %ld, this delay %ld, threshold %ld, new offset %ld\n", jb->info.last_delay, delay, threshold,
+ ts - now);
jb->info.resync_offset = ts - now;
- jb->info.last_delay = delay = 0; /* after resync, frame is right on time */
+ jb->info.last_delay = delay = 0; /* after resync, frame is right on time */
} else {
return -1;
}
@@ -176,18 +178,18 @@
goto invalidate;
/* if the new delay would go into min */
- if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
+ if (delay < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1])
goto invalidate;
/* or max.. */
- if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
+ if (delay > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1])
goto invalidate;
/* or the kicked delay would be in min */
- if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1])
+ if (kicked <= jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1])
goto invalidate;
- if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1])
+ if (kicked >= jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1])
goto invalidate;
/* if we got here, we don't need to invalidate, 'cause this delay didn't
@@ -196,21 +198,21 @@
/* end optimization */
-invalidate:
+ invalidate:
jb->hist_maxbuf_valid = 0;
return 0;
}
-static void history_calc_maxbuf(jitterbuf *jb)
+static void history_calc_maxbuf(jitterbuf * jb)
{
- int i,j;
+ int i, j;
if (jb->hist_ptr == 0)
return;
/* initialize maxbuf/minbuf to the latest value */
- for (i=0;i<JB_HISTORY_MAXBUF_SZ;i++) {
+ for (i = 0; i < JB_HISTORY_MAXBUF_SZ; i++) {
/*
* jb->hist_maxbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ];
* jb->hist_minbuf[i] = jb->history[(jb->hist_ptr-1) % JB_HISTORY_SZ];
@@ -225,14 +227,14 @@
/* start at the beginning, or JB_HISTORY_SZ frames ago */
i = (jb->hist_ptr > JB_HISTORY_SZ) ? (jb->hist_ptr - JB_HISTORY_SZ) : 0;
- for (;i<jb->hist_ptr;i++) {
- time_in_ms_t toins = jb->history[i % JB_HISTORY_SZ];
+ for (; i < jb->hist_ptr; i++) {
+ time_in_ms_t toins = jb->history[i % JB_HISTORY_SZ];
/* if the maxbuf should get this */
- if (toins > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ-1]) {
+ if (toins > jb->hist_maxbuf[JB_HISTORY_MAXBUF_SZ - 1]) {
/* insertion-sort it into the maxbuf */
- for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
+ for (j = 0; j < JB_HISTORY_MAXBUF_SZ; j++) {
/* found where it fits */
if (toins > jb->hist_maxbuf[j]) {
/* move over */
@@ -246,10 +248,10 @@
}
/* if the minbuf should get this */
- if (toins < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ-1]) {
+ if (toins < jb->hist_minbuf[JB_HISTORY_MAXBUF_SZ - 1]) {
/* insertion-sort it into the maxbuf */
- for (j=0;j<JB_HISTORY_MAXBUF_SZ;j++) {
+ for (j = 0; j < JB_HISTORY_MAXBUF_SZ; j++) {
/* found where it fits */
if (toins < jb->hist_minbuf[j]) {
/* move over */
@@ -261,15 +263,14 @@
}
}
}
-
#if 0
int k;
fprintf(stderr, "toins = %ld\n", toins);
fprintf(stderr, "maxbuf =");
- for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
+ for (k = 0; k < JB_HISTORY_MAXBUF_SZ; k++)
fprintf(stderr, "%ld ", jb->hist_maxbuf[k]);
fprintf(stderr, "\nminbuf =");
- for (k=0;k<JB_HISTORY_MAXBUF_SZ;k++)
+ for (k = 0; k < JB_HISTORY_MAXBUF_SZ; k++)
fprintf(stderr, "%ld ", jb->hist_minbuf[k]);
fprintf(stderr, "\n");
#endif
@@ -278,9 +279,9 @@
jb->hist_maxbuf_valid = 1;
}
-static void history_get(jitterbuf *jb)
+static void history_get(jitterbuf * jb)
{
- time_in_ms_t max, min, jitter;
+ time_in_ms_t max, min, jitter;
int index;
int count;
@@ -312,16 +313,16 @@
/* these debug stmts compare the difference between looking at the absolute jitter, and the
* values we get by throwing away the outliers */
/*
- fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", index, min, max, jitter);
- fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", 0, jb->hist_minbuf[0], jb->hist_maxbuf[0], jb->hist_maxbuf[0]-jb->hist_minbuf[0]);
- */
+ fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", index, min, max, jitter);
+ fprintf(stderr, "[%d] min=%d, max=%d, jitter=%d\n", 0, jb->hist_minbuf[0], jb->hist_maxbuf[0], jb->hist_maxbuf[0]-jb->hist_minbuf[0]);
+ */
jb->info.min = min;
jb->info.jitter = jitter;
}
/* returns 1 if frame was inserted into head of queue, 0 otherwise */
-static int queue_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts)
+static int queue_put(jitterbuf * jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts)
{
jb_frame *frame = jb->free;
jb_frame *p;
@@ -331,7 +332,7 @@
if (frame) {
jb->free = frame->next;
} else {
- frame = (jb_frame *)malloc(sizeof(*frame));
+ frame = (jb_frame *) malloc(sizeof(*frame));
if (!frame) {
jb_err("cannot allocate frame\n");
return 0;
@@ -350,7 +351,7 @@
* jb->frames->prev points to the highest ts
*/
- if (!jb->frames) { /* queue is empty */
+ if (!jb->frames) { /* queue is empty */
jb->frames = frame;
frame->next = frame;
frame->prev = frame;
@@ -371,7 +372,8 @@
p = jb->frames;
/* frame is out of order */
- if (resync_ts < p->prev->ts) jb->info.frames_ooo++;
+ if (resync_ts < p->prev->ts)
+ jb->info.frames_ooo++;
while (resync_ts < p->prev->ts && p->prev != jb->frames)
p = p->prev;
@@ -385,7 +387,7 @@
return head;
}
-static time_in_ms_t queue_next(jitterbuf *jb)
+static time_in_ms_t queue_next(jitterbuf * jb)
{
if (jb->frames)
return jb->frames->ts;
@@ -393,7 +395,7 @@
return -1;
}
-static time_in_ms_t queue_last(jitterbuf *jb)
+static time_in_ms_t queue_last(jitterbuf * jb)
{
if (jb->frames)
return jb->frames->prev->ts;
@@ -401,7 +403,7 @@
return -1;
}
-static jb_frame *_queue_get(jitterbuf *jb, time_in_ms_t ts, int all)
+static jb_frame *_queue_get(jitterbuf * jb, time_in_ms_t ts, int all)
{
jb_frame *frame;
frame = jb->frames;
@@ -436,46 +438,41 @@
return NULL;
}
-static jb_frame *queue_get(jitterbuf *jb, time_in_ms_t ts)
+static jb_frame *queue_get(jitterbuf * jb, time_in_ms_t ts)
{
- return _queue_get(jb,ts,0);
+ return _queue_get(jb, ts, 0);
}
-static jb_frame *queue_getall(jitterbuf *jb)
+static jb_frame *queue_getall(jitterbuf * jb)
{
- return _queue_get(jb,0,1);
+ return _queue_get(jb, 0, 1);
}
#if 0
/* some diagnostics */
-static void jb_dbginfo(jitterbuf *jb)
+static void jb_dbginfo(jitterbuf * jb)
{
if (dbgf == NULL)
return;
jb_dbg("\njb info: fin=%ld fout=%ld flate=%ld flost=%ld fdrop=%ld fcur=%ld\n",
- jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
+ jb->info.frames_in, jb->info.frames_out, jb->info.frames_late, jb->info.frames_lost, jb->info.frames_dropped, jb->info.frames_cur);
jb_dbg("jitter=%ld current=%ld target=%ld min=%ld sil=%d len=%d len/fcur=%ld\n",
- jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
- jb->info.frames_cur ? (jb->info.current - jb->info.min)/jb->info.frames_cur : -8);
+ jb->info.jitter, jb->info.current, jb->info.target, jb->info.min, jb->info.silence_begin_ts, jb->info.current - jb->info.min,
+ jb->info.frames_cur ? (jb->info.current - jb->info.min) / jb->info.frames_cur : -8);
if (jb->info.frames_in > 0)
jb_dbg("jb info: Loss PCT = %ld%%, Late PCT = %ld%%\n",
- jb->info.frames_lost * 100/(jb->info.frames_in + jb->info.frames_lost),
- jb->info.frames_late * 100/jb->info.frames_in);
+ jb->info.frames_lost * 100 / (jb->info.frames_in + jb->info.frames_lost), jb->info.frames_late * 100 / jb->info.frames_in);
jb_dbg("jb info: queue %d -> %d. last_ts %d (queue len: %d) last_ms %d\n",
- queue_next(jb),
- queue_last(jb),
- jb->info.next_voice_ts,
- queue_last(jb) - queue_next(jb),
- jb->info.last_voice_ms);
+ queue_next(jb), queue_last(jb), jb->info.next_voice_ts, queue_last(jb) - queue_next(jb), jb->info.last_voice_ms);
}
#endif
#ifdef DEEP_DEBUG
-static void jb_chkqueue(jitterbuf *jb)
+static void jb_chkqueue(jitterbuf * jb)
{
- int i=0;
+ int i = 0;
jb_frame *p = jb->frames;
if (!p) {
@@ -483,17 +480,17 @@
}
do {
- if (p->next == NULL) {
+ if (p->next == NULL) {
jb_err("Queue is BROKEN at item [%d]", i);
}
i++;
- p=p->next;
+ p = p->next;
} while (p->next != jb->frames);
}
-static void jb_dbgqueue(jitterbuf *jb)
+static void jb_dbgqueue(jitterbuf * jb)
{
- int i=0;
+ int i = 0;
jb_frame *p = jb->frames;
jb_dbg("queue: ");
@@ -505,14 +502,14 @@
do {
jb_dbg("[%d]=%ld ", i++, p->ts);
- p=p->next;
+ p = p->next;
} while (p->next != jb->frames);
jb_dbg("\n");
}
#endif
-enum jb_return_code jb_put(jitterbuf *jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts, time_in_ms_t now)
+enum jb_return_code jb_put(jitterbuf * jb, void *data, const enum jb_frame_type type, long ms, time_in_ms_t ts, time_in_ms_t now)
{
jb->info.frames_in++;
@@ -522,12 +519,12 @@
* sending retransmitted control frames with their awkward
* timestamps through
*/
- if (history_put(jb,ts,now))
+ if (history_put(jb, ts, now))
return JB_DROP;
}
/* if put into head of queue, caller needs to reschedule */
- if (queue_put(jb,data,type,ms,ts)) {
+ if (queue_put(jb, data, type, ms, ts)) {
return JB_SCHED;
}
@@ -535,7 +532,7 @@
}
-static enum jb_return_code _jb_get(jitterbuf *jb, jb_frame *frameout, time_in_ms_t now, long interpl)
+static enum jb_return_code _jb_get(jitterbuf * jb, jb_frame * frameout, time_in_ms_t now, long interpl)
{
jb_frame *frame;
time_in_ms_t diff;
@@ -557,7 +554,7 @@
diff = jb->info.target - jb->info.current;
/* jb_warn("diff = %d lms=%d last = %d now = %d\n", diff, */
- /* jb->info.last_voice_ms, jb->info.last_adjustment, now); */
+ /* jb->info.last_voice_ms, jb->info.last_adjustment, now); */
/* let's work on non-silent case first */
if (!jb->info.silence_begin_ts) {
@@ -565,8 +562,8 @@
if ((diff > 0) &&
/* we haven't grown in the delay length */
(((jb->info.last_adjustment + JB_ADJUST_DELAY) < now) ||
- /* we need to grow more than the "length" we have left */
- (diff > queue_last(jb) - queue_next(jb)) ) ) {
+ /* we need to grow more than the "length" we have left */
+ (diff > queue_last(jb) - queue_next(jb)))) {
/* grow by interp frame length */
jb->info.current += interpl;
jb->info.next_voice_ts += interpl;
@@ -619,7 +616,7 @@
jb->info.frames_lost--;
jb_dbg("l");
/*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb));
- jb_warninfo(jb); */
+ jb_warninfo(jb); */
return JB_DROP;
}
}
@@ -633,9 +630,7 @@
/* unless we don't have a frame, then shrink 1 frame */
/* every 80ms (though perhaps we can shrink even faster */
/* in this case) */
- if (diff < -jb->info.conf.target_extra &&
- ((!frame && jb->info.last_adjustment + 80 < now) ||
- (jb->info.last_adjustment + 500 < now))) {
+ if (diff < -jb->info.conf.target_extra && ((!frame && jb->info.last_adjustment + 80 < now) || (jb->info.last_adjustment + 500 < now))) {
jb->info.last_adjustment = now;
jb->info.cnt_contig_interp = 0;
@@ -677,11 +672,11 @@
* lost frame get interpolated two or more times, when there was "room" to grow, so it might
* be a bit of a bad idea overall */
/*if (diff > -1 * jb->info.last_voice_ms) {
- jb->info.current += jb->info.last_voice_ms;
- jb->info.last_adjustment = now;
- jb_warn("g");
- return JB_INTERP;
- } */
+ jb->info.current += jb->info.last_voice_ms;
+ jb->info.last_adjustment = now;
+ jb_warn("g");
+ return JB_INTERP;
+ } */
jb->info.frames_lost++;
increment_losspct(jb);
jb->info.next_voice_ts += interpl;
@@ -712,8 +707,7 @@
/* jb->info.silence_begin_ts = 0; */
/* shrink interpl len every 10ms during silence */
- if (diff < -jb->info.conf.target_extra &&
- jb->info.last_adjustment + 10 <= now) {
+ if (diff < -jb->info.conf.target_extra && jb->info.last_adjustment + 10 <= now) {
jb->info.current -= interpl;
jb->info.last_adjustment = now;
}
@@ -736,7 +730,7 @@
jb->info.frames_lost--;
jb_dbg("l");
/*jb_warn("\nlate: wanted=%ld, this=%ld, next=%ld\n", jb->info.next_voice_ts - jb->info.current, frame->ts, queue_next(jb));
- jb_warninfo(jb); */
+ jb_warninfo(jb); */
return JB_DROP;
} else {
/* voice frame */
@@ -754,7 +748,7 @@
}
}
-time_in_ms_t jb_next(jitterbuf *jb)
+time_in_ms_t jb_next(jitterbuf * jb)
{
if (jb->info.silence_begin_ts) {
if (jb->frames) {
@@ -764,28 +758,28 @@
if (jb->info.target - jb->info.current < -jb->info.conf.target_extra)
return jb->info.last_adjustment + 10;
return next + jb->info.target;
- }
- else
+ } else
return JB_LONGMAX;
} else {
return jb->info.next_voice_ts;
}
}
-enum jb_return_code jb_get(jitterbuf *jb, jb_frame *frameout, time_in_ms_t now, long interpl)
+enum jb_return_code jb_get(jitterbuf * jb, jb_frame * frameout, time_in_ms_t now, long interpl)
{
enum jb_return_code ret = _jb_get(jb, frameout, now, interpl);
#if 0
- static int lastts=0;
+ static int lastts = 0;
int thists = ((ret == JB_OK) || (ret == JB_DROP)) ? frameout->ts : 0;
jb_warn("jb_get(%x,%x,%ld) = %d (%d)\n", jb, frameout, now, ret, thists);
- if (thists && thists < lastts) jb_warn("XXXX timestamp roll-back!!!\n");
+ if (thists && thists < lastts)
+ jb_warn("XXXX timestamp roll-back!!!\n");
lastts = thists;
#endif
return ret;
}
-enum jb_return_code jb_getall(jitterbuf *jb, jb_frame *frameout)
+enum jb_return_code jb_getall(jitterbuf * jb, jb_frame * frameout)
{
jb_frame *frame;
frame = queue_getall(jb);
@@ -799,7 +793,7 @@
}
-enum jb_return_code jb_getinfo(jitterbuf *jb, jb_info *stats)
+enum jb_return_code jb_getinfo(jitterbuf * jb, jb_info * stats)
{
history_get(jb);
@@ -808,7 +802,7 @@
return JB_OK;
}
-enum jb_return_code jb_setconf(jitterbuf *jb, jb_conf *conf)
+enum jb_return_code jb_setconf(jitterbuf * jb, jb_conf * conf)
{
/* take selected settings from the struct */
@@ -817,10 +811,8 @@
jb->info.conf.max_contig_interp = conf->max_contig_interp;
/* -1 indicates use of the default JB_TARGET_EXTRA value */
- jb->info.conf.target_extra = ( conf->target_extra == -1 )
- ? JB_TARGET_EXTRA
- : conf->target_extra
- ;
+ jb->info.conf.target_extra = (conf->target_extra == -1)
+ ? JB_TARGET_EXTRA : conf->target_extra;
/* update these to match new target_extra setting */
jb->info.current = jb->info.conf.target_extra;
@@ -828,5 +820,3 @@
return JB_OK;
}
-
-
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/md5.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/md5.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/md5.c Tue May 27 07:24:06 2008
@@ -3,13 +3,13 @@
#ifdef FREEBSD
# include <machine/endian.h>
-#elif defined(LINUX)
+#elif defined(LINUX)
# include <endian.h>
# include <features.h>
# include <sys/types.h>
#elif defined(SOLARIS)
/* each solaris is different -- this won't work on 2.6 or 2.7 */
-# include <sys/isa_defs.h> /* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */
+# include <sys/isa_defs.h> /* Defines either _LITTLE_ENDIAN or _BIG_ENDIAN */
# define __BIG_ENDIAN 4321
# define __LITTLE_ENDIAN 1234
# define BIG_ENDIAN 4321
@@ -59,7 +59,7 @@
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*/
-#include <string.h> /* for memcpy() */
+#include <string.h> /* for memcpy() */
#include "md5.h"
#ifndef HIGHFIRST
@@ -73,13 +73,12 @@
*/
void byteReverse(unsigned char *buf, unsigned longs)
{
- uint32 t;
- do {
- t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
- ((unsigned) buf[1] << 8 | buf[0]);
- *(uint32 *) buf = t;
- buf += 4;
- } while (--longs);
+ uint32 t;
+ do {
+ t = (uint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]);
+ *(uint32 *) buf = t;
+ buf += 4;
+ } while (--longs);
}
#endif
#endif
@@ -90,13 +89,13 @@
*/
void MD5Init(struct MD5Context *ctx)
{
- ctx->buf[0] = 0x67452301;
- ctx->buf[1] = 0xefcdab89;
- ctx->buf[2] = 0x98badcfe;
- ctx->buf[3] = 0x10325476;
+ ctx->buf[0] = 0x67452301;
+ ctx->buf[1] = 0xefcdab89;
+ ctx->buf[2] = 0x98badcfe;
+ ctx->buf[3] = 0x10325476;
- ctx->bits[0] = 0;
- ctx->bits[1] = 0;
+ ctx->bits[0] = 0;
+ ctx->bits[1] = 0;
}
/*
@@ -105,46 +104,46 @@
*/
void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
{
- uint32 t;
+ uint32 t;
- /* Update bitcount */
+ /* Update bitcount */
- t = ctx->bits[0];
- if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
- ctx->bits[1]++; /* Carry from low to high */
- ctx->bits[1] += len >> 29;
-
- t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
-
- /* Handle any leading odd-sized chunks */
-
- if (t) {
- unsigned char *p = (unsigned char *) ctx->in + t;
+ t = ctx->bits[0];
+ if ((ctx->bits[0] = t + ((uint32) len << 3)) < t)
+ ctx->bits[1]++; /* Carry from low to high */
+ ctx->bits[1] += len >> 29;
+
+ t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
+
+ /* Handle any leading odd-sized chunks */
+
+ if (t) {
+ unsigned char *p = (unsigned char *) ctx->in + t;
+
+ t = 64 - t;
+ if (len < t) {
+ memcpy(p, buf, len);
+ return;
+ }
+ memcpy(p, buf, t);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ buf += t;
+ len -= t;
+ }
+ /* Process data in 64-byte chunks */
- t = 64 - t;
- if (len < t) {
- memcpy(p, buf, len);
- return;
+ while (len >= 64) {
+ memcpy(ctx->in, buf, 64);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ buf += 64;
+ len -= 64;
}
- memcpy(p, buf, t);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += t;
- len -= t;
- }
- /* Process data in 64-byte chunks */
-
- while (len >= 64) {
- memcpy(ctx->in, buf, 64);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- buf += 64;
- len -= 64;
- }
- /* Handle any remaining bytes of data. */
+ /* Handle any remaining bytes of data. */
- memcpy(ctx->in, buf, len);
+ memcpy(ctx->in, buf, len);
}
/*
@@ -153,43 +152,43 @@
*/
void MD5Final(unsigned char digest[16], struct MD5Context *ctx)
{
- unsigned count;
- unsigned char *p;
+ unsigned count;
+ unsigned char *p;
- /* Compute number of bytes mod 64 */
- count = (ctx->bits[0] >> 3) & 0x3F;
+ /* Compute number of bytes mod 64 */
+ count = (ctx->bits[0] >> 3) & 0x3F;
- /* Set the first char of padding to 0x80. This is safe since there is
- always at least one byte free */
- p = ctx->in + count;
- *p++ = 0x80;
-
- /* Bytes of padding needed to make 64 bytes */
- count = 64 - 1 - count;
-
- /* Pad out to 56 mod 64 */
- if (count < 8) {
- /* Two lots of padding: Pad the first block to 64 bytes */
- memset(p, 0, count);
- byteReverse(ctx->in, 16);
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ /* Set the first char of padding to 0x80. This is safe since there is
+ always at least one byte free */
+ p = ctx->in + count;
+ *p++ = 0x80;
+
+ /* Bytes of padding needed to make 64 bytes */
+ count = 64 - 1 - count;
+
+ /* Pad out to 56 mod 64 */
+ if (count < 8) {
+ /* Two lots of padding: Pad the first block to 64 bytes */
+ memset(p, 0, count);
+ byteReverse(ctx->in, 16);
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+
+ /* Now fill the next block with 56 bytes */
+ memset(ctx->in, 0, 56);
+ } else {
+ /* Pad block to 56 bytes */
+ memset(p, 0, count - 8);
+ }
+ byteReverse(ctx->in, 14);
- /* Now fill the next block with 56 bytes */
- memset(ctx->in, 0, 56);
- } else {
- /* Pad block to 56 bytes */
- memset(p, 0, count - 8);
- }
- byteReverse(ctx->in, 14);
-
- /* Append length in bits and transform */
- ((uint32 *) ctx->in)[14] = ctx->bits[0];
- ((uint32 *) ctx->in)[15] = ctx->bits[1];
-
- MD5Transform(ctx->buf, (uint32 *) ctx->in);
- byteReverse((unsigned char *) ctx->buf, 4);
- memcpy(digest, ctx->buf, 16);
- memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
+ /* Append length in bits and transform */
+ ((uint32 *) ctx->in)[14] = ctx->bits[0];
+ ((uint32 *) ctx->in)[15] = ctx->bits[1];
+
+ MD5Transform(ctx->buf, (uint32 *) ctx->in);
+ byteReverse((unsigned char *) ctx->buf, 4);
+ memcpy(digest, ctx->buf, 16);
+ memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
@@ -213,85 +212,85 @@
*/
void MD5Transform(uint32 buf[4], uint32 const in[16])
{
- register uint32 a, b, c, d;
+ register uint32 a, b, c, d;
- a = buf[0];
- b = buf[1];
- c = buf[2];
- d = buf[3];
-
- MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
- MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
- MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
- MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
- MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
- MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
- MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
- MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
- MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
- MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
- MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
- MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
- MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
- MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
- MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
- MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-
- MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
- MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
- MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
- MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
- MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
- MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
- MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
- MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
- MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
- MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
- MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
- MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
- MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
- MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
- MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
- MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-
- MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
- MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
- MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
- MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
- MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
- MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
- MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
- MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
- MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
- MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
- MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
- MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
- MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
- MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
- MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
- MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-
- MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
- MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
- MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
- MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
- MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
- MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
- MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
- MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
- MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
- MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
- MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
- MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
- MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
- MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
- MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
- MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-
- buf[0] += a;
- buf[1] += b;
- buf[2] += c;
- buf[3] += d;
+ a = buf[0];
+ b = buf[1];
+ c = buf[2];
+ d = buf[3];
+
+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
+
+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
+
+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
+
+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
+
+ buf[0] += a;
+ buf[1] += b;
+ buf[2] += c;
+ buf[3] += d;
}
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c Tue May 27 07:24:06 2008
@@ -110,14 +110,14 @@
static char *IAXNAMES[] = { "IAX_EVENT_CONNECT", "IAX_EVENT_ACCEPT", "IAX_EVENT_HANGUP", "IAX_EVENT_REJECT", "IAX_EVENT_VOICE",
- "IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
- "IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
- "IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
- "IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
- "IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
- "IAX_EVENT_UNLINK", "IAX_EVENT_LINKREJECT", "IAX_EVENT_TEXT", "IAX_EVENT_REGREJ",
- "IAX_EVENT_LINKURL", "IAX_EVENT_CNG", "IAX_EVENT_REREQUEST", "IAX_EVENT_TXREPLY",
- "IAX_EVENT_TXREJECT", "IAX_EVENT_TXACCEPT", "IAX_EVENT_TXREADY"
+ "IAX_EVENT_DTMF", "IAX_EVENT_TIMEOUT", "IAX_EVENT_LAGRQ", "IAX_EVENT_LAGRP", "IAX_EVENT_RINGA",
+ "IAX_EVENT_PING", "IAX_EVENT_PONG", "IAX_EVENT_BUSY", "IAX_EVENT_ANSWER", "IAX_EVENT_IMAGE",
+ "IAX_EVENT_AUTHRQ", "IAX_EVENT_AUTHRP", "IAX_EVENT_REGREQ", "IAX_EVENT_REGACK",
+ "IAX_EVENT_URL", "IAX_EVENT_LDCOMPLETE", "IAX_EVENT_TRANSFER", "IAX_EVENT_DPREQ",
+ "IAX_EVENT_DPREP", "IAX_EVENT_DIAL", "IAX_EVENT_QUELCH", "IAX_EVENT_UNQUELCH",
+ "IAX_EVENT_UNLINK", "IAX_EVENT_LINKREJECT", "IAX_EVENT_TEXT", "IAX_EVENT_REGREJ",
+ "IAX_EVENT_LINKURL", "IAX_EVENT_CNG", "IAX_EVENT_REREQUEST", "IAX_EVENT_TXREPLY",
+ "IAX_EVENT_TXREJECT", "IAX_EVENT_TXACCEPT", "IAX_EVENT_TXREADY"
};
@@ -129,24 +129,24 @@
//999 means it's wrong nad i dont know the real one
static struct ast_iana AST_IANA[] = { {AST_FORMAT_G723_1, 4, "g723.1"},
- {AST_FORMAT_GSM, 3, "gsm"},
- {AST_FORMAT_ULAW, 0, "ulaw"},
- {AST_FORMAT_ALAW, 8, "alaw"},
- {AST_FORMAT_G726, 999, "g726"},
- {AST_FORMAT_ADPCM, 999, "adpcm"},
- {AST_FORMAT_SLINEAR, 10, "slinear"},
- {AST_FORMAT_LPC10, 7, "lpc10"},
- {AST_FORMAT_G729A, 18, "g729"},
- {AST_FORMAT_SPEEX, 97, "speex"},
- {AST_FORMAT_SPEEX, 98, "speex"},
- {AST_FORMAT_ILBC, 102, "ilbc"},
- {AST_FORMAT_MAX_AUDIO, 999, ""},
- {AST_FORMAT_JPEG, 999, ""},
- {AST_FORMAT_PNG, 999, ""},
- {AST_FORMAT_H261, 999, ""},
- {AST_FORMAT_H263, 999, ""},
- {AST_FORMAT_MAX_VIDEO, 999, ""},
- {0, 0}
+{AST_FORMAT_GSM, 3, "gsm"},
+{AST_FORMAT_ULAW, 0, "ulaw"},
+{AST_FORMAT_ALAW, 8, "alaw"},
+{AST_FORMAT_G726, 999, "g726"},
+{AST_FORMAT_ADPCM, 999, "adpcm"},
+{AST_FORMAT_SLINEAR, 10, "slinear"},
+{AST_FORMAT_LPC10, 7, "lpc10"},
+{AST_FORMAT_G729A, 18, "g729"},
+{AST_FORMAT_SPEEX, 97, "speex"},
+{AST_FORMAT_SPEEX, 98, "speex"},
+{AST_FORMAT_ILBC, 102, "ilbc"},
+{AST_FORMAT_MAX_AUDIO, 999, ""},
+{AST_FORMAT_JPEG, 999, ""},
+{AST_FORMAT_PNG, 999, ""},
+{AST_FORMAT_H261, 999, ""},
+{AST_FORMAT_H263, 999, ""},
+{AST_FORMAT_MAX_VIDEO, 999, ""},
+{0, 0}
};
static char *ast2str(int ast)
@@ -214,7 +214,7 @@
IAX_QUERY = 2
} iax_io_t;
-static switch_status_t iax_set_codec(private_t * tech_pvt, struct iax_session *iax_session,
+static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *iax_session,
unsigned int *format, unsigned int *cababilities, unsigned short *samprate, iax_io_t io)
{
char *dname = NULL;
@@ -281,8 +281,8 @@
char pref_str[256] = "(";
for (x = 0; x < len; x++) {
- strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str)-1);
- strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str)-1);
+ strncat(pref_str, ast2str(prefs[x]), sizeof(pref_str) - 1);
+ strncat(pref_str, x == len - 1 ? ")" : ",", sizeof(pref_str) - 1);
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Codec Prefs Detected: %s\n", pref_str);
@@ -439,7 +439,7 @@
}
}
-static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
+static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
{
tech_pvt->read_frame.data = tech_pvt->databuf;
tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
@@ -619,7 +619,7 @@
return SWITCH_STATUS_FALSE;
- cng:
+ cng:
data = (switch_byte_t *) tech_pvt->read_frame.data;
data[0] = 65;
data[1] = 0;
@@ -791,7 +791,7 @@
/*.write_frame */ channel_write_frame,
/*.kill_channel */ channel_kill_channel,
/*.send_dtmf */ channel_send_dtmf,
- /*.receive_message*/ channel_receive_message,
+ /*.receive_message */ channel_receive_message,
/*.receive_event */ channel_receive_event
};
@@ -867,7 +867,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t tech_media(private_t * tech_pvt, struct iax_event *iaxevent)
+static switch_status_t tech_media(private_t *tech_pvt, struct iax_event *iaxevent)
{
unsigned int cap = iax_session_get_capability(iaxevent->session);
unsigned int format = iaxevent->ies.format;
@@ -1025,8 +1025,7 @@
NULL,
NULL,
modname,
- iaxevent->ies.called_context,
- iaxevent->ies.called_number)) != 0) {
+ iaxevent->ies.called_context, iaxevent->ies.called_number)) != 0) {
char name[128];
switch_snprintf(name, sizeof(name), "IAX/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
@@ -1062,7 +1061,7 @@
switch_clear_flag(tech_pvt, TFLAG_VOICE);
switch_mutex_unlock(tech_pvt->flag_mutex);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n", switch_channel_get_name(channel));
switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
switch_channel_hangup(channel, iaxevent->etype == IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING : SWITCH_CAUSE_FACILITY_REJECTED);
@@ -1102,7 +1101,7 @@
break;
case IAX_EVENT_DTMF:
if (channel) {
- switch_dtmf_t dtmf = { (char) iaxevent->subclass , switch_core_default_dtmf_duration(0) };
+ switch_dtmf_t dtmf = { (char) iaxevent->subclass, switch_core_default_dtmf_duration(0) };
if (globals.debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%c DTMF %s\n", dtmf.digit, switch_channel_get_name(channel));
}
@@ -1118,7 +1117,7 @@
break;
}
iax_event_free(iaxevent);
- switch_mutex_unlock(globals.mutex);
+ switch_mutex_unlock(globals.mutex);
if (tech_pvt && tech_pvt->session) {
switch_core_session_signal_unlock(tech_pvt->session);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c Tue May 27 07:24:06 2008
@@ -136,8 +136,8 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_timer_name, globals.timer_name);
#define is_master(t) switch_test_flag(t, TFLAG_MASTER)
-static void add_pvt(private_t * tech_pvt, int master);
-static void remove_pvt(private_t * tech_pvt);
+static void add_pvt(private_t *tech_pvt, int master);
+static void remove_pvt(private_t *tech_pvt);
static switch_status_t channel_on_init(switch_core_session_t *session);
static switch_status_t channel_on_hangup(switch_core_session_t *session);
static switch_status_t channel_on_routing(switch_core_session_t *session);
@@ -234,7 +234,7 @@
while (switch_channel_get_state(channel) == CS_INIT && !switch_test_flag(tech_pvt, TFLAG_ANSWER)) {
switch_size_t olen = globals.timer.samples;
-
+
if (switch_timestamp_now() - last >= waitsec) {
char buf[512];
switch_event_t *event;
@@ -250,7 +250,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", buf);
last = switch_timestamp_now();
}
-
+
if (ring_file) {
if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
switch_core_file_close(&fh);
@@ -324,7 +324,7 @@
-static void add_pvt(private_t * tech_pvt, int master)
+static void add_pvt(private_t *tech_pvt, int master)
{
private_t *tp;
uint8_t in_list = 0;
@@ -367,7 +367,7 @@
switch_mutex_unlock(globals.pvt_lock);
}
-static void remove_pvt(private_t * tech_pvt)
+static void remove_pvt(private_t *tech_pvt)
{
private_t *tp, *last = NULL;
@@ -485,8 +485,7 @@
tech_pvt->hold_file,
globals.read_codec.implementation->number_of_channels,
globals.read_codec.implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
tech_pvt->hold_file = NULL;
goto cng;
}
@@ -500,12 +499,12 @@
goto hold;
}
- cng:
+ cng:
switch_yield(globals.read_codec.implementation->microseconds_per_frame);
*frame = &globals.cng_frame;
return SWITCH_STATUS_SUCCESS;
- hold:
+ hold:
{
switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
if (switch_core_timer_next(&globals.timer) != SWITCH_STATUS_SUCCESS) {
@@ -531,13 +530,12 @@
switch_mutex_lock(globals.device_lock);
- get_samples:
+ get_samples:
- if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
- globals.read_codec.implementation->samples_per_frame,
- &globals.timer)) == 0) {
- switch_yield(1000);
- goto get_samples;
+ if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
+ globals.read_codec.implementation->samples_per_frame, &globals.timer)) == 0) {
+ switch_yield(1000);
+ goto get_samples;
} else {
globals.read_frame.datalen = samples * 2;
globals.read_frame.samples = samples;
@@ -576,8 +574,7 @@
if (globals.audio_stream) {
if (switch_test_flag((&globals), GFLAG_EAR)) {
- WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)),
- &globals.timer);
+ WriteAudioStream(globals.audio_stream, (short *) frame->data, (int) (frame->datalen / sizeof(SAMPLE)), &globals.timer);
}
status = SWITCH_STATUS_SUCCESS;
}
@@ -667,7 +664,7 @@
if (outbound_profile->destination_number && !strcasecmp(outbound_profile->destination_number, "auto_answer")) {
switch_set_flag(tech_pvt, TFLAG_ANSWER);
}
-
+
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
switch_core_session_destroy(new_session);
@@ -775,7 +772,7 @@
globals.codec_ms = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
+ "codec-ms must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
} else if (!strcmp(var, "dialplan")) {
set_global_dialplan(val);
@@ -936,7 +933,8 @@
int i, printCount, cr = 7;
PaError err;
static double standardSampleRates[] = { 8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0,
- 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1};
+ 44100.0, 48000.0, 88200.0, 96000.0, 192000.0, -1
+ };
printCount = cr;
for (i = 0; standardSampleRates[i] > 0; i++) {
@@ -1077,7 +1075,7 @@
return 0;
- error:
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "An error occured while using the portaudio stream\n");
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error number: %d\n", err);
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Error message: %s\n", Pa_GetErrorText(err));
@@ -1140,7 +1138,7 @@
outputParameters.sampleFormat = SAMPLE_TYPE;
outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
- err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
+ err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
globals.read_codec.implementation->samples_per_frame);
/* UNLOCKED ************************************************************************************************* */
switch_mutex_unlock(globals.device_lock);
@@ -1174,8 +1172,7 @@
outputParameters.sampleFormat = SAMPLE_TYPE;
outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
- err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff,
- globals.read_codec.implementation->samples_per_frame);
+ err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_frame);
/* UNLOCKED ************************************************************************************************* */
switch_mutex_unlock(globals.device_lock);
@@ -1192,8 +1189,8 @@
static switch_status_t dtmf_call(char **argv, int argc, switch_stream_handle_t *stream)
{
char *dtmf_str = argv[0];
- switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
-
+ switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
+
if (switch_strlen_zero(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
@@ -1201,7 +1198,7 @@
if (globals.call_list) {
switch_channel_t *channel = switch_core_session_get_channel(globals.call_list->session);
char *p = dtmf_str;
- while(p && *p) {
+ while (p && *p) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
@@ -1253,7 +1250,7 @@
stream->write_function(stream, "NO SUCH CALL\n");
}
- done:
+ done:
switch_mutex_unlock(globals.pvt_lock);
return SWITCH_STATUS_SUCCESS;
@@ -1317,7 +1314,7 @@
break;
}
}
- done:
+ done:
switch_mutex_unlock(globals.pvt_lock);
stream->write_function(stream, "Answered %d channels.\n", x);
@@ -1368,7 +1365,7 @@
goto bad;
}
- desc:
+ desc:
x = 0;
stream->write_function(stream, "FLAGS: ");
if (switch_test_flag((&globals), GFLAG_EAR)) {
@@ -1385,9 +1382,9 @@
goto done;
- bad:
+ bad:
stream->write_function(stream, "Usage: flags [on|off] <flags>\n");
- done:
+ done:
return SWITCH_STATUS_SUCCESS;
}
@@ -1474,20 +1471,18 @@
if (!switch_strlen_zero(argv[4])) {
tech_pvt->sample_rate = atoi(argv[4]);
}
-
+
if (!switch_strlen_zero(argv[5])) {
tech_pvt->codec_ms = atoi(argv[5]);
}
-
+
switch_find_local_ip(ip, sizeof(ip), AF_INET);
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL, dialplan, cid_name, cid_num,
- ip, NULL, NULL, NULL, modname, NULL,
- dest)) != 0) {
+ NULL, dialplan, cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, dest)) != 0) {
char name[128];
switch_snprintf(name, sizeof(name), "PortAudio/%s",
- tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
+ tech_pvt->caller_profile->destination_number ? tech_pvt->caller_profile->destination_number : modname);
switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
@@ -1498,7 +1493,7 @@
switch_channel_mark_answered(channel);
switch_channel_set_state(channel, CS_INIT);
if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
switch_core_session_destroy(&session);
stream->write_function(stream, "FAIL:Thread Error!\n");
} else {
@@ -1674,7 +1669,7 @@
}
}
- done:
+ done:
if (http) {
stream->write_function(stream,
"<br><br><table align=center><tr><td><center><form method=post>\n"
@@ -1691,25 +1686,18 @@
"<td><input name=action type=submit value=\"2\"></td>"
"<td><input name=action type=submit value=\"3\"></td>\n"
"<td><input name=action type=submit value=\"A\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"4\"></td>"
"<td><input name=action type=submit value=\"5\"></td>"
"<td><input name=action type=submit value=\"6\"></td>\n"
"<td><input name=action type=submit value=\"B\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"7\"></td>"
"<td><input name=action type=submit value=\"8\"></td>"
"<td><input name=action type=submit value=\"9\"></td>\n"
"<td><input name=action type=submit value=\"C\"></td></tr>\n"
-
"<tr><td><input name=action type=submit value=\"*\"></td>"
"<td><input name=action type=submit value=\"0\"></td>"
"<td><input name=action type=submit value=\"#\"></td>\n"
- "<td><input name=action type=submit value=\"D\"></td></tr>\n"
- "</table>"
-
- "</form><br></center></td></tr></table>\n"
- );
+ "<td><input name=action type=submit value=\"D\"></td></tr>\n" "</table>" "</form><br></center></td></tr></table>\n");
}
switch_safe_free(mycmd);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/pablio.c Tue May 27 07:24:06 2008
@@ -72,7 +72,7 @@
{
PABLIO_Stream *data = (PABLIO_Stream *) userData;
long numBytes = data->bytesPerFrame * framesPerBuffer;
-
+
/* This may get called with NULL inputBuffer during initial setup. */
if (inputBuffer != NULL) {
if (PaUtil_WriteRingBuffer(&data->inFIFO, inputBuffer, numBytes) != numBytes) {
@@ -146,26 +146,26 @@
long bytesRead = 0;
char *p = (char *) data;
long avail, totalBytes = 0, neededBytes = aStream->bytesPerFrame * numFrames;
-
- for(;;) {
+
+ for (;;) {
avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
-
+
if (switch_core_timer_check(timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
break;
}
-
- if (avail >= neededBytes * 6) {
+
+ if (avail >= neededBytes * 6) {
PaUtil_FlushRingBuffer(&aStream->inFIFO);
avail = 0;
}
-
+
bytesRead = 0;
if (totalBytes < neededBytes && avail >= neededBytes) {
bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
totalBytes += bytesRead;
}
-
+
if (bytesRead) {
p += bytesRead;
} else {
@@ -201,7 +201,7 @@
{
long numBits = 0;
if (((n - 1) & n) == 0)
- return n;
+ return n;
while (n > 0) {
n = n >> 1;
numBits++;
@@ -217,11 +217,8 @@
*
*/
PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
- const PaStreamParameters *inputParameters,
- const PaStreamParameters *outputParameters,
- double sampleRate,
- PaStreamFlags streamFlags,
- long samples_per_frame)
+ const PaStreamParameters * inputParameters,
+ const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags, long samples_per_frame)
{
long bytesPerSample = 2;
PaError err;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c Tue May 27 07:24:06 2008
@@ -34,7 +34,7 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_reference_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_reference_shutdown);
//SWITCH_MODULE_RUNTIME_FUNCTION(mod_reference_runtime);
-SWITCH_MODULE_DEFINITION(mod_reference, mod_reference_load, mod_reference_shutdown, NULL);//mod_reference_runtime);
+SWITCH_MODULE_DEFINITION(mod_reference, mod_reference_load, mod_reference_shutdown, NULL); //mod_reference_runtime);
switch_endpoint_interface_t *reference_endpoint_interface;
@@ -112,7 +112,7 @@
-static void tech_init(private_t * tech_pvt, switch_core_session_t *session)
+static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
{
tech_pvt->read_frame.data = tech_pvt->databuf;
tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
@@ -140,9 +140,9 @@
switch_set_flag_locked(tech_pvt, TFLAG_IO);
/* Move channel's state machine to ROUTING. This means the call is trying
- to get from the initial start where the call because, to the point
- where a destination has been identified. If the channel is simply
- left in the initial state, nothing will happen. */
+ to get from the initial start where the call because, to the point
+ where a destination has been identified. If the channel is simply
+ left in the initial state, nothing will happen. */
switch_channel_set_state(channel, CS_ROUTING);
switch_mutex_lock(globals.mutex);
globals.calls++;
@@ -315,7 +315,7 @@
return SWITCH_STATUS_FALSE;
- cng:
+ cng:
data = (switch_byte_t *) tech_pvt->read_frame.data;
data[0] = 65;
data[1] = 0;
@@ -346,7 +346,7 @@
switch_swap_linear(frame->data, (int) frame->datalen / 2);
}
#endif
-
+
return SWITCH_STATUS_SUCCESS;
@@ -363,7 +363,7 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -375,7 +375,7 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = (private_t *) switch_core_session_get_private(session);
assert(tech_pvt != NULL);
@@ -471,7 +471,7 @@
/*.write_frame */ channel_write_frame,
/*.kill_channel */ channel_kill_channel,
/*.send_dtmf */ channel_send_dtmf,
- /*.receive_message*/ channel_receive_message,
+ /*.receive_message */ channel_receive_message,
/*.receive_event */ channel_receive_event
};
@@ -531,7 +531,7 @@
{
module_pool = pool;
-
+
load_config();
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
@@ -540,7 +540,7 @@
reference_endpoint_interface->io_routines = &reference_io_routines;
reference_endpoint_interface->state_handler = &reference_state_handlers;
-
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c Tue May 27 07:24:06 2008
@@ -98,14 +98,14 @@
if (sofia_glue_do_invite(session) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- assert( switch_channel_get_state(channel) != CS_INIT);
+ assert(switch_channel_get_state(channel) != CS_INIT);
return SWITCH_STATUS_FALSE;
}
}
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
- assert( switch_channel_get_state(channel) != CS_INIT);
+ assert(switch_channel_get_state(channel) != CS_INIT);
return SWITCH_STATUS_SUCCESS;
}
@@ -115,7 +115,7 @@
switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
return SWITCH_STATUS_SUCCESS;
@@ -128,7 +128,7 @@
switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
return SWITCH_STATUS_SUCCESS;
@@ -141,7 +141,7 @@
switch_assert(tech_pvt != NULL);
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
return SWITCH_STATUS_SUCCESS;
@@ -160,7 +160,7 @@
/* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
static int hangup_cause_to_sip(switch_call_cause_t cause)
-{
+{
switch (cause) {
case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET:
case SWITCH_CAUSE_NO_ROUTE_DESTINATION:
@@ -223,11 +223,11 @@
switch_call_cause_t cause = switch_channel_get_cause(channel);
int sip_cause = hangup_cause_to_sip(cause);
const char *ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
-
+
if (!switch_strlen_zero(ps_cause) && !strncasecmp(ps_cause, "sip:", 4)) {
int new_cause = atoi(ps_cause + 4);
if (new_cause) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
switch_channel_get_name(channel), sip_cause, new_cause);
sip_cause = new_cause;
}
@@ -262,7 +262,7 @@
sofia_glue_deactivate_rtp(tech_pvt);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Channel %s hanging up, cause: %s\n",
- switch_channel_get_name(channel), switch_channel_cause2str(cause));
+ switch_channel_get_name(channel), switch_channel_cause2str(cause));
if (tech_pvt->hash_key) {
switch_core_hash_delete(tech_pvt->profile->chat_hash, tech_pvt->hash_key);
@@ -282,7 +282,7 @@
switch_mutex_lock(tech_pvt->profile->flag_mutex);
- if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
+ if (tech_pvt->nh && !switch_test_flag(tech_pvt, TFLAG_BYE)) {
char reason[128] = "";
if (cause > 1 && cause < 128) {
switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
@@ -291,7 +291,7 @@
} else {
switch_snprintf(reason, sizeof(reason), "FreeSWITCH;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
}
-
+
if (switch_test_flag(tech_pvt, TFLAG_ANS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
nua_bye(tech_pvt->nh, SIPTAG_REASON_STR(reason), TAG_END());
@@ -349,7 +349,7 @@
b_sdp = switch_channel_get_variable(channel, SWITCH_B_SDP_VARIABLE);
is_proxy = (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA));
-
+
if (b_sdp && is_proxy) {
tech_pvt->local_sdp_str = switch_core_session_strdup(session, b_sdp);
@@ -373,7 +373,7 @@
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
tech_pvt->num_codecs = 0;
sofia_glue_tech_prepare_codecs(tech_pvt);
-
+
if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
//nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
@@ -394,8 +394,7 @@
if (tech_pvt->nh) {
if (tech_pvt->local_sdp_str) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel),
- tech_pvt->local_sdp_str);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str);
}
}
}
@@ -406,16 +405,16 @@
session_timeout = v_session_timeout;
}
}
-
+
if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
- (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
+ (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
-
+
nua_respond(tech_pvt->nh, SIP_200_OK,
NUTAG_AUTOANSWER(0),
@@ -423,11 +422,7 @@
NUTAG_SESSION_TIMER(session_timeout),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
- SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_AUDIO_AUX("cn telephone-event"),
- NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_END());
+ SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
return SWITCH_STATUS_SUCCESS;
}
@@ -474,7 +469,7 @@
}
return status;
}
-
+
payload = tech_pvt->video_read_frame.payload;
if (tech_pvt->video_read_frame.datalen > 0) {
@@ -524,13 +519,13 @@
if (!switch_test_flag(frame, SFF_CNG)) {
switch_rtp_write_frame(tech_pvt->video_rtp_session, frame);
}
-
+
return status;
}
static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
{
- private_object_t *tech_pvt = switch_core_session_get_private(session);
+ private_object_t *tech_pvt = switch_core_session_get_private(session);
switch_channel_t *channel = switch_core_session_get_channel(session);
int payload = 0;
@@ -558,7 +553,7 @@
if (switch_test_flag(tech_pvt, TFLAG_IO)) {
switch_status_t status;
-
+
if (!switch_test_flag(tech_pvt, TFLAG_RTP)) {
return SWITCH_STATUS_GENERR;
}
@@ -570,22 +565,22 @@
tech_pvt->read_frame.flags = SFF_NONE;
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags);
-
+
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
if (status == SWITCH_STATUS_TIMEOUT) {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
}
return status;
}
-
+
payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf);
switch_channel_queue_dtmf(channel, &dtmf);
}
-
+
if (tech_pvt->read_frame.datalen > 0) {
size_t bytes = 0;
int frames = 1;
@@ -712,10 +707,7 @@
case DTMF_INFO:
snprintf(message, sizeof(message), "Signal=%c\r\nDuration=%d\r\n", dtmf->digit, dtmf->duration / 8);
- nua_info(tech_pvt->nh,
- SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"),
- SIPTAG_PAYLOAD_STR(message),
- TAG_END());
+ nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/dtmf-relay"), SIPTAG_PAYLOAD_STR(message), TAG_END());
break;
default:
break;
@@ -750,18 +742,11 @@
" <media_control>\r\n"
" <vc_primitive>\r\n"
" <to_encoder>\r\n"
- " <picture_fast_update>\r\n"
- " </picture_fast_update>\r\n"
- " </to_encoder>\r\n"
- " </vc_primitive>\r\n"
- " </media_control>\r\n";
-
- nua_info(tech_pvt->nh,
- SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"),
- SIPTAG_PAYLOAD_STR(pl),
- TAG_END());
+ " <picture_fast_update>\r\n" " </picture_fast_update>\r\n" " </to_encoder>\r\n" " </vc_primitive>\r\n" " </media_control>\r\n";
+
+ nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
+
-
}
break;
case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
@@ -770,31 +755,27 @@
switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
}
break;
- case SWITCH_MESSAGE_INDICATE_BROADCAST: {
- const char *ip = NULL, *port = NULL;
- ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
- port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
- if (ip && port) {
- sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
- }
- nua_respond(tech_pvt->nh, SIP_200_OK,
- SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
- SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
- SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_AUDIO_AUX("cn telephone-event"),
- NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_END());
- switch_channel_mark_answered(channel);
- }
+ case SWITCH_MESSAGE_INDICATE_BROADCAST:{
+ const char *ip = NULL, *port = NULL;
+ ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
+ port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
+ if (ip && port) {
+ sofia_glue_set_local_sdp(tech_pvt, ip, atoi(port), msg->string_arg, 1);
+ }
+ nua_respond(tech_pvt->nh, SIP_200_OK,
+ SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+ SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+ SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+ switch_channel_mark_answered(channel);
+ }
break;
- case SWITCH_MESSAGE_INDICATE_NOMEDIA:
+ case SWITCH_MESSAGE_INDICATE_NOMEDIA:
{
const char *uuid;
switch_core_session_t *other_session;
switch_channel_t *other_channel;
const char *ip = NULL, *port = NULL;
-
+
switch_channel_set_flag(channel, CF_PROXY_MODE);
tech_pvt->local_sdp_str = NULL;
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
@@ -826,14 +807,14 @@
case SWITCH_MESSAGE_INDICATE_MEDIA:
{
uint32_t send_invite = 1;
-
+
switch_channel_clear_flag(channel, CF_PROXY_MODE);
tech_pvt->local_sdp_str = NULL;
if (!switch_channel_media_ready(channel)) {
if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
-
+
tech_pvt->num_codecs = 0;
sofia_glue_tech_prepare_codecs(tech_pvt);
if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
@@ -882,7 +863,7 @@
}
}
break;
-
+
case SWITCH_MESSAGE_INDICATE_UNHOLD:
{
switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
@@ -890,7 +871,7 @@
}
break;
case SWITCH_MESSAGE_INDICATE_BRIDGE:
-
+
if (switch_test_flag(tech_pvt, TFLAG_XFER)) {
switch_clear_flag_locked(tech_pvt, TFLAG_XFER);
if (msg->pointer_arg) {
@@ -918,19 +899,19 @@
}
}
/*
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
- switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
- }
- */
+ if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
+ switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
+ }
+ */
break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
/*
- if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
- switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
- }
- */
+ if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_TIMER)) {
+ switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
+ }
+ */
break;
case SWITCH_MESSAGE_INDICATE_REDIRECT:
if (msg->string_arg) {
@@ -962,7 +943,7 @@
if (code) {
reason = msg->string_arg;
} else {
- if (!switch_strlen_zero(msg->string_arg)){
+ if (!switch_strlen_zero(msg->string_arg)) {
if ((code = atoi(msg->string_arg))) {
if ((reason = strchr(msg->string_arg, ' '))) {
reason++;
@@ -974,14 +955,14 @@
if (!code) {
code = 488;
}
-
+
if (switch_strlen_zero(reason) && code != 407) {
reason = sip_status_phrase(code);
if (switch_strlen_zero(reason)) {
reason = "Because";
}
}
-
+
if (code == 407 && !msg->numeric_arg) {
const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
const char *to_host = reason;
@@ -990,14 +971,14 @@
to_host = switch_channel_get_variable(channel, "sip_to_host");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
- sofia_reg_auth_challange(NULL, tech_pvt->profile, tech_pvt->nh, REG_INVITE, to_host, 0);
+ sofia_reg_auth_challange(NULL, tech_pvt->profile, tech_pvt->nh, REG_INVITE, to_host, 0);
switch_channel_hangup(channel, SWITCH_CAUSE_USER_CHALLENGE);
} else if (code == 484 && msg->numeric_arg) {
const char *to = switch_channel_get_variable(channel, "sip_to_uri");
const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
-
+
char *to_uri = NULL;
-
+
if (to) {
char *p;
to_uri = switch_core_session_sprintf(session, "sip:%s", to);
@@ -1015,9 +996,9 @@
}
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
-
- if (!switch_strlen_zero(((char *)msg->pointer_arg))) {
- tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *)msg->pointer_arg);
+
+ if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
+ tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *) msg->pointer_arg);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
sofia_glue_tech_patch_sdp(tech_pvt);
sofia_glue_tech_proxy_remote_addr(tech_pvt);
@@ -1025,10 +1006,7 @@
nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_AUDIO_AUX("cn telephone-event"),
- NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_END());
+ SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
} else {
nua_respond(tech_pvt->nh, code, reason, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
}
@@ -1036,11 +1014,11 @@
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
}
}
-
+
}
break;
case SWITCH_MESSAGE_INDICATE_RINGING:
- if (!switch_channel_test_flag(channel, CF_RING_READY) &&
+ if (!switch_channel_test_flag(channel, CF_RING_READY) &&
!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
nua_respond(tech_pvt->nh, SIP_180_RINGING, SIPTAG_CONTACT_STR(tech_pvt->reply_contact), TAG_END());
switch_channel_mark_ring_ready(channel);
@@ -1055,10 +1033,10 @@
const char *val = NULL;
if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
-
+
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Asked to send early media by %s\n", msg->from);
-
+
/* Transmit 183 Progress with SDP */
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
const char *sdp = NULL;
@@ -1105,7 +1083,7 @@
if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
- (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
+ (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
sticky = tech_pvt->record_route;
switch_channel_set_variable(channel, "sip_nat_detected", "true");
@@ -1117,8 +1095,7 @@
TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
+ SOATAG_ORDERED_USER(1), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_END());
}
}
break;
@@ -1126,10 +1103,10 @@
break;
}
- end:
-
+ end:
+
return status;
-
+
}
static switch_status_t sofia_receive_event(switch_core_session_t *session, switch_event_t *event)
@@ -1158,14 +1135,15 @@
typedef switch_status_t (*sofia_command_t) (char **argv, int argc, switch_stream_handle_t *stream);
static const char *sofia_state_names[] = { "UNREGED",
- "TRYING",
- "REGISTER",
- "REGED",
- "UNREGISTER",
- "FAILED",
- "EXPIRED",
- "NOREG",
- NULL};
+ "TRYING",
+ "REGISTER",
+ "REGED",
+ "UNREGISTER",
+ "FAILED",
+ "EXPIRED",
+ "NOREG",
+ NULL
+};
struct cb_helper {
sofia_profile_t *profile;
@@ -1188,17 +1166,14 @@
switch_strftime(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm);
}
- cb->stream->write_function(cb->stream,
+ cb->stream->write_function(cb->stream,
"Call-ID \t%s\n"
"User \t%s@%s\n"
"Contact \t%s\n"
"Agent \t%s\n"
- "Status \t%s(%s) EXP(%s)\n\n",
- switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
- switch_str_nil(argv[7]),
- switch_str_nil(argv[4]),
- switch_str_nil(argv[5]),
- exp_buf);
+ "Status \t%s(%s) EXP(%s)\n\n",
+ switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), switch_str_nil(argv[3]),
+ switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf);
return 0;
}
@@ -1254,24 +1229,24 @@
stream->write_function(stream, "Name \t%s\n", switch_str_nil(argv[1]));
stream->write_function(stream, "Domain Name\t%s\n", switch_str_nil(profile->domain_name));
if (strcasecmp(argv[1], profile->name)) {
- stream->write_function(stream, "Alias Of \t%s\n", switch_str_nil(profile->name));
+ stream->write_function(stream, "Alias Of \t%s\n", switch_str_nil(profile->name));
}
stream->write_function(stream, "DBName \t%s\n", switch_str_nil(profile->dbname));
stream->write_function(stream, "Dialplan \t%s\n", switch_str_nil(profile->dialplan));
stream->write_function(stream, "RTP-IP \t%s\n", switch_str_nil(profile->rtpip));
if (profile->extrtpip) {
- stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
+ stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
}
-
+
stream->write_function(stream, "SIP-IP \t%s\n", switch_str_nil(profile->sipip));
if (profile->extsipip) {
- stream->write_function(stream, "Ext-SIP-IP \t%s\n", profile->extsipip);
+ stream->write_function(stream, "Ext-SIP-IP \t%s\n", profile->extsipip);
}
stream->write_function(stream, "URL \t%s\n", switch_str_nil(profile->url));
stream->write_function(stream, "BIND-URL \t%s\n", switch_str_nil(profile->bindurl));
if (sofia_test_pflag(profile, PFLAG_TLS)) {
- stream->write_function(stream, "TLS-URL \t%s\n", switch_str_nil(profile->tls_url));
- stream->write_function(stream, "TLS-BIND-URL \t%s\n", switch_str_nil(profile->tls_bindurl));
+ stream->write_function(stream, "TLS-URL \t%s\n", switch_str_nil(profile->tls_url));
+ stream->write_function(stream, "TLS-BIND-URL \t%s\n", switch_str_nil(profile->tls_bindurl));
}
stream->write_function(stream, "HOLD-MUSIC \t%s\n", switch_str_nil(profile->hold_music));
stream->write_function(stream, "CODECS \t%s\n", switch_str_nil(profile->codec_string));
@@ -1283,10 +1258,8 @@
cb.profile = profile;
cb.stream = stream;
-
- sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
- "select * from sip_registrations",
- show_reg_callback, &cb);
+
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, "select * from sip_registrations", show_reg_callback, &cb);
stream->write_function(stream, "%s\n", line);
@@ -1308,7 +1281,7 @@
switch_hash_this(hi, &vvar, NULL, &val);
profile = (sofia_profile_t *) val;
if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
-
+
if (strcmp(vvar, profile->name)) {
ac++;
stream->write_function(stream, "%25s\t%s\t %32s\t%s\n", vvar, " alias", profile->name, "ALIASED");
@@ -1317,8 +1290,8 @@
sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
if (sofia_test_pflag(profile, PFLAG_TLS)) {
- stream->write_function(stream, "%25s\t%s\t %32s\t%s (%u) (TLS)\n", profile->name, "profile", profile->tls_url,
- sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
+ stream->write_function(stream, "%25s\t%s\t %32s\t%s (%u) (TLS)\n", profile->name, "profile", profile->tls_url,
+ sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
}
c++;
@@ -1366,12 +1339,12 @@
}
return SWITCH_STATUS_SUCCESS;
}
-
+
if (switch_strlen_zero(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
stream->write_function(stream, "Invalid Profile [%s]", switch_str_nil(profile_name));
return SWITCH_STATUS_SUCCESS;
}
-
+
if (!strcasecmp(argv[1], "flush_inbound_reg")) {
if (argc > 2) {
sofia_reg_expire_call_id(profile, argv[2]);
@@ -1407,7 +1380,7 @@
} else {
stream->write_function(stream, "Invalid gateway!\n");
}
-
+
goto done;
}
@@ -1442,7 +1415,7 @@
int diff = (int) (switch_timestamp(NULL) - profile->started);
int remain = rsec - diff;
if (diff < rsec) {
- stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
+ stream->write_function(stream, "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
profile->name, rsec, remain, remain == 1 ? "" : "s");
} else {
@@ -1467,7 +1440,7 @@
stream->write_function(stream, "-ERR Unknown command!\n");
- done:
+ done:
if (profile) {
sofia_glue_release_profile(profile);
}
@@ -1524,14 +1497,14 @@
if ((domain = strchr(user, '@'))) {
*domain++ = '\0';
}
-
+
if (!profile_name && domain) {
profile_name = domain;
}
if (user && profile_name) {
char *sql;
-
+
if (!(profile = sofia_glue_find_profile(profile_name))) {
profile_name = domain;
domain = NULL;
@@ -1544,7 +1517,7 @@
if (profile) {
struct cb_helper cb;
switch_stream_handle_t mystream = { 0 };
-
+
if (!domain || !strchr(domain, '.')) {
domain = profile->name;
}
@@ -1553,9 +1526,9 @@
switch_assert(mystream.data);
cb.profile = profile;
cb.stream = &mystream;
-
+
if (exclude_contact) {
- sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'",
+ sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q' and contact not like '%%%s%%'",
user, domain, exclude_contact);
} else {
sql = switch_mprintf("select contact from sip_registrations where sip_user='%q' and sip_host='%q'", user, domain);
@@ -1573,7 +1546,7 @@
switch_safe_free(mystream.data);
}
}
-
+
if (reply) {
stream->write_function(stream, "%s", reply);
}
@@ -1600,13 +1573,12 @@
"sofia help\n"
"sofia profile <profile_name> [start|stop|restart|flush_inbound_reg [<call_id>]|[register|unregister] [<gateway name>|all]] [reloadxml]\n"
"sofia status [[profile | gateway] <name>]\n"
- "sofia loglevel [0-9]\n"
- "--------------------------------------------------------------------------------\n";
-
+ "sofia loglevel [0-9]\n" "--------------------------------------------------------------------------------\n";
+
if (session) {
return SWITCH_STATUS_FALSE;
}
-
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
@@ -1621,7 +1593,7 @@
stream->write_function(stream, "%s", usage_string);
goto done;
}
-
+
if (!strcasecmp(argv[0], "profile")) {
func = cmd_profile;
} else if (!strcasecmp(argv[0], "status")) {
@@ -1664,9 +1636,9 @@
/*.send_dtmf */ sofia_send_dtmf,
/*.receive_message */ sofia_receive_message,
/*.receive_event */ sofia_receive_event,
- /*.state_change*/ NULL,
- /*.read_video_frame*/ sofia_read_video_frame,
- /*.write_video_frame*/ sofia_write_video_frame
+ /*.state_change */ NULL,
+ /*.read_video_frame */ sofia_read_video_frame,
+ /*.write_video_frame */ sofia_write_video_frame
};
switch_state_handler_table_t sofia_event_handlers = {
@@ -1677,8 +1649,8 @@
/*.on_exchange_media */ sofia_on_exchange_media,
/*.on_soft_execute */ sofia_on_soft_execute,
/*.on_consume_media */ NULL,
- /*.on_hibernate*/ sofia_on_hibernate,
- /*.on_reset*/ sofia_on_reset
+ /*.on_hibernate */ sofia_on_hibernate,
+ /*.on_reset */ sofia_on_reset
};
static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
@@ -1698,7 +1670,7 @@
private_object_t *tech_pvt = NULL;
switch_channel_t *nchannel;
char *host = NULL, *dest_to = NULL;
-
+
*new_session = NULL;
if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
@@ -1758,14 +1730,14 @@
* invite contact.
*
* TODO:
- * - Add parameters back to destination url?
+ * - Add parameters back to destination url?
*/
if ((params = strchr(dest, ';'))) {
char *tp_param;
*params++ = '\0';
- if ((tp_param = (char *)switch_stristr("port=", params))) {
+ if ((tp_param = (char *) switch_stristr("port=", params))) {
tp_param += 5;
tech_pvt->transport = sofia_glue_str2transport(tp_param);
if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN) {
@@ -1776,7 +1748,8 @@
}
if (tech_pvt->transport != gateway_ptr->register_transport) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You are trying to use a different transport type for this gateway (overriding the register-transport), this is unsupported!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ "You are trying to use a different transport type for this gateway (overriding the register-transport), this is unsupported!\n");
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
goto error;
}
@@ -1860,7 +1833,7 @@
tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s@%s", dest_to, host);
}
}
-
+
if (!tech_pvt->dest_to) {
tech_pvt->dest_to = tech_pvt->dest;
@@ -1961,7 +1934,7 @@
switch_core_hash_init(&mod_sofia_globals.profile_hash, mod_sofia_globals.pool);
switch_core_hash_init(&mod_sofia_globals.gateway_hash, mod_sofia_globals.pool);
switch_mutex_init(&mod_sofia_globals.hash_mutex, SWITCH_MUTEX_NESTED, mod_sofia_globals.pool);
-
+
switch_mutex_lock(mod_sofia_globals.mutex);
mod_sofia_globals.running = 1;
switch_mutex_unlock(mod_sofia_globals.mutex);
@@ -2034,7 +2007,7 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sofia_shutdown)
{
int sanity = 0;
-
+
switch_mutex_lock(mod_sofia_globals.mutex);
if (mod_sofia_globals.running == 1) {
mod_sofia_globals.running = 0;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c Tue May 27 07:24:06 2008
@@ -61,14 +61,15 @@
static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[]);
static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-static void sofia_handle_sip_r_options(switch_core_session_t *session, int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[]);
+static void sofia_handle_sip_r_options(switch_core_session_t *session, int status, char const *phrase, nua_t *nua, sofia_profile_t *profile,
+ nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
void sofia_handle_sip_r_notify(switch_core_session_t *session, int status,
char const *phrase,
@@ -84,16 +85,11 @@
}
void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
- char const *phrase,
- nua_t *nua,
- sofia_profile_t *profile,
- nua_handle_t *nh,
- sofia_private_t *sofia_private,
- sip_t const *sip,
- tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
switch_channel_t *channel = NULL;
-
+
/* make sure we have a proper event */
if (!sip || !sip->sip_event) {
goto error;
@@ -115,41 +111,36 @@
if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
switch_channel_answer(channel);
switch_channel_set_variable(channel, "auto_answer_destination", switch_channel_get_variable(channel, "destination_number"));
- switch_ivr_session_transfer(session, "auto_answer", NULL , NULL);
+ switch_ivr_session_transfer(session, "auto_answer", NULL, NULL);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
return;
}
-error:
+ error:
nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END());
return;
}
void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
- char const *phrase,
- nua_t *nua,
- sofia_profile_t *profile,
- nua_handle_t *nh,
- sofia_private_t *sofia_private,
- sip_t const *sip,
- tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
const char *tmp;
switch_channel_t *channel;
- if (!session) return;
+ if (!session)
+ return;
- channel = switch_core_session_get_channel(session);
+ channel = switch_core_session_get_channel(session);
- if (sip->sip_reason && sip->sip_reason->re_protocol &&
- (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) &&
- sip->sip_reason->re_cause) {
- private_object_t *tech_pvt = switch_core_session_get_private(session);
- tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
- }
+ if (sip->sip_reason && sip->sip_reason->re_protocol &&
+ (!strcasecmp(sip->sip_reason->re_protocol, "Q.850") || !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")) && sip->sip_reason->re_cause) {
+ private_object_t *tech_pvt = switch_core_session_get_private(session);
+ tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
+ }
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
+ if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
}
if ((tmp = sofia_glue_get_unknown_header(sip, "rtp-txstat"))) {
@@ -168,12 +159,7 @@
void sofia_event_callback(nua_event_t event,
int status,
char const *phrase,
- nua_t *nua,
- sofia_profile_t *profile,
- nua_handle_t *nh,
- sofia_private_t *sofia_private,
- sip_t const *sip,
- tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
struct private_object *tech_pvt = NULL;
auth_res_t auth_res = AUTH_FORBIDDEN;
@@ -204,7 +190,7 @@
}
}
}
-
+
if (status != 100 && status != 200) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event [%s] status [%d][%s] session: %s\n",
nua_event_name(event), status, phrase, session ? switch_channel_get_name(channel) : "n/a");
@@ -221,7 +207,7 @@
if ((profile->pflags & PFLAG_AUTH_ALL) && tech_pvt && tech_pvt->key && sip) {
sip_authorization_t const *authorization = NULL;
-
+
if (sip->sip_authorization) {
authorization = sip->sip_authorization;
} else if (sip->sip_proxy_authorization) {
@@ -231,8 +217,9 @@
if (authorization) {
char network_ip[80];
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
- auth_res = sofia_reg_parse_auth(profile, authorization, sip,
- (char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0, REG_INVITE, NULL);
+ auth_res = sofia_reg_parse_auth(profile, authorization, sip,
+ (char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0,
+ REG_INVITE, NULL);
}
if (auth_res != AUTH_OK) {
@@ -413,9 +400,9 @@
switch_mutex_lock(profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-
+
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','Registered', '%q', %ld, '%q')",
- call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
+ call_id, from_user, from_host, contact_str, rpid, expires, user_agent);
if (sql) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -442,9 +429,9 @@
gateway_loops = GATEWAY_SECONDS;
sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING);
-
+
switch_queue_create(&profile->sql_queue, 500000, profile->pool);
-
+
qsize = switch_queue_size(profile->sql_queue);
while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
@@ -474,9 +461,9 @@
switch_yield(10000);
qsize = switch_queue_size(profile->sql_queue);
}
-
+
sofia_clear_pflag_locked(profile, PFLAG_WORKER_RUNNING);
-
+
return NULL;
}
@@ -493,7 +480,7 @@
switch_threadattr_priority_increase(thd_attr);
switch_thread_create(&thread, thd_attr, sofia_profile_worker_thread_run, profile, profile->pool);
- while(!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
+ while (!sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
switch_yield(100000);
if (++x >= 100) {
break;
@@ -542,16 +529,9 @@
}
profile->nua = nua_create(profile->s_root, /* Event loop */
- sofia_event_callback, /* Callback for processing events */
- profile, /* Additional data to pass to callback */
- NUTAG_URL(profile->bindurl),
- TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)),
- TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)),
- TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)),
- NTATAG_UDP_MTU(65536),
- NTATAG_SERVER_RPORT(2),
- TAG_IF(tportlog, TPTAG_LOG(1)),
- TAG_END()); /* Last tag should always finish the sequence */
+ sofia_event_callback, /* Callback for processing events */
+ profile, /* Additional data to pass to callback */
+ NUTAG_URL(profile->bindurl), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), NTATAG_UDP_MTU(65536), NTATAG_SERVER_RPORT(2), TAG_IF(tportlog, TPTAG_LOG(1)), TAG_END()); /* Last tag should always finish the sequence */
if (!profile->nua) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name);
@@ -590,10 +570,9 @@
for (node = profile->aliases; node; node = node->next) {
node->nua = nua_create(profile->s_root, /* Event loop */
- sofia_event_callback, /* Callback for processing events */
- profile, /* Additional data to pass to callback */
- NTATAG_SERVER_RPORT(2),
- NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */
+ sofia_event_callback, /* Callback for processing events */
+ profile, /* Additional data to pass to callback */
+ NTATAG_SERVER_RPORT(2), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */
nua_set_params(node->nua,
NUTAG_APPL_METHOD("OPTIONS"),
@@ -605,8 +584,7 @@
NUTAG_ALLOW("INFO"),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ALLOW("PUBLISH")),
TAG_IF((profile->pflags & PFLAG_PRESENCE), NUTAG_ENABLEMESSAGE(1)),
- SIPTAG_SUPPORTED_STR(supported),
- SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
+ SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "activated db for %s\n", profile->name);
@@ -658,11 +636,11 @@
sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "waiting for worker thread\n");
- while(sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
+ while (sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
switch_yield(100000);
}
- while(profile->inuse) {
+ while (profile->inuse) {
switch_yield(100000);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "waiting for %d session(s)\n", profile->inuse);
}
@@ -676,7 +654,7 @@
if (switch_event_create(&s_event, SWITCH_EVENT_UNPUBLISH) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_sip._udp,_sip._tcp,_sip._sctp%s",
- (sofia_test_pflag(profile, PFLAG_TLS)) ? ",_sips._tcp" : "");
+ (sofia_test_pflag(profile, PFLAG_TLS)) ? ",_sips._tcp" : "");
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "port", "%d", profile->sip_port);
switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "module_name", "%s", "mod_sofia");
@@ -787,12 +765,7 @@
*context = "default",
*expire_seconds = "3600",
*retry_seconds = "30",
- *from_user = "",
- *from_domain = "",
- *register_proxy = NULL,
- *contact_params = NULL,
- *params = NULL,
- *register_transport = NULL;
+ *from_user = "", *from_domain = "", *register_proxy = NULL, *contact_params = NULL, *params = NULL, *register_transport = NULL;
uint32_t ping_freq = 0;
@@ -913,7 +886,7 @@
if (switch_true(caller_id_in_from)) {
switch_set_flag(gateway, REG_FLAG_CALLERID);
}
- register_transport = (char *)sofia_glue_transport2str(gateway->register_transport);
+ register_transport = (char *) sofia_glue_transport2str(gateway->register_transport);
if (contact_params) {
if (*contact_params == ';') {
params = switch_core_sprintf(gateway->pool, "%s&transport=%s", contact_params, register_transport);
@@ -927,8 +900,9 @@
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s;transport=%s", register_proxy, register_transport);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", from_user, from_domain, register_transport);
gateway->register_contact = switch_core_sprintf(gateway->pool, "<sip:%s@%s:%d%s>", extension,
- profile->extsipip ? profile->extsipip : profile->sipip,
- sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->sip_port, params);
+ profile->extsipip ? profile->extsipip : profile->sipip,
+ sofia_glue_transport_has_tls(gateway->register_transport) ? profile->tls_sip_port : profile->
+ sip_port, params);
if (!strncasecmp(proxy, "sip:", 4)) {
gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
@@ -941,8 +915,7 @@
gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds);
if ((gateway->freq = atoi(gateway->expires_str)) < 5) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "Invalid Freq: %d. Setting Register-Frequency to 3600\n", gateway->freq);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Freq: %d. Setting Register-Frequency to 3600\n", gateway->freq);
gateway->freq = 3600;
}
gateway->freq -= 2;
@@ -952,7 +925,7 @@
sofia_reg_add_gateway(gateway->name, gateway);
}
- skip:
+ skip:
switch_assert(gateway_tag);
}
}
@@ -965,11 +938,10 @@
if (sofia_glue_add_profile(switch_core_strdup(profile->pool, dname), profile) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", dname, profile->name);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n",
- dname, profile->name);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n", dname, profile->name);
}
}
-
+
if (switch_true(parse)) {
switch_xml_t ut, gateways_tag;
for (ut = switch_xml_child(x_domain_tag, "user"); ut; ut = ut->next) {
@@ -990,7 +962,7 @@
char url[512] = "";
int profile_found = 0;
switch_event_t *params = NULL;;
-
+
if (!reload) {
su_init();
if (sip_update_default_mclass(sip_extend_mclass(NULL)) < 0) {
@@ -1012,7 +984,7 @@
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", profile_name);
-
+
if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
status = SWITCH_STATUS_FALSE;
@@ -1080,7 +1052,7 @@
profile->dtmf_duration = 100;
profile->tls_version = 0;
profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
-
+
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -1100,7 +1072,6 @@
*profile->odbc_pass++ = '\0';
}
}
-
#else
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n");
#endif
@@ -1350,9 +1321,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds!\n");
}
- /*
- * handle TLS params #1
- */
+ /*
+ * handle TLS params #1
+ */
} else if (!strcasecmp(var, "tls")) {
if (switch_true(val)) {
sofia_set_pflag(profile, PFLAG_TLS);
@@ -1370,7 +1341,7 @@
} else {
profile->tls_version = 0;
}
- }
+ }
}
if (!profile->cng_pt) {
@@ -1437,7 +1408,8 @@
if (profile->extsipip) {
profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->extsipip, profile->tls_sip_port);
- profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
+ profile->tls_bindurl =
+ switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d;maddr=%s", profile->extsipip, profile->tls_sip_port, profile->sipip);
} else {
profile->tls_url = switch_core_sprintf(profile->pool, "sip:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
profile->tls_bindurl = switch_core_sprintf(profile->pool, "sips:mod_sofia@%s:%d", profile->sipip, profile->tls_sip_port);
@@ -1469,12 +1441,12 @@
const char *dname = switch_xml_attr_soft(domain_tag, "name");
const char *parse = switch_xml_attr_soft(domain_tag, "parse");
const char *alias = switch_xml_attr_soft(domain_tag, "alias");
-
- if (!switch_strlen_zero(dname)) {
+
+ if (!switch_strlen_zero(dname)) {
if (!strcasecmp(dname, "all")) {
switch_xml_t xml_root, x_domains;
if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, NULL) == SWITCH_STATUS_SUCCESS) {
- for(x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
+ for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
dname = switch_xml_attr_soft(x_domain_tag, "name");
parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
}
@@ -1482,7 +1454,7 @@
}
} else if (switch_xml_locate_domain(dname, NULL, &droot, &x_domain_tag) == SWITCH_STATUS_SUCCESS) {
parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
- switch_xml_free(droot);
+ switch_xml_free(droot);
}
}
}
@@ -1496,8 +1468,8 @@
if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n",
- aname, profile->name);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding Alias [%s] for profile [%s] (name in use)\n",
+ aname, profile->name);
}
}
}
@@ -1534,7 +1506,8 @@
static void sofia_handle_sip_r_options(switch_core_session_t *session, int status,
char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
sofia_gateway_t *gateway = NULL;
@@ -1564,16 +1537,11 @@
} else if ((profile->pflags & PFLAG_UNREG_OPTIONS_FAIL) && status != 200 && sip && sip->sip_to) {
char *sql;
time_t now = switch_timestamp(NULL);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
- sip->sip_to->a_url->url_user,
- sip->sip_to->a_url->url_host
- );
-
- sql = switch_mprintf("update sip_registrations set expired=%ld where sip_user='%s' and sip_host='%s'",
- (long)now,
- sip->sip_to->a_url->url_user,
- sip->sip_to->a_url->url_host
- );
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Expire registration '%s@%s' due to options failure\n",
+ sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
+
+ sql = switch_mprintf("update sip_registrations set expired=%ld where sip_user='%s' and sip_host='%s'",
+ (long) now, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
}
@@ -1581,14 +1549,15 @@
static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status,
char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
if (sip && session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
const char *uuid;
switch_core_session_t *other_session;
private_object_t *tech_pvt = switch_core_session_get_private(session);
-
+
switch_channel_clear_flag(channel, CF_REQ_MEDIA);
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
@@ -1602,14 +1571,14 @@
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
const char *r_sdp = NULL;
switch_core_session_message_t msg = { 0 };
-
- if (sip->sip_payload && sip->sip_payload->pl_data &&
+
+ if (sip->sip_payload && sip->sip_payload->pl_data &&
sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
r_sdp = sip->sip_payload->pl_data;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
msg.from = __FILE__;
msg.numeric_arg = status;
@@ -1645,7 +1614,7 @@
astate = "confirmed";
}
- if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) &&
+ if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED) &&
!switch_channel_test_flag(channel, CF_RING_READY)) {
const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
const char *user_agent = "", *call_id = "";
@@ -1675,30 +1644,20 @@
}
if (profile->pflags & PFLAG_PRESENCE) {
- sql = switch_mprintf(
- "insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+ sql = switch_mprintf("insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
call_id,
switch_core_session_get_uuid(session),
- to_user,
- to_host,
- from_user,
- from_host,
- contact_user,
- contact_host,
- astate,
- "outbound",
- user_agent
- );
+ to_user, to_host, from_user, from_host, contact_user, contact_host, astate, "outbound", user_agent);
switch_assert(sql);
-
+
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
- } else if (status == 200 && (profile->pflags & PFLAG_PRESENCE)) {
+ } else if (status == 200 && (profile->pflags & PFLAG_PRESENCE)) {
char *sql = NULL;
sql = switch_mprintf("update sip_dialogs set state='%s' where uuid='%s';\n", astate, switch_core_session_get_uuid(session));
- switch_assert(sql);
- sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+ switch_assert(sql);
+ sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
}
}
@@ -1706,7 +1665,8 @@
static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
const char *l_sdp = NULL, *r_sdp = NULL;
int offer_recv = 0, answer_recv = 0, offer_sent = 0, answer_sent = 0;
@@ -1759,8 +1719,8 @@
}
}
- state_process:
-
+ state_process:
+
switch ((enum nua_callstate) ss_state) {
case nua_callstate_init:
break;
@@ -1842,18 +1802,18 @@
switch_set_flag(tech_pvt, TFLAG_SDP);
goto done;
} else if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
- switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
- if (switch_channel_get_state(channel) == CS_NEW) {
- switch_channel_set_state(channel, CS_INIT);
- }
+ switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA");
+ switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ if (switch_channel_get_state(channel) == CS_NEW) {
+ switch_channel_set_state(channel, CS_INIT);
+ }
} else if (switch_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION)) {
- switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
- switch_set_flag_locked(tech_pvt, TFLAG_READY);
- if (switch_channel_get_state(channel) == CS_NEW) {
- switch_channel_set_state(channel, CS_INIT);
- }
- } else {
+ switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION");
+ switch_set_flag_locked(tech_pvt, TFLAG_READY);
+ if (switch_channel_get_state(channel) == CS_NEW) {
+ switch_channel_set_state(channel, CS_INIT);
+ }
+ } else {
sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
@@ -1866,7 +1826,7 @@
sdp_parser_free(parser);
}
}
-
+
if (match) {
nua_handle_t *bnh;
sip_replaces_t *replaces;
@@ -1888,11 +1848,11 @@
while (switch_channel_get_state(channel) < CS_EXECUTE) {
switch_yield(10000);
}
-
+
if ((b_private = nua_handle_magic(bnh))) {
const char *br_b = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
char *br_a = b_private->uuid;
-
+
if (br_b) {
switch_ivr_uuid_bridge(br_a, br_b);
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
@@ -1930,10 +1890,7 @@
SIPTAG_CONTACT_STR(tech_pvt->profile->url),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_AUDIO_AUX("cn telephone-event"),
- NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_END());
+ SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
goto done;
}
}
@@ -1948,11 +1905,11 @@
break;
case nua_callstate_completed:
if (tech_pvt && r_sdp) {
- sdp_parser_t *parser;
+ sdp_parser_t *parser;
sdp_session_t *sdp;
uint8_t match = 0;
- if (r_sdp) {
+ if (r_sdp) {
if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
@@ -1965,7 +1922,7 @@
if (switch_core_session_receive_message(other_session, &msg) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Other leg is not available\n");
nua_respond(tech_pvt->nh, 403, "Hangup in progress", TAG_END());
- }
+ }
switch_core_session_rwunlock(other_session);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Re-INVITE to a no-media channel that is not in a bridge.\n");
@@ -2003,10 +1960,7 @@
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
- SOATAG_ORDERED_USER(1),
- SOATAG_AUDIO_AUX("cn telephone-event"),
- NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_END());
+ SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
}
}
break;
@@ -2031,7 +1985,7 @@
if (channel) {
if (switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_ANS);
- switch_set_flag(tech_pvt, TFLAG_SDP);
+ switch_set_flag(tech_pvt, TFLAG_SDP);
switch_channel_mark_answered(channel);
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
@@ -2119,12 +2073,12 @@
if (switch_test_flag(tech_pvt, TFLAG_NOHUP)) {
switch_clear_flag_locked(tech_pvt, TFLAG_NOHUP);
} else {
- int cause;
- if (tech_pvt->q850_cause) {
- cause = tech_pvt->q850_cause;
- } else {
- cause = sofia_glue_sip_cause_to_freeswitch(status);
- }
+ int cause;
+ if (tech_pvt->q850_cause) {
+ cause = tech_pvt->q850_cause;
+ } else {
+ cause = sofia_glue_sip_cause_to_freeswitch(status);
+ }
if (status) {
switch_snprintf(st, sizeof(st), "%d", status);
switch_channel_set_variable(channel, "sip_term_status", st);
@@ -2136,14 +2090,14 @@
switch_channel_hangup(channel, cause);
}
}
-
+
if (tech_pvt->sofia_private) {
sofia_private = tech_pvt->sofia_private;
tech_pvt->sofia_private = NULL;
sofia_private->destroy_me = 1;
}
- tech_pvt->nh = NULL;
+ tech_pvt->nh = NULL;
} else if (sofia_private) {
@@ -2188,11 +2142,11 @@
from = sip->sip_from;
to = sip->sip_to;
-
+
home = su_home_new(sizeof(*home));
switch_assert(home != NULL);
- if (sip->sip_referred_by) {
+ if (sip->sip_referred_by) {
full_ref_by = sip_header_as_string(home, (void *) sip->sip_referred_by);
}
@@ -2211,13 +2165,12 @@
sip_replaces_t *replaces;
nua_handle_t *bnh;
char *rep;
-
+
if (switch_channel_test_flag(channel_a, CF_PROXY_MODE)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Attended Transfer BYPASS MEDIA CALLS!\n");
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
- TAG_END());
+ NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
goto done;
}
@@ -2240,7 +2193,7 @@
sofia_private_t *b_private = NULL;
private_object_t *b_tech_pvt = NULL;
switch_core_session_t *b_session = NULL;
-
+
switch_channel_set_variable(channel_a, SOFIA_REPLACES_HEADER, rep);
if ((b_private = nua_handle_magic(bnh))) {
@@ -2252,12 +2205,13 @@
br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", switch_str_nil(br_a), switch_str_nil(br_b));
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", switch_str_nil(br_a),
+ switch_str_nil(br_b));
if (br_a && br_b) {
switch_core_session_t *new_b_session = NULL, *a_session = NULL;
-
+
switch_ivr_uuid_bridge(br_b, br_a);
switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
@@ -2282,12 +2236,10 @@
b_tech_pvt->xferto = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session));
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
nua_notify(tech_pvt->nh,
- NUTAG_NEWSUB(1),
- SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- NUTAG_SUBSTATE(nua_substate_terminated),
- SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
- SIPTAG_EVENT_STR(etmp),
- TAG_END());
+ NUTAG_NEWSUB(1),
+ SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+ NUTAG_SUBSTATE(nua_substate_terminated),
+ SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
} else {
switch_core_session_t *t_session;
switch_channel_t *hup_channel;
@@ -2316,15 +2268,13 @@
if (!switch_strlen_zero(full_ref_to)) {
switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
-
+
switch_ivr_session_transfer(t_session, ext, NULL, NULL);
nua_notify(tech_pvt->nh,
- NUTAG_NEWSUB(1),
- SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- NUTAG_SUBSTATE(nua_substate_terminated),
- SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
- SIPTAG_EVENT_STR(etmp),
- TAG_END());
+ NUTAG_NEWSUB(1),
+ SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+ NUTAG_SUBSTATE(nua_substate_terminated),
+ SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
switch_core_session_rwunlock(t_session);
switch_channel_hangup(hup_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
} else {
@@ -2361,13 +2311,9 @@
port = "5060";
}
channel = switch_core_session_get_channel(a_session);
-
- exten = switch_mprintf("sofia/%s/%s@%s:%s",
- profile->name,
- refer_to->r_url->url_user,
- refer_to->r_url->url_host,
- port);
-
+
+ exten = switch_mprintf("sofia/%s/%s@%s:%s", profile->name, refer_to->r_url->url_user, refer_to->r_url->url_host, port);
+
switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, rep);
if (!switch_strlen_zero(full_ref_by)) {
switch_channel_set_variable(channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
@@ -2375,20 +2321,19 @@
if (!switch_strlen_zero(full_ref_to)) {
switch_channel_set_variable(channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
- status = switch_ivr_originate(a_session,
- &tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL, SOF_NONE);
+ status = switch_ivr_originate(a_session, &tsession, &cause, exten, timeout, &noop_state_handler, NULL, NULL, NULL, SOF_NONE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create Outgoing Channel! [%s]\n", exten);
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
NUTAG_SUBSTATE(nua_substate_terminated),
SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
-
+
switch_core_session_rwunlock(a_session);
if (status != SWITCH_STATUS_SUCCESS) {
goto done;
}
-
+
tuuid_str = switch_core_session_get_uuid(tsession);
switch_ivr_uuid_bridge(br_a, tuuid_str);
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
@@ -2426,7 +2371,7 @@
if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *b_session;
-
+
if ((b_session = switch_core_session_locate(br))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
@@ -2445,17 +2390,13 @@
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER");
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- NUTAG_SUBSTATE(nua_substate_terminated),
- SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
- SIPTAG_EVENT_STR(etmp),
- TAG_END());
-
+ NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n");
switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
- TAG_END());
+ NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
}
}
@@ -2480,7 +2421,7 @@
const char *rec_header;
const char *clientcode_header;
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
-
+
if (session) {
/* Get the channel */
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -2488,7 +2429,7 @@
/* Barf if we didn't get our private */
assert(switch_core_session_get_private(session));
- if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype &&
+ if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype &&
sip->sip_payload && sip->sip_payload->pl_data) {
if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) {
/* Try and find signal information in the payload */
@@ -2506,7 +2447,7 @@
signal_ptr += 9;
if ((tmp = atoi(signal_ptr)) <= 0) {
tmp = switch_core_default_dtmf_duration(0);
- }
+ }
dtmf.duration = tmp * 8;
}
} else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf")) {
@@ -2514,7 +2455,7 @@
} else {
goto fail;
}
-
+
if (dtmf.digit) {
/* queue it up */
switch_channel_queue_dtmf(channel, &dtmf);
@@ -2524,7 +2465,7 @@
/* Send 200 OK response */
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
-
+
return;
} else {
goto fail;
@@ -2576,7 +2517,7 @@
}
return;
- fail:
+ fail:
nua_respond(nh, 488, "Unsupported Request", NUTAG_WITH_THIS(nua), TAG_END());
}
@@ -2669,7 +2610,7 @@
nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
return;
}
-
+
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
@@ -2677,7 +2618,7 @@
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;
-
+
if (host && sip->sip_via->v_received) {
is_nat = "via received";
} else if (host && strcmp(network_ip, host)) {
@@ -2699,13 +2640,13 @@
}
if (!switch_strlen_zero(contact_host)) {
- for (x = 0 ; x < profile->nat_acl_count; x++) {
+ for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
break;
}
}
-
+
if (ok) {
is_nat = last_acl;
}
@@ -2717,7 +2658,7 @@
int ok = 1;
char *last_acl = NULL;
- for (x = 0 ; x < profile->acl_count; x++) {
+ for (x = 0; x < profile->acl_count; x++) {
last_acl = profile->acl[x];
if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
break;
@@ -2726,7 +2667,7 @@
if (ok) {
if ((profile->pflags & PFLAG_AUTH_CALLS)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n",
network_ip, switch_str_nil(last_acl));
is_auth = 1;
}
@@ -2736,13 +2677,13 @@
nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
return;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n",
network_ip, switch_str_nil(last_acl));
}
}
}
-
- if (!is_auth &&
+
+ if (!is_auth &&
((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
calling_myself++;
@@ -2785,10 +2726,8 @@
if (sip->sip_contact && sip->sip_contact->m_url) {
char tmp[35] = "";
- tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d",
- sip->sip_contact->m_url->url_user,
- tech_pvt->remote_ip,
- tech_pvt->remote_port);
+ tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d",
+ sip->sip_contact->m_url->url_user, tech_pvt->remote_ip, tech_pvt->remote_port);
switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
switch_channel_set_variable(channel, "sip_received_port", tmp);
@@ -2798,7 +2737,7 @@
tech_pvt->key = switch_core_session_strdup(session, key);
}
-
+
if (is_auth) {
switch_channel_set_variable(channel, "sip_authorized", "true");
}
@@ -2809,8 +2748,8 @@
if (v_event) {
switch_event_header_t *hp;
-
- for(hp = v_event->headers; hp; hp = hp->next) {
+
+ for (hp = v_event->headers; hp; hp = hp->next) {
switch_channel_set_variable(channel, hp->name, hp->value);
}
switch_event_destroy(&v_event);
@@ -2906,7 +2845,7 @@
host = switch_channel_get_variable(channel, "sip_to_host");
user = switch_channel_get_variable(channel, "sip_to_user");
-
+
switch_channel_set_variable(channel, "sip_to_comment", sip->sip_to->a_comment);
if (sip->sip_to->a_params) {
@@ -2919,8 +2858,7 @@
port = sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port;
}
- tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s@%s:%d;transport=%s",
- user, host, port, sofia_glue_transport2str(transport));
+ tech_pvt->to_uri = switch_core_session_sprintf(session, "sip:%s@%s:%d;transport=%s", user, host, port, sofia_glue_transport2str(transport));
if (profile->ndlb & PFLAG_NDLB_TO_IN_200_CONTACT) {
if (strchr(tech_pvt->to_uri, '>')) {
@@ -3006,8 +2944,8 @@
if (sip->sip_subject && sip->sip_subject->g_string) {
switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string);
}
-
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)){
+
+ if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
}
@@ -3079,10 +3017,7 @@
tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
from_user,
dialplan,
- displayname,
- from_user,
- network_ip,
- NULL, NULL, NULL, MODNAME, context, destination_number);
+ displayname, from_user, network_ip, NULL, NULL, NULL, MODNAME, context, destination_number);
if (tech_pvt->caller_profile) {
@@ -3100,8 +3035,8 @@
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME);
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NUMBER);
}
- }
-
+ }
+
if (rpid->rpid_screen && !strcasecmp(rpid->rpid_screen, "no")) {
switch_clear_flag(tech_pvt->caller_profile, SWITCH_CPF_SCREEN);
}
@@ -3138,7 +3073,7 @@
}
memset(sofia_private, 0, sizeof(*sofia_private));
tech_pvt->sofia_private = sofia_private;
-
+
if ((profile->pflags & PFLAG_PRESENCE)) {
sofia_presence_set_chat_hash(tech_pvt, sip);
}
@@ -3188,21 +3123,11 @@
if (profile->pflags & PFLAG_PRESENCE) {
- sql = switch_mprintf(
- "insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+ sql = switch_mprintf("insert into sip_dialogs values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
call_id,
tech_pvt->sofia_private->uuid,
- to_user,
- to_host,
- dialog_from_user,
- dialog_from_host,
- contact_user,
- contact_host,
- "confirmed",
- "inbound",
- user_agent
- );
-
+ to_user, to_host, dialog_from_user, dialog_from_host, contact_user, contact_host, "confirmed", "inbound", user_agent);
+
switch_assert(sql);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
@@ -3212,7 +3137,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
-
+
return;
}
@@ -3223,8 +3148,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
"Green laserfire moves past the beeping little robot as his head turns. "
"After a few beeps and a twist of his mechanical arm,\n"
- "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n",
- sess_count - 10);
+ "Artoo reduces the max sessions to %d thus, saving the switch from certian doom.\n", sess_count - 10);
switch_mutex_unlock(profile->flag_mutex);
}
@@ -3240,12 +3164,10 @@
}
void sofia_handle_sip_i_options(int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
{
- nua_respond(nh, SIP_200_OK,
- NUTAG_WITH_THIS(nua),
- TAG_END());
+ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
}
static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
@@ -3256,7 +3178,7 @@
if (aleg && bleg && switch_core_session_compare(aleg, bleg)) {
a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
-
+
if (b_tech_pvt && a_tech_pvt && a_tech_pvt->caller_profile) {
switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
@@ -3299,27 +3221,27 @@
char var1[] = "sip_";
char *cp, *sh, *sh_end, *sh_save;
- /* Build the static part of the sip_header_name variable from */
- /* the header_type. If the header type is "referred_by" then */
- /* sip_header_name = "sip_referred_by_". */
+ /* Build the static part of the sip_header_name variable from */
+ /* the header_type. If the header type is "referred_by" then */
+ /* sip_header_name = "sip_referred_by_". */
sh = sip_header_name;
sh_end = sh + sizeof(sip_header_name) - 1;
- for (cp=var1; *cp; cp++, sh++) {
+ for (cp = var1; *cp; cp++, sh++) {
*sh = *cp;
}
*sh = '\0';
- /* Copy the header_type to the sip_header_name. Before copying */
+ /* Copy the header_type to the sip_header_name. Before copying */
/* each character, check that we aren't going to overflow the */
- /* the sip_header_name buffer. We have to account for the */
- /* trailing underscore and NULL that will be added to the end. */
- for (cp=header_type; (*cp && (sh < (sh_end-1))); cp++, sh++) {
+ /* the sip_header_name buffer. We have to account for the */
+ /* trailing underscore and NULL that will be added to the end. */
+ for (cp = header_type; (*cp && (sh < (sh_end - 1))); cp++, sh++) {
*sh = *cp;
}
*sh++ = '_';
*sh = '\0';
- /* sh now points to the NULL at the end of the partially built */
+ /* sh now points to the NULL at the end of the partially built */
/* sip_header_name variable. This is also the start of the */
/* variable part of the sip_header_name built from the lvalue */
/* of the parms data. */
@@ -3327,21 +3249,21 @@
while (params && params[0]) {
- /* Copy the params data to the sip_header_name variable until */
- /* the end of the params string is reached, an '=' is detected */
- /* or until the sip_header_name buffer has been exhausted. */
- for (cp=(char *)(*params); ((*cp != '=') && *cp && (sh < sh_end)); cp++, sh++) {
+ /* Copy the params data to the sip_header_name variable until */
+ /* the end of the params string is reached, an '=' is detected */
+ /* or until the sip_header_name buffer has been exhausted. */
+ for (cp = (char *) (*params); ((*cp != '=') && *cp && (sh < sh_end)); cp++, sh++) {
*sh = *cp;
}
- /* cp now points to either the end of the parms data or the */
- /* equal (=) sign spearating the lvalue and rvalue. */
+ /* cp now points to either the end of the parms data or the */
+ /* equal (=) sign spearating the lvalue and rvalue. */
if (*cp == '=')
- cp++;
+ cp++;
*sh = '\0';
switch_channel_set_variable(channel, sip_header_name, cp);
- /* Bump pointer to next param in the list. Also reset the */
+ /* Bump pointer to next param in the list. Also reset the */
/* sip_header_name pointer to the beginning of the dynamic area */
params++;
sh = sh_save;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c Tue May 27 07:24:06 2008
@@ -47,12 +47,13 @@
const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
- if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
+ if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPRESS_CNG) ||
((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val))) {
use_cng = 0;
}
- if (!force && !ip && !sr && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) {
+ if (!force && !ip && !sr
+ && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) {
return;
}
@@ -76,21 +77,20 @@
}
if (!tech_pvt->session_id) {
- tech_pvt->session_id = tech_pvt->owner_id ;
+ tech_pvt->session_id = tech_pvt->owner_id;
}
tech_pvt->session_id++;
-
+
switch_snprintf(buf, sizeof(buf),
"v=0\n"
"o=FreeSWITCH %010u %010u IN IP4 %s\n"
- "s=FreeSWITCH\n"
- "c=IN IP4 %s\n" "t=0 0\n"
- "a=%s\n"
+ "s=FreeSWITCH\n"
+ "c=IN IP4 %s\n" "t=0 0\n"
+ "a=%s\n"
"m=audio %d RTP/%sAVP", tech_pvt->owner_id, tech_pvt->session_id, ip, ip, sr, port,
- (!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""
- );
-
+ (!switch_strlen_zero(tech_pvt->local_crypto_key) && switch_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : "");
+
if (tech_pvt->rm_encoding) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
@@ -103,7 +103,7 @@
if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
continue;
}
-
+
if (imp->ianacode < 128) {
if (already_did[imp->ianacode]) {
continue;
@@ -122,7 +122,7 @@
if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te);
}
-
+
if (tech_pvt->cng_pt && use_cng) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt);
}
@@ -154,12 +154,12 @@
if (already_did[imp->ianacode]) {
continue;
}
-
+
already_did[imp->ianacode] = 1;
}
-
+
rate = imp->samples_per_second;
-
+
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate);
if (imp->fmtp) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
@@ -188,7 +188,7 @@
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
#if 0
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio %d RTP/AVP", port);
-
+
if (tech_pvt->rm_encoding) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
} else if (tech_pvt->num_codecs) {
@@ -196,16 +196,16 @@
int already_did[128] = { 0 };
for (i = 0; i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-
+
if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) {
continue;
}
-
+
if (imp->ianacode < 128) {
if (already_did[imp->ianacode]) {
continue;
}
-
+
already_did[imp->ianacode] = 1;
}
@@ -218,14 +218,14 @@
}
if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
- if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
+ if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
!tech_pvt->local_sdp_video_port) {
sofia_glue_tech_choose_video_port(tech_pvt, 0);
}
if ((v_port = tech_pvt->adv_sdp_video_port)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
-
+
/*****************************/
if (tech_pvt->video_rm_encoding) {
sofia_glue_tech_set_video_codec(tech_pvt, 0);
@@ -235,18 +235,18 @@
int already_did[128] = { 0 };
for (i = 0; i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-
+
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
continue;
}
-
+
if (imp->ianacode < 128) {
if (already_did[imp->ianacode]) {
continue;
}
already_did[imp->ianacode] = 1;
}
-
+
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
if (!ptime) {
ptime = imp->microseconds_per_frame / 1000;
@@ -259,16 +259,17 @@
if (tech_pvt->video_rm_encoding) {
const char *of;
rate = tech_pvt->video_rm_rate;
- switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate);
-
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding,
+ tech_pvt->video_rm_rate);
+
pass_fmtp = NULL;
if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
pass_fmtp = of;
}
- }
-
+ }
+
if (ov_fmtp) {
pass_fmtp = ov_fmtp;
}
@@ -283,7 +284,7 @@
for (i = 0; i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
-
+
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
continue;
}
@@ -294,12 +295,13 @@
}
already_did[imp->ianacode] = 1;
}
-
+
if (!rate) {
rate = imp->samples_per_second;
}
- switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, imp->samples_per_second);
+ switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame,
+ imp->samples_per_second);
if (imp->fmtp) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp);
} else {
@@ -338,7 +340,7 @@
codec_string = tech_pvt->profile->codec_string;
}
}
-
+
if ((ocodec = switch_channel_get_variable(tech_pvt->channel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
if (!codec_string || (tech_pvt->profile->pflags & PFLAG_DISABLE_TRANSCODING)) {
codec_string = ocodec;
@@ -349,7 +351,7 @@
}
}
}
-
+
if (codec_string) {
char *tmp_codec_string;
if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
@@ -358,14 +360,13 @@
switch_loadable_module_get_codecs_sorted(tech_pvt->codecs, SWITCH_MAX_CODECS, tech_pvt->codec_order, tech_pvt->codec_order_last);
}
} else {
- tech_pvt->num_codecs =
- switch_loadable_module_get_codecs(tech_pvt->codecs, sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
+ tech_pvt->num_codecs = switch_loadable_module_get_codecs(tech_pvt->codecs, sizeof(tech_pvt->codecs) / sizeof(tech_pvt->codecs[0]));
}
-
+
}
-void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
+void sofia_glue_check_video_codecs(private_object_t *tech_pvt)
{
if (tech_pvt->num_codecs && !switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
int i;
@@ -481,7 +482,7 @@
char tmp[50];
if (!force) {
- if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
+ if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) ||
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->adv_sdp_audio_port) {
return SWITCH_STATUS_SUCCESS;
}
@@ -521,9 +522,10 @@
char *ip = tech_pvt->profile->rtpip;
switch_port_t sdp_port;
char tmp[50];
-
+
if (!force) {
- if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->local_sdp_video_port) {
+ if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)
+ || tech_pvt->local_sdp_video_port) {
return SWITCH_STATUS_SUCCESS;
}
}
@@ -537,7 +539,7 @@
return SWITCH_STATUS_FALSE;
}
sdp_port = tech_pvt->local_sdp_video_port;
-
+
if (tech_pvt->profile->extrtpip) {
if (sofia_glue_ext_address_lookup(&ip, &sdp_port, tech_pvt->profile->extrtpip, switch_core_session_get_pool(tech_pvt->session)) !=
@@ -559,26 +561,23 @@
{
if (!strncasecmp(str, "udp", 3)) {
return SOFIA_TRANSPORT_UDP;
- }
- else if (!strncasecmp(str, "tcp", 3)) {
+ } else if (!strncasecmp(str, "tcp", 3)) {
return SOFIA_TRANSPORT_TCP;
- }
- else if (!strncasecmp(str, "sctp", 4)) {
+ } else if (!strncasecmp(str, "sctp", 4)) {
return SOFIA_TRANSPORT_SCTP;
- }
- else if (!strncasecmp(str, "tls", 3)) {
+ } else if (!strncasecmp(str, "tls", 3)) {
return SOFIA_TRANSPORT_TCP_TLS;
}
return SOFIA_TRANSPORT_UNKNOWN;
}
-char * sofia_glue_find_parameter(const char *str, const char *param)
+char *sofia_glue_find_parameter(const char *str, const char *param)
{
char *ptr = NULL;
- ptr = (char *)str;
- while(ptr) {
+ ptr = (char *) str;
+ while (ptr) {
if (!strncasecmp(ptr, param, strlen(param)))
return ptr;
@@ -625,14 +624,11 @@
if (!strncasecmp(ptr, "udp", 3)) {
return SOFIA_TRANSPORT_UDP;
- }
- else if (!strncasecmp(ptr, "tcp", 3)) {
+ } else if (!strncasecmp(ptr, "tcp", 3)) {
return SOFIA_TRANSPORT_TCP;
- }
- else if (!strncasecmp(ptr, "tls", 3)) {
+ } else if (!strncasecmp(ptr, "tls", 3)) {
return SOFIA_TRANSPORT_TCP_TLS;
- }
- else if (!strncasecmp(ptr, "sctp", 4)) {
+ } else if (!strncasecmp(ptr, "sctp", 4)) {
return SOFIA_TRANSPORT_SCTP;
}
}
@@ -642,7 +638,7 @@
const char *sofia_glue_transport2str(const sofia_transport_t tp)
{
- switch(tp) {
+ switch (tp) {
case SOFIA_TRANSPORT_TCP:
return "tcp";
@@ -659,7 +655,7 @@
int sofia_glue_transport_has_tls(const sofia_transport_t tp)
{
- switch(tp) {
+ switch (tp) {
case SOFIA_TRANSPORT_TCP_TLS:
return 1;
@@ -668,7 +664,8 @@
}
}
-char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params)
+char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only,
+ const char *params)
{
char *stripped = switch_core_session_strdup(session, uri);
char *new_uri = NULL;
@@ -679,7 +676,7 @@
if (switch_stristr("port=", stripped)) {
new_uri = switch_core_session_sprintf(session, "%s%s%s", uri_only ? "" : "<", stripped, uri_only ? "" : ">");
} else {
-
+
if (strchr(stripped, ';')) {
if (params) {
new_uri = switch_core_session_sprintf(session, "%s%s&transport=%s;%s%s",
@@ -690,10 +687,10 @@
}
} else {
if (params) {
- new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s;%s%s",
+ new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s;%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), params, uri_only ? "" : ">");
} else {
- new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s",
+ new_uri = switch_core_session_sprintf(session, "%s%s;transport=%s%s",
uri_only ? "" : "<", stripped, sofia_glue_transport2str(transport), uri_only ? "" : ">");
}
}
@@ -705,11 +702,11 @@
new_uri = stripped;
}
}
-
+
return new_uri;
}
-switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
+switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
{
const char *err;
char rip[128] = "";
@@ -722,39 +719,39 @@
return SWITCH_STATUS_FALSE;
}
- if ((p = (char *)switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str))) {
+ if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str))) {
ip_ptr = p + 9;
}
- if ((p = (char *)switch_stristr("m=audio ", tech_pvt->remote_sdp_str))) {
+ if ((p = (char *) switch_stristr("m=audio ", tech_pvt->remote_sdp_str))) {
port_ptr = p + 8;
}
- if ((p = (char *)switch_stristr("m=video ", tech_pvt->remote_sdp_str))) {
+ if ((p = (char *) switch_stristr("m=video ", tech_pvt->remote_sdp_str))) {
vid_port_ptr = p + 8;
}
-
+
if (!(ip_ptr && port_ptr)) {
return SWITCH_STATUS_FALSE;
}
p = ip_ptr;
x = 0;
- while(x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+ while (x < sizeof(rip) && p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
rip[x++] = *p;
p++;
}
p = port_ptr;
x = 0;
- while(x < sizeof(rp) && p && *p && (*p >= '0' && *p <= '9')) {
+ while (x < sizeof(rp) && p && *p && (*p >= '0' && *p <= '9')) {
rp[x++] = *p;
p++;
}
p = vid_port_ptr;
x = 0;
- while(x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
+ while (x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
rvp[x++] = *p;
p++;
}
@@ -769,10 +766,10 @@
tech_pvt->remote_sdp_video_ip = switch_core_session_strdup(tech_pvt->session, rip);
tech_pvt->remote_sdp_video_port = (switch_port_t) atoi(rvp);
}
-
+
if (tech_pvt->remote_sdp_video_ip && tech_pvt->remote_sdp_video_port) {
if (!strcmp(tech_pvt->remote_sdp_video_ip, rip) && atoi(rvp) == tech_pvt->remote_sdp_video_port) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
} else {
switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
@@ -792,7 +789,7 @@
}
if (tech_pvt->remote_sdp_audio_ip && !strcmp(tech_pvt->remote_sdp_audio_ip, rip) && atoi(rp) == tech_pvt->remote_sdp_audio_port) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
return SWITCH_STATUS_SUCCESS;
}
@@ -808,7 +805,7 @@
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -824,8 +821,8 @@
}
len = strlen(tech_pvt->local_sdp_str) + 384;
-
- if ((p = (char *)switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
+
+ if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
ip_ptr = p + 9;
}
@@ -834,16 +831,16 @@
return;
}
- if ((p = (char *)switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
+ if ((p = (char *) switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
port_ptr = p + 8;
}
- if ((p = (char *)switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
+ if ((p = (char *) switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
vport_ptr = p + 8;
}
-
+
if (!(ip_ptr && port_ptr)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
return;
}
@@ -867,7 +864,7 @@
tech_pvt->orig_local_sdp_str = tech_pvt->local_sdp_str;
tech_pvt->local_sdp_str = switch_core_session_alloc(tech_pvt->session, len);
-
+
q = tech_pvt->local_sdp_str;
p = tech_pvt->orig_local_sdp_str;
@@ -876,36 +873,36 @@
strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip));
q += strlen(tech_pvt->adv_sdp_audio_ip);
x = 0;
- while(p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
+ while (p && *p && ((*p >= '0' && *p <= '9') || *p == '.')) {
p++;
}
} else if (p == port_ptr) {
char port_buf[25] = "";
-
+
switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
strncpy(q, port_buf, strlen(port_buf));
q += strlen(port_buf);
x = 0;
- while(p && *p && (*p >= '0' && *p <= '9')) {
+ while (p && *p && (*p >= '0' && *p <= '9')) {
p++;
}
- } else if (vport_ptr && tech_pvt->adv_sdp_video_port && p == vport_ptr) {
+ } else if (vport_ptr && tech_pvt->adv_sdp_video_port && p == vport_ptr) {
char port_buf[25] = "";
-
+
switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_video_port);
strncpy(q, port_buf, strlen(port_buf));
q += strlen(port_buf);
x = 0;
- while(p && *p && (*p >= '0' && *p <= '9')) {
+ while (p && *p && (*p >= '0' && *p <= '9')) {
p++;
}
}
*q++ = *p++;
}
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->orig_local_sdp_str, tech_pvt->local_sdp_str);
}
@@ -1014,9 +1011,9 @@
* since all of them have been already taken care of in mod_sofia.c:sofia_outgoing_channel()
*/
if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && switch_strlen_zero(tech_pvt->gateway_name)) {
- if ((p = (char *)switch_stristr("port=", url))) {
+ if ((p = (char *) switch_stristr("port=", url))) {
p += 5;
- tech_pvt->transport = sofia_glue_str2transport( p );
+ tech_pvt->transport = sofia_glue_str2transport(p);
} else {
if ((t_var = switch_channel_get_variable(channel, "sip_transport"))) {
tech_pvt->transport = sofia_glue_str2transport(t_var);
@@ -1045,23 +1042,19 @@
invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, NULL);
from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_FALSE, NULL);
to_str = sofia_overcome_sip_uri_weakness(session, tech_pvt->dest_to, 0, SWITCH_FALSE, invite_params);
-
+
/*
Does the "genius" who wanted SIP to be "text-based" so it was "easier to read" even use it now,
or did he just suggest it to make our lives miserable?
- */
+ */
use_from_str = from_str;
from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", tech_pvt->caller_profile->caller_id_name, use_from_str);
tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
- NUTAG_URL(url_str),
- SIPTAG_TO_STR(to_str),
- SIPTAG_FROM_STR(from_str),
- SIPTAG_CONTACT_STR(invite_contact),
- TAG_END());
+ NUTAG_URL(url_str), SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END());
+
-
if (strstr(tech_pvt->dest, ";nat") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
switch_set_flag(tech_pvt, TFLAG_NAT);
tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
@@ -1069,7 +1062,7 @@
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
-
+
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
@@ -1084,14 +1077,12 @@
screen = "yes";
}
- tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "Remote-Party-ID: \"%s\"<sip:%s@%s>;screen=%s;privacy=%s",
- tech_pvt->caller_profile->caller_id_name,
- tech_pvt->caller_profile->caller_id_number,
- rpid_domain,
- screen, priv);
+ tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "Remote-Party-ID: \"%s\"<sip:%s@%s>;screen=%s;privacy=%s",
+ tech_pvt->caller_profile->caller_id_name,
+ tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
switch_safe_free(d_url);
-
+
if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
abort();
}
@@ -1108,7 +1099,7 @@
e_dest = strdup(tech_pvt->e_dest);
switch_assert(e_dest != NULL);
user = e_dest;
-
+
if ((host = strchr(user, '@'))) {
*host++ = '\0';
}
@@ -1132,7 +1123,7 @@
for (; hi; hi = hi->next) {
const char *name = (char *) hi->name;
char *value = (char *) hi->value;
-
+
if (!strncasecmp(name, SOFIA_SIP_HEADER_PREFIX, strlen(SOFIA_SIP_HEADER_PREFIX))) {
const char *hname = name + strlen(SOFIA_SIP_HEADER_PREFIX);
stream.write_function(&stream, "%s: %s\r\n", hname, value);
@@ -1144,7 +1135,7 @@
if (stream.data) {
extra_headers = stream.data;
}
-
+
session_timeout = tech_pvt->profile->session_timeout;
if ((val = switch_channel_get_variable(channel, SOFIA_SESSION_TIMEOUT))) {
int v_session_timeout = atoi(val);
@@ -1198,9 +1189,7 @@
tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL,
SIPTAG_TO_STR(tech_pvt->dest),
- SIPTAG_FROM_STR(tech_pvt->from_str),
- SIPTAG_CONTACT_STR(tech_pvt->profile->url),
- TAG_END());
+ SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(tech_pvt->profile->url), TAG_END());
nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private);
@@ -1329,7 +1318,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
-
+
tech_pvt->video_fmtp_out = switch_core_session_strdup(tech_pvt->session, tech_pvt->video_write_codec.fmtp_out);
tech_pvt->video_write_codec.agreed_pt = tech_pvt->video_agreed_pt;
@@ -1378,7 +1367,7 @@
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
- }
+ }
if (switch_core_codec_init(&tech_pvt->write_codec,
tech_pvt->iananame,
@@ -1390,7 +1379,7 @@
NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
- }
+ }
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
@@ -1402,10 +1391,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
- tech_pvt->read_codec.implementation->samples_per_frame
- );
+ tech_pvt->read_codec.implementation->samples_per_frame);
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
-
+
tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
tech_pvt->read_codec.agreed_pt = tech_pvt->agreed_pt;
@@ -1441,12 +1429,12 @@
key = tech_pvt->remote_raw_key;
}
-
+
switch_rtp_get_random(key, SWITCH_RTP_KEY_LEN);
switch_b64_encode(key, SWITCH_RTP_KEY_LEN, b64_key, sizeof(b64_key));
- p = strrchr((char *)b64_key, '=');
+ p = strrchr((char *) b64_key, '=');
- while(p && *p && *p == '=') {
+ while (p && *p && *p == '=') {
*p-- = '\0';
}
@@ -1469,12 +1457,12 @@
if (!switch_rtp_ready(tech_pvt->rtp_session)) {
goto bad;
}
-
+
index = atoi(key_str);
p = strchr(key_str, ' ');
-
- if (p && *p && *(p+1)) {
+
+ if (p && *p && *(p + 1)) {
p++;
if (!strncasecmp(p, SWITCH_RTP_CRYPTO_KEY_32, strlen(SWITCH_RTP_CRYPTO_KEY_32))) {
type = AES_CM_128_HMAC_SHA1_32;
@@ -1486,7 +1474,7 @@
}
p = strchr(p, ' ');
- if (p && *p && *(p+1)) {
+ if (p && *p && *(p + 1)) {
p++;
if (strncasecmp(p, "inline:", 7)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error near [%s]\n", p);
@@ -1494,8 +1482,8 @@
}
p += 7;
- switch_b64_decode(p, (char *)key, sizeof(key));
-
+ switch_b64_decode(p, (char *) key, sizeof(key));
+
if (direction == SWITCH_RTP_CRYPTO_SEND) {
tech_pvt->crypto_send_type = type;
memcpy(tech_pvt->local_raw_key, key, SWITCH_RTP_KEY_LEN);
@@ -1507,8 +1495,8 @@
}
}
-
- bad:
+
+ bad:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
return SWITCH_STATUS_FALSE;
@@ -1532,7 +1520,7 @@
switch_assert(tech_pvt != NULL);
switch_core_session_signal_lock(tech_pvt->session);
-
+
if ((var = switch_channel_get_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
switch_set_flag_locked(tech_pvt, TFLAG_SECURE);
@@ -1556,7 +1544,7 @@
bw = tech_pvt->read_codec.implementation->bits_per_second;
ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
- if (myflags) {
+ if (myflags) {
flags = myflags;
} else {
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
@@ -1581,7 +1569,7 @@
flags |= SWITCH_RTP_FLAG_PASS_RFC2833;
}
- if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
+ if (!((tech_pvt->profile->pflags & PFLAG_REWRITE_TIMESTAMPS) ||
((val = switch_channel_get_variable(tech_pvt->channel, "rtp_rewrite_timestamps")) && !switch_true(val)))) {
flags |= SWITCH_RTP_FLAG_RAW_WRITE;
}
@@ -1589,7 +1577,7 @@
if (tech_pvt->cng_pt) {
flags |= SWITCH_RTP_FLAG_AUTO_CNG;
}
-
+
if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
@@ -1606,9 +1594,7 @@
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
- tech_pvt->remote_sdp_audio_port,
- tech_pvt->agreed_pt,
- tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
}
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
@@ -1627,9 +1613,9 @@
/* Reactivate the NAT buster flag. */
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
}
- goto video;
+ goto video;
}
-
+
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
goto end;
@@ -1642,9 +1628,7 @@
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
- tech_pvt->remote_sdp_audio_port,
- tech_pvt->agreed_pt,
- tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
} else {
timer_name = tech_pvt->profile->timer_name;
@@ -1657,11 +1641,8 @@
tech_pvt->agreed_pt,
tech_pvt->read_codec.implementation->samples_per_frame,
tech_pvt->codec_ms * 1000,
- (switch_rtp_flag_t) flags,
- timer_name,
- &err,
- switch_core_session_get_pool(tech_pvt->session));
-
+ (switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
+
if (switch_rtp_ready(tech_pvt->rtp_session)) {
uint8_t vad_in = switch_test_flag(tech_pvt, TFLAG_VAD_IN) ? 1 : 0;
uint8_t vad_out = switch_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
@@ -1694,14 +1675,14 @@
if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) {
int len = atoi(val);
-
+
if (len < 100 || len > 1000) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Jitterbuffer spec [%d] must be between 100 and 1000\n", len);
} else {
int qlen;
qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen);
}
@@ -1720,11 +1701,11 @@
rtp_hold_timeout_sec = v;
}
}
-
+
if (rtp_timeout_sec) {
- tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) /
+ tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) /
tech_pvt->read_codec.implementation->samples_per_frame;
-
+
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
if (!rtp_hold_timeout_sec) {
rtp_hold_timeout_sec = rtp_timeout_sec * 10;
@@ -1732,7 +1713,7 @@
}
if (rtp_hold_timeout_sec) {
- tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) /
+ tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) /
tech_pvt->read_codec.implementation->samples_per_frame;
}
@@ -1742,16 +1723,17 @@
if (tech_pvt->cng_pt) {
switch_rtp_set_cng_pt(tech_pvt->rtp_session, tech_pvt->cng_pt);
}
-
+
if (tech_pvt->remote_crypto_key && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
- switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key, SWITCH_RTP_KEY_LEN);
- switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
- tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
+ switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_SEND, 1, tech_pvt->crypto_type, tech_pvt->local_raw_key,
+ SWITCH_RTP_KEY_LEN);
+ switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag, tech_pvt->crypto_type, tech_pvt->remote_raw_key,
+ SWITCH_RTP_KEY_LEN);
switch_channel_set_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE, "true");
}
- video:
+ video:
sofia_glue_check_video_codecs(tech_pvt);
@@ -1760,7 +1742,7 @@
sofia_glue_tech_choose_video_port(tech_pvt, 1);
}
- flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
+ flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
@@ -1774,12 +1756,7 @@
tech_pvt->remote_sdp_video_ip,
tech_pvt->remote_sdp_video_port,
tech_pvt->video_agreed_pt,
- 1,
- 10000,
- (switch_rtp_flag_t) flags,
- NULL,
- &err,
- switch_core_session_get_pool(tech_pvt->session));
+ 1, 10000, (switch_rtp_flag_t) flags, NULL, &err, switch_core_session_get_pool(tech_pvt->session));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sVIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) ? "PROXY " : "",
@@ -1788,8 +1765,7 @@
tech_pvt->local_sdp_video_port,
tech_pvt->remote_sdp_video_ip,
tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt,
- 0,
- switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err);
+ 0, switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err);
if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
@@ -1809,13 +1785,13 @@
switch_set_flag(tech_pvt, TFLAG_IO);
status = SWITCH_STATUS_SUCCESS;
-
- end:
+
+ end:
switch_core_session_signal_unlock(tech_pvt->session);
return status;
-
+
}
switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_sdp)
@@ -1878,7 +1854,7 @@
switch_assert(tech_pvt != NULL);
greedy = !!(tech_pvt->profile->pflags & PFLAG_GREEDY);
-
+
if (!greedy) {
if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation")) && !strcasecmp(val, "greedy")) {
greedy = 1;
@@ -1893,7 +1869,7 @@
}
if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
- sendonly = 2; /* global sendonly always wins */
+ sendonly = 2; /* global sendonly always wins */
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
@@ -1924,7 +1900,7 @@
if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
stream = tech_pvt->profile->hold_music;
}
-
+
if (stream && switch_is_moh(stream)) {
if (!strcasecmp(stream, "indicate_hold")) {
switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
@@ -1939,7 +1915,7 @@
if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
const char *uuid;
switch_core_session_t *b_session;
-
+
if (tech_pvt->max_missed_packets) {
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
}
@@ -1999,7 +1975,7 @@
if (switch_rtp_ready(tech_pvt->rtp_session) && switch_test_flag(tech_pvt, TFLAG_SECURE)) {
sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
- switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
+ switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
tech_pvt->crypto_type, tech_pvt->remote_raw_key, SWITCH_RTP_KEY_LEN);
}
got_crypto++;
@@ -2012,7 +1988,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Remote Key [%s]\n", tech_pvt->remote_crypto_key);
tech_pvt->crypto_tag = crypto_tag;
got_crypto++;
-
+
if (switch_strlen_zero(tech_pvt->local_crypto_key)) {
if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_32, crypto)) {
switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_32);
@@ -2043,8 +2019,8 @@
match = 0;
break;
}
-
- greed:
+
+ greed:
x = 0;
if (tech_pvt->rm_encoding) {
@@ -2054,12 +2030,12 @@
} else {
match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
}
-
+
if (match) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec [%s] is still good, let's keep it\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Our existing codec [%s] is still good, let's keep it\n",
tech_pvt->rm_encoding);
- got_audio = 1;
- break;
+ got_audio = 1;
+ break;
}
}
}
@@ -2071,7 +2047,7 @@
uint32_t near_rate = 0;
const switch_codec_implementation_t *mimp = NULL, *near_match = NULL;
const char *rm_encoding;
-
+
if (x++ < skip) {
continue;
}
@@ -2079,7 +2055,7 @@
if (!(rm_encoding = map->rm_encoding)) {
rm_encoding = "";
}
-
+
if (!te && !strcasecmp(rm_encoding, "telephone-event")) {
te = tech_pvt->te = (switch_payload_t) map->rm_pt;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set 2833 dtmf payload to %u\n", te);
@@ -2096,19 +2072,20 @@
switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTO_CNG);
}
}
-
+
if (match) {
if (te && cng_pt) {
break;
}
continue;
}
-
+
if (greedy) {
first = mine;
last = first + 1;
} else {
- first = 0; last = tech_pvt->num_codecs;
+ first = 0;
+ last = tech_pvt->num_codecs;
}
for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
@@ -2119,13 +2096,13 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u]/[%s:%d:%u]\n",
- rm_encoding, map->rm_pt, (int)map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
+ rm_encoding, map->rm_pt, (int) map->rm_rate, imp->iananame, imp->ianacode, codec_rate);
if (map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
}
-
+
if (match) {
if ((ptime && ptime * 1000 != imp->microseconds_per_frame) || map->rm_rate != codec_rate) {
near_rate = map->rm_rate;
@@ -2139,15 +2116,15 @@
match = 0;
}
}
-
+
if (!match && near_match) {
const switch_codec_implementation_t *search[1];
char *prefs[1];
char tmp[80];
int num;
-
+
switch_snprintf(tmp, sizeof(tmp), "%s@%uk@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
-
+
prefs[0] = tmp;
num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
@@ -2156,7 +2133,7 @@
} else {
mimp = near_match;
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
mimp->iananame, mimp->microseconds_per_frame / 1000, mimp->samples_per_second);
match = 1;
@@ -2197,14 +2174,14 @@
goto greed;
}
- } else if (m->m_type == sdp_media_video && m->m_port) {
+ } else if (m->m_type == sdp_media_video && m->m_port) {
sdp_rtpmap_t *map;
const char *rm_encoding;
int framerate = 0;
const switch_codec_implementation_t *mimp = NULL;
int vmatch = 0, i;
switch_channel_set_variable(tech_pvt->channel, "video_possible", "true");
-
+
connection = sdp->sdp_connection;
if (m->m_connections) {
connection = m->m_connections;
@@ -2226,7 +2203,7 @@
if (!(rm_encoding = map->rm_encoding)) {
rm_encoding = "";
}
-
+
for (i = 0; i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
@@ -2241,7 +2218,7 @@
} else {
vmatch = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
}
-
+
if (vmatch && (map->rm_rate == imp->samples_per_second)) {
mimp = imp;
@@ -2251,7 +2228,7 @@
}
}
-
+
if (mimp) {
if ((tech_pvt->video_rm_encoding = switch_core_session_strdup(session, (char *) rm_encoding))) {
char tmp[50];
@@ -2269,7 +2246,7 @@
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->video_agreed_pt);
switch_channel_set_variable(tech_pvt->channel, "sip_video_pt", tmp);
sofia_glue_check_video_codecs(tech_pvt);
- break;
+ break;
} else {
vmatch = 0;
}
@@ -2408,7 +2385,7 @@
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is locked\n", profile->name);
#endif
profile = NULL;
- }
+ }
} else {
#ifdef SOFIA_DEBUG_RWLOCKS
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "Profile %s is not in the hash\n", key);
@@ -2420,7 +2397,7 @@
}
#endif
- done:
+ done:
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
return profile;
@@ -2458,7 +2435,7 @@
const void *var;
void *val;
sofia_profile_t *pptr;
-
+
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if (mod_sofia_globals.profile_hash) {
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -2492,12 +2469,9 @@
" call_id VARCHAR(255),\n"
" sip_user VARCHAR(255),\n"
" sip_host VARCHAR(255),\n"
- " contact VARCHAR(1024),\n"
- " status VARCHAR(255),\n"
- " rpid VARCHAR(255),\n"
- " expires INTEGER,\n"
- " user_agent VARCHAR(255)\n"
- ");\n";
+ " contact VARCHAR(1024),\n"
+ " status VARCHAR(255),\n"
+ " rpid VARCHAR(255),\n" " expires INTEGER,\n" " user_agent VARCHAR(255)\n" ");\n";
char dialog_sql[] =
"CREATE TABLE sip_dialogs (\n"
@@ -2507,12 +2481,9 @@
" sip_to_host VARCHAR(255),\n"
" sip_from_user VARCHAR(255),\n"
" sip_from_host VARCHAR(255),\n"
- " contact_user VARCHAR(255),\n"
- " contact_host VARCHAR(255),\n"
- " state VARCHAR(255),\n"
- " direction VARCHAR(255),\n"
- " user_agent VARCHAR(255)\n"
- ");\n";
+ " contact_user VARCHAR(255),\n"
+ " contact_host VARCHAR(255),\n"
+ " state VARCHAR(255),\n" " direction VARCHAR(255),\n" " user_agent VARCHAR(255)\n" ");\n";
char sub_sql[] =
"CREATE TABLE sip_subscriptions (\n"
@@ -2523,21 +2494,14 @@
" sub_to_host VARCHAR(255),\n"
" event VARCHAR(255),\n"
" contact VARCHAR(1024),\n"
- " call_id VARCHAR(255),\n"
- " full_from VARCHAR(255),\n"
- " full_via VARCHAR(255),\n"
- " expires INTEGER,\n"
- " user_agent VARCHAR(255),\n"
- " accept VARCHAR(255)\n"
- ");\n";
+ " call_id VARCHAR(255),\n"
+ " full_from VARCHAR(255),\n"
+ " full_via VARCHAR(255),\n"
+ " expires INTEGER,\n" " user_agent VARCHAR(255),\n" " accept VARCHAR(255)\n" ");\n";
+
+ char auth_sql[] = "CREATE TABLE sip_authentication (\n" " nonce VARCHAR(255),\n" " expires INTEGER" ");\n";
- char auth_sql[] =
- "CREATE TABLE sip_authentication (\n"
- " nonce VARCHAR(255),\n"
- " expires INTEGER"
- ");\n";
-
if (profile->odbc_dsn) {
#ifdef SWITCH_HAVE_ODBC
if (!(profile->master_odbc = switch_odbc_handle_new(profile->odbc_dsn, profile->odbc_user, profile->odbc_pass))) {
@@ -2549,13 +2513,14 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
-
+
if (switch_odbc_handle_exec(profile->master_odbc, "select sip_user,user_agent from sip_registrations", NULL) != SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_registrations", NULL);
switch_odbc_handle_exec(profile->master_odbc, reg_sql, NULL);
}
- if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions where sip_user != '' or accept != ''", NULL) != SWITCH_ODBC_SUCCESS) {
+ if (switch_odbc_handle_exec(profile->master_odbc, "delete from sip_subscriptions where sip_user != '' or accept != ''", NULL) !=
+ SWITCH_ODBC_SUCCESS) {
switch_odbc_handle_exec(profile->master_odbc, "DROP TABLE sip_subscriptions", NULL);
switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
}
@@ -2578,7 +2543,8 @@
}
switch_core_db_test_reactive(profile->master_db, "select sip_user,user_agent from sip_registrations", "DROP TABLE sip_registrations", reg_sql);
- switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions where sip_user != '' or accept != ''", "DROP TABLE sip_subscriptions", sub_sql);
+ switch_core_db_test_reactive(profile->master_db, "delete from sip_subscriptions where sip_user != '' or accept != ''",
+ "DROP TABLE sip_subscriptions", sub_sql);
switch_core_db_test_reactive(profile->master_db, "delete from sip_dialogs", "DROP TABLE sip_dialogs", dialog_sql);
switch_core_db_test_reactive(profile->master_db, "select * from sip_authentication", "DROP TABLE sip_authentication", auth_sql);
@@ -2590,13 +2556,13 @@
}
#endif
- return profile->master_db ? 1: 0;
+ return profile->master_db ? 1 : 0;
}
void sofia_glue_sql_close(sofia_profile_t *profile)
{
#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
switch_odbc_handle_destroy(&profile->master_odbc);
return;
}
@@ -2614,7 +2580,7 @@
switch_assert(sqlp && *sqlp);
sql = *sqlp;
-
+
if (profile->sql_queue) {
if (sql_already_dynamic) {
d_sql = sql;
@@ -2649,7 +2615,7 @@
switch_mutex_lock(mutex);
}
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
#ifdef SWITCH_HAVE_ODBC
SQLHSTMT stmt;
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
@@ -2678,7 +2644,7 @@
if (!master) {
switch_core_db_close(db);
}
- }
+ }
end:
if (mutex) {
@@ -2687,22 +2653,18 @@
}
switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
- switch_bool_t master,
- switch_mutex_t *mutex,
- char *sql,
- switch_core_db_callback_func_t callback,
- void *pdata)
+ switch_bool_t master, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
{
switch_bool_t ret = SWITCH_FALSE;
switch_core_db_t *db;
char *errmsg = NULL;
-
+
if (mutex) {
- switch_mutex_lock(mutex);
- }
+ switch_mutex_lock(mutex);
+ }
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
#ifdef SWITCH_HAVE_ODBC
switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata);
#else
@@ -2718,7 +2680,7 @@
goto end;
}
}
-
+
switch_core_db_exec(db, sql, callback, pdata, &errmsg);
if (errmsg) {
@@ -2729,12 +2691,12 @@
if (!master && db) {
switch_core_db_close(db);
}
- }
+ }
- end:
+ end:
if (mutex) {
- switch_mutex_unlock(mutex);
- }
+ switch_mutex_unlock(mutex);
+ }
return ret;
}
@@ -2760,7 +2722,7 @@
}
SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
- SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *)resbuf, (SQLLEN)len, NULL);
+ SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ret = resbuf;
}
@@ -2776,7 +2738,7 @@
char *ret = NULL;
#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
+ if (profile->odbc_dsn) {
return sofia_glue_execute_sql2str_odbc(profile, mutex, sql, resbuf, len);
}
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c Tue May 27 07:24:06 2008
@@ -127,7 +127,8 @@
void *val;
struct presence_helper helper = { 0 };
- if (!mod_sofia_globals.profile_hash) return;
+ if (!mod_sofia_globals.profile_hash)
+ return;
if ((sql = switch_mprintf("select *,-1,'unavailable','unavailable' from sip_subscriptions where event='presence'"))) {
switch_mutex_lock(mod_sofia_globals.hash_mutex);
@@ -151,16 +152,15 @@
void sofia_presence_establish_presence(sofia_profile_t *profile)
{
- if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
- "select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
+ if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
+ "select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
return;
}
if (sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex,
"select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
- "where proto='ext' or proto='user' or proto='conf'",
- sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
+ "where proto='ext' or proto='user' or proto='conf'", sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
return;
}
}
@@ -172,7 +172,7 @@
if (in && (switch_stristr("null", in))) {
in = NULL;
}
-
+
if (!in) {
in = ext;
}
@@ -233,7 +233,7 @@
return;
}
}
-
+
if (profile->domain_name && profile->domain_name != host) {
host = profile->domain_name;
}
@@ -251,43 +251,32 @@
if (!strcasecmp(hp->name, "mwi-message-account") && strncasecmp(hp->value, "sip:", 4)) {
tmp = switch_mprintf("sip:%s", hp->value);
value = tmp;
- }
+ }
stream.write_function(&stream, "%s: %s\r\n", hp->name + 4, value);
switch_safe_free(tmp);
}
}
stream.write_function(&stream, "\r\n");
-
- sql = switch_mprintf("select *,'%q' from sip_subscriptions where event='message-summary' and sub_to_user='%q' and sub_to_host='%q'",
+
+ sql = switch_mprintf("select *,'%q' from sip_subscriptions where event='message-summary' and sub_to_user='%q' and sub_to_host='%q'",
stream.data, user, host);
-
- switch_assert (sql != NULL);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_mwi_callback,
- &h);
+
+ switch_assert(sql != NULL);
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback, &h);
switch_safe_free(sql);
-
- sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'",
- stream.data, user, host);
-
-
- switch_assert (sql != NULL);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_mwi_callback2,
- &h);
-
+ sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'", stream.data, user, host);
+
+
+
+ switch_assert(sql != NULL);
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_mwi_callback2, &h);
+
switch_safe_free(sql);
switch_safe_free(stream.data);
@@ -312,11 +301,11 @@
char *sql = NULL;
char *euser = NULL, *user = NULL, *host = NULL;
-
+
if (!mod_sofia_globals.running) {
return;
}
-
+
if (rpid && !strcasecmp(rpid, "n/a")) {
rpid = NULL;
}
@@ -350,8 +339,9 @@
if (event->event_id == SWITCH_EVENT_ROSTER) {
struct presence_helper helper = { 0 };
- if (!mod_sofia_globals.profile_hash) return;
-
+ if (!mod_sofia_globals.profile_hash)
+ return;
+
if (from) {
sql = switch_mprintf("select *,1,'%q','%q' from sip_subscriptions where event='presence' and full_from like '%%%q%%'", status, rpid, from);
} else {
@@ -367,13 +357,8 @@
continue;
}
helper.profile = profile;
- helper.event = NULL;
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_sub_callback,
- &helper);
+ helper.event = NULL;
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_callback, &helper);
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
free(sql);
@@ -387,7 +372,7 @@
if (switch_strlen_zero(alt_event_type)) {
alt_event_type = "presence";
}
-
+
if ((user = strdup(from))) {
if ((host = strchr(user, '@'))) {
char *p;
@@ -432,15 +417,9 @@
"from sip_registrations left join sip_dialogs on "
"(sip_dialogs.sip_from_user = sip_registrations.sip_user) "
"and sip_dialogs.sip_from_host = sip_registrations.sip_host "
- "where sip_registrations.sip_user='%q' and sip_registrations.sip_host='%q'",
- probe_euser, probe_host);
+ "where sip_registrations.sip_user='%q' and sip_registrations.sip_host='%q'", probe_euser, probe_host);
switch_assert(sql);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_resub_callback,
- profile);
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_resub_callback, profile);
sofia_glue_release_profile(profile);
switch_safe_free(sql);
@@ -465,7 +444,8 @@
break;
}
- if (!mod_sofia_globals.profile_hash) goto done;
+ if (!mod_sofia_globals.profile_hash)
+ goto done;
switch_mutex_lock(mod_sofia_globals.hash_mutex);
for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -478,31 +458,27 @@
if (sql) {
struct presence_helper helper = { 0 };
helper.profile = profile;
- helper.event = event;
+ helper.event = event;
SWITCH_STANDARD_STREAM(helper.stream);
switch_assert(helper.stream.data);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE,
//profile->ireg_mutex,
- NULL,
- sql,
- sofia_presence_sub_callback,
- &helper);
-
- if (!switch_strlen_zero((char *)helper.stream.data)) {
- char *this = (char *)helper.stream.data;
+ NULL, sql, sofia_presence_sub_callback, &helper);
+
+ if (!switch_strlen_zero((char *) helper.stream.data)) {
+ char *this = (char *) helper.stream.data;
char *next = NULL;
char *last = NULL;
-
+
do {
if ((next = strchr(this, ';'))) {
*next++ = '\0';
- while(*next == '\n' || *next == ' ' || *next == '\r') {
+ while (*next == '\n' || *next == ' ' || *next == '\r') {
*next++ = '\0';
}
}
-
+
if (!switch_strlen_zero(this) && (!last || strcmp(last, this))) {
sofia_glue_execute_sql(profile, &this, SWITCH_FALSE);
last = this;
@@ -516,7 +492,7 @@
}
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
-done:
+ done:
switch_safe_free(sql);
switch_safe_free(user);
}
@@ -543,10 +519,10 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread Started\n");
-
+
while (mod_sofia_globals.running == 1) {
int count = 0;
-
+
if (switch_queue_trypop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event = (switch_event_t *) pop;
@@ -580,7 +556,7 @@
switch_event_t *event = (switch_event_t *) pop;
switch_event_destroy(&event);
}
-
+
while (switch_queue_trypop(mod_sofia_globals.mwi_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
switch_event_t *event = (switch_event_t *) pop;
switch_event_destroy(&event);
@@ -592,7 +568,7 @@
mod_sofia_globals.threads--;
EVENT_THREAD_RUNNING = EVENT_THREAD_STARTED = 0;
switch_mutex_unlock(mod_sofia_globals.mutex);
-
+
return NULL;
}
@@ -728,7 +704,7 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "astate", "%s", state);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "call-direction", "%s", direction);
}
-
+
switch_event_fire(&event);
}
@@ -738,7 +714,7 @@
static char *translate_rpid(char *in)
{
char *r = in;
-
+
if (in && (strstr(in, "null") || strstr(in, "NULL"))) {
in = NULL;
}
@@ -762,7 +738,7 @@
r = "busy";
}
- end:
+ end:
return r;
}
@@ -792,17 +768,17 @@
char *prpid;
int done = 0;
const char *ct = "no/idea";
- time_t exptime = switch_timestamp(NULL) + 3600;
- char exp[80] = "";
+ time_t exptime = switch_timestamp(NULL) + 3600;
+ char exp[80] = "";
int is_dialog = 0;
- if (expires) {
- long tmp = atol(expires);
- if (tmp > 0) {
- exptime = tmp - switch_timestamp(NULL);
+ if (expires) {
+ long tmp = atol(expires);
+ if (tmp > 0) {
+ exptime = tmp - switch_timestamp(NULL);
}
}
-
+
if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id);
return 0;
@@ -817,7 +793,7 @@
if (in < 0) {
done = 1;
in = 0;
- }
+ }
if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) {
clean_id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
@@ -838,7 +814,7 @@
to = switch_mprintf("sip:%s@%s", user, host);
is_dialog = !strcmp(event, "dialog");
-
+
if (helper->event) {
switch_stream_handle_t stream = { 0 };
const char *direction = switch_str_nil(switch_event_get_header(helper->event, "call-direction"));
@@ -854,7 +830,7 @@
const char *clean_to_user = NULL;
const char *clean_from_user = NULL;
-
+
if (is_dialog) {
SWITCH_STANDARD_STREAM(stream);
}
@@ -866,43 +842,43 @@
direction = "initiator";
dft_state = "confirmed";
}
-
+
if (!strcasecmp(state, "cs_execute") && !strstr(event_status, "hold")) {
goto end;
- }
-
+ }
+
if (!strcasecmp(event_status, "Registered")) {
answer_state = "resubscribe";
}
if (is_dialog) {
- stream.write_function(&stream,
+ stream.write_function(&stream,
"<?xml version=\"1.0\"?>\n"
"<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" "
- "version=\"%s\" state=\"%s\" entity=\"%s\">\n",
+ "version=\"%s\" state=\"%s\" entity=\"%s\">\n",
switch_str_nil(switch_event_get_header(helper->event, "event_count")),
!strcasecmp(answer_state, "resubscribe") ? "partial" : "full", clean_id);
}
-
+
if (strcasecmp(answer_state, "resubscribe")) {
if (!strcasecmp(state, "cs_hangup")) {
astate = "terminated";
- } else if (switch_strlen_zero(astate)) {
+ } else if (switch_strlen_zero(astate)) {
astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
- if (switch_strlen_zero(astate)) {
+ if (switch_strlen_zero(astate)) {
astate = dft_state;
}
- }
-
+ }
+
if (!strcasecmp(event_status, "hold")) {
astate = "early";
}
-
+
if (!strcasecmp(astate, "answered")) {
astate = "confirmed";
}
-
+
if (!strcasecmp(astate, "ringing")) {
if (!strcasecmp(direction, "recipient")) {
astate = "early";
@@ -915,7 +891,7 @@
stream.write_function(&stream, "<state>%s</state>\n", astate);
}
if (!strcasecmp(astate, "early") || !strcasecmp(astate, "confirmed")) {
-
+
clean_to_user = switch_mprintf("%s", sub_to_user ? sub_to_user : to_user);
clean_from_user = switch_mprintf("%s", from_id ? from_id : from_user);
@@ -923,24 +899,26 @@
if (!switch_strlen_zero(clean_to_user) && !switch_strlen_zero(clean_from_user)) {
stream.write_function(&stream, "<local>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_to_user, clean_to_user, host);
stream.write_function(&stream, "<target uri=\"sip:%s@%s\">\n", clean_to_user, host);
- stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n", !strcasecmp(event_status, "hold") ? "no" : "yes" );
- stream.write_function(&stream, "</target>\n</local>\n");
- stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_from_user, clean_from_user, host);
+ stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n",
+ !strcasecmp(event_status, "hold") ? "no" : "yes");
+ stream.write_function(&stream, "</target>\n</local>\n");
+ stream.write_function(&stream, "<remote>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_from_user, clean_from_user,
+ host);
stream.write_function(&stream, "<target uri=\"sip:**%s@%s\"/>\n", clean_to_user, host);
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "park")) {
- stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n",
+ stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n",
host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:parking@%s\">\n", host);
- stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
+ stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"parking\">sip:%s</identity>\n", uuid);
stream.write_function(&stream, "<target uri=\"sip:park+%s\"/>\n", uuid);
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "conf")) {
- stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n",
+ stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n",
host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:conference@%s\">\n", host);
- stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");
+ stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"conference\">sip:%s@%s</identity>\n", uuid, host);
stream.write_function(&stream, "<target uri=\"sip:conf+%s@%s\"/>\n", uuid, host);
stream.write_function(&stream, "</remote>\n");
@@ -948,7 +926,7 @@
}
}
if (is_dialog) {
- stream.write_function(&stream, "</dialog>\n");
+ stream.write_function(&stream, "</dialog>\n");
}
}
@@ -957,10 +935,10 @@
pl = stream.data;
ct = "application/dialog-info+xml";
}
-
+
if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';", astate, uuid);
-
+
switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
}
@@ -968,7 +946,7 @@
if (!is_dialog) {
if (in) {
char status_line[256] = "";
-
+
if (!strcmp(astate, "early")) {
switch_snprintf(status_line, sizeof(status_line), "R %s", switch_str_nil(from_id));
rpid = "on-the-phone";
@@ -976,8 +954,8 @@
char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number");
if (switch_strlen_zero(from_id) && !switch_strlen_zero(dest)) {
from_id = dest;
- }
-
+ }
+
if (switch_strlen_zero(from_id)) {
switch_snprintf(status_line, sizeof(status_line), "Available");
} else {
@@ -994,7 +972,7 @@
note = NULL;
open = "closed";
}
-
+
prpid = translate_rpid(rpid);
pl = switch_mprintf("<?xml version='1.0' encoding='UTF-8'?>\r\n"
"<presence xmlns='urn:ietf:params:xml:ns:pidf'\r\n"
@@ -1017,11 +995,8 @@
"</status>\r\n"
"</tuple>\r\n"
"<dm:person id='p06360c4a'>\r\n"
- "<rpid:activities>\r\n" "<rpid:%s/>\r\n"
- "</rpid:activities>%s</dm:person>\r\n"
- "</presence>", id,
- id, profile->url, open, status, prpid,
- open, rpid, note);
+ "<rpid:activities>\r\n" "<rpid:%s/>\r\n"
+ "</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
ct = "application/pidf+xml";
}
@@ -1055,21 +1030,16 @@
"</status>\r\n"
"</tuple>\r\n"
"<dm:person id='p06360c4a'>\r\n"
- "<rpid:activities>\r\n" "<rpid:%s/>\r\n"
- "</rpid:activities>%s</dm:person>\r\n"
- "</presence>", id,
- id, profile->url, open, status, prpid,
- open, rpid, note);
+ "<rpid:activities>\r\n" "<rpid:%s/>\r\n"
+ "</rpid:activities>%s</dm:person>\r\n" "</presence>", id, id, profile->url, open, status, prpid, open, rpid, note);
ct = "application/pidf+xml";
}
- switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime);
+ switch_snprintf(exp, sizeof(exp), "active;expires=%ld", (long) exptime);
nua_handle_bind(nh, &mod_sofia_globals.keep_private);
- nua_notify(nh,
- SIPTAG_SUBSCRIPTION_STATE_STR(exp),
- SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
+ nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR(exp), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
- end:
+ end:
switch_safe_free(id);
switch_safe_free(clean_id);
@@ -1101,15 +1071,15 @@
int expire_sec = atoi(expires);
//int *total = (int *) pArg;
struct mwi_helper *h = (struct mwi_helper *) pArg;
-
-
+
+
if (!(nh = nua_handle_by_call_id(h->profile->nua, call_id))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find handle for %s\n", call_id);
return 0;
}
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
- expire_sec = (int)(expire_sec - switch_timestamp(NULL));
+ expire_sec = (int) (expire_sec - switch_timestamp(NULL));
if (expire_sec < 0) {
expire_sec = 3600;
}
@@ -1118,7 +1088,7 @@
nua_notify(nh,
SIPTAG_SUBSCRIPTION_STATE_STR(exp),
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-
+
switch_safe_free(id);
switch_safe_free(exp);
@@ -1139,33 +1109,29 @@
char *id = NULL;
nua_handle_t *nh;
struct mwi_helper *h = (struct mwi_helper *) pArg;
-
-
+
+
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
contact = sofia_glue_get_url_from_contact(o_contact, 1);
-
- nh = nua_handle(h->profile->nua, NULL,
- NUTAG_URL(contact),
- SIPTAG_FROM_STR(id),
- SIPTAG_TO_STR(id),
- SIPTAG_CONTACT_STR(h->profile->url),
- TAG_END());
-
+
+ nh = nua_handle(h->profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(h->profile->url), TAG_END());
+
nua_notify(nh,
NUTAG_NEWSUB(1),
TAG_IF(strstr(o_contact, ";nat"), NUTAG_PROXY(contact)),
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-
+
switch_safe_free(contact);
switch_safe_free(id);
-
+
return 0;
}
void sofia_presence_handle_sip_i_subscribe(int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
if (sip) {
long exp, exp_raw;
@@ -1205,15 +1171,14 @@
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
- tl_gets(tags,
- NUTAG_SUBSTATE_REF(sub_state), TAG_END());
+ tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
event = sip_header_as_string(profile->home, (void *) sip->sip_event);
port = (char *) contact->m_url->url_port;
contact_host = sip->sip_contact->m_url->url_host;
contact_user = sip->sip_contact->m_url->url_user;
-
+
display = contact->m_display;
if (switch_strlen_zero(display)) {
@@ -1226,12 +1191,12 @@
} else {
display = "\"user\"";
}
-
+
if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
if (sip && sip->sip_via) {
const char *v_port = sip->sip_via->v_port;
const char *v_host = sip->sip_via->v_host;
-
+
if (v_host && sip->sip_via->v_received) {
is_nat = "via received";
} else if (v_host && strcmp(network_ip, v_host)) {
@@ -1241,27 +1206,27 @@
}
}
}
-
+
if (!is_nat && profile->nat_acl_count) {
uint32_t x = 0;
int ok = 1;
char *last_acl = NULL;
-
+
if (!switch_strlen_zero(contact_host)) {
- for (x = 0 ; x < profile->nat_acl_count; x++) {
+ for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
break;
}
}
-
+
if (ok) {
is_nat = last_acl;
}
}
}
-
-
+
+
if (is_nat) {
contact_host = network_ip;
switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
@@ -1272,14 +1237,14 @@
if (port) {
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
-
+
if (contact->m_url->url_params) {
contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, is_nat ? ";nat" : "");
} else {
contact_str = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact_host, new_port, is_nat ? ";nat" : "");
}
-
+
if (to) {
to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host); //, to->a_url->url_port);
@@ -1306,7 +1271,7 @@
if ((p = strchr(protocol, '+'))) {
*p = '\0';
}
-
+
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "proto", protocol);
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "login", "%s", profile->name);
@@ -1315,7 +1280,7 @@
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "status", "Click To Call");
switch_event_fire(&sevent);
}
-
+
} else {
if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
@@ -1358,12 +1323,7 @@
} else {
sql = switch_mprintf("delete from sip_subscriptions where "
"proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q'",
- proto,
- from_user,
- from_host,
- to_user,
- to_host, event
- );
+ proto, from_user, from_host, to_user, to_host, event);
}
@@ -1377,34 +1337,30 @@
sip_accept_t *ap = sip->sip_accept;
char accept[256] = "";
full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
- while(ap) {
+ while (ap) {
switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : "");
ap = ap->ac_next;
}
sql = switch_mprintf("insert into sip_subscriptions values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q')",
- proto, from_user, from_host, to_user, to_host, event,
- contact_str, call_id, full_from, full_via, exp, full_agent, accept);
-
+ proto, from_user, from_host, to_user, to_host, event, contact_str, call_id, full_from, full_via, exp, full_agent, accept);
+
switch_assert(sql != NULL);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
sstr = switch_mprintf("active;expires=%ld", exp_raw);
}
-
+
switch_mutex_unlock(profile->ireg_mutex);
if (status < 200) {
char *sticky = NULL;
-
+
if (is_nat) {
sticky = switch_mprintf("sip:%s@%s:%d", contact_user, network_ip, network_port);
}
- nua_respond(nh, SIP_202_ACCEPTED,
- NUTAG_WITH_THIS(nua),
- SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
- TAG_IF(sticky, NUTAG_PROXY(sticky)),
+ nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(sticky, NUTAG_PROXY(sticky)),
//SIPTAG_FROM(sip->sip_to),
//SIPTAG_TO(sip->sip_from),
//SIPTAG_CONTACT_STR(contact_str),
@@ -1413,32 +1369,26 @@
switch_safe_free(sticky);
}
-
+
sent_reply++;
#if 0
- nua_notify(nh,
+ nua_notify(nh,
NUTAG_NEWSUB(1),
- SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event),
+ SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event),
SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"),
- SIPTAG_PAYLOAD_STR("Note: Come to ClueCon http://www.cluecon.com\n\n"),
- TAG_END());
+ SIPTAG_PAYLOAD_STR("Note: Come to ClueCon http://www.cluecon.com\n\n"), TAG_END());
#endif
switch_safe_free(sstr);
if ((sql = switch_mprintf("select * from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_sub_reg_callback,
- profile);
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
switch_safe_free(sql);
}
- end:
+ end:
if (event) {
su_free(profile->home, event);
@@ -1466,13 +1416,15 @@
}
void sofia_presence_handle_sip_r_subscribe(int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
}
-void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -1573,8 +1525,9 @@
}
void sofia_presence_handle_sip_i_message(int status,
- char const *phrase,
- nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+ char const *phrase,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
if (sip) {
sip_from_t const *from = sip->sip_from;
@@ -1692,7 +1645,7 @@
if (sofia_reg_find_reg_url(tech_pvt->profile, sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host, buf, sizeof(buf))) {
home = su_home_new(sizeof(*home));
- switch_assert(home != NULL);
+ switch_assert(home != NULL);
tech_pvt->chat_from = sip_header_as_string(home, (const sip_header_t *) sip->sip_to);
tech_pvt->chat_to = switch_core_session_strdup(tech_pvt->session, buf);
sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip);
@@ -1706,6 +1659,7 @@
switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);
}
+
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c Tue May 27 07:24:06 2008
@@ -38,21 +38,21 @@
static void sofia_reg_kill_reg(sofia_gateway_t *gateway_ptr, int unreg)
{
- if (gateway_ptr->nh) {
- if (unreg) {
- nua_unregister(gateway_ptr->nh,
- NUTAG_URL(gateway_ptr->register_url),
- SIPTAG_FROM_STR(gateway_ptr->register_from),
- SIPTAG_TO_STR(gateway_ptr->register_from),
- SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
- SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
- NUTAG_REGISTRAR(gateway_ptr->register_proxy),
- NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
- }
- nua_handle_bind(gateway_ptr->nh, NULL);
- nua_handle_destroy(gateway_ptr->nh);
- gateway_ptr->nh = NULL;
- }
+ if (gateway_ptr->nh) {
+ if (unreg) {
+ nua_unregister(gateway_ptr->nh,
+ NUTAG_URL(gateway_ptr->register_url),
+ SIPTAG_FROM_STR(gateway_ptr->register_from),
+ SIPTAG_TO_STR(gateway_ptr->register_from),
+ SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
+ SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
+ NUTAG_REGISTRAR(gateway_ptr->register_proxy),
+ NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
+ }
+ nua_handle_bind(gateway_ptr->nh, NULL);
+ nua_handle_destroy(gateway_ptr->nh);
+ gateway_ptr->nh = NULL;
+ }
}
@@ -64,7 +64,7 @@
free(gateway_ptr->sofia_private);
gateway_ptr->sofia_private = NULL;
}
- sofia_reg_kill_reg(gateway_ptr, 1);
+ sofia_reg_kill_reg(gateway_ptr, 1);
}
}
@@ -94,7 +94,7 @@
gateway_ptr->pinging = 1;
nua_options(nh, TAG_END());
}
-
+
switch (ostate) {
case REG_STATE_NOREG:
gateway_ptr->status = SOFIA_GATEWAY_UP;
@@ -107,12 +107,12 @@
break;
case REG_STATE_UNREGISTER:
- sofia_reg_kill_reg(gateway_ptr, 1);
+ sofia_reg_kill_reg(gateway_ptr, 1);
gateway_ptr->state = REG_STATE_NOREG;
break;
case REG_STATE_UNREGED:
gateway_ptr->status = SOFIA_GATEWAY_DOWN;
- sofia_reg_kill_reg(gateway_ptr, 1);
+ sofia_reg_kill_reg(gateway_ptr, 1);
if ((gateway_ptr->nh = nua_handle(gateway_ptr->profile->nua, NULL,
NUTAG_URL(gateway_ptr->register_proxy),
@@ -120,10 +120,10 @@
NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END()))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "registering %s\n", gateway_ptr->name);
- if (!gateway_ptr->sofia_private) {
- gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
- switch_assert(gateway_ptr->sofia_private);
- }
+ if (!gateway_ptr->sofia_private) {
+ gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
+ switch_assert(gateway_ptr->sofia_private);
+ }
memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
gateway_ptr->sofia_private->gateway = gateway_ptr;
@@ -159,7 +159,7 @@
break;
case REG_STATE_FAILED:
- sofia_reg_kill_reg(gateway_ptr, 0);
+ sofia_reg_kill_reg(gateway_ptr, 0);
gateway_ptr->status = SOFIA_GATEWAY_DOWN;
case REG_STATE_TRYING:
if (gateway_ptr->retry && now >= gateway_ptr->retry) {
@@ -201,7 +201,7 @@
nua_options(nh, TAG_END());
switch_safe_free(contact);
-
+
return 0;
}
@@ -242,15 +242,10 @@
{
char sql[1024];
char *psql = sql;
-
+
switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where call_id='%s'", profile->name, call_id);
switch_mutex_lock(profile->ireg_mutex);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_TRUE,
- NULL,
- sql,
- sofia_reg_del_callback,
- NULL);
+ sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
switch_mutex_unlock(profile->ireg_mutex);
switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where call_id='%s'", call_id);
@@ -262,19 +257,19 @@
char sql[1024];
#ifdef SWITCH_HAVE_ODBC
- if (profile->odbc_dsn) {
- if (!profile->master_odbc) {
+ if (profile->odbc_dsn) {
+ if (!profile->master_odbc) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
return;
- }
- } else {
+ }
+ } else {
#endif
if (!profile->master_db) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
return;
}
#ifdef SWITCH_HAVE_ODBC
- }
+ }
#endif
@@ -286,12 +281,7 @@
switch_snprintf(sql, sizeof(sql), "select *,'%s' from sip_registrations where expires > 0", profile->name);
}
- sofia_glue_execute_sql_callback(profile,
- SWITCH_TRUE,
- NULL,
- sql,
- sofia_reg_del_callback,
- NULL);
+ sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_del_callback, NULL);
if (now) {
switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld", (long) now);
} else {
@@ -299,7 +289,7 @@
}
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-
+
if (now) {
switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld", (long) now);
} else {
@@ -307,7 +297,7 @@
}
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-
+
if (now) {
@@ -316,12 +306,7 @@
switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires > 0");
}
- sofia_glue_execute_sql_callback(profile,
- SWITCH_TRUE,
- NULL,
- sql,
- sofia_sub_del_callback,
- profile);
+ sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_sub_del_callback, profile);
if (now) {
switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld", (long) now);
@@ -330,16 +315,11 @@
}
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, NULL);
-
+
if (now) {
switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%AUTO-NAT%%'");
- sofia_glue_execute_sql_callback(profile,
- SWITCH_TRUE,
- NULL,
- sql,
- sofia_reg_nat_callback,
- profile);
+ sofia_glue_execute_sql_callback(profile, SWITCH_TRUE, NULL, sql, sofia_reg_nat_callback, profile);
}
switch_mutex_unlock(profile->ireg_mutex);
@@ -365,12 +345,7 @@
}
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- val,
- sofia_reg_find_callback,
- &cbt);
+ sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, val, sofia_reg_find_callback, &cbt);
if (cbt.matches) {
@@ -390,30 +365,24 @@
switch_uuid_get(&uuid);
switch_uuid_format(uuid_str, &uuid);
- sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)",
- uuid_str, switch_timestamp(NULL) + profile->nonce_ttl);
+ sql = switch_mprintf("insert into sip_authentication (nonce, expires) values('%q', %ld)", uuid_str, switch_timestamp(NULL) + profile->nonce_ttl);
switch_assert(sql != NULL);
sofia_glue_actually_execute_sql(profile, SWITCH_FALSE, sql, profile->ireg_mutex);
switch_safe_free(sql);
//sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
- auth_str =
- switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
+ auth_str = switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
if (regtype == REG_REGISTER) {
- nua_respond(nh,
- SIP_401_UNAUTHORIZED,
- TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
+ nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
} else if (regtype == REG_INVITE) {
- nua_respond(nh,
- SIP_407_PROXY_AUTH_REQUIRED,
- TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
+ nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
}
switch_safe_free(auth_str);
}
-uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
+uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
uint32_t keylen, switch_event_t **v_event, const char *is_nat)
{
sip_to_t const *to = NULL;
@@ -446,7 +415,7 @@
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-
+
expires = sip->sip_expires;
authorization = sip->sip_authorization;
contact = sip->sip_contact;
@@ -468,14 +437,14 @@
char new_port[25] = "";
const char *contact_host = contact->m_url->url_host;
display = contact->m_display;
-
+
if (is_nat) {
reg_desc = "Registered(AUTO-NAT)";
contact_host = network_ip;
switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
port = NULL;
}
-
+
if (switch_strlen_zero(display)) {
if (to) {
display = to->a_display;
@@ -495,13 +464,10 @@
if (contact->m_url->url_params) {
switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>%s%s",
- display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params,
- received_data,
- is_nat ? ";nat" : "");
+ display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, received_data, is_nat ? ";nat" : "");
} else {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port,
- received_data,
- is_nat ? ";nat" : "");
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port,
+ received_data, is_nat ? ";nat" : "");
}
}
@@ -524,37 +490,38 @@
if (authorization) {
char *v_contact_str;
- if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name,
+ if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name,
key, keylen, network_ip, v_event, exptime, regtype, to_user)) == AUTH_STALE) {
stale = 1;
}
-
+
if (exptime && v_event && *v_event) {
char *exp_var;
register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
-
+
/* Allow us to force the SIP user to be something specific - needed if
* we - for example - want to be able to ensure that the username a UA can
* be contacted at is the same one that they used for authentication.
- */
+ */
if ((force_user = switch_event_get_header(*v_event, "sip-force-user"))) {
to_user = force_user;
}
-
+
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
}
- if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
+ if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
if (contact->m_url->url_params) {
switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>%s;nat",
display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params, received_data);
} else {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip, network_port, received_data);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip,
+ network_port, received_data);
}
if (strstr(v_contact_str, "tls")) {
reg_desc = "Registered(TLSHACK)";
@@ -566,14 +533,14 @@
} else {
char *p;
switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
- for(p = contact_str; p && *p; p++) {
+ for (p = contact_str; p && *p; p++) {
if (*p == '\'' || *p == '[' || *p == ']') {
*p = '"';
}
}
}
}
-
+
if ((exp_var = switch_event_get_header(*v_event, "sip-force-expires"))) {
int tmp = atoi(exp_var);
if (tmp > 0) {
@@ -585,13 +552,9 @@
if (auth_res != AUTH_OK && !stale) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", to_user, to_host);
if (auth_res == AUTH_FORBIDDEN) {
- nua_respond(nh,
- SIP_403_FORBIDDEN,
- NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
} else {
- nua_respond(nh,
- SIP_401_UNAUTHORIZED,
- NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
}
return 1;
}
@@ -604,13 +567,13 @@
}
return 1;
}
- reg:
+ reg:
if (regtype != REG_REGISTER) {
return 0;
}
- call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
+ call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
switch_assert(call_id);
if (exptime) {
@@ -627,10 +590,9 @@
}
switch_mutex_lock(profile->ireg_mutex);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-
+
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q')", call_id,
- to_user, to_host, contact_str, reg_desc,
- rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
+ to_user, to_host, contact_str, reg_desc, rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
if (sql) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
@@ -647,7 +609,7 @@
switch_event_fire(&s_event);
}
-
+
if (profile->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
@@ -676,7 +638,7 @@
if ((sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
-
+
if ((sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
@@ -685,7 +647,7 @@
if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
-
+
if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, to_host))) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
@@ -709,22 +671,22 @@
switch_event_fire(&event);
}
-
+
/*
- if (call_id) {
- su_free(profile->home, call_id);
- }
- */
+ if (call_id) {
+ su_free(profile->home, call_id);
+ }
+ */
if (regtype == REG_REGISTER) {
char *new_contact = NULL;
char new_port[30] = "";
char exp_param[128] = "";
-
+
if (exptime) {
switch_snprintf(exp_param, sizeof(exp_param), ";expires=%ld", exptime);
}
-
+
if (contact->m_url->url_port) {
switch_snprintf(new_port, sizeof(new_port), ":%s", contact->m_url->url_port);
@@ -732,17 +694,12 @@
if (contact->m_url->url_params) {
new_contact = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
- display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params,
- exp_param);
+ display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params, exp_param);
} else {
- new_contact = switch_mprintf("%s <sip:%s@%s%s>%s",
- display, contact->m_url->url_user, contact->m_url->url_host, new_port,
- exp_param);
- }
-
- nua_respond(nh,
- SIP_200_OK,
- SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
+ new_contact = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact->m_url->url_host, new_port, exp_param);
+ }
+
+ nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
switch_safe_free(new_contact);
if (exptime) {
@@ -763,7 +720,7 @@
}
}
}
-
+
return 1;
}
@@ -773,7 +730,8 @@
-void sofia_reg_handle_sip_i_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
char key[128] = "";
switch_event_t *v_event = NULL;
@@ -785,7 +743,7 @@
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-
+
if (!(sip->sip_contact && sip->sip_contact->m_url)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
@@ -794,9 +752,7 @@
}
if (!(profile->mflags & MFLAG_REGISTER)) {
- nua_respond(nh,
- SIP_403_FORBIDDEN,
- NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
goto end;
}
@@ -804,7 +760,7 @@
if (sip && sip->sip_via) {
const char *port = sip->sip_via->v_port;
const char *host = sip->sip_via->v_host;
-
+
if (host && sip->sip_via->v_received) {
is_nat = "via received";
} else if (host && strcmp(network_ip, host)) {
@@ -826,13 +782,13 @@
}
if (!switch_strlen_zero(contact_host)) {
- for (x = 0 ; x < profile->nat_acl_count; x++) {
+ for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
break;
}
}
-
+
if (ok) {
is_nat = last_acl;
}
@@ -844,29 +800,25 @@
int ok = 1;
char *last_acl = NULL;
- for (x = 0 ; x < profile->reg_acl_count; x++) {
+ for (x = 0; x < profile->reg_acl_count; x++) {
last_acl = profile->reg_acl[x];
if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
break;
}
}
-
+
if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
type = REG_AUTO_REGISTER;
} else if (!ok) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
- nua_respond(nh,
- SIP_403_FORBIDDEN,
- NUTAG_WITH_THIS(nua), TAG_END());
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
+ nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
goto end;
}
}
-
+
if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
- nua_respond(nh,
- SIP_500_INTERNAL_SERVER_ERROR,
- TAG_END());
+ nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
goto end;
}
@@ -876,7 +828,7 @@
switch_event_fire(&v_event);
}
- end:
+ end:
nua_handle_destroy(nh);
@@ -885,7 +837,8 @@
void sofia_reg_handle_sip_r_register(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+ tagi_t tags[])
{
if (sofia_private && sofia_private->gateway) {
switch (status) {
@@ -915,7 +868,7 @@
void sofia_reg_handle_sip_r_challenge(int status,
char const *phrase,
- nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh,
+ nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
switch_core_session_t *session, sofia_gateway_t *gateway, sip_t const *sip, tagi_t tags[])
{
sip_www_authenticate_t const *authenticate = NULL;
@@ -976,17 +929,17 @@
return;
- cancel:
+ cancel:
if (session) {
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_MANDATORY_IE_MISSING);
} else {
nua_cancel(nh, TAG_END());
}
-
+
}
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
{
int indexnum;
@@ -1001,13 +954,13 @@
const char *a1_hash = NULL;
char *sql;
char *mailbox = NULL;
- switch_xml_t domain, xml = NULL, user, param, uparams, dparams;
+ switch_xml_t domain, xml = NULL, user, param, uparams, dparams;
char hexdigest[2 * SU_MD5_DIGEST_SIZE + 1] = "";
char *domain_name = NULL;
switch_event_t *params = NULL;
username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
-
+
if (authorization->au_params) {
for (indexnum = 0; (cur = authorization->au_params[indexnum]); indexnum++) {
char *var, *val, *p, *work;
@@ -1052,7 +1005,7 @@
ret = AUTH_STALE;
goto end;
}
-
+
/* Optional check that auth name == SIP username */
if ((regtype == REG_REGISTER) && (profile->pflags & PFLAG_CHECKUSER)) {
if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
@@ -1072,44 +1025,45 @@
goto end;
}
free(sql);
- }
-
+ }
+
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "sip_auth");
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent", (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent",
+ (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_username", username);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_realm", realm);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nonce", nonce);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_uri", uri);
- if (qop) {
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop);
- }
- if (cnonce) {
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_cnonce", cnonce);
- }
- if (nc) {
- switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nc", nc);
- }
+ if (qop) {
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop);
+ }
+ if (cnonce) {
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_cnonce", cnonce);
+ }
+ if (nc) {
+ switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nc", nc);
+ }
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_response", response);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_method", (sip && sip->sip_request) ? sip->sip_request->rq_method_name : NULL);
-
+
if (!switch_strlen_zero(profile->reg_domain)) {
domain_name = profile->reg_domain;
} else {
domain_name = realm;
}
-
+
if (switch_xml_locate_user("id", username, domain_name, ip, &xml, &domain, &user, params) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", username, domain_name);
ret = AUTH_FORBIDDEN;
goto end;
}
- if (!(mailbox = (char *)switch_xml_attr(user, "mailbox"))) {
+ if (!(mailbox = (char *) switch_xml_attr(user, "mailbox"))) {
mailbox = username;
}
@@ -1125,11 +1079,11 @@
for (param = switch_xml_child(dparams, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
-
+
if (!strcasecmp(var, "password")) {
passwd = val;
}
-
+
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
@@ -1140,11 +1094,11 @@
for (param = switch_xml_child(uparams, "param"); param; param = param->next) {
const char *var = switch_xml_attr_soft(param, "name");
const char *val = switch_xml_attr_soft(param, "value");
-
+
if (!strcasecmp(var, "password")) {
passwd = val;
}
-
+
if (!strcasecmp(var, "a1-hash")) {
a1_hash = val;
}
@@ -1164,10 +1118,10 @@
su_md5_deinit(&ctx);
switch_safe_free(input);
a1_hash = hexdigest;
-
+
}
- for_the_sake_of_interop:
+ for_the_sake_of_interop:
if ((input = switch_mprintf("%s:%q", regstr, uri))) {
su_md5_init(&ctx);
@@ -1176,38 +1130,38 @@
su_md5_deinit(&ctx);
}
- if (nc && cnonce && qop) {
- input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest);
- } else {
- input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
- }
-
- switch_assert(input2);
-
- memset(&ctx, 0, sizeof(ctx));
- su_md5_init(&ctx);
- su_md5_strupdate(&ctx, input2);
- su_md5_hexdigest(&ctx, bigdigest);
- su_md5_deinit(&ctx);
-
- if (!strcasecmp(bigdigest, response)) {
- ret = AUTH_OK;
- } else {
- if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
- /* some clients send an ACK with the method 'INVITE' in the hash which will break auth so we will
- try again with INVITE so we don't get people complaining to us when someone else's client has a bug......
- */
- switch_safe_free(input);
- switch_safe_free(input2);
- regstr = "INVITE";
- goto for_the_sake_of_interop;
- }
-
- ret = AUTH_FORBIDDEN;
- }
-
+ if (nc && cnonce && qop) {
+ input2 = switch_mprintf("%q:%q:%q:%q:%q:%q", a1_hash, nonce, nc, cnonce, qop, uridigest);
+ } else {
+ input2 = switch_mprintf("%q:%q:%q", a1_hash, nonce, uridigest);
+ }
- skip_auth:
+ switch_assert(input2);
+
+ memset(&ctx, 0, sizeof(ctx));
+ su_md5_init(&ctx);
+ su_md5_strupdate(&ctx, input2);
+ su_md5_hexdigest(&ctx, bigdigest);
+ su_md5_deinit(&ctx);
+
+ if (!strcasecmp(bigdigest, response)) {
+ ret = AUTH_OK;
+ } else {
+ if ((profile->ndlb & PFLAG_NDLB_BROKEN_AUTH_HASH) && strcasecmp(regstr, "REGISTER") && strcasecmp(regstr, "INVITE")) {
+ /* some clients send an ACK with the method 'INVITE' in the hash which will break auth so we will
+ try again with INVITE so we don't get people complaining to us when someone else's client has a bug......
+ */
+ switch_safe_free(input);
+ switch_safe_free(input2);
+ regstr = "INVITE";
+ goto for_the_sake_of_interop;
+ }
+
+ ret = AUTH_FORBIDDEN;
+ }
+
+
+ skip_auth:
if (first && ret == AUTH_OK) {
if (v_event) {
@@ -1223,7 +1177,7 @@
switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "mailbox", "%s", mailbox);
switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "user_name", "%s", username);
switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, "domain_name", "%s", realm);
-
+
if ((dparams = switch_xml_child(domain, "variables"))) {
xparams[i++] = dparams;
}
@@ -1243,7 +1197,7 @@
if (!switch_strlen_zero(var) && !switch_strlen_zero(val)) {
switch_event_add_header(*v_event, SWITCH_STACK_BOTTOM, var, "%s", val);
-
+
if (!strcasecmp(var, "register-gateway")) {
if (!strcasecmp(val, "all")) {
switch_xml_t gateways_tag, gateway_tag;
@@ -1253,7 +1207,7 @@
if (switch_strlen_zero(name)) {
name = "anonymous";
}
-
+
if ((gateway_ptr = sofia_reg_find_gateway(name))) {
gateway_ptr->retry = 0;
if (exptime) {
@@ -1263,7 +1217,7 @@
}
sofia_reg_release_gateway(gateway_ptr);
}
-
+
}
}
} else {
@@ -1272,11 +1226,11 @@
mydata = strdup(val);
switch_assert(mydata != NULL);
-
+
argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
for (x = 0; x < argc; x++) {
- if ((gateway_ptr = sofia_reg_find_gateway((char *)argv[x]))) {
+ if ((gateway_ptr = sofia_reg_find_gateway((char *) argv[x]))) {
gateway_ptr->retry = 0;
if (exptime) {
gateway_ptr->state = REG_STATE_UNREGED;
@@ -1298,7 +1252,7 @@
}
}
}
- end:
+ end:
switch_event_destroy(¶ms);
@@ -1329,7 +1283,7 @@
switch_mutex_lock(mod_sofia_globals.hash_mutex);
if ((gateway = (sofia_gateway_t *) switch_core_hash_find(mod_sofia_globals.gateway_hash, key))) {
if (!(gateway->profile->pflags & PFLAG_RUNNING)) {
- gateway = NULL;
+ gateway = NULL;
goto done;
}
if (switch_thread_rwlock_tryrdlock(gateway->profile->rwlock) != SWITCH_STATUS_SUCCESS) {
@@ -1343,7 +1297,7 @@
#endif
}
- done:
+ done:
switch_mutex_unlock(mod_sofia_globals.hash_mutex);
return gateway;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/lib_api.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/lib_api.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/lib_api.c Tue May 27 07:24:06 2008
@@ -39,16 +39,16 @@
#define RANGE_CHANNEL 0x1
-char read_enable=0;
-char write_enable=0;
-char primary_enable=0;
-int tx_cnt=1;
-int rx_cnt=0;
-int tx_size=10;
-int tx_delay=0;
-int tx_data=-1;
-int tx_ss7_type=0;
-int rx_ss7_timer=0;
+char read_enable = 0;
+char write_enable = 0;
+char primary_enable = 0;
+int tx_cnt = 1;
+int rx_cnt = 0;
+int tx_size = 10;
+int tx_delay = 0;
+int tx_data = -1;
+int tx_ss7_type = 0;
+int rx_ss7_timer = 0;
unsigned char card_name[WAN_IFNAME_SZ];
unsigned char if_name[WAN_IFNAME_SZ];
@@ -63,343 +63,343 @@
unsigned char saddr[TX_ADDR_STR_SZ];
unsigned char udata[TX_ADDR_STR_SZ];
-int files_used=0;
-int verbose=0;
+int files_used = 0;
+int verbose = 0;
-int tx_connections;
+int tx_connections;
-int ds_prot=0;
-int ds_prot_opt=0;
-int ds_max_mult_cnt=0;
-unsigned int ds_active_ch=0;
-int ds_7bit_hdlc=0;
-int direction=-1;
-
-int tx_channels=1;
-int cause=0;
-int diagn=0;
+int ds_prot = 0;
+int ds_prot_opt = 0;
+int ds_max_mult_cnt = 0;
+unsigned int ds_active_ch = 0;
+int ds_7bit_hdlc = 0;
+int direction = -1;
+
+int tx_channels = 1;
+int cause = 0;
+int diagn = 0;
-int card_cnt=0;
-int i_cnt=0;
+int card_cnt = 0;
+int i_cnt = 0;
-unsigned long parse_active_channel(char* val);
+unsigned long parse_active_channel(char *val);
int init_args(int argc, char *argv[])
{
int i;
- int c_cnt=0;
+ int c_cnt = 0;
- sprintf(daddr,"111");
- sprintf(saddr,"222");
- sprintf(udata,"C9");
-
- for (i = 0; i < argc; i++){
-
- if (!strcmp(argv[i],"-i")){
+ sprintf(daddr, "111");
+ sprintf(saddr, "222");
+ sprintf(udata, "C9");
- if (i+1 > argc-1){
+ for (i = 0; i < argc; i++) {
+
+ if (!strcmp(argv[i], "-i")) {
+
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Interface Name!\n");
return WAN_FALSE;
}
- strncpy(if_name, argv[i+1],WAN_IFNAME_SZ);
- i_cnt=1;
-
- }else if (!strcmp(argv[i],"-si")){
- if (i+1 > argc-1){
+ strncpy(if_name, argv[i + 1], WAN_IFNAME_SZ);
+ i_cnt = 1;
+
+ } else if (!strcmp(argv[i], "-si")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Switch Interface Name!\n");
return WAN_FALSE;
}
-
- strncpy(sw_if_name, argv[i+1], WAN_IFNAME_SZ);
- }else if (!strcmp(argv[i],"-c")){
- if (i+1 > argc-1){
+ strncpy(sw_if_name, argv[i + 1], WAN_IFNAME_SZ);
+
+ } else if (!strcmp(argv[i], "-c")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Card Name!\n");
return WAN_FALSE;
}
-
- strncpy(card_name, argv[i+1], WAN_IFNAME_SZ);
- card_cnt=1;
-
- }else if (!strcmp(argv[i],"-sc")){
- if (i+1 > argc-1){
+
+ strncpy(card_name, argv[i + 1], WAN_IFNAME_SZ);
+ card_cnt = 1;
+
+ } else if (!strcmp(argv[i], "-sc")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Switch Card Name!\n");
return WAN_FALSE;
}
-
- strncpy(sw_card_name, argv[i+1], WAN_IFNAME_SZ);
- }else if (!strcmp(argv[i],"-r")){
- read_enable=1;
- c_cnt=1;
-
- }else if (!strcmp(argv[i],"-w")){
- write_enable=1;
- c_cnt=1;
-
- }else if (!strcmp(argv[i],"-pri")){
- primary_enable=1;
-
- }else if (!strcmp(argv[i],"-txcnt")){
- if (i+1 > argc-1){
+ strncpy(sw_card_name, argv[i + 1], WAN_IFNAME_SZ);
+
+ } else if (!strcmp(argv[i], "-r")) {
+ read_enable = 1;
+ c_cnt = 1;
+
+ } else if (!strcmp(argv[i], "-w")) {
+ write_enable = 1;
+ c_cnt = 1;
+
+ } else if (!strcmp(argv[i], "-pri")) {
+ primary_enable = 1;
+
+ } else if (!strcmp(argv[i], "-txcnt")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid tx cnt!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- tx_cnt = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ tx_cnt = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx cnt!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-rxcnt")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-rxcnt")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid rx cnt!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- rx_cnt = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ rx_cnt = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid rx cnt!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-txsize")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-txsize")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid tx size!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- tx_size = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ tx_size = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx size, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-txdelay")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-txdelay")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid tx delay!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- tx_delay = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ tx_delay = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx delay, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-txdata")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-txdata")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid tx data!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- tx_data = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ tx_data = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx data, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-tx_ss7_type")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-tx_ss7_type")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid tx ss7 type!\n");
return WAN_FALSE;
}
-
- if(isdigit(argv[i+1][0])){
- tx_ss7_type = atoi(argv[i+1]);
- }else{
+
+ if (isdigit(argv[i + 1][0])) {
+ tx_ss7_type = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx ss7 type, must be a digit!\n");
return WAN_FALSE;
}
-
- }else if (!strcmp(argv[i],"-rx_ss7_timer")){
- if (i+1 > argc-1){
+
+ } else if (!strcmp(argv[i], "-rx_ss7_timer")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid rx ss7 timer!\n");
return WAN_FALSE;
}
-
- if(isdigit(argv[i+1][0])){
- rx_ss7_timer = atoi(argv[i+1]);
- }else{
+
+ if (isdigit(argv[i + 1][0])) {
+ rx_ss7_timer = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid tx ss7 type, must be a digit!\n");
return WAN_FALSE;
}
-
- }else if (!strcmp(argv[i],"-txfile")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-txfile")) {
+
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Tx File Name!\n");
return WAN_FALSE;
}
- strncpy(tx_file, argv[i+1],WAN_IFNAME_SZ);
+ strncpy(tx_file, argv[i + 1], WAN_IFNAME_SZ);
files_used |= TX_FILE_USED;
-
- }else if (!strcmp(argv[i],"-rxfile")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-rxfile")) {
+
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid Rx File Name!\n");
return WAN_FALSE;
}
- strncpy(rx_file, argv[i+1],WAN_IFNAME_SZ);
+ strncpy(rx_file, argv[i + 1], WAN_IFNAME_SZ);
files_used |= RX_FILE_USED;
- }else if (!strcmp(argv[i],"-daddr")){
+ } else if (!strcmp(argv[i], "-daddr")) {
- if (i+1 > argc-1){
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid daddr str!\n");
return WAN_FALSE;
}
- strncpy(daddr, argv[i+1],TX_ADDR_STR_SZ);
-
- }else if (!strcmp(argv[i],"-saddr")){
+ strncpy(daddr, argv[i + 1], TX_ADDR_STR_SZ);
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-saddr")) {
+
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid saddr str!\n");
return WAN_FALSE;
}
- strncpy(saddr, argv[i+1],TX_ADDR_STR_SZ);
-
- }else if (!strcmp(argv[i],"-udata")){
+ strncpy(saddr, argv[i + 1], TX_ADDR_STR_SZ);
+
+ } else if (!strcmp(argv[i], "-udata")) {
- if (i+1 > argc-1){
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid udata str!\n");
return WAN_FALSE;
}
- strncpy(udata, argv[i+1],TX_ADDR_STR_SZ);
+ strncpy(udata, argv[i + 1], TX_ADDR_STR_SZ);
- }else if (!strcmp(argv[i],"-verbose")){
- verbose=1;
+ } else if (!strcmp(argv[i], "-verbose")) {
+ verbose = 1;
- }else if (!strcmp(argv[i],"-prot")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-prot")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid prot!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- ds_prot = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ ds_prot = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid prot, must be a digit!\n");
return WAN_FALSE;
}
-
- }else if (!strcmp(argv[i],"-prot_opt")){
- if (i+1 > argc-1){
+
+ } else if (!strcmp(argv[i], "-prot_opt")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid prot_opt!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- ds_prot_opt = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ ds_prot_opt = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid prot_opt, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-max_mult_cnt")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-max_mult_cnt")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid max_mult_cnt!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- ds_max_mult_cnt = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ ds_max_mult_cnt = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid max_mult_cnt, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-active_ch")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-active_ch")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid active ch!\n");
return WAN_FALSE;
- }
+ }
- ds_active_ch = parse_active_channel(argv[i+1]);
- }else if (!strcmp(argv[i],"-txchan")){
- if (i+1 > argc-1){
+ ds_active_ch = parse_active_channel(argv[i + 1]);
+ } else if (!strcmp(argv[i], "-txchan")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid channels!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- tx_channels = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ tx_channels = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid channels, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-diagn")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-diagn")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid diagn!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- diagn = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ diagn = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid diagn, must be a digit!\n");
return WAN_FALSE;
}
-
- }else if (!strcmp(argv[i],"-cause")){
- if (i+1 > argc-1){
+
+ } else if (!strcmp(argv[i], "-cause")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid cause!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- cause = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ cause = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid cause, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-7bit_hdlc")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-7bit_hdlc")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid 7bit hdlc value!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- ds_7bit_hdlc = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ ds_7bit_hdlc = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid 7bit hdlc, must be a digit!\n");
return WAN_FALSE;
}
- }else if (!strcmp(argv[i],"-dir")){
- if (i+1 > argc-1){
+ } else if (!strcmp(argv[i], "-dir")) {
+ if (i + 1 > argc - 1) {
printf("ERROR: Invalid direction value!\n");
return WAN_FALSE;
- }
+ }
- if(isdigit(argv[i+1][0])){
- direction = atoi(argv[i+1]);
- }else{
+ if (isdigit(argv[i + 1][0])) {
+ direction = atoi(argv[i + 1]);
+ } else {
printf("ERROR: Invalid direction, must be a digit!\n");
return WAN_FALSE;
}
}
}
- if (!i_cnt){
+ if (!i_cnt) {
printf("ERROR: No Interface Name!\n");
return WAN_FALSE;
}
- if (!card_cnt){
+ if (!card_cnt) {
printf("ERROR: No Card name!\n");
return WAN_FALSE;
}
- if (!c_cnt){
+ if (!c_cnt) {
printf("ERROR: No Read or Write Command!\n");
return WAN_FALSE;
}
@@ -407,69 +407,66 @@
return WAN_TRUE;
}
-static unsigned char api_usage[]="\n"
-"\n"
-"<options>:\n"
-" -i <ifname> #interface name\n"
-" -c <card name> #card name\n"
-" -r #read enable\n"
-" -w #write eable\n"
-"\n"
-"<extra options>\n"
-" -txcnt <digit> #number of tx packets (Dflt: 1)\n"
-" -txsize <digit> #tx packet size (Dflt: 10)\n"
-" -txdelay <digit> #delay in sec after each tx packet (Dflt: 0)\n"
-" -txdata <digit> #data to tx <1-255>\n"
-"\n"
-" -txfile <file> #Use file to tx instead\n"
-" -rxfile <file> #Save all rx data to a file\n"
-" \n"
-"\n"
-" -tx_ss7_type <digit> # 1=FISU 2=LSSU (repeating)\n"
-" -rx_ss7_timer <digit> #Force receive timeout value \n"
-"\n"
-" -rxcnt <digit> #number of rx packets before exit\n"
-" #this number overwrites the txcnt\n"
-" #Thus, app will only exit after it\n"
-" #receives the rxcnt number of packets.\n"
-" \n"
-" -verbose #Enable verbose mode\n"
-"\n"
-"<datascope options>\n"
-"\n"
-" -prot <digit> #Protocol Bit map: \n"
-" #1=FISU, 2=LSSU, 4=MSU, 8=RAW HDLC\n"
-" \n"
-" -prot_opt <digit> #Protocol bit map\n"
-" #0=None, 1=Delta, 2=Max Multiple\n"
-"\n"
-" -active_ch <digit> #Active channel\n"
-" #ALL = all channels \n"
-" #1 24 = 1 to 24 \n"
-" #1.24 = 1 and 24 \n"
-" #1-4.7-15 = 1 to 4 and 7 to 15\n"
-" \n"
-" -max_mult_cnt <digit> #If Prot_opt == 2 \n"
-" #max_mult_cnt is the number of \n"
-" #consecutive duplicate frames \n"
-" #received before pass up the stack.\n"
-" \n"
-" -7bit_hdlc <digit> #Enable 7 Bit Hdlc Engine\n"
-" #1=Enable 0=Disable\n"
-" \n"
-" -dir <digit> #Direction 0: Rx 1: Tx none: All\n"
-"\n"
-"<x25 protocol options>\n"
-"\n"
-" -txchan <digit> #Number of channels (dflt=1)\n"
-" -cause <digit> #disconnect cause (dflt=0)\n"
-" -diagn <digit> #disconnect diagnostic (dflt=0)\n"
-"\n";
+static unsigned char api_usage[] = "\n"
+ "\n"
+ "<options>:\n"
+ " -i <ifname> #interface name\n"
+ " -c <card name> #card name\n"
+ " -r #read enable\n"
+ " -w #write eable\n"
+ "\n"
+ "<extra options>\n"
+ " -txcnt <digit> #number of tx packets (Dflt: 1)\n"
+ " -txsize <digit> #tx packet size (Dflt: 10)\n"
+ " -txdelay <digit> #delay in sec after each tx packet (Dflt: 0)\n"
+ " -txdata <digit> #data to tx <1-255>\n"
+ "\n"
+ " -txfile <file> #Use file to tx instead\n"
+ " -rxfile <file> #Save all rx data to a file\n"
+ " \n"
+ "\n"
+ " -tx_ss7_type <digit> # 1=FISU 2=LSSU (repeating)\n"
+ " -rx_ss7_timer <digit> #Force receive timeout value \n"
+ "\n"
+ " -rxcnt <digit> #number of rx packets before exit\n"
+ " #this number overwrites the txcnt\n"
+ " #Thus, app will only exit after it\n"
+ " #receives the rxcnt number of packets.\n"
+ " \n"
+ " -verbose #Enable verbose mode\n"
+ "\n"
+ "<datascope options>\n"
+ "\n"
+ " -prot <digit> #Protocol Bit map: \n"
+ " #1=FISU, 2=LSSU, 4=MSU, 8=RAW HDLC\n"
+ " \n"
+ " -prot_opt <digit> #Protocol bit map\n"
+ " #0=None, 1=Delta, 2=Max Multiple\n"
+ "\n"
+ " -active_ch <digit> #Active channel\n"
+ " #ALL = all channels \n"
+ " #1 24 = 1 to 24 \n"
+ " #1.24 = 1 and 24 \n"
+ " #1-4.7-15 = 1 to 4 and 7 to 15\n"
+ " \n"
+ " -max_mult_cnt <digit> #If Prot_opt == 2 \n"
+ " #max_mult_cnt is the number of \n"
+ " #consecutive duplicate frames \n"
+ " #received before pass up the stack.\n"
+ " \n"
+ " -7bit_hdlc <digit> #Enable 7 Bit Hdlc Engine\n"
+ " #1=Enable 0=Disable\n"
+ " \n"
+ " -dir <digit> #Direction 0: Rx 1: Tx none: All\n"
+ "\n"
+ "<x25 protocol options>\n"
+ "\n"
+ " -txchan <digit> #Number of channels (dflt=1)\n"
+ " -cause <digit> #disconnect cause (dflt=0)\n" " -diagn <digit> #disconnect diagnostic (dflt=0)\n" "\n";
void usage(unsigned char *api_name)
{
-printf ("\n\nAPI %s USAGE:\n\n%s <options> <extra options>\n\n%s\n",
- api_name,api_name,api_usage);
+ printf("\n\nAPI %s USAGE:\n\n%s <options> <extra options>\n\n%s\n", api_name, api_name, api_usage);
}
@@ -483,30 +480,30 @@
if ((channel_flag & (SINGLE_CHANNEL | RANGE_CHANNEL)) == 0)
return tmp;
- if (channel_flag & RANGE_CHANNEL) { /* Range of channels */
- for(i = start_channel; i <= stop_channel; i++) {
+ if (channel_flag & RANGE_CHANNEL) { /* Range of channels */
+ for (i = start_channel; i <= stop_channel; i++) {
mask = 1 << (i - 1);
- tmp |=mask;
+ tmp |= mask;
}
- } else { /* Single channel */
+ } else { /* Single channel */
mask = 1 << (stop_channel - 1);
- tmp |= mask;
+ tmp |= mask;
}
return tmp;
}
-unsigned long parse_active_channel(char* val)
+unsigned long parse_active_channel(char *val)
{
int channel_flag = 0;
- char* ptr = val;
+ char *ptr = val;
int channel = 0, start_channel = 0;
unsigned long tmp = 0;
- if (strcmp(val,"ALL") == 0)
+ if (strcmp(val, "ALL") == 0)
return ENABLE_ALL_CHANNELS;
- while(*ptr != '\0') {
+ while (*ptr != '\0') {
if (isdigit(*ptr)) {
channel = strtoul(ptr, &ptr, 10);
channel_flag |= SINGLE_CHANNEL;
@@ -521,7 +518,7 @@
ptr++;
}
}
- if (channel_flag){
+ if (channel_flag) {
tmp |= get_active_channels(channel_flag, start_channel, channel);
}
return tmp;
@@ -531,7 +528,7 @@
{
struct timeval tv;
tv.tv_usec = usec;
- tv.tv_sec=0;
+ tv.tv_sec = 0;
- select(0,NULL,NULL, NULL, &tv);
+ select(0, NULL, NULL, NULL, &tv);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Tue May 27 07:24:06 2008
@@ -86,8 +86,8 @@
switch_mutex_t *mutex;
};
-unsigned int txseq=0;
-unsigned int rxseq=0;
+unsigned int txseq = 0;
+unsigned int rxseq = 0;
#define SETUP_LEN CORE_MAX_CHAN_PER_SPAN*CORE_MAX_SPANS+1
@@ -233,19 +233,19 @@
static int local_sangoma_tdm_read_event(sng_fd_t fd, wp_tdm_api_rx_hdr_t *rx_event)
{
wanpipe_tdm_api_t tdm_api[1];
-
+
#if defined(WIN32)
- rx_event = &last_tdm_api_event_buffer;
+ rx_event = &last_tdm_api_event_buffer;
#else
- int err;
+ int err;
- tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
+ tdm_api->wp_tdm_cmd.cmd = SIOC_WP_TDM_READ_EVENT;
- if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
- return err;
- }
+ if ((err = sangoma_tdm_cmd_exec(fd, tdm_api))) {
+ return err;
+ }
- rx_event = &tdm_api->wp_tdm_cmd.event;
+ rx_event = &tdm_api->wp_tdm_cmd.event;
#endif
return 0;
@@ -261,7 +261,7 @@
{
wanpipe_tdm_api_t tdm_api;
- switch(alc->state) {
+ switch (alc->state) {
case ANALOG_STATE_DOWN:
sangoma_tdm_enable_rxhook_events(alc->sock->fd, &tdm_api);
analog_set_state(alc, ANALOG_STATE_ONHOOK);
@@ -275,7 +275,7 @@
{
wp_tdm_api_rx_hdr_t rx_event;
int err = local_sangoma_tdm_read_event(alc->sock->fd, &rx_event);
-
+
if (err < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reading event!\n");
return;
@@ -292,18 +292,18 @@
static void *SWITCH_THREAD_FUNC fxs_thread_run(switch_thread_t *thread, void *obj)
{
- for(;;) {
+ for (;;) {
int i = 0, sel_on = -1;
fd_set oob;
FD_ZERO(&oob);
-
- for(i = 0; i < globals.fxs_index; i++) {
+
+ for (i = 0; i < globals.fxs_index; i++) {
int fd;
assert(FXS_ANALOG_CHANNELS[i]);
assert(FXS_ANALOG_CHANNELS[i]->sock);
fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
-
+
analog_check_state(FXS_ANALOG_CHANNELS[i]);
FD_SET(fd, &oob);
@@ -315,7 +315,7 @@
if (sel_on > -1) {
if (select(++sel_on, NULL, NULL, &oob, NULL)) {
- for(i = 0; i < globals.fxs_index; i++) {
+ for (i = 0; i < globals.fxs_index; i++) {
int fd = FXS_ANALOG_CHANNELS[i]->sock->fd;
if (FD_ISSET(fd, &oob)) {
analog_parse_event(FXS_ANALOG_CHANNELS[i]);
@@ -332,7 +332,7 @@
sng_fd_t fd;
wpsock_t *sock;
char name[25];
-
+
snprintf(name, sizeof(name), "s%dc%d", span, chan);
switch_mutex_lock(globals.hash_mutex);
@@ -359,7 +359,7 @@
wpsock_t *sock;
sng_fd_t fd;
char name[25];
-
+
snprintf(name, sizeof(name), "s%dc%d", span, chan);
switch_mutex_lock(globals.hash_mutex);
@@ -375,7 +375,7 @@
sangoma_socket_close(&fd);
return 0;
}
-
+
return -1;
}
@@ -449,7 +449,7 @@
if (!strcasecmp(dp, "local"))
return PRI_LOCAL_ISDN;
if (!strcasecmp(dp, "private"))
- return PRI_PRIVATE;
+ return PRI_PRIVATE;
if (!strcasecmp(dp, "unknown"))
return PRI_UNKNOWN;
@@ -468,16 +468,14 @@
static switch_status_t wanpipe_on_soft_execute(switch_core_session_t *session);
static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
- switch_io_flag_t flags, int stream_id);
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame,
- switch_io_flag_t flags, int stream_id);
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
static int check_flags(struct sangoma_pri *spri);
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent);
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent);
static void *SWITCH_THREAD_FUNC pri_thread_run(switch_thread_t *thread, void *obj);
static switch_status_t config_wanpipe(int reload);
@@ -485,7 +483,7 @@
static switch_status_t wanpipe_codec_init(private_object_t *tech_pvt)
{
int err = 0;
- wanpipe_tdm_api_t tdm_api = {{0}};
+ wanpipe_tdm_api_t tdm_api = { {0} };
unsigned int rate = 8000;
switch_channel_t *channel = NULL;
@@ -498,7 +496,7 @@
assert(channel != NULL);
err = sangoma_tdm_set_codec(tech_pvt->wpsock->fd, &tdm_api, WP_SLINEAR);
-
+
sangoma_tdm_set_usr_period(tech_pvt->wpsock->fd, &tdm_api, globals.samples_per_frame / 8);
tech_pvt->frame_size = sangoma_tdm_get_usr_mtu_mru(tech_pvt->wpsock->fd, &tdm_api);
@@ -522,28 +520,28 @@
switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
-#ifdef DOTRACE
- tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
- tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
+#ifdef DOTRACE
+ tech_pvt->fd = open("/tmp/wp-in.raw", O_WRONLY | O_TRUNC | O_CREAT);
+ tech_pvt->fd2 = open("/tmp/wp-out.raw", O_WRONLY | O_TRUNC | O_CREAT);
#endif
/* Setup artificial DTMF stuff */
memset(&tech_pvt->tone_session, 0, sizeof(tech_pvt->tone_session));
teletone_init_session(&tech_pvt->tone_session, 1024, NULL, NULL);
-
+
if (globals.debug) {
tech_pvt->tone_session.debug = globals.debug;
tech_pvt->tone_session.debug_stream = stdout;
}
-
+
tech_pvt->tone_session.rate = rate;
tech_pvt->tone_session.duration = globals.dtmf_on * (tech_pvt->tone_session.rate / 1000);
tech_pvt->tone_session.wait = globals.dtmf_off * (tech_pvt->tone_session.rate / 1000);
- if (!globals.ignore_dtmf_tone) {
- teletone_dtmf_detect_init (&tech_pvt->dtmf_detect, rate);
+ if (!globals.ignore_dtmf_tone) {
+ teletone_dtmf_detect_init(&tech_pvt->dtmf_detect, rate);
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio init %s\n", switch_channel_get_name(channel));
switch_set_flag(tech_pvt, TFLAG_CODEC);
@@ -572,46 +570,46 @@
tech_pvt->read_frame.data = tech_pvt->databuf;
- if (tech_pvt->ss7boost_handle) {
+ if (tech_pvt->ss7boost_handle) {
if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
ss7boost_client_event_t event;
event.calling_number_presentation = tech_pvt->boost_pres;
event.trunk_group = tech_pvt->boost_trunk_group;
-
+
switch_mutex_lock(tech_pvt->ss7boost_handle->mutex);
tech_pvt->setup_index = ++tech_pvt->ss7boost_handle->setup_index;
if (tech_pvt->ss7boost_handle->setup_index == SETUP_LEN - 1) {
tech_pvt->ss7boost_handle->setup_index = 0;
}
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
-
+
switch_copy_string(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index],
- switch_core_session_get_uuid(session),
- sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
-
-
- ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number, tech_pvt->setup_index);
-
+ switch_core_session_get_uuid(session), sizeof(tech_pvt->ss7boost_handle->setup_array[tech_pvt->setup_index]));
+
+
+ ss7boost_client_call_init(&event, tech_pvt->caller_profile->caller_id_number, tech_pvt->caller_profile->destination_number,
+ tech_pvt->setup_index);
+
if (ss7boost_client_connection_write(&tech_pvt->ss7boost_handle->mcon, &event) <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Critical System Error: Failed to tx on ISUP socket [%s]\n", strerror(errno));
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Called Event TG=%d\n", tech_pvt->boost_trunk_group);
goto done;
}
- }
+ }
if ((status = wanpipe_codec_init(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return status;
}
-
+
if (switch_test_flag(tech_pvt, TFLAG_NOSIG)) {
switch_channel_mark_answered(channel);
}
- done:
+ done:
/* Move channel's state machine to ROUTING */
switch_channel_set_state(channel, CS_ROUTING);
@@ -631,7 +629,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE ROUTING\n");
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -642,7 +640,7 @@
switch_channel_t *channel = NULL;
struct channel_map *chanmap = NULL;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -661,11 +659,7 @@
switch_mutex_unlock(tech_pvt->ss7boost_handle->mutex);
if (!switch_test_flag(tech_pvt, TFLAG_BYE)) {
isup_exec_command(tech_pvt->ss7boost_handle,
- tech_pvt->boost_span_number,
- tech_pvt->boost_chan_number,
- -1,
- SIGBOOST_EVENT_CALL_STOPPED,
- SIGBOOST_RELEASE_CAUSE_NORMAL);
+ tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_NORMAL);
}
} else if (tech_pvt->spri) {
chanmap = tech_pvt->spri->private_info;
@@ -682,7 +676,7 @@
switch_mutex_lock(globals.channel_mutex);
*chanmap->map[tech_pvt->callno] = '\0';
switch_mutex_unlock(globals.channel_mutex);
-
+
}
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
@@ -690,7 +684,7 @@
teletone_destroy_session(&tech_pvt->tone_session);
switch_buffer_destroy(&tech_pvt->dtmf_buffer);
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -731,19 +725,14 @@
if (tech_pvt->spri) {
struct channel_map *chanmap = tech_pvt->spri->private_info;
-
+
if (switch_test_flag(tech_pvt, TFLAG_INBOUND)) {
switch_mutex_lock(chanmap->mutex);
pri_answer(tech_pvt->spri->pri, tech_pvt->call, 0, 1);
switch_mutex_unlock(chanmap->mutex);
}
} else if (tech_pvt->ss7boost_handle) {
- isup_exec_command(tech_pvt->ss7boost_handle,
- tech_pvt->boost_span_number,
- tech_pvt->boost_chan_number,
- -1,
- SIGBOOST_EVENT_CALL_ANSWERED,
- 0);
+ isup_exec_command(tech_pvt->ss7boost_handle, tech_pvt->boost_span_number, tech_pvt->boost_chan_number, -1, SIGBOOST_EVENT_CALL_ANSWERED, 0);
}
return SWITCH_STATUS_SUCCESS;
@@ -751,8 +740,7 @@
-static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
- switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
{
private_object_t *tech_pvt;
switch_channel_t *channel = NULL;
@@ -785,8 +773,7 @@
}
if ((bread = sangoma_readmsg_socket(tech_pvt->wpsock->fd,
- &tech_pvt->hdrframe,
- sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
+ &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), bp, sizeof(tech_pvt->databuf) - bytes, 0)) < 0) {
if (errno == EBUSY) {
continue;
} else {
@@ -804,15 +791,15 @@
tech_pvt->read_frame.datalen = bytes;
tech_pvt->read_frame.samples = bytes / 2;
-
+
if (!globals.ignore_dtmf_tone) {
- teletone_dtmf_detect (&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
+ teletone_dtmf_detect(&tech_pvt->dtmf_detect, tech_pvt->read_frame.data, tech_pvt->read_frame.samples);
teletone_dtmf_get(&tech_pvt->dtmf_detect, digit_str, sizeof(digit_str));
-
+
if (digit_str[0]) {
char *p = digit_str;
- switch_dtmf_t dtmf = {0, globals.dtmf_on};
- while(p && *p) {
+ switch_dtmf_t dtmf = { 0, globals.dtmf_on };
+ while (p && *p) {
dtmf.digit = *p;
switch_channel_queue_dtmf(channel, &dtmf);
p++;
@@ -830,7 +817,7 @@
tech_pvt->skip_read_frames--;
}
}
-#ifdef DOTRACE
+#ifdef DOTRACE
write(tech_pvt->fd2, tech_pvt->read_frame.data, (int) tech_pvt->read_frame.datalen);
#endif
//printf("read %d\n", tech_pvt->read_frame.datalen);
@@ -838,8 +825,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame,
- switch_io_flag_t flags, int stream_id)
+static switch_status_t wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
{
private_object_t *tech_pvt;
uint32_t dtmf_blen;
@@ -856,25 +842,24 @@
if (tech_pvt->dtmf_buffer && (dtmf_blen = switch_buffer_inuse(tech_pvt->dtmf_buffer))) {
uint32_t len = dtmf_blen > frame->datalen ? frame->datalen : dtmf_blen;
- switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);
+ switch_buffer_read(tech_pvt->dtmf_buffer, tech_pvt->auxbuf, len);
if (len < frame->datalen) {
uint8_t *data = frame->data;
memcpy(data + len, tech_pvt->auxbuf + len, frame->datalen - len);
}
- data= tech_pvt->auxbuf;
- }
-
+ data = tech_pvt->auxbuf;
+ }
+
if (tech_pvt->skip_write_frames) {
tech_pvt->skip_write_frames--;
return SWITCH_STATUS_SUCCESS;
}
-
#ifdef DOTRACE
write(tech_pvt->fd, data, frame->datalen);
#endif
result = sangoma_sendmsg_socket(tech_pvt->wpsock->fd, &tech_pvt->hdrframe, sizeof(tech_pvt->hdrframe), data, frame->datalen, 0);
-
+
if (result < 0 && errno != EBUSY) {
return SWITCH_STATUS_GENERR;
}
@@ -910,13 +895,13 @@
}
tech_pvt->tone_session.duration = dtmf.duration * (tech_pvt->tone_session.rate / 1000);
- if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int)dtmf->digit]))) {
+ if ((wrote = teletone_mux_tones(&tech_pvt->tone_session, &tech_pvt->tone_session.TONES[(int) dtmf->digit]))) {
switch_buffer_write(tech_pvt->dtmf_buffer, tech_pvt->tone_session.buffer, wrote * 2);
}
tech_pvt->skip_read_frames = 200;
-
+
return status;
}
@@ -927,7 +912,7 @@
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = (private_object_t *) switch_core_session_get_private(session);
assert(tech_pvt != NULL);
@@ -975,7 +960,7 @@
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
- switch(sig) {
+ switch (sig) {
case SWITCH_SIG_KILL:
switch_clear_flag_locked(tech_pvt, TFLAG_MEDIA);
break;
@@ -993,8 +978,8 @@
/*.read_frame */ wanpipe_read_frame,
/*.write_frame */ wanpipe_write_frame,
/*.kill_channel */ wanpipe_kill_channel,
- /*.send_dtmf*/ wanpipe_send_dtmf,
- /*.receive_message*/ wanpipe_receive_message
+ /*.send_dtmf */ wanpipe_send_dtmf,
+ /*.receive_message */ wanpipe_receive_message
};
switch_state_handler_table_t wanpipe_state_handlers = {
@@ -1023,7 +1008,7 @@
int span = 0, autospan = 0, autochan = 0;
char *num, *p;
struct channel_map *chanmap = NULL;
-
+
if (!outbound_profile) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh! no caller profile\n");
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
@@ -1038,7 +1023,7 @@
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
goto error;
}
-
+
*dest++ = '\0';
if (!strcasecmp(protocol, "raw")) {
@@ -1057,7 +1042,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error No SS7BOOST Spans Configured.\n");
}
}
-
+
if (!ready) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Continue!\n");
cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER;
@@ -1068,7 +1053,7 @@
if (!(*new_session = switch_core_session_request(wanpipe_endpoint_interface, pool))) {
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
- goto error;
+ goto error;
}
switch_core_session_add_stream(*new_session, NULL);
@@ -1085,7 +1070,7 @@
goto error;
}
-
+
caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
if (is_pri) {
@@ -1139,7 +1124,7 @@
if (is_raw) {
int chan, span;
- if (sangoma_span_chan_fromif (bchan, &span, &chan)) {
+ if (sangoma_span_chan_fromif(bchan, &span, &chan)) {
if (!(tech_pvt->wpsock = wp_open(span, chan))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n", span, chan, strerror(errno));
switch_core_session_destroy(new_session);
@@ -1148,7 +1133,7 @@
}
switch_set_flag_locked(tech_pvt, TFLAG_NOSIG);
snprintf(name, sizeof(name), "wanpipe/%s/nosig", bchan);
- switch_channel_set_name(channel, name);
+ switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid address\n");
@@ -1170,18 +1155,18 @@
if (SPANS[span] && (spri = &SPANS[span]->spri) && switch_test_flag(spri, SANGOMA_PRI_READY)) {
chanmap = spri->private_info;
-
+
if (autochan > 0) {
- for(callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
- if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
+ for (callno = 1; callno < SANGOMA_MAX_CHAN_PER_SPAN; callno++) {
+ if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
goto done;
}
}
callno = 0;
} else if (autochan < 0) {
- for(callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
- if ((SPANS[span]->bchans & (1 << callno)) && ! *chanmap->map[callno]) {
+ for (callno = SANGOMA_MAX_CHAN_PER_SPAN; callno > 0; callno--) {
+ if ((SPANS[span]->bchans & (1 << callno)) && !*chanmap->map[callno]) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choosing channel s%dc%d\n", span, callno);
goto done;
}
@@ -1196,7 +1181,7 @@
span--;
}
}
- done:
+ done:
switch_mutex_unlock(globals.channel_mutex);
if (!spri || callno == 0 || callno == (SANGOMA_MAX_CHAN_PER_SPAN)) {
@@ -1205,17 +1190,17 @@
cause = SWITCH_CAUSE_SWITCH_CONGESTION;
goto error;
}
-
+
tech_pvt->callno = callno;
-
+
if (spri) {
struct channel_map *chanmap = spri->private_info;
switch_mutex_lock(chanmap->mutex);
if (tech_pvt->call = pri_new_call(spri->pri)) {
struct pri_sr *sr;
-
+
snprintf(name, sizeof(name), "wanpipe/pri/s%dc%d/%s", spri->span, callno, caller_profile->destination_number);
- switch_channel_set_name(channel, name);
+ switch_channel_set_name(channel, name);
switch_channel_set_caller_profile(channel, caller_profile);
sr = pri_sr_new();
pri_sr_set_channel(sr, callno, 0, 0);
@@ -1223,23 +1208,18 @@
pri_sr_set_called(sr, caller_profile->destination_number, SPANS[span]->dp, 1);
pri_sr_set_caller(sr,
caller_profile->caller_id_number,
- caller_profile->caller_id_name,
- SPANS[span]->dp,
- PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
+ caller_profile->caller_id_name, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
pri_sr_set_redirecting(sr,
- caller_profile->caller_id_number,
- SPANS[span]->dp,
- PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN,
- PRI_REDIR_UNCONDITIONAL);
-
- if (pri_setup(spri->pri, tech_pvt->call , sr)) {
+ caller_profile->caller_id_number, SPANS[span]->dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL);
+
+ if (pri_setup(spri->pri, tech_pvt->call, sr)) {
switch_core_session_destroy(new_session);
pri_sr_free(sr);
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
switch_mutex_unlock(chanmap->mutex);
goto error;
}
-
+
if (!(tech_pvt->wpsock = wp_open(spri->span, callno))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd!\n");
switch_core_session_destroy(new_session);
@@ -1249,9 +1229,7 @@
goto error;
}
pri_sr_free(sr);
- switch_copy_string(chanmap->map[callno],
- switch_core_session_get_uuid(*new_session),
- sizeof(chanmap->map[callno]));
+ switch_copy_string(chanmap->map[callno], switch_core_session_get_uuid(*new_session), sizeof(chanmap->map[callno]));
tech_pvt->spri = spri;
}
switch_mutex_unlock(chanmap->mutex);
@@ -1262,8 +1240,8 @@
if ((p = strchr(caller_profile->destination_number, '/'))) {
char *grp = caller_profile->destination_number;
*p = '\0';
- caller_profile->destination_number = p+1;
- tech_pvt->boost_trunk_group = atoi(grp+1) - 1;
+ caller_profile->destination_number = p + 1;
+ tech_pvt->boost_trunk_group = atoi(grp + 1) - 1;
if (tech_pvt->boost_trunk_group < 0) {
tech_pvt->boost_trunk_group = 0;
}
@@ -1284,9 +1262,9 @@
switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
switch_channel_set_state(channel, CS_INIT);
cause = SWITCH_CAUSE_SUCCESS;
-
- error:
+
+ error:
switch_safe_free(protocol);
return cause;
}
@@ -1357,7 +1335,7 @@
/*event Handlers */
-static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum);
if (strlen(pevent->ring.callednum) > 3) {
@@ -1367,7 +1345,7 @@
return 0;
}
-static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
struct channel_map *chanmap;
switch_core_session_t *session;
@@ -1409,7 +1387,7 @@
return 0;
}
-static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1427,12 +1405,12 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Answer on channel s%dc%d but it's not in use?\n", spri->span, pevent->answer.channel);
}
-
+
return 0;
}
-static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1444,16 +1422,16 @@
switch_core_session_message_t *msg;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, pevent->proceeding.channel);
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
switch_channel_mark_pre_answered(channel);
-
+
switch_core_session_rwunlock(session);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n",
spri->span, pevent->proceeding.channel);
}
@@ -1461,7 +1439,7 @@
}
-static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
switch_core_session_t *session;
switch_channel_t *channel;
@@ -1480,34 +1458,34 @@
switch_core_session_rwunlock(session);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span,
+ pevent->ringing.channel, chanmap->map[pevent->ringing.channel]);
}
return 0;
}
-static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
char name[128];
switch_core_session_t *session = NULL;
switch_channel_t *channel;
struct channel_map *chanmap;
int ret = 0;
-
+
switch_mutex_lock(globals.channel_mutex);
chanmap = spri->private_info;
if ((session = switch_core_session_locate(chanmap->map[pevent->ring.channel]))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n",
- spri->span, pevent->ring.channel);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate Ring on channel s%dc%d (ignored)\n", spri->span, pevent->ring.channel);
switch_core_session_rwunlock(session);
ret = 0;
goto done;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Ring on channel s%dc%d (from %s to %s)\n", spri->span, pevent->ring.channel,
- pevent->ring.callingnum, pevent->ring.callednum);
+ pevent->ring.callingnum, pevent->ring.callednum);
switch_mutex_unlock(chanmap->mutex);
pri_proceeding(spri->pri, pevent->ring.call, pevent->ring.channel, 0);
@@ -1540,21 +1518,14 @@
}
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL,
- globals.dialplan,
- "FreeSWITCH",
- pevent->ring.callingnum,
+ NULL, globals.dialplan, "FreeSWITCH", pevent->ring.callingnum,
#ifdef WIN32
NULL,
#else
pevent->ring.callingani,
#endif
switch_strlen_zero(ani2str) ? NULL : ani2str,
- NULL,
- NULL,
- (char *)modname,
- globals.context,
- pevent->ring.callednum))) {
+ NULL, NULL, (char *) modname, globals.context, pevent->ring.callednum))) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
@@ -1565,7 +1536,7 @@
if (!tech_pvt->call) {
tech_pvt->call = pevent->ring.call;
}
-
+
tech_pvt->callno = pevent->ring.channel;
tech_pvt->span = spri->span;
@@ -1574,7 +1545,7 @@
}
switch_copy_string(chanmap->map[pevent->ring.channel], switch_core_session_get_uuid(session), sizeof(chanmap->map[pevent->ring.channel]));
-
+
switch_channel_set_state(channel, CS_INIT);
if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n");
@@ -1586,9 +1557,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
}
- done:
+ done:
switch_mutex_unlock(globals.channel_mutex);
-
+
return ret;
}
@@ -1598,7 +1569,7 @@
return 0;
}
-static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
switch_core_session_t *session;
struct channel_map *chanmap;
@@ -1612,7 +1583,7 @@
chanmap = spri->private_info;
-
+
if ((session = switch_core_session_locate(chanmap->map[pevent->restart.channel]))) {
switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
@@ -1620,13 +1591,13 @@
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
switch_core_session_rwunlock(session);
}
-
+
wp_restart(spri->span, pevent->restart.channel);
return 0;
}
-static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_dchan_up(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
if (!switch_test_flag(spri, SANGOMA_PRI_READY)) {
@@ -1637,22 +1608,21 @@
return 0;
}
-static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_dchan_down(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
if (switch_test_flag(spri, SANGOMA_PRI_READY)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span);
switch_clear_flag(spri, SANGOMA_PRI_READY);
}
-
+
return 0;
}
-static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *pevent)
+static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event * pevent)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type,
- sangoma_pri_event_str(event_type));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span, event_type, sangoma_pri_event_str(event_type));
return 0;
}
@@ -1699,7 +1669,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -1716,12 +1686,12 @@
switch_mutex_lock(ss7boost_handle->mutex);
ss7boost_client_event_init(&oevent, cmd, chan, span);
oevent.release_cause = cause;
-
+
if (id >= 0) {
oevent.call_setup_id = id;
}
-
- if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0){
+
+ if (ss7boost_client_connection_write(&ss7boost_handle->mcon, &oevent) <= 0) {
r = -1;
}
@@ -1733,26 +1703,26 @@
#ifdef USE_WAITFOR_SOCKET
static int waitfor_socket(int fd, int timeout, int flags)
{
- struct pollfd pfds[1];
- int res;
-
- memset(&pfds[0], 0, sizeof(pfds[0]));
- pfds[0].fd = fd;
- pfds[0].events = flags;
- res = poll(pfds, 1, timeout);
-
- if (res > 0) {
- if (pfds[0].revents & POLLIN) {
- res = 1;
- } else if ((pfds[0].revents & POLLERR)) {
- res = -1;
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"System Error: Poll Event Error no event!\n");
- res = -1;
+ struct pollfd pfds[1];
+ int res;
+
+ memset(&pfds[0], 0, sizeof(pfds[0]));
+ pfds[0].fd = fd;
+ pfds[0].events = flags;
+ res = poll(pfds, 1, timeout);
+
+ if (res > 0) {
+ if (pfds[0].revents & POLLIN) {
+ res = 1;
+ } else if ((pfds[0].revents & POLLERR)) {
+ res = -1;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "System Error: Poll Event Error no event!\n");
+ res = -1;
+ }
}
- }
- return res;
+ return res;
}
#endif
@@ -1780,7 +1750,7 @@
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1792,14 +1762,9 @@
}
*uuid = '\0';
- }
+ }
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- -1,
- SIGBOOST_EVENT_CALL_STOPPED_ACK,
- 0);
+ isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED_ACK, 0);
}
@@ -1811,16 +1776,11 @@
char name[128];
if (*ss7boost_handle->span_chanmap[event->span].map[event->chan]) {
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- -1,
- SIGBOOST_EVENT_CALL_START_NACK,
- SIGBOOST_RELEASE_CAUSE_BUSY);
+ isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_NACK, SIGBOOST_RELEASE_CAUSE_BUSY);
return;
}
-
+
if ((session = switch_core_session_request(wanpipe_endpoint_interface, NULL))) {
private_object_t *tech_pvt;
@@ -1830,7 +1790,7 @@
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
channel = switch_core_session_get_channel(session);
switch_core_session_set_private(session, tech_pvt);
- sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span+1, event->chan+1);
+ sprintf(name, "wanpipe/ss7boost/s%dc%d", event->span + 1, event->chan + 1);
switch_channel_set_name(channel, name);
tech_pvt->session = session;
} else {
@@ -1840,21 +1800,13 @@
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
- NULL,
- globals.dialplan,
- "FreeSWITCH(boost)",
- (char *)event->calling_number_digits,
+ NULL, globals.dialplan, "FreeSWITCH(boost)", (char *) event->calling_number_digits,
#ifdef WIN32
NULL,
#else
- (char *)event->calling_number_digits,
+ (char *) event->calling_number_digits,
#endif
- NULL,
- NULL,
- NULL,
- (char *)modname,
- NULL,
- (char *)event->called_number_digits))) {
+ NULL, NULL, NULL, (char *) modname, NULL, (char *) event->called_number_digits))) {
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
@@ -1866,40 +1818,30 @@
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
tech_pvt->boost_pres = event->calling_number_presentation;
-
- if (!(tech_pvt->wpsock = wp_open(event->span+1, event->chan+1))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span+1, event->chan+1);
+
+ if (!(tech_pvt->wpsock = wp_open(event->span + 1, event->chan + 1))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open channel %d:%d\n", event->span + 1, event->chan + 1);
goto fail;
}
- switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
+ switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
-
+
switch_channel_set_state(channel, CS_INIT);
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- -1,
- SIGBOOST_EVENT_CALL_START_ACK,
- 0);
+ isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_START_ACK, 0);
switch_core_session_thread_launch(session);
return;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Create new Inbound Channel!\n");
}
-
- fail:
+
+ fail:
if (session) {
switch_core_session_destroy(&session);
}
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- -1,
- SIGBOOST_EVENT_CALL_STOPPED,
- SIGBOOST_RELEASE_CAUSE_BUSY);
+ isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_CALL_STOPPED, SIGBOOST_RELEASE_CAUSE_BUSY);
}
@@ -1909,45 +1851,40 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Heartbeat!\n");
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- -1,
- SIGBOOST_EVENT_HEARTBEAT,
- 0);
+ isup_exec_command(ss7boost_handle, event->span, event->chan, -1, SIGBOOST_EVENT_HEARTBEAT, 0);
}
static void handle_call_start_ack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-
+
if (*uuid) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
+
tech_pvt->ss7boost_handle = ss7boost_handle;
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
-
- switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
+
+ switch_copy_string(ss7boost_handle->span_chanmap[event->span].map[event->chan], switch_core_session_get_uuid(session),
sizeof(ss7boost_handle->span_chanmap[event->span].map[event->chan]));
if (!tech_pvt->wpsock) {
- if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
- tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
+ if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+ tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return;
}
@@ -1958,7 +1895,7 @@
}
switch_channel_mark_pre_answered(channel);
-
+
switch_core_session_rwunlock(session);
}
*uuid = '\0';
@@ -1976,11 +1913,11 @@
if (*uuid) {
switch_core_session_t *session;
-
+
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@@ -1988,9 +1925,9 @@
assert(tech_pvt != NULL);
if (!tech_pvt->wpsock) {
- if (!(tech_pvt->wpsock=wp_open(tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
- tech_pvt->boost_span_number+1, tech_pvt->boost_chan_number+1, strerror(errno));
+ if (!(tech_pvt->wpsock = wp_open(tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open fd for s%dc%d! [%s]\n",
+ tech_pvt->boost_span_number + 1, tech_pvt->boost_chan_number + 1, strerror(errno));
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return;
}
@@ -1999,7 +1936,7 @@
return;
}
}
-
+
switch_channel_mark_answered(channel);
switch_core_session_rwunlock(session);
} else {
@@ -2021,32 +1958,27 @@
static void handle_call_start_nack(ss7boost_handle_t *ss7boost_handle, ss7boost_client_event_t *event)
{
char *uuid = ss7boost_handle->setup_array[event->call_setup_id];
-
+
if (*uuid) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
private_object_t *tech_pvt;
switch_channel_t *channel;
-
+
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-
+
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
+
tech_pvt->ss7boost_handle = ss7boost_handle;
tech_pvt->boost_span_number = event->span;
tech_pvt->boost_chan_number = event->chan;
-
+
switch_channel_hangup(channel, event->release_cause);
-
- isup_exec_command(ss7boost_handle,
- event->span,
- event->chan,
- event->call_setup_id,
- SIGBOOST_EVENT_CALL_START_NACK_ACK,
- 0);
+
+ isup_exec_command(ss7boost_handle, event->span, event->chan, event->call_setup_id, SIGBOOST_EVENT_CALL_START_NACK_ACK, 0);
switch_core_session_rwunlock(session);
} else {
@@ -2061,9 +1993,9 @@
int ret = 0;
switch_mutex_lock(ss7boost_handle->mutex);
-
- validate_number((unsigned char*)event->called_number_digits);
- validate_number((unsigned char*)event->calling_number_digits);
+
+ validate_number((unsigned char *) event->called_number_digits);
+ validate_number((unsigned char *) event->calling_number_digits);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"\nRX EVENT\n"
@@ -2082,21 +2014,16 @@
"\n",
ss7boost_client_event_id_name(event->event_id),
event->event_id,
- event->span+1,
- event->chan+1,
+ event->span + 1,
+ event->chan + 1,
(event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"),
(event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A"),
switch_channel_cause2str(event->release_cause),
- event->span+1,
- event->chan+1,
- event->event_id,
- event->call_setup_id,
- event->seqno
- );
-
+ event->span + 1, event->chan + 1, event->event_id, event->call_setup_id, event->seqno);
+
+
+ switch (event->event_id) {
- switch(event->event_id) {
-
case SIGBOOST_EVENT_CALL_START:
handle_call_start(ss7boost_handle, event);
break;
@@ -2122,7 +2049,7 @@
handle_call_stop_ack(ss7boost_handle, event);
break;
default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Warning no handler implemented for [%s]\n",
ss7boost_client_event_id_name(event->event_id));
break;
}
@@ -2136,42 +2063,34 @@
ss7boost_client_event_t *event;
if (ss7boost_client_connection_open(&ss7boost_handle->mcon,
- ss7boost_handle->local_ip,
- ss7boost_handle->local_port,
- ss7boost_handle->remote_ip,
- ss7boost_handle->remote_port,
- module_pool) != SWITCH_STATUS_SUCCESS) {
+ ss7boost_handle->local_ip,
+ ss7boost_handle->local_port,
+ ss7boost_handle->remote_ip, ss7boost_handle->remote_port, module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FATAL ERROR CREATING CLIENT CONNECTION\n");
return NULL;
}
-
- isup_exec_command(ss7boost_handle,
- 0,
- 0,
- -1,
- SIGBOOST_EVENT_SYSTEM_RESTART,
- 0);
-
-
+
+ isup_exec_command(ss7boost_handle, 0, 0, -1, SIGBOOST_EVENT_SYSTEM_RESTART, 0);
+
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Started\n");
-
+
switch_mutex_lock(globals.hash_mutex);
globals.configured_boost_spans++;
switch_mutex_unlock(globals.hash_mutex);
globals.ss7boost_handle = ss7boost_handle;
-
- for(;;) {
+
+ for (;;) {
if (ss7boost_client_connection_read(&ss7boost_handle->mcon, &event) == SWITCH_STATUS_SUCCESS) {
- struct timeval current;
- struct timeval difftime;
- gettimeofday(¤t,NULL);
- timersub (¤t, &event->tv, &difftime);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
- ss7boost_client_event_id_name(event->event_id),
- (int)difftime.tv_sec, (int)difftime.tv_usec);
-
- parse_ss7_event(ss7boost_handle, event);
+ struct timeval current;
+ struct timeval difftime;
+ gettimeofday(¤t, NULL);
+ timersub(¤t, &event->tv, &difftime);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket Event [%s] T=%d:%d\n",
+ ss7boost_client_event_id_name(event->event_id), (int) difftime.tv_sec, (int) difftime.tv_usec);
+
+ parse_ss7_event(ss7boost_handle, event);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: Reading from Boost Socket! %s\n", strerror(errno));
break;
@@ -2180,8 +2099,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Close udp socket\n");
ss7boost_client_connection_close(&ss7boost_handle->mcon);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Monitor Thread Ended\n");
+
return NULL;
}
@@ -2190,7 +2109,7 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2251,7 +2170,7 @@
for (param = switch_xml_child(span, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
-
+
if (!strcasecmp(var, "local-ip")) {
local_ip = val;
} else if (!strcasecmp(var, "local-port")) {
@@ -2282,7 +2201,7 @@
}
analog_channels = switch_xml_child(cfg, "analog_channels");
- for(channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
+ for (channel = switch_xml_child(analog_channels, "channel"); channel; channel = channel->next) {
char *c_type = (char *) switch_xml_attr(channel, "type");
char *c_dev = (char *) switch_xml_attr(channel, "device");
char *user = NULL;
@@ -2292,7 +2211,7 @@
analog_type_t a_type = ANALOG_TYPE_UNKNOWN;
wpsock_t *sock;
int chan, span;
-
+
if (!c_type) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required attribute 'type'\n");
continue;
@@ -2312,20 +2231,20 @@
continue;
}
- if (!sangoma_span_chan_fromif (c_dev, &span, &chan)) {
+ if (!sangoma_span_chan_fromif(c_dev, &span, &chan)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid device name '%s'\n", c_dev);
continue;
}
-
+
if (!(sock = wp_open(span, chan))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot open device '%s' (%s)\n", c_dev, strerror(errno));
continue;
}
for (param = switch_xml_child(channel, "param"); param; param = param->next) {
- char *var = (char *) switch_xml_attr_soft(param, "name");
- char *val = (char *) switch_xml_attr_soft(param, "value");
-
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+
if (!strcasecmp(var, "user")) {
user = var;
} else if (!strcasecmp(var, "domain")) {
@@ -2351,7 +2270,7 @@
if (cid_num) {
alc->cid_name = strdup(cid_num);
}
-
+
alc->a_type = a_type;
alc->sock = sock;
alc->chan = chan;
@@ -2368,7 +2287,7 @@
if (globals.fxs_index) {
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
-
+
switch_threadattr_create(&thd_attr, module_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2383,10 +2302,10 @@
int32_t i = 0;
current_span = 0;
-
+
if (id) {
char *p;
-
+
min_span = atoi(id);
if ((p = strchr(id, '-'))) {
p++;
@@ -2402,16 +2321,16 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
continue;
}
-
+
for (i = min_span; i <= max_span; i++) {
current_span = i;
-
+
if (current_span <= 0 || current_span > MAX_SPANS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
current_span = 0;
continue;
}
-
+
if (!SPANS[current_span]) {
if (!(SPANS[current_span] = switch_core_alloc(module_pool, sizeof(*SPANS[current_span])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
@@ -2419,12 +2338,12 @@
}
SPANS[current_span]->span = current_span;
}
-
+
for (param = switch_xml_child(span, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
-
+
if (!strcmp(var, "dchan")) {
SPANS[current_span]->dchan = atoi(val);
} else if (!strcmp(var, "bchan")) {
@@ -2437,7 +2356,7 @@
fromi = atoi(from);
toi = atoi(to);
if (fromi > 0 && toi > 0 && fromi < toi && fromi < MAX_SPANS && toi < MAX_SPANS) {
- for(x = fromi; x <= toi; x++) {
+ for (x = fromi; x <= toi; x++) {
SPANS[current_span]->bchans |= (1 << x);
}
} else {
@@ -2470,18 +2389,14 @@
}
globals.configured_spans = 0;
- for(current_span = 1; current_span < MAX_SPANS; current_span++) {
+ for (current_span = 1; current_span < MAX_SPANS; current_span++) {
if (SPANS[current_span]) {
if (!SPANS[current_span]->l1) {
SPANS[current_span]->l1 = PRI_LAYER_1_ULAW;
}
if (sangoma_init_pri(&SPANS[current_span]->spri,
- current_span,
- SPANS[current_span]->dchan,
- SPANS[current_span]->pswitch,
- SPANS[current_span]->node,
- globals.debug)) {
+ current_span, SPANS[current_span]->dchan, SPANS[current_span]->pswitch, SPANS[current_span]->node, globals.debug)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
continue;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/ss7boost_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/ss7boost_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/ss7boost_client.c Tue May 27 07:24:06 2008
@@ -56,7 +56,7 @@
-static switch_status_t create_udp_socket(ss7boost_client_connection_t * mcon, char *local_ip, int local_port, char *ip, int port)
+static switch_status_t create_udp_socket(ss7boost_client_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "connect %s:%d->%s:%d\n", local_ip, local_port, ip, port);
@@ -88,7 +88,7 @@
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client_connection_t * mcon)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_close(ss7boost_client_connection_t *mcon)
{
switch_socket_close(mcon->socket);
mcon->socket = NULL;
@@ -97,7 +97,7 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t * mcon,
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_open(ss7boost_client_connection_t *mcon,
char *local_ip, int local_port, char *ip, int port, switch_memory_pool_t *pool)
{
memset(mcon, 0, sizeof(*mcon));
@@ -112,7 +112,7 @@
return SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t * mcon, ss7boost_client_event_t ** event)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_read(ss7boost_client_connection_t *mcon, ss7boost_client_event_t **event)
{
unsigned int fromlen = sizeof(struct sockaddr_in);
switch_size_t bytes = 0;
@@ -138,7 +138,7 @@
return SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t * mcon, ss7boost_client_event_t * event)
+SWITCH_DECLARE(switch_status_t) ss7boost_client_connection_write(ss7boost_client_connection_t *mcon, ss7boost_client_event_t *event)
{
int err;
switch_size_t len;
@@ -200,7 +200,7 @@
return err ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t * event, char *calling, char *called, int setup_id)
+SWITCH_DECLARE(void) ss7boost_client_call_init(ss7boost_client_event_t *event, char *calling, char *called, int setup_id)
{
memset(event, 0, sizeof(ss7boost_client_event_t));
event->event_id = SIGBOOST_EVENT_CALL_START;
@@ -219,7 +219,7 @@
}
-SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t * event, ss7boost_client_event_id_t event_id, int chan, int span)
+SWITCH_DECLARE(void) ss7boost_client_event_init(ss7boost_client_event_t *event, ss7boost_client_event_id_t event_id, int chan, int span)
{
memset(event, 0, sizeof(ss7boost_client_event_t));
event->event_id = event_id;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/testapp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/testapp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/testapp.c Tue May 27 07:24:06 2008
@@ -34,8 +34,8 @@
#include <libsangoma.h>
#include "lib_api.h"
-#define MAX_TX_DATA 5000 /* Size of tx data */
-#define MAX_FRAMES 5000 /* Number of frames to transmit */
+#define MAX_TX_DATA 5000 /* Size of tx data */
+#define MAX_FRAMES 5000 /* Number of frames to transmit */
#define MAX_RX_DATA 5000
@@ -46,12 +46,12 @@
/* Prototypes */
int MakeConnection(void);
-void handle_span_chan( void);
+void handle_span_chan(void);
void sig_end(int sigid);
int dev_fd;
-FILE *tx_fd=NULL,*rx_fd=NULL;
-wanpipe_tdm_api_t tdm_api;
+FILE *tx_fd = NULL, *rx_fd = NULL;
+wanpipe_tdm_api_t tdm_api;
/***************************************************
@@ -114,263 +114,246 @@
*
*/
-void handle_span_chan(void)
+void handle_span_chan(void)
{
- unsigned int Rx_count,Tx_count,Tx_length;
- wp_tdm_api_rx_element_t* api_rx_el;
- wp_tdm_api_tx_element_t * api_tx_el;
- fd_set ready,write,oob;
- int err,i;
-
+ unsigned int Rx_count, Tx_count, Tx_length;
+ wp_tdm_api_rx_element_t *api_rx_el;
+ wp_tdm_api_tx_element_t *api_tx_el;
+ fd_set ready, write, oob;
+ int err, i;
+
#if 0
int rlen;
- int stream_sync=0;
+ int stream_sync = 0;
#endif
-
+
Rx_count = 0;
Tx_count = 0;
if (tdm_api.wp_tdm_cmd.hdlc) {
- Tx_length = tx_size;
+ Tx_length = tx_size;
} else {
Tx_length = tdm_api.wp_tdm_cmd.usr_mtu_mru;
}
-
- printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n",
- read_enable,write_enable,tx_cnt,tx_size,tx_delay);
+
+ printf("\n\nSocket Handler: Rx=%d Tx=%i TxCnt=%i TxLen=%i TxDelay=%i\n", read_enable, write_enable, tx_cnt, tx_size, tx_delay);
/* Initialize the Tx Data buffer */
- memset(&Tx_data[0],0,MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t));
+ memset(&Tx_data[0], 0, MAX_TX_DATA + sizeof(wp_tdm_api_rx_hdr_t));
/* Cast the Tx data packet with the tx element
* structure. We must insert a 16 byte
* driver header, which driver will remove
* before passing packet out the physical port */
- api_tx_el = (wp_tdm_api_tx_element_t*)&Tx_data[0];
-
+ api_tx_el = (wp_tdm_api_tx_element_t *) &Tx_data[0];
+
/* Create a Tx packet based on user info, or
* by deafult incrementing number starting from 0 */
- for (i=0;i<Tx_length;i++){
- if (tx_data == -1){
- api_tx_el->data[i] = (unsigned char)i;
- }else{
+ for (i = 0; i < Tx_length; i++) {
+ if (tx_data == -1) {
+ api_tx_el->data[i] = (unsigned char) i;
+ } else {
#if 0
- api_tx_el->data[i] = (unsigned char)tx_data+(i%4);
+ api_tx_el->data[i] = (unsigned char) tx_data + (i % 4);
#else
- api_tx_el->data[i] = (unsigned char)tx_data;
+ api_tx_el->data[i] = (unsigned char) tx_data;
#endif
}
}
- sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api);
+ sangoma_tdm_enable_rxhook_events(dev_fd, &tdm_api);
/* Main Rx Tx OOB routine */
- for(;;) {
+ for (;;) {
/* Initialize all select() descriptors */
FD_ZERO(&ready);
FD_ZERO(&write);
FD_ZERO(&oob);
- FD_SET(dev_fd,&oob);
- FD_SET(dev_fd,&ready);
+ FD_SET(dev_fd, &oob);
+ FD_SET(dev_fd, &ready);
- if (write_enable){
- FD_SET(dev_fd,&write);
+ if (write_enable) {
+ FD_SET(dev_fd, &write);
}
/* Select will block, until:
- * 1: OOB event, link level change
- * 2: Rx data available
- * 3: Interface able to Tx */
-
- if(select(dev_fd + 1,&ready, &write, &oob, NULL)){
-
- fflush(stdout);
- if (FD_ISSET(dev_fd,&oob)){
-
+ * 1: OOB event, link level change
+ * 2: Rx data available
+ * 3: Interface able to Tx */
+
+ if (select(dev_fd + 1, &ready, &write, &oob, NULL)) {
+
+ fflush(stdout);
+ if (FD_ISSET(dev_fd, &oob)) {
+
/* An OOB event is pending, usually indicating
* a link level change */
-
- err=sangoma_tdm_read_event(dev_fd,&tdm_api);
- if(err < 0 ) {
+ err = sangoma_tdm_read_event(dev_fd, &tdm_api);
+
+ if (err < 0) {
printf("Failed to receive OOB %i , %i\n", Rx_count, err);
- err = ioctl(dev_fd,SIOC_WANPIPE_SOCK_STATE,0);
- printf("Sock state is %s\n",
- (err == 0) ? "CONNECTED" :
- (err == 1) ? "DISCONNECTED" :
- "CONNECTING");
+ err = ioctl(dev_fd, SIOC_WANPIPE_SOCK_STATE, 0);
+ printf("Sock state is %s\n", (err == 0) ? "CONNECTED" : (err == 1) ? "DISCONNECTED" : "CONNECTING");
break;
}
-
+
printf("GOT OOB EXCEPTION CMD Exiting\n");
}
-
-
- if (FD_ISSET(dev_fd,&ready)){
+
+
+ if (FD_ISSET(dev_fd, &ready)) {
/* An Rx packet is pending
- * 1: Read the rx packet into the Rx_data
- * buffer. Confirm len > 0
+ * 1: Read the rx packet into the Rx_data
+ * buffer. Confirm len > 0
*
- * 2: Cast Rx_data to the api_rx_element.
- * Thus, removing a 16 byte header
- * attached by the driver.
+ * 2: Cast Rx_data to the api_rx_element.
+ * Thus, removing a 16 byte header
+ * attached by the driver.
*
- * 3. Check error_flag:
- * CRC,Abort..etc
+ * 3. Check error_flag:
+ * CRC,Abort..etc
*/
memset(Rx_data, 0, sizeof(Rx_data));
- err = sangoma_readmsg_tdm(dev_fd,
- Rx_data,
- sizeof(wp_tdm_api_rx_hdr_t),
- &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)],
- MAX_RX_DATA, 0);
+ err = sangoma_readmsg_tdm(dev_fd, Rx_data, sizeof(wp_tdm_api_rx_hdr_t), &Rx_data[sizeof(wp_tdm_api_rx_hdr_t)], MAX_RX_DATA, 0);
- if (!read_enable){
+ if (!read_enable) {
goto bitstrm_skip_read;
}
/* err indicates bytes received */
- if(err <= 0) {
+ if (err <= 0) {
printf("\nError receiving data\n");
break;
}
- api_rx_el = (wp_tdm_api_rx_element_t*)&Rx_data[0];
+ api_rx_el = (wp_tdm_api_rx_element_t *) & Rx_data[0];
/* Check the packet length */
Rx_lgth = err;
- if(Rx_lgth<=0) {
- printf("\nShort frame received (%d)\n",
- Rx_lgth);
+ if (Rx_lgth <= 0) {
+ printf("\nShort frame received (%d)\n", Rx_lgth);
return;
}
-
#if 0
- if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data+1)){
- if (!stream_sync){
- printf("GOT SYNC %x\n",api_rx_el->data[0]);
+ if (api_rx_el->data[0] == tx_data && api_rx_el->data[1] == (tx_data + 1)) {
+ if (!stream_sync) {
+ printf("GOT SYNC %x\n", api_rx_el->data[0]);
}
- stream_sync=1;
- }else{
- if (stream_sync){
- printf("OUT OF SYNC: %x\n",api_rx_el->data[0]);
+ stream_sync = 1;
+ } else {
+ if (stream_sync) {
+ printf("OUT OF SYNC: %x\n", api_rx_el->data[0]);
}
}
-#endif
+#endif
++Rx_count;
- if (verbose){
+ if (verbose) {
#if 0
- printf("Received %i Length = %i\n",
- Rx_count,Rx_lgth);
+ printf("Received %i Length = %i\n", Rx_count, Rx_lgth);
printf("Data: ");
- for(i=0;i<Rx_lgth; i ++) {
+ for (i = 0; i < Rx_lgth; i++) {
printf("0x%02X ", api_rx_el->data[i]);
}
printf("\n");
#endif
- }else{
+ } else {
//putchar('R');
}
#if 0
- switch(api_rx_el->hdr.wp_api_event_type){
+ switch (api_rx_el->hdr.wp_api_event_type) {
case WP_TDM_EVENT_DTMF:
printf("DTMV Event: %c (%s:%s)!\n",
- api_rx_el->hdr.wp_api_event_dtmf_digit,
- (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_ROUT)?"ROUT":"SOUT",
- (api_rx_el->hdr.wp_api_event_dtmf_type&WP_TDM_EVENT_DTMF_PRESET)?"PRESET":"STOP");
+ api_rx_el->hdr.wp_api_event_dtmf_digit,
+ (api_rx_el->hdr.wp_api_event_dtmf_type & WP_TDM_EVENT_DTMF_ROUT) ? "ROUT" : "SOUT",
+ (api_rx_el->hdr.wp_api_event_dtmf_type & WP_TDM_EVENT_DTMF_PRESET) ? "PRESET" : "STOP");
break;
case WP_TDM_EVENT_RXHOOK:
- printf("RXHOOK Event: %s!\n",
- (api_rx_el->hdr.wp_api_event_rxhook_state&WP_TDM_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK");
+ printf("RXHOOK Event: %s!\n", (api_rx_el->hdr.wp_api_event_rxhook_state & WP_TDM_EVENT_RXHOOK_OFF) ? "OFF-HOOK" : "ON-HOOK");
break;
case WP_TDM_EVENT_RING:
- printf("RING Event: %s!\n",
- (api_rx_el->hdr.wp_api_event_ring_state&WP_TDM_EVENT_RING_PRESENT)?"PRESENT":"STOP");
+ printf("RING Event: %s!\n", (api_rx_el->hdr.wp_api_event_ring_state & WP_TDM_EVENT_RING_PRESENT) ? "PRESENT" : "STOP");
break;
}
#endif
- if (rx_cnt > 0 && Rx_count >= rx_cnt){
+ if (rx_cnt > 0 && Rx_count >= rx_cnt) {
break;
}
-bitstrm_skip_read:
-;
- }
-
- if (FD_ISSET(dev_fd,&write)){
+ bitstrm_skip_read:
+ ;
+ }
+ if (FD_ISSET(dev_fd, &write)) {
- err = sangoma_writemsg_tdm(dev_fd,
- Tx_data,16,
- &Tx_data[16], Tx_length,
- 0);
- if (err <= 0){
- if (errno == EBUSY){
- if (verbose){
+
+ err = sangoma_writemsg_tdm(dev_fd, Tx_data, 16, &Tx_data[16], Tx_length, 0);
+ if (err <= 0) {
+ if (errno == EBUSY) {
+ if (verbose) {
printf("Sock busy try again!\n");
}
- /* Socket busy try sending again !*/
- }else{
- printf("Faild to send %i \n",errno);
+ /* Socket busy try sending again ! */
+ } else {
+ printf("Faild to send %i \n", errno);
perror("Send: ");
break;
}
- }else{
+ } else {
++Tx_count;
-
- if (verbose){
+
+ if (verbose) {
//printf("Packet sent: Sent %i : %i\n",
- // err,Tx_count);
- }else{
+ // err,Tx_count);
+ } else {
//putchar('T');
}
}
- }
+ }
- if (tx_delay){
+ if (tx_delay) {
usleep(tx_delay);
}
- if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)){
-
- write_enable=0;
- if (rx_cnt > 0){
+ if (tx_cnt && tx_size && Tx_count >= tx_cnt && !(files_used & TX_FILE_USED)) {
+
+ write_enable = 0;
+ if (rx_cnt > 0) {
/* Dont break let rx finish */
- }else{
+ } else {
break;
}
}
}
}
- sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
- if (tx_fd){
+ sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
+ if (tx_fd) {
fclose(tx_fd);
}
- if (rx_fd){
+ if (rx_fd) {
fclose(rx_fd);
}
- close (dev_fd);
+ close(dev_fd);
return;
-}
+}
-int rxhook_event (int fd, unsigned char state)
+int rxhook_event(int fd, unsigned char state)
{
- printf("%d: RXHOOK Event: %s!\n",
- fd, (state & WAN_EVENT_RXHOOK_OFF)?"OFF-HOOK":"ON-HOOK");
+ printf("%d: RXHOOK Event: %s!\n", fd, (state & WAN_EVENT_RXHOOK_OFF) ? "OFF-HOOK" : "ON-HOOK");
return 0;
}
@@ -383,37 +366,34 @@
**************************************************************/
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
int proceed;
- proceed=init_args(argc,argv);
- if (proceed != WAN_TRUE){
+ proceed = init_args(argc, argv);
+ if (proceed != WAN_TRUE) {
usage(argv[0]);
return -1;
}
- signal(SIGINT,&sig_end);
- memset(&tdm_api,0,sizeof(tdm_api));
+ signal(SIGINT, &sig_end);
+ memset(&tdm_api, 0, sizeof(tdm_api));
tdm_api.wp_tdm_event.wp_rxhook_event = &rxhook_event;
-
- printf("TDM RXHOOK PTR = %p\n",tdm_api.wp_tdm_event.wp_rxhook_event);
-
- dev_fd =-1;
-
- dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name),atoi(if_name));
- if( dev_fd < 0){
- printf("Failed to open span chan (%s:%s:%d:%d)\n",
- card_name, if_name,
- atoi(card_name),atoi(if_name));
- exit (1);
+
+ printf("TDM RXHOOK PTR = %p\n", tdm_api.wp_tdm_event.wp_rxhook_event);
+
+ dev_fd = -1;
+
+ dev_fd = sangoma_open_tdmapi_span_chan(atoi(card_name), atoi(if_name));
+ if (dev_fd < 0) {
+ printf("Failed to open span chan (%s:%s:%d:%d)\n", card_name, if_name, atoi(card_name), atoi(if_name));
+ exit(1);
}
- printf("HANDLING SPAN %i CHAN %i FD=%i\n",
- atoi(card_name),atoi(if_name),dev_fd);
-
- sangoma_tdm_set_codec(dev_fd,&tdm_api,WP_NONE);
+ printf("HANDLING SPAN %i CHAN %i FD=%i\n", atoi(card_name), atoi(if_name), dev_fd);
+
+ sangoma_tdm_set_codec(dev_fd, &tdm_api, WP_NONE);
sangoma_get_full_cfg(dev_fd, &tdm_api);
-
+
handle_span_chan();
close(dev_fd);
return 0;
@@ -425,24 +405,21 @@
void sig_end(int sigid)
{
- printf("Got Signal %i\n",sigid);
-
+ printf("Got Signal %i\n", sigid);
+
sangoma_tdm_disable_rxhook_events(dev_fd, &tdm_api);
- if (tx_fd){
+ if (tx_fd) {
fclose(tx_fd);
}
- if (rx_fd){
+ if (rx_fd) {
fclose(rx_fd);
}
- if (dev_fd){
- close (dev_fd);
+ if (dev_fd) {
+ close(dev_fd);
}
-
+
exit(1);
}
-
-
-
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c Tue May 27 07:24:06 2008
@@ -180,16 +180,16 @@
static switch_status_t woomera_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
static switch_status_t woomera_kill_channel(switch_core_session_t *session, int sig);
static void tech_destroy(private_object * tech_pvt);
-static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...);
+static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...);
static char *woomera_message_header(woomera_message * wmsg, char *key);
static int woomera_enqueue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
static int woomera_dequeue_event(woomera_event_queue * event_queue, woomera_message * wmsg);
-static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue);
-static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags);
+static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue);
+static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags);
static int woomera_profile_thread_running(woomera_profile * profile, int set, int new);
-static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket);
+static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket);
static int tech_create_read_socket(private_object * tech_pvt);
-static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj);
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj);
static void *woomera_thread_run(void *obj);
static int tech_activate(private_object * tech_pvt);
@@ -264,7 +264,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static void woomera_socket_close(switch_socket_t ** socket)
+static void woomera_socket_close(switch_socket_t **socket)
{
if (*socket) {
switch_socket_close(*socket);
@@ -330,7 +330,7 @@
switch_assert(tech_pvt != NULL);
- for(;;) {
+ for (;;) {
if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
return SWITCH_STATUS_GENERR;
}
@@ -364,7 +364,7 @@
switch_size_t len;
switch_assert(tech_pvt != NULL);
-
+
if (switch_test_flag(tech_pvt, TFLAG_ABORT) || !tech_pvt->udp_socket) {
return SWITCH_STATUS_GENERR;
}
@@ -469,7 +469,7 @@
}
-static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...)
+static void woomera_printf(woomera_profile * profile, switch_socket_t *socket, char *fmt, ...)
{
char *stuff = NULL;
size_t res = 0, len = 0;
@@ -558,7 +558,7 @@
return 0;
}
-static int woomera_message_parse(switch_socket_t * fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue)
+static int woomera_message_parse(switch_socket_t *fd, woomera_message * wmsg, int timeout, woomera_profile * profile, woomera_event_queue * event_queue)
{
char *cur, *cr, *next = NULL;
char buf[2048] = "", *ptr;
@@ -719,7 +719,7 @@
}
-static int connect_woomera(switch_socket_t ** new_sock, woomera_profile * profile, int flags)
+static int connect_woomera(switch_socket_t **new_sock, woomera_profile * profile, int flags)
{
switch_sockaddr_t *sa;
@@ -764,7 +764,7 @@
}
-static int woomera_locate_socket(woomera_profile * profile, switch_socket_t ** woomera_socket)
+static int woomera_locate_socket(woomera_profile * profile, switch_socket_t **woomera_socket)
{
woomera_message wmsg;
@@ -823,7 +823,7 @@
} else {
switch_set_flag_locked(tech_pvt, TFLAG_ABORT);
}
-
+
return 0;
}
@@ -872,7 +872,7 @@
-static void *woomera_channel_thread_run(switch_thread_t * thread, void *obj)
+static void *woomera_channel_thread_run(switch_thread_t *thread, void *obj)
{
switch_core_session_t *session = obj;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -976,15 +976,7 @@
if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
NULL,
tech_pvt->profile->dialplan,
- cid_name,
- cid_num,
- ip,
- NULL,
- NULL,
- NULL,
- modname,
- NULL,
- exten)) != 0) {
+ cid_name, cid_num, ip, NULL, NULL, NULL, modname, NULL, exten)) != 0) {
char name[128];
switch_snprintf(name, sizeof(name), "Woomera/%s-%04x", tech_pvt->caller_profile->destination_number, rand() & 0xffff);
switch_channel_set_name(channel, name);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c Tue May 27 07:24:06 2008
@@ -37,7 +37,7 @@
};
typedef struct cdr_fd cdr_fd_t;
-const char *default_template =
+const char *default_template =
"\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\","
"\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\", \"${accountcode}\"\n";
@@ -58,12 +58,12 @@
static off_t fd_size(int fd)
{
- struct stat s = {0};
+ struct stat s = { 0 };
fstat(fd, &s);
return s.st_size;
}
-static void do_reopen(cdr_fd_t *fd)
+static void do_reopen(cdr_fd_t *fd)
{
int x = 0;
@@ -72,7 +72,7 @@
fd->fd = -1;
}
- for (x = 0 ; x < 10; x++) {
+ for (x = 0; x < 10; x++) {
if ((fd->fd = open(fd->path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR)) > -1) {
fd->bytes = fd_size(fd->fd);
break;
@@ -95,7 +95,7 @@
if (globals.rotate) {
switch_time_exp_lt(&tm, switch_timestamp_now());
switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
-
+
len = strlen(fd->path) + strlen(date) + 2;
p = switch_mprintf("%s.%s", fd->path, date);
assert(p);
@@ -104,7 +104,7 @@
}
do_reopen(fd);
-
+
if (fd->fd < 0) {
switch_event_t *event;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error opening %s\n", fd->path);
@@ -115,14 +115,14 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s CDR logfile %s\n", globals.rotate ? "Rotated" : "Re-opened", fd->path);
}
-
+
}
static void write_cdr(const char *path, const char *log_line)
{
cdr_fd_t *fd = NULL;
unsigned int bytes_in, bytes_out;
-
+
if (!(fd = switch_core_hash_find(globals.fd_hash, path))) {
fd = switch_core_alloc(globals.pool, sizeof(*fd));
switch_assert(fd);
@@ -132,10 +132,10 @@
fd->path = switch_core_strdup(globals.pool, path);
switch_core_hash_insert(globals.fd_hash, path, fd);
}
-
+
switch_mutex_lock(fd->mutex);
- bytes_out = (unsigned)strlen(log_line);
-
+ bytes_out = (unsigned) strlen(log_line);
+
if (fd->fd < 0) {
do_reopen(fd);
if (fd->fd < 0) {
@@ -143,18 +143,18 @@
goto end;
}
}
-
+
if (fd->bytes + bytes_out > UINT_MAX) {
do_rotate(fd);
}
-
+
if ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int)bytes_in, (int)bytes_out);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out);
}
fd->bytes += bytes_in;
- end:
+ end:
switch_mutex_unlock(fd->mutex);
}
@@ -164,7 +164,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_SUCCESS;
const char *log_dir = NULL, *accountcode = NULL, *a_template_str = NULL, *g_template_str = NULL;
- char *log_line, *path = NULL;
+ char *log_line, *path = NULL;
if (switch_channel_get_originator_caller_profile(channel)) {
return SWITCH_STATUS_SUCCESS;
@@ -173,7 +173,7 @@
if (!(log_dir = switch_channel_get_variable(channel, "cdr_csv_base"))) {
log_dir = globals.log_dir;
}
-
+
if (switch_dir_make_recursive(log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", log_dir);
return SWITCH_STATUS_FALSE;
@@ -193,15 +193,15 @@
}
g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
-
+
if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) {
a_template_str = (const char *) switch_core_hash_find(globals.template_hash, accountcode);
}
-
+
if (!a_template_str) {
a_template_str = g_template_str;
}
-
+
log_line = switch_channel_expand_variables(channel, a_template_str);
if (accountcode) {
@@ -210,21 +210,21 @@
write_cdr(path, log_line);
free(path);
}
-
+
if (g_template_str != a_template_str) {
if (log_line && log_line != a_template_str) {
switch_safe_free(log_line);
}
log_line = switch_channel_expand_variables(channel, g_template_str);
}
-
-
+
+
path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR);
assert(path);
write_cdr(path, log_line);
free(path);
-
+
if (log_line && log_line != g_template_str) {
free(log_line);
@@ -237,7 +237,7 @@
static void event_handler(switch_event_t *event)
{
const char *sig = switch_event_get_header(event, "Trapped-Signal");
- switch_hash_index_t *hi;
+ switch_hash_index_t *hi;
void *val;
cdr_fd_t *fd;
@@ -269,18 +269,18 @@
char *cf = "cdr_csv.conf";
switch_xml_t cfg, xml, settings, param;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- memset(&globals,0,sizeof(globals));
+
+ memset(&globals, 0, sizeof(globals));
switch_core_hash_init(&globals.fd_hash, pool);
switch_core_hash_init(&globals.template_hash, pool);
-
+
globals.pool = pool;
-
+
switch_core_hash_insert(globals.template_hash, "default", default_template);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");
if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
-
+
if ((settings = switch_xml_child(cfg, "settings"))) {
for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -317,7 +317,7 @@
}
switch_xml_free(xml);
}
-
+
if (switch_strlen_zero(globals.default_template)) {
globals.default_template = switch_core_strdup(pool, "default");
@@ -326,7 +326,7 @@
if (!globals.log_dir) {
globals.log_dir = switch_core_sprintf(pool, "%s%scdr-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
}
-
+
return status;
}
@@ -344,20 +344,20 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
load_config(pool);
-
+
if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
}
-
+
return status;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_csv_shutdown)
{
-
- globals.shutdown=1;
- return SWITCH_STATUS_SUCCESS;
+
+ globals.shutdown = 1;
+ return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c Tue May 27 07:24:06 2008
@@ -283,10 +283,10 @@
uint64_t host_hash = 0;
switch_status_t status;
memset(buf, 0, len);
-
+
switch_sockaddr_ip_get(&myaddr, globals.addr);
status = switch_socket_recvfrom(addr, globals.udp_socket, 0, buf, &len);
-
+
if (!len) {
if (SWITCH_STATUS_IS_BREAK(status)) {
switch_yield(100000);
@@ -334,7 +334,7 @@
switch_event_fire(&local_event);
}
-
+
}
globals.running = 0;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c Tue May 27 07:24:06 2008
@@ -103,8 +103,8 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_ip, prefs.ip);
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_pref_pass, prefs.password);
-static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj);
-static void launch_listener_thread(listener_t * listener);
+static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj);
+static void launch_listener_thread(listener_t *listener);
static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
{
@@ -117,7 +117,7 @@
if (data) {
if (switch_queue_trypush(l->log_queue, data) == SWITCH_STATUS_SUCCESS) {
if (l->lost_logs) {
- int ll = l->lost_logs;
+ int ll = l->lost_logs;
switch_event_t *event;
l->lost_logs = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Lost %d log lines!\n", ll);
@@ -158,7 +158,7 @@
if (!switch_test_flag(l, LFLAG_EVENTS)) {
continue;
}
-
+
if (l->event_list[SWITCH_EVENT_ALL]) {
send = 1;
} else if ((l->event_list[event->event_id])) {
@@ -300,7 +300,7 @@
}
-static void close_socket(switch_socket_t ** sock)
+static void close_socket(switch_socket_t **sock)
{
switch_mutex_lock(listen_list.sock_mutex);
if (*sock) {
@@ -320,7 +320,7 @@
close_socket(&listen_list.sock);
- while(prefs.threads) {
+ while (prefs.threads) {
switch_yield(10000);
if (++sanity == 1000) {
break;
@@ -350,7 +350,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static void add_listener(listener_t * listener)
+static void add_listener(listener_t *listener)
{
/* add me to the listeners so I get events */
switch_mutex_lock(listen_list.mutex);
@@ -359,7 +359,7 @@
switch_mutex_unlock(listen_list.mutex);
}
-static void remove_listener(listener_t * listener)
+static void remove_listener(listener_t *listener)
{
listener_t *l, *last = NULL;
@@ -385,7 +385,7 @@
}
}
-static switch_status_t read_packet(listener_t * listener, switch_event_t **event, uint32_t timeout)
+static switch_status_t read_packet(listener_t *listener, switch_event_t **event, uint32_t timeout)
{
switch_size_t mlen, bytes = 0;
char mbuf[2048] = "";
@@ -543,8 +543,8 @@
switch_socket_send(listener->sock, listener->ebuf, &len);
switch_safe_free(listener->ebuf);
-
- endloop:
+
+ endloop:
switch_event_destroy(&pevent);
}
}
@@ -569,7 +569,7 @@
switch_memory_pool_t *pool;
};
-static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
{
struct api_command_struct *acs = (struct api_command_struct *) obj;
@@ -630,7 +630,7 @@
switch_thread_rwlock_unlock(acs->listener->rwlock);
}
- done:
+ done:
if (acs && acs->bg) {
switch_memory_pool_t *pool = acs->pool;
acs = NULL;
@@ -640,7 +640,7 @@
return NULL;
}
-static switch_status_t parse_command(listener_t * listener, switch_event_t *event, char *reply, uint32_t reply_len)
+static switch_status_t parse_command(listener_t *listener, switch_event_t *event, char *reply, uint32_t reply_len)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *cmd = switch_event_get_header(event, "command");
@@ -866,7 +866,7 @@
switch_snprintf(reply, reply_len, "+OK Job-UUID: %s", acs->uuid_str);
switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
-
+
return SWITCH_STATUS_SUCCESS;
} else if (!strncasecmp(cmd, "log", 3)) {
@@ -950,7 +950,7 @@
}
}
- end:
+ end:
cur = next;
}
}
@@ -1039,7 +1039,7 @@
}
}
- done:
+ done:
if (event) {
switch_event_destroy(&event);
}
@@ -1051,7 +1051,7 @@
return status;
}
-static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
{
listener_t *listener = (listener_t *) obj;
char buf[1024];
@@ -1071,13 +1071,13 @@
if (prefs.acl_count && listener->sa && !switch_strlen_zero(listener->remote_ip)) {
uint32_t x = 0;
-
- for (x = 0 ; x < prefs.acl_count; x++) {
+
+ for (x = 0; x < prefs.acl_count; x++) {
if (!switch_check_network_list_ip(listener->remote_ip, prefs.acl[x])) {
const char message[] = "Access Denied, go away.\n";
int mlen = strlen(message);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", listener->remote_ip, prefs.acl[x]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", listener->remote_ip, prefs.acl[x]);
switch_snprintf(buf, sizeof(buf), "Content-Type: rude/rejection\nContent-Length %d\n\n", mlen);
len = strlen(buf);
@@ -1203,7 +1203,7 @@
}
- done:
+ done:
remove_listener(listener);
@@ -1234,7 +1234,7 @@
/* Create a thread for the socket and launch it */
-static void launch_listener_thread(listener_t * listener)
+static void launch_listener_thread(listener_t *listener)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -1333,7 +1333,7 @@
goto sock_fail;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Socket up listening on %s:%u\n", prefs.ip, prefs.port);
break;
- sock_fail:
+ sock_fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error! Could not listen on %s:%u\n", prefs.ip, prefs.port);
switch_yield(100000);
}
@@ -1348,7 +1348,7 @@
switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG);
- for(;;) {
+ for (;;) {
if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
goto fail;
@@ -1396,11 +1396,11 @@
}
- for (x = 0 ; x < prefs.acl_count; x++) {
+ for (x = 0; x < prefs.acl_count; x++) {
switch_safe_free(prefs.acl[x]);
}
- fail:
+ fail:
return SWITCH_STATUS_TERM;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_test/mod_event_test.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_test/mod_event_test.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_event_test/mod_event_test.c Tue May 27 07:24:06 2008
@@ -77,7 +77,7 @@
#define TTHREADS 500
static int THREADS = 0;
-static void *torture_thread(switch_thread_t * thread, void *obj)
+static void *torture_thread(switch_thread_t *thread, void *obj)
{
int y = 0;
int z = 0;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c Tue May 27 07:24:06 2008
@@ -38,17 +38,17 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load);
SWITCH_MODULE_DEFINITION(mod_radius_cdr, mod_radius_cdr_load, NULL, NULL);
-static char cf[] = "mod_radius_cdr.conf";
-static char my_dictionary[PATH_MAX];
-static char my_seqfile[PATH_MAX];
-static char * my_deadtime; /* 0 */
-static char * my_timeout; /* 5 */
-static char * my_retries; /* 3 */
-static char my_servers[SERVER_MAX][255];
+static char cf[] = "mod_radius_cdr.conf";
+static char my_dictionary[PATH_MAX];
+static char my_seqfile[PATH_MAX];
+static char *my_deadtime; /* 0 */
+static char *my_timeout; /* 5 */
+static char *my_retries; /* 3 */
+static char my_servers[SERVER_MAX][255];
-static rc_handle * my_radius_init(void)
+static rc_handle *my_radius_init(void)
{
- rc_handle *rad_config;
+ rc_handle *rad_config;
rad_config = rc_new();
@@ -63,19 +63,17 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error initializing radius config!\n");
rc_destroy(rad_config);
return NULL;
- }
+ }
/* Some hardcoded ( for now ) defaults needed to initialize radius */
if (rc_add_config(rad_config, "auth_order", "radius", "mod_radius_cdr.c", 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "setting auth_order = radius failed\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting auth_order = radius failed\n");
rc_destroy(rad_config);
return NULL;
}
if (rc_add_config(rad_config, "seqfile", my_seqfile, "mod_radius_cdr.c", 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "setting seqfile = %s failed\n", my_seqfile);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting seqfile = %s failed\n", my_seqfile);
rc_destroy(rad_config);
return NULL;
}
@@ -92,37 +90,32 @@
}
if (rc_add_config(rad_config, "dictionary", my_dictionary, cf, 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed setting dictionary = %s failed\n", my_dictionary);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed setting dictionary = %s failed\n", my_dictionary);
rc_destroy(rad_config);
return NULL;
}
if (rc_add_config(rad_config, "radius_deadtime", my_deadtime, cf, 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "setting radius_deadtime = %s failed\n", my_deadtime);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_deadtime = %s failed\n", my_deadtime);
rc_destroy(rad_config);
return NULL;
}
if (rc_add_config(rad_config, "radius_timeout", my_timeout, cf, 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "setting radius_timeout = %s failed\n", my_timeout);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_timeout = %s failed\n", my_timeout);
rc_destroy(rad_config);
return NULL;
}
if (rc_add_config(rad_config, "radius_retries", my_retries, cf, 0) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "setting radius_retries = %s failed\n", my_retries);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting radius_retries = %s failed\n", my_retries);
rc_destroy(rad_config);
- return NULL;
+ return NULL;
}
/* Read the dictionary file(s) */
if (rc_read_dictionary(rad_config, rc_conf_str(rad_config, "dictionary")) != 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "reading dictionary file(s): %s\n", my_dictionary);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "reading dictionary file(s): %s\n", my_dictionary);
rc_destroy(rad_config);
return NULL;
}
@@ -132,20 +125,20 @@
static switch_status_t my_on_routing(switch_core_session_t *session)
{
- switch_xml_t cdr;
+ switch_xml_t cdr;
switch_channel_t *channel = switch_core_session_get_channel(session);
- rc_handle *rad_config;
- int retval = 0;
- VALUE_PAIR *send = NULL;
- uint32_t client_port = 0;
- uint32_t status_type = PW_STATUS_START;
- switch_time_t callstartdate = 0;
- switch_time_t callanswerdate = 0;
- switch_time_t callenddate = 0;
- switch_time_t calltransferdate = 0;
+ rc_handle *rad_config;
+ int retval = 0;
+ VALUE_PAIR *send = NULL;
+ uint32_t client_port = 0;
+ uint32_t status_type = PW_STATUS_START;
+ switch_time_t callstartdate = 0;
+ switch_time_t callanswerdate = 0;
+ switch_time_t callenddate = 0;
+ switch_time_t calltransferdate = 0;
+
+ char *uuid_str;
- char *uuid_str;
-
switch_time_exp_t tm;
char buffer[32];
@@ -162,7 +155,7 @@
uuid_str = switch_core_session_get_uuid(session);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
- return SWITCH_STATUS_TERM;
+ return SWITCH_STATUS_TERM;
}
/* Create the radius packet */
@@ -172,135 +165,122 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed setting Acct-Status-Type: Start\n");
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
- }
+ }
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Acct-Session-ID: %s\n", uuid_str);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
- }
+ }
/* Add VSAs */
if (channel) {
- /*switch_call_cause_t cause;*/
- switch_caller_profile_t *profile;
+ /*switch_call_cause_t cause; */
+ switch_caller_profile_t *profile;
/*
- cause = switch_channel_get_cause(channel);
- if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
- rc_destroy(rad_config);
- return SWITCH_STATUS_TERM;
- }
- */
-
+ cause = switch_channel_get_cause(channel);
+ if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause);
+ rc_destroy(rad_config);
+ return SWITCH_STATUS_TERM;
+ }
+ */
+
profile = switch_channel_get_caller_profile(channel);
-
+
if (profile) {
callstartdate = profile->times->created;
callanswerdate = profile->times->answered;
calltransferdate = profile->times->transferred;
callenddate = profile->times->hungup;
-
+
if (profile->username) {
- if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding User-Name: %s\n", profile->username);
+ if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->caller_id_number) {
- if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
+ if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->caller_id_name) {
- if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *)profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
+ if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->destination_number) {
- if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *)profile->destination_number, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
+ if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->dialplan) {
- if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *)profile->dialplan, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
+ if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->network_addr) {
- if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Framed-IP-Address: %s\n", profile->network_addr);
+ if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->rdnis) {
- if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
+ if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->context) {
- if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Context: %s\n", profile->context);
+ if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->ani) {
- if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-ANI: %s\n", profile->ani);
+ if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->aniii) {
- if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
+ if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->source) {
- if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Source: %s\n", profile->source);
+ if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (callstartdate > 0) {
switch_time_exp_lt(&tm, callstartdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callstartdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -309,12 +289,10 @@
if (callanswerdate > 0) {
switch_time_exp_lt(&tm, callanswerdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -323,12 +301,10 @@
if (calltransferdate > 0) {
switch_time_exp_lt(&tm, calltransferdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -337,26 +313,23 @@
if (callenddate > 0) {
switch_time_exp_lt(&tm, callenddate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callenddate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
}
if (profile->caller_extension && profile->caller_extension->last_application->application_name) {
- if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
- (void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Lastapp: %s\n", profile->source);
+ if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
+ (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");
}
@@ -371,27 +344,27 @@
}
rc_avpair_free(send);
- return(retval);
+ return (retval);
}
static switch_status_t my_on_hangup(switch_core_session_t *session)
{
- switch_xml_t cdr;
+ switch_xml_t cdr;
switch_channel_t *channel = switch_core_session_get_channel(session);
- rc_handle *rad_config;
- int retval = 0;
- VALUE_PAIR *send = NULL;
- uint32_t client_port = 0;
- uint32_t status_type = PW_STATUS_STOP;
- switch_time_t callstartdate = 0;
- switch_time_t callanswerdate = 0;
- switch_time_t callenddate = 0;
- switch_time_t calltransferdate = 0;
- switch_time_t billusec = 0;
- uint32_t billsec = 0;
- char *uuid_str;
-
- switch_time_exp_t tm;
+ rc_handle *rad_config;
+ int retval = 0;
+ VALUE_PAIR *send = NULL;
+ uint32_t client_port = 0;
+ uint32_t status_type = PW_STATUS_STOP;
+ switch_time_t callstartdate = 0;
+ switch_time_t callanswerdate = 0;
+ switch_time_t callenddate = 0;
+ switch_time_t calltransferdate = 0;
+ switch_time_t billusec = 0;
+ uint32_t billsec = 0;
+ char *uuid_str;
+
+ switch_time_exp_t tm;
char buffer[32] = "";
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_hangup\n");
@@ -407,7 +380,7 @@
uuid_str = switch_core_session_get_uuid(session);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n");
- return SWITCH_STATUS_TERM;
+ return SWITCH_STATUS_TERM;
}
/* Create the radius packet */
@@ -417,19 +390,19 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
- }
+ }
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
- }
+ }
/* Add VSAs */
if (channel) {
- switch_call_cause_t cause;
- switch_caller_profile_t *profile;
+ switch_call_cause_t cause;
+ switch_caller_profile_t *profile;
cause = switch_channel_get_cause(channel);
if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) {
@@ -437,7 +410,7 @@
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
-
+
profile = switch_channel_get_caller_profile(channel);
if (profile) {
@@ -449,16 +422,15 @@
callanswerdate = profile->times->answered;
calltransferdate = profile->times->transferred;
callenddate = profile->times->hungup;
-
- if (switch_channel_test_flag(channel,CF_ANSWERED)) {
+
+ if (switch_channel_test_flag(channel, CF_ANSWERED)) {
if (callstartdate && callanswerdate) {
if (callenddate)
billusec = callenddate - callanswerdate;
else if (calltransferdate)
billusec = calltransferdate - callanswerdate;
}
- }
- else if (switch_channel_test_flag(channel,CF_TRANSFER)) {
+ } else if (switch_channel_test_flag(channel, CF_TRANSFER)) {
if (callanswerdate && calltransferdate)
billusec = calltransferdate - callanswerdate;
}
@@ -467,105 +439,92 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n");
if (profile->username) {
- if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *)profile->username, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding User-Name: %s\n", profile->username);
+ if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->caller_id_number) {
- if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *)profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
+ if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->caller_id_name) {
- if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *)profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
+ if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->destination_number) {
- if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *)profile->destination_number, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
+ if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->dialplan) {
- if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *)profile->dialplan, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
+ if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->network_addr) {
- if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *)profile->network_addr, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Framed-IP-Address: %s\n", profile->network_addr);
+ if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, (void *) profile->network_addr, -1, 0) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->rdnis) {
- if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *)profile->rdnis, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
+ if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->context) {
- if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *)profile->context, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Context: %s\n", profile->context);
+ if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->ani) {
- if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *)profile->ani, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-ANI: %s\n", profile->ani);
+ if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->aniii) {
- if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *)profile->aniii, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
+ if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->source) {
- if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *)profile->source, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Source: %s\n", profile->source);
+ if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (profile->caller_extension && profile->caller_extension->last_application->application_name) {
- if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
- (void *)profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Lastapp: %s\n", profile->source);
+ if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
+ (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- }
+ }
if (rc_avpair_add(rad_config, &send, PW_FS_BILLUSEC, &billusec, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Billusec: %u\n", (uint32_t)billusec);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Billusec: %u\n", (uint32_t) billusec);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -573,12 +532,10 @@
if (callstartdate > 0) {
switch_time_exp_lt(&tm, callstartdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callstartdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -587,12 +544,10 @@
if (callanswerdate > 0) {
switch_time_exp_lt(&tm, callanswerdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -601,12 +556,10 @@
if (calltransferdate > 0) {
switch_time_exp_lt(&tm, calltransferdate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
@@ -615,25 +568,22 @@
if (callenddate > 0) {
switch_time_exp_lt(&tm, callenddate);
switch_snprintf(buffer, sizeof(buffer), "%04u-%02u-%02uT%02u:%02u:%02u.%06u%+03d%02d",
- tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
- tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec,
- tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
+ tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600);
if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Freeswitch-Callenddate: %s\n", buffer);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
}
if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_TIME, &billsec, -1, 0) == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "failed adding Acct-Session-Time: %u\n", billsec);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-Time: %u\n", billsec);
rc_destroy(rad_config);
return SWITCH_STATUS_TERM;
}
- } else { /* no profile, can't create data to send */
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");
+ } else { /* no profile, can't create data to send */
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n");
}
}
@@ -646,57 +596,52 @@
}
rc_avpair_free(send);
- return(retval);
+ return (retval);
}
static switch_status_t load_config(void)
{
- switch_xml_t cfg, xml, settings, param;
+ switch_xml_t cfg, xml, settings, param;
int num_servers = 0;
my_timeout = "5";
my_retries = "3";
my_deadtime = "0";
- strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX-1);
- strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX-1);
+ strncpy(my_seqfile, "/var/run/radius.seq", PATH_MAX - 1);
+ strncpy(my_dictionary, "/usr/local/freeswitch/conf/radius/dictionary", PATH_MAX - 1);
- for( int i = 0; i < SERVER_MAX; i++ ) {
+ for (int i = 0; i < SERVER_MAX; i++) {
my_servers[i][0] = '\0';
}
- if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
- return SWITCH_STATUS_TERM;
- }
+ if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+ return SWITCH_STATUS_TERM;
+ }
- if ((settings = switch_xml_child(cfg, "settings"))) {
- for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+ if ((settings = switch_xml_child(cfg, "settings"))) {
+ for (param = switch_xml_child(settings, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
if (!strcmp(var, "acctserver")) {
if (num_servers < SERVER_MAX) {
- strncpy(my_servers[num_servers],val,255-1);
+ strncpy(my_servers[num_servers], val, 255 - 1);
num_servers++;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ "you can only specify %d radius servers, ignoring excess server entry\n", SERVER_MAX);
}
- }
- else if (!strcmp(var, "dictionary")) {
- strncpy(my_dictionary,val,PATH_MAX-1);
- }
- else if (!strcmp(var, "seqfile")) {
- strncpy(my_seqfile,val,PATH_MAX-1);
- }
- else if (!strcmp(var, "radius_timeout")) {
+ } else if (!strcmp(var, "dictionary")) {
+ strncpy(my_dictionary, val, PATH_MAX - 1);
+ } else if (!strcmp(var, "seqfile")) {
+ strncpy(my_seqfile, val, PATH_MAX - 1);
+ } else if (!strcmp(var, "radius_timeout")) {
my_timeout = strdup(val);
- }
- else if (!strcmp(var, "radius_retries")) {
+ } else if (!strcmp(var, "radius_retries")) {
my_retries = strdup(val);
- }
- else if (!strcmp(var, "radius_deadtime")) {
+ } else if (!strcmp(var, "radius_deadtime")) {
my_deadtime = strdup(val);
}
}
@@ -705,8 +650,7 @@
switch_xml_free(xml);
if (num_servers < 1) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
- "you must specify at least 1 radius server\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you must specify at least 1 radius server\n");
return SWITCH_STATUS_TERM;
}
@@ -726,8 +670,8 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)
{
if (load_config() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_TERM;
- }
+ return SWITCH_STATUS_TERM;
+ }
/* test global state handlers */
switch_core_add_state_handler(&state_handlers);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c Tue May 27 07:24:06 2008
@@ -50,7 +50,7 @@
struct local_stream_source *source;
switch_mutex_t *audio_mutex;
switch_buffer_t *audio_buffer;
- int err;
+ int err;
const char *file;
const char *func;
int line;
@@ -86,18 +86,18 @@
double r;
int index;
srand(getpid() + ++S);
- r = ((double)rand() / ((double)(RAND_MAX)+(double)(1)));
- index = (int)(r * 9) + 1;
+ r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
+ index = (int) (r * 9) + 1;
return index;
}
static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
{
local_stream_source_t *source = obj;
- switch_file_handle_t fh = {0};
+ switch_file_handle_t fh = { 0 };
local_stream_context_t *cp;
char file_buf[128] = "", path_buf[512] = "";
- switch_timer_t timer = {0};
+ switch_timer_t timer = { 0 };
int fd = -1;
switch_buffer_t *audio_buffer;
switch_byte_t *dist_buf;
@@ -110,12 +110,12 @@
switch_buffer_create_dynamic(&audio_buffer, 1024, source->prebuf + 10, 0);
dist_buf = switch_core_alloc(source->pool, source->prebuf + 10);
-
+
if (source->shuffle) {
skip = do_rand();
}
- while(RUNNING) {
+ while (RUNNING) {
const char *fname;
if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
@@ -125,15 +125,14 @@
switch_yield(1000000);
- while(RUNNING) {
+ while (RUNNING) {
switch_size_t olen;
- uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0};
+ uint8_t abuf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
if (fd > -1) {
char *p;
if (switch_fd_read_line(fd, path_buf, sizeof(path_buf))) {
- if ((p = strchr(path_buf, '\r')) ||
- (p = strchr(path_buf, '\n'))) {
+ if ((p = strchr(path_buf, '\r')) || (p = strchr(path_buf, '\n'))) {
*p = '\0';
}
} else {
@@ -164,20 +163,18 @@
fname = path_buf;
fh.prebuf = source->prebuf;
-
+
if (switch_core_file_open(&fh,
- (char *)fname,
- source->channels,
- source->rate,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+ (char *) fname,
+ source->channels, source->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", fname);
switch_yield(1000000);
continue;
}
-
+
source->rate = fh.samplerate;
source->samples = switch_samples_per_frame(fh.native_rate, source->interval);
-
+
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
switch_dir_close(source->dir_handle);
@@ -196,11 +193,11 @@
switch_buffer_write(audio_buffer, abuf, olen * 2);
used = switch_buffer_inuse(audio_buffer);
-
+
if (used >= source->prebuf || (source->total && used > source->samples * 2)) {
used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
if (source->total) {
-
+
switch_mutex_lock(source->mutex);
for (cp = source->context_list; cp; cp = cp->next) {
if (switch_test_flag(cp->handle, SWITCH_FILE_CALLBACK)) {
@@ -208,7 +205,8 @@
}
switch_mutex_lock(cp->audio_mutex);
if (switch_buffer_inuse(cp->audio_buffer) > source->samples * 768) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d]\n", cp->func, cp->file, cp->line);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d]\n", cp->func, cp->file,
+ cp->line);
switch_buffer_zero(cp->audio_buffer);
} else {
switch_buffer_write(cp->audio_buffer, dist_buf, used);
@@ -230,13 +228,13 @@
source->dir_handle = NULL;
}
-done:
+ done:
switch_buffer_destroy(&audio_buffer);
if (fd > -1) {
close(fd);
}
-
+
switch_core_destroy_memory_pool(&source->pool);
return NULL;
@@ -248,12 +246,12 @@
local_stream_source_t *source;
char *alt_path = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
+
if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
return SWITCH_STATUS_FALSE;
}
-
+
alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
switch_mutex_lock(globals.mutex);
@@ -273,7 +271,7 @@
if ((context = switch_core_alloc(handle->memory_pool, sizeof(*context))) == 0) {
status = SWITCH_STATUS_MEMERR;
goto end;
- }
+ }
handle->samples = 0;
handle->samplerate = source->rate;
@@ -285,14 +283,14 @@
handle->private_info = context;
handle->interval = source->interval;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening Stream [%s] %dhz\n", path, handle->samplerate);
-
+
switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
status = SWITCH_STATUS_MEMERR;
goto end;
}
-
+
context->source = source;
context->file = handle->file;
context->func = handle->func;
@@ -304,7 +302,7 @@
source->total++;
switch_mutex_unlock(source->mutex);
- end:
+ end:
switch_safe_free(alt_path);
return status;
}
@@ -328,29 +326,29 @@
context->source->total--;
switch_mutex_unlock(context->source->mutex);
switch_buffer_destroy(&context->audio_buffer);
-
+
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t local_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
{
- local_stream_context_t *context = handle->private_info;
- switch_size_t bytes = 0;
- size_t need = *len * 2;
-
- switch_mutex_lock(context->audio_mutex);
- if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
- *len = bytes / 2;
- } else {
- if (need > 2560) {
- need = 2560;
- }
- memset(data, 255, need);
- *len = need / 2;
- }
- switch_mutex_unlock(context->audio_mutex);
- handle->sample_count += *len;
- return SWITCH_STATUS_SUCCESS;
+ local_stream_context_t *context = handle->private_info;
+ switch_size_t bytes = 0;
+ size_t need = *len * 2;
+
+ switch_mutex_lock(context->audio_mutex);
+ if ((bytes = switch_buffer_read(context->audio_buffer, data, need))) {
+ *len = bytes / 2;
+ } else {
+ if (need > 2560) {
+ need = 2560;
+ }
+ memset(data, 255, need);
+ *len = need / 2;
+ }
+ switch_mutex_unlock(context->audio_mutex);
+ handle->sample_count += *len;
+ return SWITCH_STATUS_SUCCESS;
}
/* Registration */
@@ -374,7 +372,7 @@
for (directory = switch_xml_child(cfg, "directory"); directory; directory = directory->next) {
char *path = (char *) switch_xml_attr(directory, "path");
char *name = (char *) switch_xml_attr(directory, "name");
-
+
if (!(name && path)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid config!\n");
continue;
@@ -388,7 +386,7 @@
source = switch_core_alloc(pool, sizeof(*source));
assert(source != NULL);
source->pool = pool;
-
+
source->name = switch_core_strdup(source->pool, name);
source->location = switch_core_strdup(source->pool, path);
source->rate = 8000;
@@ -396,7 +394,7 @@
source->channels = 1;
source->timer_name = "soft";
source->prebuf = DEFAULT_PREBUFFER_SIZE;
-
+
for (param = switch_xml_child(directory, "param"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -416,7 +414,7 @@
} else if (!strcasecmp(var, "channels")) {
int tmp = atoi(val);
if (tmp == 1 || tmp == 2) {
- source->channels = (uint8_t)tmp;
+ source->channels = (uint8_t) tmp;
}
} else if (!strcasecmp(var, "interval")) {
int tmp = atoi(val);
@@ -424,19 +422,19 @@
source->interval = tmp;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
+ "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
} else if (!strcasecmp(var, "timer-name")) {
source->timer_name = switch_core_strdup(source->pool, val);
}
}
-
+
source->samples = switch_samples_per_frame(source->rate, source->interval);
switch_core_hash_insert(globals.source_hash, source->name, source);
-
+
switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
-
+
switch_threadattr_create(&thd_attr, source->pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -450,7 +448,7 @@
{
switch_file_interface_t *file_interface;
supported_formats[0] = "local_stream";
-
+
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
file_interface->interface_name = modname;
@@ -463,7 +461,7 @@
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, pool);
switch_core_hash_init(&globals.source_hash, pool);
launch_threads();
-
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/layer3.c Tue May 27 07:24:06 2008
@@ -37,7 +37,7 @@
{
return (i > 0 && i < 8207) ? __ispow[i] : 1;
-
+
}
@@ -854,9 +854,9 @@
if (!mc) {
unsigned sanity;
mc = *m++;
- if ((unsigned)*scf < 100 && (unsigned)*pretab < 100) {
+ if ((unsigned) *scf < 100 && (unsigned) *pretab < 100) {
sanity = (((*scf++) + (*pretab++)) << shift);
-
+
//v = gr_info->pow2gain[((*scf++) + (*pretab++)) << shift];
if (sanity < 100) {
v = gr_info->pow2gain[sanity];
@@ -993,8 +993,8 @@
#if 0
static int III_dequantize_sample_ms(real xr[2][SBLIMIT][SSLIMIT], int *scf, struct gr_info_s *gr_info, int sfreq, int part2bits)
-{ma
- int shift = 1 + gr_info->scalefac_scale;
+{
+ ma int shift = 1 + gr_info->scalefac_scale;
real *xrpnt = (real *) xr[1];
real *xr0pnt = (real *) xr[0];
int l[3], l3;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c Tue May 27 07:24:06 2008
@@ -64,15 +64,15 @@
int samplerate;
uint8_t thread_running;
uint8_t shout_init;
- uint32_t prebuf;
- int lame_ready;
+ uint32_t prebuf;
+ int lame_ready;
};
typedef struct shout_context shout_context_t;
-static size_t decode_fd(shout_context_t * context, void *data, size_t bytes);
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes);
-static inline void free_context(shout_context_t * context)
+static inline void free_context(shout_context_t *context)
{
int ret;
@@ -210,7 +210,7 @@
}
}
-static size_t decode_fd(shout_context_t * context, void *data, size_t bytes)
+static size_t decode_fd(shout_context_t *context, void *data, size_t bytes)
{
int decode_status = 0;
int dlen = 0;
@@ -278,7 +278,7 @@
}
dlen = 0;
- continue;
+ continue;
}
context->mp3err = 0;
@@ -309,7 +309,7 @@
return 0;
- error:
+ error:
switch_mutex_lock(context->audio_mutex);
context->err++;
switch_mutex_unlock(context->audio_mutex);
@@ -340,9 +340,9 @@
error_check();
- if (context->prebuf) {
- buf_size = context->prebuf;
- }
+ if (context->prebuf) {
+ buf_size = context->prebuf;
+ }
/* make sure we aren't over zealous by slowing down the stream when the buffer is too full */
for (;;) {
@@ -358,7 +358,7 @@
switch_mutex_unlock(context->audio_mutex);
if (used < buf_size) {
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Buffered %u/%u!\n", used, buf_size);
break;
}
@@ -421,7 +421,7 @@
return realsize;
- error:
+ error:
switch_mutex_lock(context->audio_mutex);
context->err++;
switch_mutex_unlock(context->audio_mutex);
@@ -431,7 +431,7 @@
#define MY_BUF_LEN 1024 * 32
#define MY_BLOCK_SIZE MY_BUF_LEN
-static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void *obj)
{
CURL *curl_handle = NULL;
shout_context_t *context = (shout_context_t *) obj;
@@ -451,7 +451,7 @@
return NULL;
}
-static void launch_read_stream_thread(shout_context_t * context)
+static void launch_read_stream_thread(shout_context_t *context)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -467,7 +467,7 @@
switch_thread_create(&thread, thd_attr, read_stream_thread, context, context->memory_pool);
}
-static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC write_stream_thread(switch_thread_t *thread, void *obj)
{
shout_context_t *context = (shout_context_t *) obj;
@@ -513,13 +513,13 @@
switch_yield(100000);
}
- error:
+ error:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Thread Done\n");
context->thread_running = 0;
return NULL;
}
-static void launch_write_stream_thread(shout_context_t * context)
+static void launch_write_stream_thread(shout_context_t *context)
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
@@ -565,7 +565,7 @@
InitMP3(&context->mp, OUTSCALE, context->samplerate);
if (handle->handler) {
context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
- context->prebuf = handle->prebuf;
+ context->prebuf = handle->prebuf;
launch_read_stream_thread(context);
} else {
if (switch_file_open(&context->fd, path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, handle->memory_pool) !=
@@ -580,25 +580,25 @@
goto error;
}
- if (!handle->handler) {
- id3tag_init(context->gfp);
- id3tag_v2_only(context->gfp);
- id3tag_pad_v2(context->gfp);
+ if (!handle->handler) {
+ id3tag_init(context->gfp);
+ id3tag_v2_only(context->gfp);
+ id3tag_pad_v2(context->gfp);
- }
+ }
lame_set_brate(context->gfp, 24 * (handle->samplerate / 8000) * handle->channels);
lame_set_num_channels(context->gfp, handle->channels);
lame_set_in_samplerate(context->gfp, handle->samplerate);
lame_set_out_samplerate(context->gfp, handle->samplerate);
- if (handle->channels == 2) {
- lame_set_mode(context->gfp, STEREO);
- } else {
- lame_set_mode(context->gfp, MONO);
- }
+ if (handle->channels == 2) {
+ lame_set_mode(context->gfp, STEREO);
+ } else {
+ lame_set_mode(context->gfp, MONO);
+ }
lame_set_quality(context->gfp, 2); /* 2=high 5 = medium 7=low */
-
+
lame_set_errorf(context->gfp, log_error);
lame_set_debugf(context->gfp, log_debug);
lame_set_msgf(context->gfp, log_msg);
@@ -716,7 +716,7 @@
return SWITCH_STATUS_SUCCESS;
- error:
+ error:
if (err) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: %s\n", err);
}
@@ -750,8 +750,8 @@
*cur_sample = fseek(context->fp, *cur_sample, whence);
}
- ExitMP3(&context->mp);
- InitMP3(&context->mp, OUTSCALE, context->samplerate);
+ ExitMP3(&context->mp);
+ InitMP3(&context->mp, OUTSCALE, context->samplerate);
switch_buffer_zero(context->audio_buffer);
} else {
@@ -833,35 +833,35 @@
}
} else {
- if (!context->lame_ready) {
- lame_init_params(context->gfp);
- lame_print_config(context->gfp);
- context->lame_ready = 1;
- }
-
- if (handle->channels == 2) {
- int16_t l[4096] = {0};
- int16_t r[4096] = {0};
- int i, j = 0;
-
- for(i = 0; i < nsamples; i++) {
- l[i] = audio[j++];
- r[i] = audio[j++];
- }
-
- if ((rlen = lame_encode_buffer(context->gfp, l, r, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
- return SWITCH_STATUS_FALSE;
- }
-
- } else if (handle->channels == 1) {
- if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
- return SWITCH_STATUS_FALSE;
- }
- } else {
- rlen = 0;
- }
+ if (!context->lame_ready) {
+ lame_init_params(context->gfp);
+ lame_print_config(context->gfp);
+ context->lame_ready = 1;
+ }
+
+ if (handle->channels == 2) {
+ int16_t l[4096] = { 0 };
+ int16_t r[4096] = { 0 };
+ int i, j = 0;
+
+ for (i = 0; i < nsamples; i++) {
+ l[i] = audio[j++];
+ r[i] = audio[j++];
+ }
+
+ if ((rlen = lame_encode_buffer(context->gfp, l, r, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+ return SWITCH_STATUS_FALSE;
+ }
+
+ } else if (handle->channels == 1) {
+ if ((rlen = lame_encode_buffer(context->gfp, audio, NULL, nsamples, mp3buf, sizeof(mp3buf))) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+ return SWITCH_STATUS_FALSE;
+ }
+ } else {
+ rlen = 0;
+ }
if (rlen) {
int ret = fwrite(mp3buf, 1, rlen, context->fp);
@@ -879,55 +879,55 @@
static switch_status_t shout_file_set_string(switch_file_handle_t *handle, switch_audio_col_t col, const char *string)
{
shout_context_t *context = handle->private_info;
- switch_status_t status = SWITCH_STATUS_FALSE;
-
- if (!context->shout) {
- switch (col) {
- case SWITCH_AUDIO_COL_STR_TITLE:
- id3tag_set_title(context->gfp, string);
- break;
- case SWITCH_AUDIO_COL_STR_COMMENT:
- id3tag_set_comment(context->gfp, string);
- break;
- case SWITCH_AUDIO_COL_STR_ARTIST:
- id3tag_set_artist(context->gfp, string);
- break;
- case SWITCH_AUDIO_COL_STR_DATE:
- id3tag_set_year(context->gfp, string);
- break;
- case SWITCH_AUDIO_COL_STR_SOFTWARE:
- break;
- id3tag_set_album(context->gfp, string);
- case SWITCH_AUDIO_COL_STR_COPYRIGHT:
- id3tag_set_genre(context->gfp, string);
- break;
- default:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
- break;
- }
-
- return status;
- }
-
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ if (!context->shout) {
+ switch (col) {
+ case SWITCH_AUDIO_COL_STR_TITLE:
+ id3tag_set_title(context->gfp, string);
+ break;
+ case SWITCH_AUDIO_COL_STR_COMMENT:
+ id3tag_set_comment(context->gfp, string);
+ break;
+ case SWITCH_AUDIO_COL_STR_ARTIST:
+ id3tag_set_artist(context->gfp, string);
+ break;
+ case SWITCH_AUDIO_COL_STR_DATE:
+ id3tag_set_year(context->gfp, string);
+ break;
+ case SWITCH_AUDIO_COL_STR_SOFTWARE:
+ break;
+ id3tag_set_album(context->gfp, string);
+ case SWITCH_AUDIO_COL_STR_COPYRIGHT:
+ id3tag_set_genre(context->gfp, string);
+ break;
+ default:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Value Ignored\n");
+ break;
+ }
+
+ return status;
+ }
+
switch (col) {
case SWITCH_AUDIO_COL_STR_TITLE:
if (shout_set_name(context->shout, string) == SHOUTERR_SUCCESS) {
- status = SWITCH_STATUS_SUCCESS;
- } else {
+ status = SWITCH_STATUS_SUCCESS;
+ } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
}
break;
case SWITCH_AUDIO_COL_STR_COMMENT:
if (shout_set_url(context->shout, string) == SHOUTERR_SUCCESS) {
- status = SWITCH_STATUS_SUCCESS;
- } else {
+ status = SWITCH_STATUS_SUCCESS;
+ } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
}
break;
case SWITCH_AUDIO_COL_STR_ARTIST:
if (shout_set_description(context->shout, string) == SHOUTERR_SUCCESS) {
- status = SWITCH_STATUS_SUCCESS;
- } else {
+ status = SWITCH_STATUS_SUCCESS;
+ } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting name: %s\n", shout_get_error(context->shout));
}
break;
@@ -946,7 +946,7 @@
static switch_bool_t telecast_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
{
- switch_buffer_t *buffer = (switch_buffer_t *) user_data;
+ switch_buffer_t *buffer = (switch_buffer_t *) user_data;
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_frame_t frame = { 0 };
@@ -961,18 +961,18 @@
case SWITCH_ABC_TYPE_READ_PING:
if (buffer) {
if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
- switch_buffer_lock(buffer);
- switch_buffer_write(buffer, frame.data, frame.datalen);
- switch_buffer_unlock(buffer);
+ switch_buffer_lock(buffer);
+ switch_buffer_write(buffer, frame.data, frame.datalen);
+ switch_buffer_unlock(buffer);
}
} else {
- return SWITCH_FALSE;
- }
+ return SWITCH_FALSE;
+ }
break;
case SWITCH_ABC_TYPE_READ:
case SWITCH_ABC_TYPE_WRITE:
-
+
default:
break;
}
@@ -981,357 +981,344 @@
}
struct holder {
- switch_stream_handle_t *stream;
- switch_memory_pool_t *pool;
- char *host;
- char *port;
- char *uri;
+ switch_stream_handle_t *stream;
+ switch_memory_pool_t *pool;
+ char *host;
+ char *port;
+ char *uri;
};
static int web_callback(void *pArg, int argc, char **argv, char **columnNames)
{
- struct holder *holder = (struct holder *) pArg;
- char title_b4[128] = "";
- char title_aft[128*3] = "";
- char *mp3, *m3u;
-
- /*
- 0 uuid VARCHAR(255),
- 1 created VARCHAR(255),
- 2 name VARCHAR(255),
- 3 state VARCHAR(255),
- 4 cid_name VARCHAR(255),
- 5 cid_num VARCHAR(255),
- 6 ip_addr VARCHAR(255),
- 7 dest VARCHAR(255),
- 8 application VARCHAR(255),
- 9 application_data VARCHAR(255),
- 10 read_codec VARCHAR(255),
- 11 read_rate VARCHAR(255),
- 12 write_codec VARCHAR(255),
- 13 write_rate VARCHAR(255)
- */
-
- holder->stream->write_function(holder->stream,
- "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>",
- argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
-
- snprintf(title_b4, sizeof(title_b4), "%s <%s>", argv[4], argv[5]);
- switch_url_encode(title_b4, title_aft, sizeof(title_aft));
-
- mp3 = switch_mprintf("http://%s:%s%s/mp3/%s/%s.mp3", holder->host, holder->port, holder->uri, argv[0], argv[5]);
- m3u = switch_mprintf("http://%s:%s%s/m3u/mp3/%s/%s.mp3.m3u", holder->host, holder->port, holder->uri, argv[0], argv[5]);
-
- holder->stream->write_function(holder->stream, "[<a href=%s>mp3</a>] ", mp3);
- holder->stream->write_function(holder->stream, "[<a href=%s>m3u</a>]</td></tr>\n", m3u);
-
- switch_safe_free(mp3);
- switch_safe_free(m3u);
- return 0;
+ struct holder *holder = (struct holder *) pArg;
+ char title_b4[128] = "";
+ char title_aft[128 * 3] = "";
+ char *mp3, *m3u;
+
+ /*
+ 0 uuid VARCHAR(255),
+ 1 created VARCHAR(255),
+ 2 name VARCHAR(255),
+ 3 state VARCHAR(255),
+ 4 cid_name VARCHAR(255),
+ 5 cid_num VARCHAR(255),
+ 6 ip_addr VARCHAR(255),
+ 7 dest VARCHAR(255),
+ 8 application VARCHAR(255),
+ 9 application_data VARCHAR(255),
+ 10 read_codec VARCHAR(255),
+ 11 read_rate VARCHAR(255),
+ 12 write_codec VARCHAR(255),
+ 13 write_rate VARCHAR(255)
+ */
+
+ holder->stream->write_function(holder->stream,
+ "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>",
+ argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
+
+ snprintf(title_b4, sizeof(title_b4), "%s <%s>", argv[4], argv[5]);
+ switch_url_encode(title_b4, title_aft, sizeof(title_aft));
+
+ mp3 = switch_mprintf("http://%s:%s%s/mp3/%s/%s.mp3", holder->host, holder->port, holder->uri, argv[0], argv[5]);
+ m3u = switch_mprintf("http://%s:%s%s/m3u/mp3/%s/%s.mp3.m3u", holder->host, holder->port, holder->uri, argv[0], argv[5]);
+
+ holder->stream->write_function(holder->stream, "[<a href=%s>mp3</a>] ", mp3);
+ holder->stream->write_function(holder->stream, "[<a href=%s>m3u</a>]</td></tr>\n", m3u);
+
+ switch_safe_free(mp3);
+ switch_safe_free(m3u);
+ return 0;
}
void do_telecast(switch_stream_handle_t *stream)
{
- char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
- char *uuid = strdup(path_info + 4);
- switch_core_session_t *tsession;
- char *fname = "stream.mp3";
-
- if ((fname = strchr(uuid, '/'))) {
- *fname++ = '\0';
- }
-
- if (!(tsession = switch_core_session_locate(uuid))) {
- char *ref = switch_event_get_header(stream->param_event, "http-referer");
- stream->write_function(stream,"Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n"
- "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
- } else {
- switch_media_bug_t *bug = NULL;
- switch_buffer_t *buffer;
- switch_mutex_t *mutex;
- switch_channel_t *channel = switch_core_session_get_channel(tsession);
- lame_global_flags *gfp = NULL;
- switch_codec_t *read_codec;
-
- if (!(gfp = lame_init())) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
- goto end;
- }
- read_codec = switch_core_session_get_read_codec(tsession);
-
- lame_set_num_channels(gfp, read_codec->implementation->number_of_channels);
- lame_set_in_samplerate(gfp, read_codec->implementation->actual_samples_per_second);
- lame_set_brate(gfp, 24);
- lame_set_mode(gfp, 3);
- lame_set_quality(gfp, 2);
- lame_set_errorf(gfp, log_error);
- lame_set_debugf(gfp, log_debug);
- lame_set_msgf(gfp, log_msg);
- lame_set_bWriteVbrTag(gfp, 0);
- lame_mp3_tags_fid(gfp, NULL);
- lame_init_params(gfp);
- lame_print_config(gfp);
-
- switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
- switch_buffer_create_dynamic(&buffer, 1024, 2048, 0);
- switch_buffer_add_mutex(buffer, mutex);
-
- if (switch_core_media_bug_add(tsession, telecast_callback, buffer, 0,
- SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING, &bug) != SWITCH_STATUS_SUCCESS) {
- goto end;
- }
-
- stream->write_function(stream,
- "Content-type: audio/mpeg\r\n"
- "Content-Disposition: inline; filename=\"%s\"\r\n\r\n",
- fname);
-
- while(switch_channel_ready(channel)) {
- unsigned char mp3buf[TC_BUFFER_SIZE] = "";
- int rlen;
- uint8_t buf[1024];
- switch_size_t bytes = 0;
-
- if (switch_buffer_inuse(buffer) >= 1024) {
- switch_buffer_lock(buffer);
- bytes = switch_buffer_read(buffer, buf, sizeof(buf));
- switch_buffer_unlock(buffer);
- } else {
- if (!bytes) {
- switch_yield(1000);
- continue;
- }
- memset(buf, 0, bytes);
- }
-
- if ((rlen = lame_encode_buffer(gfp, (void *)buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
- goto end;
- }
-
- if (rlen) {
- if (stream->raw_write_function(stream, mp3buf, rlen)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
- goto end;
- }
- }
- }
-
- end:
-
- switch_safe_free(uuid);
-
- if (gfp) {
- lame_close(gfp);
- gfp = NULL;
- }
-
- if (bug) {
- switch_core_media_bug_remove(tsession, &bug);
- }
-
- if (buffer) {
- switch_buffer_destroy(&buffer);
- }
+ char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
+ char *uuid = strdup(path_info + 4);
+ switch_core_session_t *tsession;
+ char *fname = "stream.mp3";
+
+ if ((fname = strchr(uuid, '/'))) {
+ *fname++ = '\0';
+ }
+
+ if (!(tsession = switch_core_session_locate(uuid))) {
+ char *ref = switch_event_get_header(stream->param_event, "http-referer");
+ stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n" "<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
+ } else {
+ switch_media_bug_t *bug = NULL;
+ switch_buffer_t *buffer;
+ switch_mutex_t *mutex;
+ switch_channel_t *channel = switch_core_session_get_channel(tsession);
+ lame_global_flags *gfp = NULL;
+ switch_codec_t *read_codec;
+
+ if (!(gfp = lame_init())) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
+ goto end;
+ }
+ read_codec = switch_core_session_get_read_codec(tsession);
+
+ lame_set_num_channels(gfp, read_codec->implementation->number_of_channels);
+ lame_set_in_samplerate(gfp, read_codec->implementation->actual_samples_per_second);
+ lame_set_brate(gfp, 24);
+ lame_set_mode(gfp, 3);
+ lame_set_quality(gfp, 2);
+ lame_set_errorf(gfp, log_error);
+ lame_set_debugf(gfp, log_debug);
+ lame_set_msgf(gfp, log_msg);
+ lame_set_bWriteVbrTag(gfp, 0);
+ lame_mp3_tags_fid(gfp, NULL);
+ lame_init_params(gfp);
+ lame_print_config(gfp);
+
+ switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
+ switch_buffer_create_dynamic(&buffer, 1024, 2048, 0);
+ switch_buffer_add_mutex(buffer, mutex);
+
+ if (switch_core_media_bug_add(tsession, telecast_callback, buffer, 0,
+ SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING, &bug) != SWITCH_STATUS_SUCCESS) {
+ goto end;
+ }
+
+ stream->write_function(stream, "Content-type: audio/mpeg\r\n" "Content-Disposition: inline; filename=\"%s\"\r\n\r\n", fname);
+
+ while (switch_channel_ready(channel)) {
+ unsigned char mp3buf[TC_BUFFER_SIZE] = "";
+ int rlen;
+ uint8_t buf[1024];
+ switch_size_t bytes = 0;
+
+ if (switch_buffer_inuse(buffer) >= 1024) {
+ switch_buffer_lock(buffer);
+ bytes = switch_buffer_read(buffer, buf, sizeof(buf));
+ switch_buffer_unlock(buffer);
+ } else {
+ if (!bytes) {
+ switch_yield(1000);
+ continue;
+ }
+ memset(buf, 0, bytes);
+ }
+
+ if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, bytes / 2, mp3buf, sizeof(mp3buf))) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+ goto end;
+ }
+
+ if (rlen) {
+ if (stream->raw_write_function(stream, mp3buf, rlen)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+ goto end;
+ }
+ }
+ }
+
+ end:
+
+ switch_safe_free(uuid);
+
+ if (gfp) {
+ lame_close(gfp);
+ gfp = NULL;
+ }
+
+ if (bug) {
+ switch_core_media_bug_remove(tsession, &bug);
+ }
+
+ if (buffer) {
+ switch_buffer_destroy(&buffer);
+ }
- switch_core_session_rwunlock(tsession);
- }
+ switch_core_session_rwunlock(tsession);
+ }
}
void do_broadcast(switch_stream_handle_t *stream)
{
- char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
- char *file;
- lame_global_flags *gfp = NULL;
- switch_file_handle_t fh = {0};
- unsigned char mp3buf[TC_BUFFER_SIZE] = "";
- uint8_t buf[1024];
- int rlen;
- int is_local = 0;
- uint32_t interval = 20000;
-
- if (strstr(path_info + 7, "://")) {
- file = strdup(path_info + 7);
- is_local++;
- } else {
- file = switch_mprintf("%s/streamfiles/%s", SWITCH_GLOBAL_dirs.base_dir, path_info + 7);
- }
- assert(file);
-
- if (switch_core_file_open(&fh,
- file,
- 0,
- 0,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
- memset(&fh, 0, sizeof(fh));
- stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File not found</h2>\n");
- goto end;
- }
-
- if (switch_test_flag((&fh), SWITCH_FILE_NATIVE)) {
- stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File format not supported</h2>\n");
- goto end;
- }
-
- if (!(gfp = lame_init())) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
- goto end;
- }
-
- lame_set_num_channels(gfp, fh.channels);
- lame_set_in_samplerate(gfp, fh.samplerate);
- lame_set_brate(gfp, 24);
- lame_set_mode(gfp, 3);
- lame_set_quality(gfp, 2);
- lame_set_errorf(gfp, log_error);
- lame_set_debugf(gfp, log_debug);
- lame_set_msgf(gfp, log_msg);
- lame_set_bWriteVbrTag(gfp, 0);
- lame_mp3_tags_fid(gfp, NULL);
- lame_init_params(gfp);
- lame_print_config(gfp);
-
- stream->write_function(stream,
- "Content-type: audio/mpeg\r\n"
- "Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n",
- path_info + 7);
-
- if (fh.interval) {
- interval = fh.interval * 1000;
- }
-
- for(;;) {
- switch_size_t samples = sizeof(buf) / 2;
-
- switch_core_file_read(&fh, buf, &samples);
-
- if (is_local) {
- switch_yield(interval);
- }
-
- if (!samples) {
- break;
- }
-
- if ((rlen = lame_encode_buffer(gfp, (void *)buf, NULL, samples, mp3buf, sizeof(mp3buf))) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
- goto end;
- }
-
- if (rlen) {
- if (stream->raw_write_function(stream, mp3buf, rlen)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
- goto end;
- }
- }
- }
-
- while ((rlen = lame_encode_flush(gfp, mp3buf, sizeof(mp3buf))) > 0) {
- if (stream->raw_write_function(stream, mp3buf, rlen)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
- goto end;
- }
- }
-
- end:
-
- if (fh.channels) {
- switch_core_file_close(&fh);
- }
-
- switch_safe_free(file);
-
- if (gfp) {
- lame_close(gfp);
- gfp = NULL;
- }
+ char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
+ char *file;
+ lame_global_flags *gfp = NULL;
+ switch_file_handle_t fh = { 0 };
+ unsigned char mp3buf[TC_BUFFER_SIZE] = "";
+ uint8_t buf[1024];
+ int rlen;
+ int is_local = 0;
+ uint32_t interval = 20000;
+
+ if (strstr(path_info + 7, "://")) {
+ file = strdup(path_info + 7);
+ is_local++;
+ } else {
+ file = switch_mprintf("%s/streamfiles/%s", SWITCH_GLOBAL_dirs.base_dir, path_info + 7);
+ }
+ assert(file);
+
+ if (switch_core_file_open(&fh, file, 0, 0, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+ memset(&fh, 0, sizeof(fh));
+ stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File not found</h2>\n");
+ goto end;
+ }
+
+ if (switch_test_flag((&fh), SWITCH_FILE_NATIVE)) {
+ stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>File format not supported</h2>\n");
+ goto end;
+ }
+
+ if (!(gfp = lame_init())) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not allocate lame\n");
+ goto end;
+ }
+
+ lame_set_num_channels(gfp, fh.channels);
+ lame_set_in_samplerate(gfp, fh.samplerate);
+ lame_set_brate(gfp, 24);
+ lame_set_mode(gfp, 3);
+ lame_set_quality(gfp, 2);
+ lame_set_errorf(gfp, log_error);
+ lame_set_debugf(gfp, log_debug);
+ lame_set_msgf(gfp, log_msg);
+ lame_set_bWriteVbrTag(gfp, 0);
+ lame_mp3_tags_fid(gfp, NULL);
+ lame_init_params(gfp);
+ lame_print_config(gfp);
+
+ stream->write_function(stream, "Content-type: audio/mpeg\r\n" "Content-Disposition: inline; filename=\"%s.mp3\"\r\n\r\n", path_info + 7);
+
+ if (fh.interval) {
+ interval = fh.interval * 1000;
+ }
+
+ for (;;) {
+ switch_size_t samples = sizeof(buf) / 2;
+
+ switch_core_file_read(&fh, buf, &samples);
+
+ if (is_local) {
+ switch_yield(interval);
+ }
+
+ if (!samples) {
+ break;
+ }
+
+ if ((rlen = lame_encode_buffer(gfp, (void *) buf, NULL, samples, mp3buf, sizeof(mp3buf))) < 0) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
+ goto end;
+ }
+
+ if (rlen) {
+ if (stream->raw_write_function(stream, mp3buf, rlen)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+ goto end;
+ }
+ }
+ }
+
+ while ((rlen = lame_encode_flush(gfp, mp3buf, sizeof(mp3buf))) > 0) {
+ if (stream->raw_write_function(stream, mp3buf, rlen)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected\n");
+ goto end;
+ }
+ }
+
+ end:
+
+ if (fh.channels) {
+ switch_core_file_close(&fh);
+ }
+
+ switch_safe_free(file);
+
+ if (gfp) {
+ lame_close(gfp);
+ gfp = NULL;
+ }
}
void do_index(switch_stream_handle_t *stream)
{
- switch_core_db_t *db = switch_core_db_handle();
- const char *sql = "select * from channels";
- struct holder holder;
- char *errmsg;
-
- holder.host = switch_event_get_header(stream->param_event, "http-host");
- holder.port = switch_event_get_header(stream->param_event, "http-port");
- holder.uri = switch_event_get_header(stream->param_event, "http-uri");
- holder.stream = stream;
-
- stream->write_function(stream, "Content-type: text/html\r\n\r\n");
- stream->write_function(stream,
- "<table align=center border=1 cellpadding=6 cellspacing=0>"
- "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
- "Created", "CID Name", "CID Num", "Ext", "App", "Data", "Codec", "Rate", "Listen"
- );
-
- switch_core_db_exec(db, sql, web_callback, &holder, &errmsg);
-
- stream->write_function(stream,
- "</table>");
-
- if (errmsg) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n", errmsg);
- switch_safe_free(errmsg);
- }
+ switch_core_db_t *db = switch_core_db_handle();
+ const char *sql = "select * from channels";
+ struct holder holder;
+ char *errmsg;
+
+ holder.host = switch_event_get_header(stream->param_event, "http-host");
+ holder.port = switch_event_get_header(stream->param_event, "http-port");
+ holder.uri = switch_event_get_header(stream->param_event, "http-uri");
+ holder.stream = stream;
+
+ stream->write_function(stream, "Content-type: text/html\r\n\r\n");
+ stream->write_function(stream,
+ "<table align=center border=1 cellpadding=6 cellspacing=0>"
+ "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
+ "Created", "CID Name", "CID Num", "Ext", "App", "Data", "Codec", "Rate", "Listen");
+
+ switch_core_db_exec(db, sql, web_callback, &holder, &errmsg);
+
+ stream->write_function(stream, "</table>");
+
+ if (errmsg) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n", errmsg);
+ switch_safe_free(errmsg);
+ }
}
#define TELECAST_SYNTAX ""
SWITCH_STANDARD_API(telecast_api_function)
{
- char *host = NULL, *port = NULL, *uri = NULL, *path_info = NULL;
+ char *host = NULL, *port = NULL, *uri = NULL, *path_info = NULL;
- if (session) {
+ if (session) {
return SWITCH_STATUS_FALSE;
}
- if (stream->param_event) {
- host = switch_event_get_header(stream->param_event, "http-host");
- port = switch_event_get_header(stream->param_event, "http-port");
- uri = switch_event_get_header(stream->param_event, "http-uri");
- path_info = switch_event_get_header(stream->param_event, "http-path-info");
- }
-
- if (!path_info) {
- return SWITCH_STATUS_FALSE;
- } else {
- if (!strncmp(path_info, "index", 5)) {
- do_index(stream);
- return SWITCH_STATUS_SUCCESS;
- }
-
- if (!strncmp(path_info, "m3u/", 4)) {
- char *p;
-
- if ((p = strstr(path_info, ".m3u"))) {
- *p = '\0';
- }
-
- stream->write_function(stream, "Content-type: audio/x-mpegurl\r\n\r\nhttp://%s:%s%s/%s\n", host, port, uri, path_info + 4);
- return SWITCH_STATUS_SUCCESS;
- }
-
- if (!strncmp(path_info, "mp3/", 4)) {
- do_telecast(stream);
- return SWITCH_STATUS_SUCCESS;
- }
-
- if (!strncmp(path_info, "stream/", 7)) {
- do_broadcast(stream);
- return SWITCH_STATUS_SUCCESS;
- }
- }
-
- stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Invalid URL</h2>\n");
+ if (stream->param_event) {
+ host = switch_event_get_header(stream->param_event, "http-host");
+ port = switch_event_get_header(stream->param_event, "http-port");
+ uri = switch_event_get_header(stream->param_event, "http-uri");
+ path_info = switch_event_get_header(stream->param_event, "http-path-info");
+ }
- return SWITCH_STATUS_SUCCESS;
+ if (!path_info) {
+ return SWITCH_STATUS_FALSE;
+ } else {
+ if (!strncmp(path_info, "index", 5)) {
+ do_index(stream);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (!strncmp(path_info, "m3u/", 4)) {
+ char *p;
+
+ if ((p = strstr(path_info, ".m3u"))) {
+ *p = '\0';
+ }
+
+ stream->write_function(stream, "Content-type: audio/x-mpegurl\r\n\r\nhttp://%s:%s%s/%s\n", host, port, uri, path_info + 4);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (!strncmp(path_info, "mp3/", 4)) {
+ do_telecast(stream);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (!strncmp(path_info, "stream/", 7)) {
+ do_broadcast(stream);
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
+
+ stream->write_function(stream, "Content-type: text/html\r\n\r\n<h2>Invalid URL</h2>\n");
+
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load)
{
- switch_api_interface_t *shout_api_interface;
- switch_file_interface_t *file_interface;
+ switch_api_interface_t *shout_api_interface;
+ switch_file_interface_t *file_interface;
supported_formats[0] = "shout";
supported_formats[1] = "mp3";
@@ -1339,16 +1326,16 @@
curl_global_init(CURL_GLOBAL_ALL);
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
- file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
- file_interface->interface_name = modname;
- file_interface->extens = supported_formats;
- file_interface->file_open = shout_file_open;
- file_interface->file_close = shout_file_close;
- file_interface->file_read = shout_file_read;
- file_interface->file_write = shout_file_write;
- file_interface->file_seek = shout_file_seek;
- file_interface->file_set_string = shout_file_set_string;
- file_interface->file_get_string = shout_file_get_string;
+ file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
+ file_interface->interface_name = modname;
+ file_interface->extens = supported_formats;
+ file_interface->file_open = shout_file_open;
+ file_interface->file_close = shout_file_close;
+ file_interface->file_read = shout_file_read;
+ file_interface->file_write = shout_file_write;
+ file_interface->file_seek = shout_file_seek;
+ file_interface->file_set_string = shout_file_set_string;
+ file_interface->file_get_string = shout_file_get_string;
/* connect my internal structure to the blank pointer passed to me */
//*module_interface = &shout_module_interface;
@@ -1356,7 +1343,7 @@
shout_init();
InitMP3Constants();
- SWITCH_ADD_API(shout_api_interface, "telecast", "telecast", telecast_api_function, TELECAST_SYNTAX);
+ SWITCH_ADD_API(shout_api_interface, "telecast", "telecast", telecast_api_function, TELECAST_SYNTAX);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c Tue May 27 07:24:06 2008
@@ -147,7 +147,7 @@
alt_len = strlen(path) + 10;
switch_zmalloc(alt_path, alt_len);
-
+
switch_copy_string(alt_path, path, alt_len);
if ((last = strrchr(alt_path, '/'))) {
next = ++last;
@@ -177,7 +177,6 @@
goto end;
}
}
-
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
handle->samples = (unsigned int) context->sfinfo.frames;
handle->samplerate = context->sfinfo.samplerate;
@@ -188,8 +187,8 @@
handle->speed = 0;
handle->private_info = context;
- end:
-
+ end:
+
switch_safe_free(alt_path);
switch_safe_free(ldup);
@@ -334,7 +333,7 @@
char *p;
struct format_map *map = switch_core_permanent_alloc(sizeof(*map));
switch_assert(map);
-
+
map->ext = switch_core_permanent_strdup(info.extension);
map->uext = switch_core_permanent_strdup(info.extension);
map->format = info.format;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_tone_stream/mod_tone_stream.c Tue May 27 07:24:06 2008
@@ -79,9 +79,9 @@
}
teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
- ts.rate = handle->samplerate;
- ts.channels = 1;
-
+ ts.rate = handle->samplerate;
+ ts.channels = 1;
+
if (!strncasecmp(tonespec, "path=", 5)) {
tmp = tonespec + 5;
if ((fd = open(tmp, O_RDONLY)) < 0) {
@@ -89,7 +89,7 @@
return SWITCH_STATUS_FALSE;
}
- while((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
+ while ((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
teletone_run(&ts, buf);
}
close(fd);
@@ -99,7 +99,7 @@
}
teletone_destroy_session(&ts);
-
+
handle->private_info = audio_buffer;
return SWITCH_STATUS_SUCCESS;
@@ -108,7 +108,7 @@
static switch_status_t tone_stream_file_close(switch_file_handle_t *handle)
{
switch_buffer_t *audio_buffer = handle->private_info;
-
+
switch_buffer_destroy(&audio_buffer);
return SWITCH_STATUS_SUCCESS;
}
@@ -117,7 +117,7 @@
{
switch_buffer_t *audio_buffer = handle->private_info;
switch_size_t bytes;
-
+
if ((bytes = switch_buffer_read_loop(audio_buffer, data, *len * 2)) <= 0) {
*len = 0;
return SWITCH_STATUS_FALSE;
@@ -135,7 +135,7 @@
{
switch_file_interface_t *file_interface;
supported_formats[0] = "tone_stream";
-
+
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE);
file_interface->interface_name = modname;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/freeswitch_lua.cpp Tue May 27 07:24:06 2008
@@ -3,19 +3,19 @@
#include "freeswitch_lua.h"
using namespace LUA;
-Session::Session() : CoreSession()
+Session::Session():CoreSession()
{
cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
hh = mark = 0;
}
-Session::Session(char *uuid) : CoreSession(uuid)
+Session::Session(char *uuid):CoreSession(uuid)
{
cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
hh = mark = 0;
}
-Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
{
cb_function = cb_arg = hangup_func_str = hangup_func_arg = NULL;
hh = mark = 0;
@@ -30,25 +30,25 @@
}
free(hangup_func_str);
}
-
+
switch_safe_free(hangup_func_arg);
switch_safe_free(cb_function);
switch_safe_free(cb_arg);
}
-bool Session::begin_allow_threads()
+bool Session::begin_allow_threads()
{
do_hangup_hook();
return true;
}
-bool Session::end_allow_threads()
+bool Session::end_allow_threads()
{
do_hangup_hook();
return true;
}
-void Session::setLUA(lua_State *state)
+void Session::setLUA(lua_State * state)
{
L = state;
}
@@ -56,30 +56,31 @@
lua_State *Session::getLUA()
{
if (!L) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
}
return L;
}
-bool Session::ready() {
+bool Session::ready()
+{
bool r;
- sanity_check(false);
+ sanity_check(false);
r = switch_channel_ready(channel) != 0;
do_hangup_hook();
return r;
}
-void Session::check_hangup_hook()
+void Session::check_hangup_hook()
{
if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
hh++;
}
}
-void Session::do_hangup_hook()
+void Session::do_hangup_hook()
{
if (hh && !mark) {
const char *err = NULL;
@@ -90,25 +91,25 @@
return;
}
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)hangup_func_str);
-
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) hangup_func_str);
+
lua_pushstring(L, hook_state == CS_HANGUP ? "hangup" : "transfer");
if (hangup_func_arg) {
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)hangup_func_arg);
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) hangup_func_arg);
arg_count++;
}
-
+
lua_call(L, arg_count, 1);
err = lua_tostring(L, -1);
if (!switch_strlen_zero(err)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
}
}
-static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
+static switch_status_t lua_hanguphook(switch_core_session_t *session_hungup)
{
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
CoreSession *coresession = NULL;
@@ -125,13 +126,14 @@
}
-void Session::setHangupHook(char *func, char *arg) {
+void Session::setHangupHook(char *func, char *arg)
+{
sanity_check_noreturn;
switch_safe_free(hangup_func_str);
switch_safe_free(hangup_func_arg);
-
+
if (func) {
hangup_func_str = strdup(func);
if (!switch_strlen_zero(arg)) {
@@ -143,7 +145,8 @@
}
}
-void Session::setInputCallback(char *cbfunc, char *funcargs) {
+void Session::setInputCallback(char *cbfunc, char *funcargs)
+{
sanity_check_noreturn;
@@ -156,15 +159,15 @@
if (funcargs) {
cb_arg = strdup(funcargs);
}
-
+
args.buf = this;
switch_channel_set_private(channel, "CoreSession", this);
- args.input_callback = dtmf_callback;
+ args.input_callback = dtmf_callback;
ap = &args;
}
-switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
{
const char *ret;
@@ -173,27 +176,27 @@
}
switch (itype) {
- case SWITCH_INPUT_TYPE_DTMF:
+ case SWITCH_INPUT_TYPE_DTMF:
{
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
char str[2] = "";
int arg_count = 2;
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_function);
- lua_pushstring(L, "dtmf");
-
- lua_newtable(L);
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
+ lua_pushstring(L, "dtmf");
+
+ lua_newtable(L);
lua_pushstring(L, "digit");
str[0] = dtmf->digit;
lua_pushstring(L, str);
lua_rawset(L, -3);
-
+
lua_pushstring(L, "duration");
lua_pushnumber(L, dtmf->duration);
lua_rawset(L, -3);
if (cb_arg) {
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_arg);
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
@@ -201,30 +204,30 @@
ret = lua_tostring(L, -1);
lua_pop(L, 1);
- return process_callback_result((char *)ret);
+ return process_callback_result((char *) ret);
}
break;
- case SWITCH_INPUT_TYPE_EVENT:
+ case SWITCH_INPUT_TYPE_EVENT:
{
switch_event_t *event = (switch_event_t *) input;
int arg_count = 2;
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_function);
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_function);
lua_pushstring(L, "event");
mod_lua_conjure_event(L, event, "__Input_Event__", 1);
lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
if (cb_arg) {
- lua_getfield(L, LUA_GLOBALSINDEX, (char *)cb_arg);
+ lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
lua_call(L, 2, 1);
- ret = lua_tostring(L, -1);
+ ret = lua_tostring(L, -1);
lua_pop(L, 1);
-
- return process_callback_result((char *)ret);
+
+ return process_callback_result((char *) ret);
}
break;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp Tue May 27 07:24:06 2008
@@ -45,23 +45,23 @@
char *xml_handler;
} globals;
-int luaopen_freeswitch(lua_State* L);
+int luaopen_freeswitch(lua_State * L);
-static int panic (lua_State *L)
+static int panic(lua_State * L)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "unprotected error in call to Lua API (%s)\n",
- lua_tostring(L, -1));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "unprotected error in call to Lua API (%s)\n", lua_tostring(L, -1));
return 0;
}
-static void lua_uninit(lua_State *L)
+static void lua_uninit(lua_State * L)
{
lua_gc(L, LUA_GCCOLLECT, 0);
lua_close(L);
}
-static int traceback (lua_State *L) {
+static int traceback(lua_State * L)
+{
lua_getfield(L, LUA_GLOBALSINDEX, "debug");
if (!lua_istable(L, -1)) {
lua_pop(L, 1);
@@ -72,30 +72,32 @@
lua_pop(L, 2);
return 1;
}
- lua_pushvalue(L, 1); /* pass error message */
- lua_pushinteger(L, 2); /* skip this function and traceback */
- lua_call(L, 2, 1); /* call debug.traceback */
+ lua_pushvalue(L, 1); /* pass error message */
+ lua_pushinteger(L, 2); /* skip this function and traceback */
+ lua_call(L, 2, 1); /* call debug.traceback */
return 1;
}
-static int docall (lua_State *L, int narg, int clear) {
+static int docall(lua_State * L, int narg, int clear)
+{
int status;
- int base = lua_gettop(L) - narg; /* function index */
-
- lua_pushcfunction(L, traceback); /* push traceback function */
- lua_insert(L, base); /* put it under chunk and args */
+ int base = lua_gettop(L) - narg; /* function index */
+
+ lua_pushcfunction(L, traceback); /* push traceback function */
+ lua_insert(L, base); /* put it under chunk and args */
status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base);
- lua_remove(L, base); /* remove traceback function */
+ lua_remove(L, base); /* remove traceback function */
/* force a complete garbage collection in case of errors */
- if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0);
+ if (status != 0)
+ lua_gc(L, LUA_GCCOLLECT, 0);
return status;
}
-static lua_State *lua_init(void)
+static lua_State *lua_init(void)
{
lua_State *L = lua_open();
int error = 0;
@@ -108,12 +110,12 @@
lua_gc(L, LUA_GCRESTART, 0);
lua_atpanic(L, panic);
error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1);
- }
+ }
return L;
}
-static int lua_parse_and_execute(lua_State *L, char *input_code)
+static int lua_parse_and_execute(lua_State * L, char *input_code)
{
int error = 0;
@@ -124,7 +126,7 @@
if (*input_code == '~') {
char *buff = input_code + 1;
- error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1); //lua_pcall(L, 0, 0, 0);
+ error = luaL_loadbuffer(L, buff, strlen(buff), "line") || docall(L, 0, 1); //lua_pcall(L, 0, 0, 0);
} else {
char *args = strchr(input_code, ' ');
if (args) {
@@ -136,13 +138,13 @@
if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_stream_handle_t stream = { 0 };
SWITCH_STANDARD_STREAM(stream);
-
+
stream.write_function(&stream, " argv = { ");
for (x = 0; x < argc; x++) {
- stream.write_function(&stream, "'%s'%s", argv[x], x == argc-1 ? "" : ", ");
+ stream.write_function(&stream, "'%s'%s", argv[x], x == argc - 1 ? "" : ", ");
}
stream.write_function(&stream, " };");
- code = (char *)stream.data;
+ code = (char *) stream.data;
} else {
code = switch_mprintf("argv = {};");
}
@@ -154,7 +156,7 @@
}
if (!error) {
char *file = input_code, *fdup = NULL;
-
+
if (!switch_is_file_path(file)) {
fdup = switch_mprintf("%s/%s", SWITCH_GLOBAL_dirs.script_dir, file);
switch_assert(fdup);
@@ -170,7 +172,7 @@
if (!switch_strlen_zero(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
- lua_pop(L, 1); /* pop error message from the stack */
+ lua_pop(L, 1); /* pop error message from the stack */
}
return error;
@@ -179,10 +181,10 @@
static void *SWITCH_THREAD_FUNC lua_thread_run(switch_thread_t *thread, void *obj)
{
char *input_code = (char *) obj;
- lua_State *L = lua_init(); /* opens Lua */
+ lua_State *L = lua_init(); /* opens Lua */
lua_parse_and_execute(L, input_code);
-
+
if (input_code) {
free(input_code);
}
@@ -193,12 +195,8 @@
}
-static switch_xml_t lua_fetch(const char *section,
- const char *tag_name,
- const char *key_name,
- const char *key_value,
- switch_event_t *params,
- void *user_data)
+static switch_xml_t lua_fetch(const char *section,
+ const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
{
switch_xml_t xml = NULL;
@@ -238,11 +236,11 @@
if (str) {
if (switch_strlen_zero(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
- } else if (!(xml = switch_xml_parse_str((char *)str, strlen(str)))) {
+ } else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
}
}
-
+
lua_uninit(L);
free(mycmd);
}
@@ -304,13 +302,13 @@
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no args specified!\n");
- return;
- }
+ return;
+ }
snprintf(code, sizeof(code), "~session = freeswitch.Session(\"%s\");", switch_core_session_get_uuid(session));
error = lua_parse_and_execute(L, code);
- mycmd = strdup((char *)data);
+ mycmd = strdup((char *) data);
switch_assert(mycmd);
lua_parse_and_execute(L, mycmd);
@@ -319,8 +317,9 @@
}
-SWITCH_STANDARD_API(luarun_api_function) {
-
+SWITCH_STANDARD_API(luarun_api_function)
+{
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
} else {
@@ -332,7 +331,8 @@
}
-SWITCH_STANDARD_API(lua_api_function) {
+SWITCH_STANDARD_API(lua_api_function)
+{
lua_State *L = lua_init();
char *mycmd;
@@ -370,13 +370,13 @@
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-
+
SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "<script>");
SWITCH_ADD_API(api_interface, "lua", "run a script as an api function", lua_api_function, "<script>");
SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA);
-
+
globals.pool = pool;
do_config();
@@ -385,7 +385,6 @@
}
SWITCH_END_EXTERN_C
-
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_extra.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_extra.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_extra.c Tue May 27 07:24:06 2008
@@ -1,18 +1,15 @@
-SWITCH_BEGIN_EXTERN_C
-
-
-void mod_lua_conjure_event(lua_State *L, switch_event_t *event, const char *name, int destroy_me)
+SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me)
{
Event *result = new Event(event);
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event, destroy_me);
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, destroy_me);
lua_setglobal(L, name);
}
-void mod_lua_conjure_stream(lua_State *L, switch_stream_handle_t *stream, const char *name, int destroy_me)
+void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const char *name, int destroy_me)
{
Stream *result = new Stream(stream);
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream, destroy_me);
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, destroy_me);
lua_setglobal(L, name);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp Tue May 27 07:24:06 2008
@@ -10,22 +10,35 @@
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
- T *tt;
-public:
- SwigValueWrapper() : tt(0) { }
- SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
- SwigValueWrapper(const T& t) : tt(new T(t)) { }
- ~SwigValueWrapper() { delete tt; }
- SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
- operator T&() const { return *tt; }
- T *operator&() { return tt; }
-private:
- SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+ T *tt;
+ public:
+ SwigValueWrapper():tt(0) {
+ }
+ SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+ }
+ SwigValueWrapper(const T & t):tt(new T(t)) {
+ }
+ ~SwigValueWrapper() {
+ delete tt;
+ }
+ SwigValueWrapper & operator=(const T & t) {
+ delete tt;
+ tt = new T(t);
+ return *this;
+ }
+ operator T & () const {
+ return *tt;
+ } T *operator&() {
+ return tt;
+ }
+ private:
+ SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
};
-template <typename T> T SwigValueInit() {
- return T();
+template < typename T > T SwigValueInit()
+{
+ return T();
}
#endif
@@ -60,14 +73,14 @@
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
-# define SWIGUNUSED
+# define SWIGUNUSED
# endif
#endif
@@ -75,7 +88,7 @@
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
@@ -118,7 +131,7 @@
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
-# endif
+# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -262,10 +275,10 @@
*/
-#define SWIG_OK (0)
+#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
@@ -292,16 +305,18 @@
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
-# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) {
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
-SWIGINTERNINLINE int SWIG_CheckState(int r) {
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
@@ -317,38 +332,38 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+ typedef void *(*swig_converter_func) (void *, int *);
+ typedef struct swig_type_info *(*swig_dycast_func) (void **);
/* Structure to store information on one type */
-typedef struct swig_type_info {
- const char *name; /* mangled name of this type */
- const char *str; /* human readable name of this type */
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
- void *clientdata; /* language specific type data */
- int owndata; /* flag if the structure owns the clientdata */
-} swig_type_info;
+ typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+ } swig_type_info;
/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
- swig_type_info *type; /* pointer to type that is equivalent to this type */
- swig_converter_func converter; /* function to cast the void pointers */
- struct swig_cast_info *next; /* pointer to next cast in linked list */
- struct swig_cast_info *prev; /* pointer to the previous cast */
-} swig_cast_info;
+ typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+ } swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
- size_t size; /* Number of types in this module */
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
- swig_type_info **type_initial; /* Array of initially generated type structures */
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
- void *clientdata; /* Language specific module data */
-} swig_module_info;
+ typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+ } swig_module_info;
/*
Compare two type names skipping the space characters, therefore
@@ -357,54 +372,56 @@
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
- const char *f2, const char *l2) {
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
- }
- return (int)((l1 - f1) - (l2 - f2));
-}
+ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+ for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1))
+ ++f1;
+ while ((*f2 == ' ') && (f2 != l2))
+ ++f2;
+ if (*f1 != *f2)
+ return (*f1 > *f2) ? 1 : -1;
+ } return (int) ((l1 - f1) - (l2 - f2));
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/* think of this as a c++ template<> or a scheme macro */
@@ -432,94 +449,89 @@
/*
Check the typename
*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+ }
/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
- SWIG_TypeCheck_Template(iter->type == from, into);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+ SWIG_TypeCheck_Template(iter->type == from, into);
+ }
/*
Cast a pointer up an inheritance hierarchy
*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+ SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+ }
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast) return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast)(ptr);
- if (ty) lastty = ty;
- }
- return lastty;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast)
+ return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast) (ptr);
+ if (ty)
+ lastty = ty;
+ }
+ return lastty;
+ }
/*
Return the name associated with this type
*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
- return ty->name;
-}
+ SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+ return ty->name;
+ }
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
- /* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
- if (!type) return NULL;
- if (type->str != NULL) {
- const char *last_name = type->str;
- const char *s;
- for (s = type->str; *s; s++)
- if (*s == '|') last_name = s+1;
- return last_name;
- }
- else
- return type->name;
-}
+ SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type)
+ return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|')
+ last_name = s + 1;
+ return last_name;
+ } else
+ return type->name;
+ }
/*
Set the clientdata field for a type
*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_cast_info *cast = ti->cast;
- /* if (ti->clientdata == clientdata) return; */
- ti->clientdata = clientdata;
-
- while (cast) {
- if (!cast->converter) {
- swig_type_info *tc = cast->type;
- if (!tc->clientdata) {
- SWIG_TypeClientData(tc, clientdata);
- }
- }
- cast = cast->next;
- }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
- SWIG_TypeClientData(ti, clientdata);
- ti->owndata = 1;
-}
-
+ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+ }
+ SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+ }
+
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
@@ -528,41 +540,38 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- swig_module_info *iter = start;
- do {
- if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
- do {
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
- const char *iname = iter->types[i]->name;
- if (iname) {
- register int compare = strcmp(name, iname);
- if (compare == 0) {
- return iter->types[i];
- } else if (compare < 0) {
- if (i) {
- r = i - 1;
- } else {
- break;
- }
- } else if (compare > 0) {
- l = i + 1;
- }
- } else {
- break; /* should never happen */
+ SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ register size_t l = 0;
+ register size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ register size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ register int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
}
- } while (l <= r);
- }
- iter = iter->next;
- } while (iter != end);
- return 0;
-}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -573,130 +582,124 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- /* STEP 1: Search the name field using binary search */
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
- if (ret) {
- return ret;
- } else {
- /* STEP 2: If the type hasn't been found, do a complete search
- of the str field (the human readable name) */
- swig_module_info *iter = start;
- do {
- register size_t i = 0;
- for (; i < iter->size; ++i) {
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
- return iter->types[i];
- }
- iter = iter->next;
- } while (iter != end);
- }
-
- /* neither found a match */
- return 0;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ register size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+ }
/*
Pack binary data into a string
*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
- static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register unsigned char uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
-}
+ SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ register const unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+ }
/*
Unpack binary data from a string
*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a'-10)) << 4);
- else
- return (char *) 0;
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a'-10));
- else
- return (char *) 0;
- *u = uu;
- }
- return c;
-}
+ SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ register unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register char d = *(c++);
+ register unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a' - 10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a' - 10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+ }
/*
Pack 'void *' into a string buffer.
*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
- char *r = buff;
- if ((2*sizeof(void *) + 2) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
- strcpy(r,name);
- return buff;
-}
+ SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2 * sizeof(void *) + 2) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, &ptr, sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff)))
+ return 0;
+ strcpy(r, name);
+ return buff;
+ }
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- *ptr = (void *) 0;
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+ SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sizeof(void *));
+ }
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
- char *r = buff;
- size_t lname = (name ? strlen(name) : 0);
- if ((2*sz + 2 + lname) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- if (lname) {
- strncpy(r,name,lname+1);
- } else {
- *r = 0;
- }
- return buff;
-}
+ SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2 * sz + 2 + lname) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, ptr, sz);
+ if (lname) {
+ strncpy(r, name, lname + 1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+ }
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- memset(ptr,0,sz);
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sz);
-}
+ SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ memset(ptr, 0, sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sz);
+ }
#ifdef __cplusplus
}
@@ -719,8 +722,8 @@
#include "lua.h"
#include "lauxlib.h"
-#include <stdlib.h> /* for malloc */
-#include <assert.h> /* for a few sanity tests */
+#include <stdlib.h> /* for malloc */
+#include <assert.h> /* for a few sanity tests */
/* -----------------------------------------------------------------------------
* global swig types
@@ -734,62 +737,62 @@
#define SWIG_LUA_CHAR 6
/* Structure for variable linking table */
-typedef struct {
- const char *name;
- lua_CFunction get;
- lua_CFunction set;
-} swig_lua_var_info;
+ typedef struct {
+ const char *name;
+ lua_CFunction get;
+ lua_CFunction set;
+ } swig_lua_var_info;
/* Constant information structure */
-typedef struct {
- int type;
- char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
-} swig_lua_const_info;
-
-typedef struct {
- const char *name;
- lua_CFunction method;
-} swig_lua_method;
-
-typedef struct {
- const char *name;
- lua_CFunction getmethod;
- lua_CFunction setmethod;
-} swig_lua_attribute;
-
-typedef struct swig_lua_class {
- const char *name;
- swig_type_info **type;
- lua_CFunction constructor;
- void (*destructor)(void *);
- swig_lua_method *methods;
- swig_lua_attribute *attributes;
- struct swig_lua_class **bases;
- const char **base_names;
-} swig_lua_class;
+ typedef struct {
+ int type;
+ char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+ } swig_lua_const_info;
+
+ typedef struct {
+ const char *name;
+ lua_CFunction method;
+ } swig_lua_method;
+
+ typedef struct {
+ const char *name;
+ lua_CFunction getmethod;
+ lua_CFunction setmethod;
+ } swig_lua_attribute;
+
+ typedef struct swig_lua_class {
+ const char *name;
+ swig_type_info **type;
+ lua_CFunction constructor;
+ void (*destructor) (void *);
+ swig_lua_method *methods;
+ swig_lua_attribute *attributes;
+ struct swig_lua_class **bases;
+ const char **base_names;
+ } swig_lua_class;
/* this is the struct for wrappering all pointers in SwigLua
*/
-typedef struct {
- swig_type_info *type;
- int own; /* 1 if owned & must be destroyed */
- void *ptr;
-} swig_lua_userdata;
+ typedef struct {
+ swig_type_info *type;
+ int own; /* 1 if owned & must be destroyed */
+ void *ptr;
+ } swig_lua_userdata;
/* this is the struct for wrapping arbitary packed binary data
(currently it is only used for member function pointers)
the data ordering is similar to swig_lua_userdata, but it is currently not possible
to tell the two structures apart within Swig, other than by looking at the type
*/
-typedef struct {
- swig_type_info *type;
- int own; /* 1 if owned & must be destroyed */
- char data[1]; /* arbitary amount of data */
-} swig_lua_rawdata;
+ typedef struct {
+ swig_type_info *type;
+ int own; /* 1 if owned & must be destroyed */
+ char data[1]; /* arbitary amount of data */
+ } swig_lua_rawdata;
/* Common SWIG API */
#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner)
@@ -840,24 +843,20 @@
#endif
/* storing/access of swig_module_info */
-SWIGRUNTIME swig_module_info *
-SWIG_Lua_GetModule(lua_State* L) {
- swig_module_info *ret = 0;
- lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
- lua_rawget(L,LUA_REGISTRYINDEX);
- if (lua_islightuserdata(L,-1))
- ret=(swig_module_info*)lua_touserdata(L,-1);
- lua_pop(L,1); /* tidy */
- return ret;
-}
-
-SWIGRUNTIME void
-SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) {
- /* add this all into the Lua registry: */
- lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
- lua_pushlightuserdata(L,(void*)module);
- lua_rawset(L,LUA_REGISTRYINDEX);
-}
+ SWIGRUNTIME swig_module_info *SWIG_Lua_GetModule(lua_State * L) {
+ swig_module_info *ret = 0;
+ lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ if (lua_islightuserdata(L, -1))
+ ret = (swig_module_info *) lua_touserdata(L, -1);
+ lua_pop(L, 1); /* tidy */
+ return ret;
+ } SWIGRUNTIME void SWIG_Lua_SetModule(lua_State * L, swig_module_info * module) {
+ /* add this all into the Lua registry: */
+ lua_pushstring(L, "swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
+ lua_pushlightuserdata(L, (void *) module);
+ lua_rawset(L, LUA_REGISTRYINDEX);
+ }
/* -----------------------------------------------------------------------------
* global variable support code: modules
@@ -866,20 +865,18 @@
/* this function is called when trying to set an immutable.
default value is to print an error.
This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */
-SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_set_immutable(lua_State * L) {
/* there should be 1 param passed in: the new value */
#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE
- lua_pop(L,1); /* remove it */
- lua_pushstring(L,"This variable is immutable");
- lua_error(L);
+ lua_pop(L, 1); /* remove it */
+ lua_pushstring(L, "This variable is immutable");
+ lua_error(L);
#endif
- return 0; /* should not return anything */
-}
+ return 0; /* should not return anything */
+ }
/* the module.get method used for getting linked data */
-SWIGINTERN int SWIG_Lua_module_get(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_module_get(lua_State * L) {
/* there should be 2 params passed in
(1) table (not the meta table)
(2) string name of the attribute
@@ -887,173 +884,158 @@
lua_topointer(L,1),lua_typename(L,lua_type(L,1)),
lua_tostring(L,2));
*/
- /* get the metatable */
- assert(lua_istable(L,1)); /* just in case */
- lua_getmetatable(L,1); /* get the metatable */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_get_table(L,".get"); /* get the .get table */
- lua_remove(L,3); /* remove metatable */
- if (lua_istable(L,-1))
- {
- /* look for the key in the .get table */
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- lua_remove(L,3); /* remove .get */
- if (lua_iscfunction(L,-1))
- { /* found it so call the fn & return its value */
- lua_call(L,0,1);
- return 1;
- }
- lua_pop(L,1); /* remove the top */
- }
- lua_pop(L,1); /* remove the .get */
- lua_pushnil(L); /* return a nil */
- return 1;
-}
+ /* get the metatable */
+ assert(lua_istable(L, 1)); /* just in case */
+ lua_getmetatable(L, 1); /* get the metatable */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_get_table(L, ".get"); /* get the .get table */
+ lua_remove(L, 3); /* remove metatable */
+ if (lua_istable(L, -1)) {
+ /* look for the key in the .get table */
+ lua_pushvalue(L, 2); /* key */
+ lua_rawget(L, -2);
+ lua_remove(L, 3); /* remove .get */
+ if (lua_iscfunction(L, -1)) { /* found it so call the fn & return its value */
+ lua_call(L, 0, 1);
+ return 1;
+ }
+ lua_pop(L, 1); /* remove the top */
+ }
+ lua_pop(L, 1); /* remove the .get */
+ lua_pushnil(L); /* return a nil */
+ return 1;
+ }
/* the module.set method used for setting linked data */
-SWIGINTERN int SWIG_Lua_module_set(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_module_set(lua_State * L) {
/* there should be 3 params passed in
(1) table (not the meta table)
(2) string name of the attribute
(3) any for the new value
*/
- /* get the metatable */
- assert(lua_istable(L,1)); /* just in case */
- lua_getmetatable(L,1); /* get the metatable */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_get_table(L,".set"); /* get the .set table */
- lua_remove(L,4); /* remove metatable */
- if (lua_istable(L,-1))
- {
- /* look for the key in the .set table */
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- lua_remove(L,4); /* remove .set */
- if (lua_iscfunction(L,-1))
- { /* found it so call the fn & return its value */
- lua_pushvalue(L,3); /* value */
- lua_call(L,1,0);
- return 0;
- }
- }
- lua_settop(L,3); /* reset back to start */
- /* we now have the table, key & new value, so just set directly */
- lua_rawset(L,1); /* add direct */
- return 0;
-}
+ /* get the metatable */
+ assert(lua_istable(L, 1)); /* just in case */
+ lua_getmetatable(L, 1); /* get the metatable */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_get_table(L, ".set"); /* get the .set table */
+ lua_remove(L, 4); /* remove metatable */
+ if (lua_istable(L, -1)) {
+ /* look for the key in the .set table */
+ lua_pushvalue(L, 2); /* key */
+ lua_rawget(L, -2);
+ lua_remove(L, 4); /* remove .set */
+ if (lua_iscfunction(L, -1)) { /* found it so call the fn & return its value */
+ lua_pushvalue(L, 3); /* value */
+ lua_call(L, 1, 0);
+ return 0;
+ }
+ }
+ lua_settop(L, 3); /* reset back to start */
+ /* we now have the table, key & new value, so just set directly */
+ lua_rawset(L, 1); /* add direct */
+ return 0;
+ }
/* registering a module in lua */
-SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name)
-{
- assert(lua_istable(L,-1)); /* just in case */
- lua_pushstring(L,name);
- lua_newtable(L); /* the table */
- /* add meta table */
- lua_newtable(L); /* the meta table */
- SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get);
- SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set);
- lua_pushstring(L,".get");
- lua_newtable(L); /* the .get table */
- lua_rawset(L,-3); /* add .get into metatable */
- lua_pushstring(L,".set");
- lua_newtable(L); /* the .set table */
- lua_rawset(L,-3); /* add .set into metatable */
- lua_setmetatable(L,-2); /* sets meta table in module */
- lua_rawset(L,-3); /* add module into parent */
- SWIG_Lua_get_table(L,name); /* get the table back out */
-}
+ SWIGINTERN void SWIG_Lua_module_begin(lua_State * L, const char *name) {
+ assert(lua_istable(L, -1)); /* just in case */
+ lua_pushstring(L, name);
+ lua_newtable(L); /* the table */
+ /* add meta table */
+ lua_newtable(L); /* the meta table */
+ SWIG_Lua_add_function(L, "__index", SWIG_Lua_module_get);
+ SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_module_set);
+ lua_pushstring(L, ".get");
+ lua_newtable(L); /* the .get table */
+ lua_rawset(L, -3); /* add .get into metatable */
+ lua_pushstring(L, ".set");
+ lua_newtable(L); /* the .set table */
+ lua_rawset(L, -3); /* add .set into metatable */
+ lua_setmetatable(L, -2); /* sets meta table in module */
+ lua_rawset(L, -3); /* add module into parent */
+ SWIG_Lua_get_table(L, name); /* get the table back out */
+ }
/* ending the register */
-SWIGINTERN void SWIG_Lua_module_end(lua_State* L)
-{
- lua_pop(L,1); /* tidy stack (remove module) */
-}
+ SWIGINTERN void SWIG_Lua_module_end(lua_State * L) {
+ lua_pop(L, 1); /* tidy stack (remove module) */
+ }
/* adding a linked variable to the module */
-SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
-{
- assert(lua_istable(L,-1)); /* just in case */
- lua_getmetatable(L,-1); /* get the metatable */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_get_table(L,".get"); /* find the .get table */
- assert(lua_istable(L,-1)); /* should be a table: */
- SWIG_Lua_add_function(L,name,getFn);
- lua_pop(L,1); /* tidy stack (remove table) */
- if (setFn) /* if there is a set fn */
- {
- SWIG_Lua_get_table(L,".set"); /* find the .set table */
- assert(lua_istable(L,-1)); /* should be a table: */
- SWIG_Lua_add_function(L,name,setFn);
- lua_pop(L,1); /* tidy stack (remove table) */
- }
- lua_pop(L,1); /* tidy stack (remove meta) */
-}
+ SWIGINTERN void SWIG_Lua_module_add_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
+ assert(lua_istable(L, -1)); /* just in case */
+ lua_getmetatable(L, -1); /* get the metatable */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_get_table(L, ".get"); /* find the .get table */
+ assert(lua_istable(L, -1)); /* should be a table: */
+ SWIG_Lua_add_function(L, name, getFn);
+ lua_pop(L, 1); /* tidy stack (remove table) */
+ if (setFn) { /* if there is a set fn */
+ SWIG_Lua_get_table(L, ".set"); /* find the .set table */
+ assert(lua_istable(L, -1)); /* should be a table: */
+ SWIG_Lua_add_function(L, name, setFn);
+ lua_pop(L, 1); /* tidy stack (remove table) */
+ }
+ lua_pop(L, 1); /* tidy stack (remove meta) */
+ }
/* adding a function module */
-SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn)
-{
- SWIG_Lua_add_function(L,name,fn);
-}
+ SWIGINTERN void SWIG_Lua_module_add_function(lua_State * L, const char *name, lua_CFunction fn) {
+ SWIG_Lua_add_function(L, name, fn);
+ }
/* -----------------------------------------------------------------------------
* global variable support code: classes
* ----------------------------------------------------------------------------- */
/* the class.get method, performs the lookup of class attributes */
-SWIGINTERN int SWIG_Lua_class_get(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_class_get(lua_State * L) {
/* there should be 2 params passed in
(1) userdata (not the meta table)
(2) string name of the attribute
*/
- assert(lua_isuserdata(L,-2)); /* just in case */
- lua_getmetatable(L,-2); /* get the meta table */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_get_table(L,".get"); /* find the .get table */
- assert(lua_istable(L,-1)); /* just in case */
- /* look for the key in the .get table */
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- lua_remove(L,-2); /* stack tidy, remove .get table */
- if (lua_iscfunction(L,-1))
- { /* found it so call the fn & return its value */
- lua_pushvalue(L,1); /* the userdata */
- lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */
- lua_remove(L,-2); /* stack tidy, remove metatable */
- return 1;
- }
- lua_pop(L,1); /* remove whatever was there */
- /* ok, so try the .fn table */
- SWIG_Lua_get_table(L,".fn"); /* find the .get table */
- assert(lua_istable(L,-1)); /* just in case */
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2); /* look for the fn */
- lua_remove(L,-2); /* stack tidy, remove .fn table */
- if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
- { /* found it so return the fn & let lua call it */
- lua_remove(L,-2); /* stack tidy, remove metatable */
- return 1;
- }
- lua_pop(L,1); /* remove whatever was there */
- /* NEW: looks for the __getitem() fn
- this is a user provided get fn */
- SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
- if (lua_iscfunction(L,-1)) /* if its there */
- { /* found it so call the fn & return its value */
- lua_pushvalue(L,1); /* the userdata */
- lua_pushvalue(L,2); /* the parameter */
- lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */
- lua_remove(L,-2); /* stack tidy, remove metatable */
- return 1;
- }
- return 0; /* sorry not known */
-}
+ assert(lua_isuserdata(L, -2)); /* just in case */
+ lua_getmetatable(L, -2); /* get the meta table */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_get_table(L, ".get"); /* find the .get table */
+ assert(lua_istable(L, -1)); /* just in case */
+ /* look for the key in the .get table */
+ lua_pushvalue(L, 2); /* key */
+ lua_rawget(L, -2);
+ lua_remove(L, -2); /* stack tidy, remove .get table */
+ if (lua_iscfunction(L, -1)) { /* found it so call the fn & return its value */
+ lua_pushvalue(L, 1); /* the userdata */
+ lua_call(L, 1, 1); /* 1 value in (userdata),1 out (result) */
+ lua_remove(L, -2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ lua_pop(L, 1); /* remove whatever was there */
+ /* ok, so try the .fn table */
+ SWIG_Lua_get_table(L, ".fn"); /* find the .get table */
+ assert(lua_istable(L, -1)); /* just in case */
+ lua_pushvalue(L, 2); /* key */
+ lua_rawget(L, -2); /* look for the fn */
+ lua_remove(L, -2); /* stack tidy, remove .fn table */
+ if (lua_isfunction(L, -1)) { /* note: if its a C function or lua function *//* found it so return the fn & let lua call it */
+ lua_remove(L, -2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ lua_pop(L, 1); /* remove whatever was there */
+ /* NEW: looks for the __getitem() fn
+ this is a user provided get fn */
+ SWIG_Lua_get_table(L, "__getitem"); /* find the __getitem fn */
+ if (lua_iscfunction(L, -1)) { /* if its there *//* found it so call the fn & return its value */
+ lua_pushvalue(L, 1); /* the userdata */
+ lua_pushvalue(L, 2); /* the parameter */
+ lua_call(L, 2, 1); /* 2 value in (userdata),1 out (result) */
+ lua_remove(L, -2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ return 0; /* sorry not known */
+ }
/* the class.set method, performs the lookup of class attributes */
-SWIGINTERN int SWIG_Lua_class_set(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_class_set(lua_State * L) {
/* there should be 3 params passed in
(1) table (not the meta table)
(2) string name of the attribute
@@ -1063,136 +1045,123 @@
lua_tostring(L,2),
lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/
- assert(lua_isuserdata(L,1)); /* just in case */
- lua_getmetatable(L,1); /* get the meta table */
- assert(lua_istable(L,-1)); /* just in case */
-
- SWIG_Lua_get_table(L,".set"); /* find the .set table */
- if (lua_istable(L,-1))
- {
- /* look for the key in the .set table */
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- if (lua_iscfunction(L,-1))
- { /* found it so call the fn & return its value */
- lua_pushvalue(L,1); /* userdata */
- lua_pushvalue(L,3); /* value */
- lua_call(L,2,0);
- return 0;
- }
- lua_pop(L,1); /* remove the value */
- }
- lua_pop(L,1); /* remove the value .set table */
- /* NEW: looks for the __setitem() fn
- this is a user provided set fn */
- SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
- if (lua_iscfunction(L,-1)) /* if its there */
- { /* found it so call the fn & return its value */
- lua_pushvalue(L,1); /* the userdata */
- lua_pushvalue(L,2); /* the parameter */
- lua_pushvalue(L,3); /* the value */
- lua_call(L,3,0); /* 3 values in ,0 out */
- lua_remove(L,-2); /* stack tidy, remove metatable */
- return 1;
- }
- return 0;
-}
+ assert(lua_isuserdata(L, 1)); /* just in case */
+ lua_getmetatable(L, 1); /* get the meta table */
+ assert(lua_istable(L, -1)); /* just in case */
+
+ SWIG_Lua_get_table(L, ".set"); /* find the .set table */
+ if (lua_istable(L, -1)) {
+ /* look for the key in the .set table */
+ lua_pushvalue(L, 2); /* key */
+ lua_rawget(L, -2);
+ if (lua_iscfunction(L, -1)) { /* found it so call the fn & return its value */
+ lua_pushvalue(L, 1); /* userdata */
+ lua_pushvalue(L, 3); /* value */
+ lua_call(L, 2, 0);
+ return 0;
+ }
+ lua_pop(L, 1); /* remove the value */
+ }
+ lua_pop(L, 1); /* remove the value .set table */
+ /* NEW: looks for the __setitem() fn
+ this is a user provided set fn */
+ SWIG_Lua_get_table(L, "__setitem"); /* find the fn */
+ if (lua_iscfunction(L, -1)) { /* if its there *//* found it so call the fn & return its value */
+ lua_pushvalue(L, 1); /* the userdata */
+ lua_pushvalue(L, 2); /* the parameter */
+ lua_pushvalue(L, 3); /* the value */
+ lua_call(L, 3, 0); /* 3 values in ,0 out */
+ lua_remove(L, -2); /* stack tidy, remove metatable */
+ return 1;
+ }
+ return 0;
+ }
/* the class.destruct method called by the interpreter */
-SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L)
-{
+ SWIGINTERN int SWIG_Lua_class_destruct(lua_State * L) {
/* there should be 1 params passed in
(1) userdata (not the meta table) */
- swig_lua_userdata* usr;
- swig_lua_class* clss;
- assert(lua_isuserdata(L,-1)); /* just in case */
- usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */
- /* if must be destroyed & has a destructor */
- if (usr->own) /* if must be destroyed */
- {
- clss=(swig_lua_class*)usr->type->clientdata; /* get the class */
- if (clss && clss->destructor) /* there is a destroy fn */
- {
- clss->destructor(usr->ptr); /* bye bye */
- }
- }
- return 0;
-}
+ swig_lua_userdata *usr;
+ swig_lua_class *clss;
+ assert(lua_isuserdata(L, -1)); /* just in case */
+ usr = (swig_lua_userdata *) lua_touserdata(L, -1); /* get it */
+ /* if must be destroyed & has a destructor */
+ if (usr->own) { /* if must be destroyed */
+ clss = (swig_lua_class *) usr->type->clientdata; /* get the class */
+ if (clss && clss->destructor) { /* there is a destroy fn */
+ clss->destructor(usr->ptr); /* bye bye */
+ }
+ }
+ return 0;
+ }
/* gets the swig class registry (or creates it) */
-SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L)
-{
- /* add this all into the swig registry: */
- lua_pushstring(L,"SWIG");
- lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */
- if (!lua_istable(L,-1)) /* not there */
- { /* must be first time, so add it */
- lua_pop(L,1); /* remove the result */
- lua_pushstring(L,"SWIG");
- lua_newtable(L);
- lua_rawset(L,LUA_REGISTRYINDEX);
- /* then get it */
- lua_pushstring(L,"SWIG");
- lua_rawget(L,LUA_REGISTRYINDEX);
- }
-}
+ SWIGINTERN void SWIG_Lua_get_class_registry(lua_State * L) {
+ /* add this all into the swig registry: */
+ lua_pushstring(L, "SWIG");
+ lua_rawget(L, LUA_REGISTRYINDEX); /* get the registry */
+ if (!lua_istable(L, -1)) { /* not there *//* must be first time, so add it */
+ lua_pop(L, 1); /* remove the result */
+ lua_pushstring(L, "SWIG");
+ lua_newtable(L);
+ lua_rawset(L, LUA_REGISTRYINDEX);
+ /* then get it */
+ lua_pushstring(L, "SWIG");
+ lua_rawget(L, LUA_REGISTRYINDEX);
+ }
+ }
/* helper fn to get the classes metatable from the register */
-SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname)
-{
- SWIG_Lua_get_class_registry(L); /* get the registry */
- lua_pushstring(L,cname); /* get the name */
- lua_rawget(L,-2); /* get it */
- lua_remove(L,-2); /* tidy up (remove registry) */
-}
+ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State * L, const char *cname) {
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L, cname); /* get the name */
+ lua_rawget(L, -2); /* get it */
+ lua_remove(L, -2); /* tidy up (remove registry) */
+ }
/* helper add a variable to a registered class */
-SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn)
-{
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_get_table(L,".get"); /* find the .get table */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_add_function(L,name,getFn);
- lua_pop(L,1); /* tidy stack (remove table) */
- if (setFn)
- {
- SWIG_Lua_get_table(L,".set"); /* find the .set table */
- assert(lua_istable(L,-1)); /* just in case */
- SWIG_Lua_add_function(L,name,setFn);
- lua_pop(L,1); /* tidy stack (remove table) */
- }
-}
+ SWIGINTERN void SWIG_Lua_add_class_variable(lua_State * L, const char *name, lua_CFunction getFn, lua_CFunction setFn) {
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_get_table(L, ".get"); /* find the .get table */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_add_function(L, name, getFn);
+ lua_pop(L, 1); /* tidy stack (remove table) */
+ if (setFn) {
+ SWIG_Lua_get_table(L, ".set"); /* find the .set table */
+ assert(lua_istable(L, -1)); /* just in case */
+ SWIG_Lua_add_function(L, name, setFn);
+ lua_pop(L, 1); /* tidy stack (remove table) */
+ }
+ }
/* helper to recursively add class details (attributes & operations) */
-SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss)
-{
- int i;
- /* call all the base classes first: we can then override these later: */
- for(i=0;clss->bases[i];i++)
- {
- SWIG_Lua_add_class_details(L,clss->bases[i]);
- }
- /* add fns */
- for(i=0;clss->attributes[i].name;i++){
- SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod);
- }
- /* add methods to the metatable */
- SWIG_Lua_get_table(L,".fn"); /* find the .fn table */
- assert(lua_istable(L,-1)); /* just in case */
- for(i=0;clss->methods[i].name;i++){
- SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
- }
- lua_pop(L,1); /* tidy stack (remove table) */
- /* add operator overloads
- these look ANY method which start with "__" and assume they
- are operator overloads & add them to the metatable
- (this might mess up is someone defines a method __gc (the destructor)*/
- for(i=0;clss->methods[i].name;i++){
- if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){
- SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method);
- }
- }
-}
+ SWIGINTERN void SWIG_Lua_add_class_details(lua_State * L, swig_lua_class * clss) {
+ int i;
+ /* call all the base classes first: we can then override these later: */
+ for (i = 0; clss->bases[i]; i++) {
+ SWIG_Lua_add_class_details(L, clss->bases[i]);
+ }
+ /* add fns */
+ for (i = 0; clss->attributes[i].name; i++) {
+ SWIG_Lua_add_class_variable(L, clss->attributes[i].name, clss->attributes[i].getmethod, clss->attributes[i].setmethod);
+ }
+ /* add methods to the metatable */
+ SWIG_Lua_get_table(L, ".fn"); /* find the .fn table */
+ assert(lua_istable(L, -1)); /* just in case */
+ for (i = 0; clss->methods[i].name; i++) {
+ SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
+ }
+ lua_pop(L, 1); /* tidy stack (remove table) */
+ /* add operator overloads
+ these look ANY method which start with "__" and assume they
+ are operator overloads & add them to the metatable
+ (this might mess up is someone defines a method __gc (the destructor) */
+ for (i = 0; clss->methods[i].name; i++) {
+ if (clss->methods[i].name[0] == '_' && clss->methods[i].name[1] == '_') {
+ SWIG_Lua_add_function(L, clss->methods[i].name, clss->methods[i].method);
+ }
+ }
+ }
/* set up the base classes pointers.
Each class structure has a list of pointers to the base class structures.
@@ -1201,256 +1170,237 @@
spread over more than one swig file.
Therefore it must be done at runtime, querying the SWIG type system.
*/
-SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss)
-{
- int i=0;
- swig_module_info* module=SWIG_GetModule(L);
- for(i=0;clss->base_names[i];i++)
- {
- if (clss->bases[i]==0) /* not found yet */
- {
- /* lookup and cache the base class */
- swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]);
- if (info) clss->bases[i] = (swig_lua_class *) info->clientdata;
- }
- }
-}
+ SWIGINTERN void SWIG_Lua_init_base_class(lua_State * L, swig_lua_class * clss) {
+ int i = 0;
+ swig_module_info *module = SWIG_GetModule(L);
+ for (i = 0; clss->base_names[i]; i++) {
+ if (clss->bases[i] == 0) { /* not found yet */
+ /* lookup and cache the base class */
+ swig_type_info *info = SWIG_TypeQueryModule(module, module, clss->base_names[i]);
+ if (info)
+ clss->bases[i] = (swig_lua_class *) info->clientdata;
+ }
+ }
+ }
/* performs the entire class registration process */
-SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss)
-{
- /* add its constructor to module with the name of the class
- so you can do MyClass(...) as well as new_MyClass(...)
- BUT only if a constructor is defined
- (this overcomes the problem of pure virtual classes without constructors)*/
- if (clss->constructor)
- SWIG_Lua_add_function(L,clss->name,clss->constructor);
-
- SWIG_Lua_get_class_registry(L); /* get the registry */
- lua_pushstring(L,clss->name); /* get the name */
- lua_newtable(L); /* create the metatable */
- /* add string of class name called ".type" */
- lua_pushstring(L,".type");
- lua_pushstring(L,clss->name);
- lua_rawset(L,-3);
- /* add a table called ".get" */
- lua_pushstring(L,".get");
- lua_newtable(L);
- lua_rawset(L,-3);
- /* add a table called ".set" */
- lua_pushstring(L,".set");
- lua_newtable(L);
- lua_rawset(L,-3);
- /* add a table called ".fn" */
- lua_pushstring(L,".fn");
- lua_newtable(L);
- lua_rawset(L,-3);
- /* add accessor fns for using the .get,.set&.fn */
- SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get);
- SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set);
- SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct);
- /* add it */
- lua_rawset(L,-3); /* metatable into registry */
- lua_pop(L,1); /* tidy stack (remove registry) */
-
- SWIG_Lua_get_class_metatable(L,clss->name);
- SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */
- lua_pop(L,1); /* tidy stack (remove class metatable) */
-}
+ SWIGINTERN void SWIG_Lua_class_register(lua_State * L, swig_lua_class * clss) {
+ /* add its constructor to module with the name of the class
+ so you can do MyClass(...) as well as new_MyClass(...)
+ BUT only if a constructor is defined
+ (this overcomes the problem of pure virtual classes without constructors) */
+ if (clss->constructor)
+ SWIG_Lua_add_function(L, clss->name, clss->constructor);
+
+ SWIG_Lua_get_class_registry(L); /* get the registry */
+ lua_pushstring(L, clss->name); /* get the name */
+ lua_newtable(L); /* create the metatable */
+ /* add string of class name called ".type" */
+ lua_pushstring(L, ".type");
+ lua_pushstring(L, clss->name);
+ lua_rawset(L, -3);
+ /* add a table called ".get" */
+ lua_pushstring(L, ".get");
+ lua_newtable(L);
+ lua_rawset(L, -3);
+ /* add a table called ".set" */
+ lua_pushstring(L, ".set");
+ lua_newtable(L);
+ lua_rawset(L, -3);
+ /* add a table called ".fn" */
+ lua_pushstring(L, ".fn");
+ lua_newtable(L);
+ lua_rawset(L, -3);
+ /* add accessor fns for using the .get,.set&.fn */
+ SWIG_Lua_add_function(L, "__index", SWIG_Lua_class_get);
+ SWIG_Lua_add_function(L, "__newindex", SWIG_Lua_class_set);
+ SWIG_Lua_add_function(L, "__gc", SWIG_Lua_class_destruct);
+ /* add it */
+ lua_rawset(L, -3); /* metatable into registry */
+ lua_pop(L, 1); /* tidy stack (remove registry) */
+
+ SWIG_Lua_get_class_metatable(L, clss->name);
+ SWIG_Lua_add_class_details(L, clss); /* recursive adding of details (atts & ops) */
+ lua_pop(L, 1); /* tidy stack (remove class metatable) */
+ }
/* -----------------------------------------------------------------------------
* Class/structure conversion fns
* ----------------------------------------------------------------------------- */
/* helper to add metatable to new lua object */
-SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type)
-{
- if (type->clientdata) /* there is clientdata: so add the metatable */
- {
- SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name);
- if (lua_istable(L,-1))
- {
- lua_setmetatable(L,-2);
- }
- else
- {
- lua_pop(L,1);
- }
- }
-}
+ SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State * L, swig_type_info * type) {
+ if (type->clientdata) { /* there is clientdata: so add the metatable */
+ SWIG_Lua_get_class_metatable(L, ((swig_lua_class *) (type->clientdata))->name);
+ if (lua_istable(L, -1)) {
+ lua_setmetatable(L, -2);
+ } else {
+ lua_pop(L, 1);
+ }
+ }
+ }
/* pushes a new object into the lua stack */
-SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own)
-{
- swig_lua_userdata* usr;
- if (!ptr){
- lua_pushnil(L);
- return;
- }
- usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */
- usr->ptr=ptr; /* set the ptr */
- usr->type=type;
- usr->own=own;
- _SWIG_Lua_AddMetatable(L,type); /* add metatable */
-}
+ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State * L, void *ptr, swig_type_info * type, int own) {
+ swig_lua_userdata *usr;
+ if (!ptr) {
+ lua_pushnil(L);
+ return;
+ }
+ usr = (swig_lua_userdata *) lua_newuserdata(L, sizeof(swig_lua_userdata)); /* get data */
+ usr->ptr = ptr; /* set the ptr */
+ usr->type = type;
+ usr->own = own;
+ _SWIG_Lua_AddMetatable(L, type); /* add metatable */
+ }
/* takes a object from the lua stack & converts it into an object of the correct type
(if possible) */
-SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags)
-{
- swig_lua_userdata* usr;
- swig_cast_info *cast;
- if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */
- usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */
- if (usr)
- {
- if (flags & SWIG_POINTER_DISOWN) /* must disown the object */
- {
- usr->own=0;
- }
- if (!type) /* special cast void*, no casting fn */
- {
- *ptr=usr->ptr;
- return SWIG_OK; /* ok */
- }
- cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */
- if (cast)
- {
- int newmemory = 0;
- *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- return SWIG_OK; /* ok */
- }
- }
- return SWIG_ERROR; /* error */
-}
+ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State * L, int index, void **ptr, swig_type_info * type, int flags) {
+ swig_lua_userdata *usr;
+ swig_cast_info *cast;
+ if (lua_isnil(L, index)) {
+ *ptr = 0;
+ return SWIG_OK;
+ } /* special case: lua nil => NULL pointer */
+ usr = (swig_lua_userdata *) lua_touserdata(L, index); /* get data */
+ if (usr) {
+ if (flags & SWIG_POINTER_DISOWN) { /* must disown the object */
+ usr->own = 0;
+ }
+ if (!type) { /* special cast void*, no casting fn */
+ *ptr = usr->ptr;
+ return SWIG_OK; /* ok */
+ }
+ cast = SWIG_TypeCheckStruct(usr->type, type); /* performs normal type checking */
+ if (cast) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(cast, usr->ptr, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ return SWIG_OK; /* ok */
+ }
+ }
+ return SWIG_ERROR; /* error */
+ }
-SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags,
- int argnum,const char* func_name){
- void* result;
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){
- lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n",
- func_name,(type && type->str)?type->str:"void*",argnum);
- lua_error(L);
- }
- return result;
-}
+ SWIGRUNTIME void *SWIG_Lua_MustGetPtr(lua_State * L, int index, swig_type_info * type, int flags, int argnum, const char *func_name) {
+ void *result;
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, index, &result, type, flags))) {
+ lua_pushfstring(L, "Error in %s, expected a %s at argument number %d\n", func_name, (type && type->str) ? type->str : "void*", argnum);
+ lua_error(L);
+ }
+ return result;
+ }
/* pushes a packed userdata. user for member fn pointers only */
-SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type)
-{
- swig_lua_rawdata* raw;
- assert(ptr); /* not acceptable to pass in a NULL value */
- raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */
- raw->type=type;
- raw->own=0;
- memcpy(raw->data,ptr,size); /* copy the data */
- _SWIG_Lua_AddMetatable(L,type); /* add metatable */
-}
-
+ SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State * L, void *ptr, size_t size, swig_type_info * type) {
+ swig_lua_rawdata *raw;
+ assert(ptr); /* not acceptable to pass in a NULL value */
+ raw = (swig_lua_rawdata *) lua_newuserdata(L, sizeof(swig_lua_rawdata) - 1 + size); /* alloc data */
+ raw->type = type;
+ raw->own = 0;
+ memcpy(raw->data, ptr, size); /* copy the data */
+ _SWIG_Lua_AddMetatable(L, type); /* add metatable */
+ }
+
/* converts a packed userdata. user for member fn pointers only */
-SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type)
-{
- swig_lua_rawdata* raw;
- raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */
- if (!raw) return SWIG_ERROR; /* error */
- if (type==0 || type==raw->type) /* void* or identical type */
- {
- memcpy(ptr,raw->data,size); /* copy it */
- return SWIG_OK; /* ok */
- }
- return SWIG_ERROR; /* error */
-}
+ SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State * L, int index, void *ptr, size_t size, swig_type_info * type) {
+ swig_lua_rawdata *raw;
+ raw = (swig_lua_rawdata *) lua_touserdata(L, index); /* get data */
+ if (!raw)
+ return SWIG_ERROR; /* error */
+ if (type == 0 || type == raw->type) { /* void* or identical type */
+ memcpy(ptr, raw->data, size); /* copy it */
+ return SWIG_OK; /* ok */
+ }
+ return SWIG_ERROR; /* error */
+ }
/* a function to get the typestring of a piece of data */
-SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp)
-{
- swig_lua_userdata* usr;
- if (lua_isuserdata(L,tp))
- {
- usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
- if (usr && usr->type && usr->type->str)
- return usr->type->str;
- return "userdata (unknown type)";
- }
- return lua_typename(L,lua_type(L,tp));
-}
+ SWIGRUNTIME const char *SWIG_Lua_typename(lua_State * L, int tp) {
+ swig_lua_userdata *usr;
+ if (lua_isuserdata(L, tp)) {
+ usr = (swig_lua_userdata *) lua_touserdata(L, 1); /* get data */
+ if (usr && usr->type && usr->type->str)
+ return usr->type->str;
+ return "userdata (unknown type)";
+ }
+ return lua_typename(L, lua_type(L, tp));
+ }
/* lua callable function to get the userdata's type */
-SWIGRUNTIME int SWIG_Lua_type(lua_State* L)
-{
- lua_pushstring(L,SWIG_Lua_typename(L,1));
- return 1;
-}
+ SWIGRUNTIME int SWIG_Lua_type(lua_State * L) {
+ lua_pushstring(L, SWIG_Lua_typename(L, 1));
+ return 1;
+ }
/* lua callable function to compare userdata's value
the issue is that two userdata may point to the same thing
but to lua, they are different objects */
-SWIGRUNTIME int SWIG_Lua_equal(lua_State* L)
-{
- int result;
- swig_lua_userdata *usr1,*usr2;
- if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */
- return 0; /* nil reply */
- usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */
- usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */
- /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/
- result=(usr1->ptr==usr2->ptr);
- lua_pushboolean(L,result);
- return 1;
-}
+ SWIGRUNTIME int SWIG_Lua_equal(lua_State * L) {
+ int result;
+ swig_lua_userdata *usr1, *usr2;
+ if (!lua_isuserdata(L, 1) || !lua_isuserdata(L, 2)) /* just in case */
+ return 0; /* nil reply */
+ usr1 = (swig_lua_userdata *) lua_touserdata(L, 1); /* get data */
+ usr2 = (swig_lua_userdata *) lua_touserdata(L, 2); /* get data */
+ /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same */
+ result = (usr1->ptr == usr2->ptr);
+ lua_pushboolean(L, result);
+ return 1;
+ }
/* -----------------------------------------------------------------------------
* global variable support code: class/struct typemap functions
* ----------------------------------------------------------------------------- */
/* Install Constants */
-SWIGINTERN void
-SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) {
- int i;
- for (i = 0; constants[i].type; i++) {
- switch(constants[i].type) {
- case SWIG_LUA_INT:
- lua_pushstring(L,constants[i].name);
- lua_pushnumber(L,(lua_Number)constants[i].lvalue);
- lua_rawset(L,-3);
- break;
- case SWIG_LUA_FLOAT:
- lua_pushstring(L,constants[i].name);
- lua_pushnumber(L,(lua_Number)constants[i].dvalue);
- lua_rawset(L,-3);
- break;
- case SWIG_LUA_CHAR:
- lua_pushstring(L,constants[i].name);
- lua_pushfstring(L,"%c",(char)constants[i].lvalue);
- lua_rawset(L,-3);
- break;
- case SWIG_LUA_STRING:
- lua_pushstring(L,constants[i].name);
- lua_pushstring(L,(char *) constants[i].pvalue);
- lua_rawset(L,-3);
- break;
- case SWIG_LUA_POINTER:
- lua_pushstring(L,constants[i].name);
- SWIG_NewPointerObj(L,constants[i].pvalue, *(constants[i]).ptype,0);
- lua_rawset(L,-3);
- break;
- case SWIG_LUA_BINARY:
- lua_pushstring(L,constants[i].name);
- SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype);
- lua_rawset(L,-3);
- break;
- default:
- break;
- }
- }
-}
+ SWIGINTERN void
+ SWIG_Lua_InstallConstants(lua_State * L, swig_lua_const_info constants[]) {
+ int i;
+ for (i = 0; constants[i].type; i++) {
+ switch (constants[i].type) {
+ case SWIG_LUA_INT:
+ lua_pushstring(L, constants[i].name);
+ lua_pushnumber(L, (lua_Number) constants[i].lvalue);
+ lua_rawset(L, -3);
+ break;
+ case SWIG_LUA_FLOAT:
+ lua_pushstring(L, constants[i].name);
+ lua_pushnumber(L, (lua_Number) constants[i].dvalue);
+ lua_rawset(L, -3);
+ break;
+ case SWIG_LUA_CHAR:
+ lua_pushstring(L, constants[i].name);
+ lua_pushfstring(L, "%c", (char) constants[i].lvalue);
+ lua_rawset(L, -3);
+ break;
+ case SWIG_LUA_STRING:
+ lua_pushstring(L, constants[i].name);
+ lua_pushstring(L, (char *) constants[i].pvalue);
+ lua_rawset(L, -3);
+ break;
+ case SWIG_LUA_POINTER:
+ lua_pushstring(L, constants[i].name);
+ SWIG_NewPointerObj(L, constants[i].pvalue, *(constants[i]).ptype, 0);
+ lua_rawset(L, -3);
+ break;
+ case SWIG_LUA_BINARY:
+ lua_pushstring(L, constants[i].name);
+ SWIG_NewMemberObj(L, constants[i].pvalue, constants[i].lvalue, *(constants[i]).ptype);
+ lua_rawset(L, -3);
+ break;
+ default:
+ break;
+ }
+ }
+ }
/* -----------------------------------------------------------------------------
* executing lua code from within the wrapper
* ----------------------------------------------------------------------------- */
-#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
+#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */
#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S)
#endif
/* Executes a C string in Lua a really simple way of calling lua from C
@@ -1458,22 +1408,23 @@
In lua 5.0.X its lua_dostring()
In lua 5.1.X its luaL_dostring()
*/
-SWIGINTERN int
-SWIG_Lua_dostring(lua_State *L, const char* str) {
- int ok,top;
- if (str==0 || str[0]==0) return 0; /* nothing to do */
- top=lua_gettop(L); /* save stack */
+ SWIGINTERN int
+ SWIG_Lua_dostring(lua_State * L, const char *str) {
+ int ok, top;
+ if (str == 0 || str[0] == 0)
+ return 0; /* nothing to do */
+ top = lua_gettop(L); /* save stack */
#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501))
- ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */
+ ok = luaL_dostring(L, str); /* looks like this is lua 5.1.X or later, good */
#else
- ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */
+ ok = lua_dostring(L, str); /* might be lua 5.0.x, using lua_dostring */
#endif
- if (ok!=0) {
- SWIG_DOSTRING_FAIL(lua_tostring(L,-1));
- }
- lua_settop(L,top); /* restore the stack */
- return ok;
-}
+ if (ok != 0) {
+ SWIG_DOSTRING_FAIL(lua_tostring(L, -1));
+ }
+ lua_settop(L, top); /* restore the stack */
+ return ok;
+ }
#ifdef __cplusplus
}
@@ -1504,7 +1455,8 @@
#define SWIGTYPE_p_switch_stream_handle_t swig_types[17]
#define SWIGTYPE_p_void swig_types[18]
static swig_type_info *swig_types[20];
-static swig_module_info swig_module = {swig_types, 19, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 19, 0, 0, 0, 0 };
+
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -1518,4782 +1470,5297 @@
namespace swig {
-typedef struct{} LANGUAGE_OBJ;
+ typedef struct {
+ } LANGUAGE_OBJ;
}
-
-
#include "switch.h"
#include "switch_cpp.h"
#include "freeswitch_lua.h"
-
#ifdef __cplusplus
extern "C" {
#endif
-static int _wrap_consoleLog(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("consoleLog",2,2)
- if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- arg2 = (char *)lua_tostring(L, 2);
- consoleLog(arg1,arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_consoleLog(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("consoleLog", 2, 2)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("consoleLog", 1, "char *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("consoleLog", 2, "char *");
+ arg1 = (char *) lua_tostring(L, 1);
+ arg2 = (char *) lua_tostring(L, 2);
+ consoleLog(arg1, arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:lua_error(L);
+ return SWIG_arg;
+ } static int _wrap_consoleCleanLog(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+
+ SWIG_check_num_args("consoleCleanLog", 1, 1)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("consoleCleanLog", 1, "char *");
+ arg1 = (char *) lua_tostring(L, 1);
+ consoleCleanLog(arg1);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_consoleCleanLog(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
-
- SWIG_check_num_args("consoleCleanLog",1,1)
- if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- consoleCleanLog(arg1);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_IVRMenu(lua_State * L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ int arg9;
+ int arg10;
+ int arg11;
+ int arg12;
+ int arg13;
+ IVRMenu *result = 0;
+
+ SWIG_check_num_args("IVRMenu", 13, 13)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("IVRMenu", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("IVRMenu", 3, "char const *");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("IVRMenu", 4, "char const *");
+ if (!lua_isstring(L, 5))
+ SWIG_fail_arg("IVRMenu", 5, "char const *");
+ if (!lua_isstring(L, 6))
+ SWIG_fail_arg("IVRMenu", 6, "char const *");
+ if (!lua_isstring(L, 7))
+ SWIG_fail_arg("IVRMenu", 7, "char const *");
+ if (!lua_isstring(L, 8))
+ SWIG_fail_arg("IVRMenu", 8, "char const *");
+ if (!lua_isnumber(L, 9))
+ SWIG_fail_arg("IVRMenu", 9, "int");
+ if (!lua_isnumber(L, 10))
+ SWIG_fail_arg("IVRMenu", 10, "int");
+ if (!lua_isnumber(L, 11))
+ SWIG_fail_arg("IVRMenu", 11, "int");
+ if (!lua_isnumber(L, 12))
+ SWIG_fail_arg("IVRMenu", 12, "int");
+ if (!lua_isnumber(L, 13))
+ SWIG_fail_arg("IVRMenu", 13, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+ SWIG_fail_ptr("new_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ arg5 = (char *) lua_tostring(L, 5);
+ arg6 = (char *) lua_tostring(L, 6);
+ arg7 = (char *) lua_tostring(L, 7);
+ arg8 = (char *) lua_tostring(L, 8);
+ arg9 = (int) lua_tonumber(L, 9);
+ arg10 = (int) lua_tonumber(L, 10);
+ arg11 = (int) lua_tonumber(L, 11);
+ arg12 = (int) lua_tonumber(L, 12);
+ arg13 = (int) lua_tonumber(L, 13);
+ result =
+ (IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+ (char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_IVRMenu, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_IVRMenu(lua_State* L) {
- int SWIG_arg = -1;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- int arg9 ;
- int arg10 ;
- int arg11 ;
- int arg12 ;
- int arg13 ;
- IVRMenu *result = 0 ;
-
- SWIG_check_num_args("IVRMenu",13,13)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *");
- if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *");
- if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *");
- if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *");
- if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *");
- if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *");
- if(!lua_isnumber(L,9)) SWIG_fail_arg("IVRMenu",9,"int");
- if(!lua_isnumber(L,10)) SWIG_fail_arg("IVRMenu",10,"int");
- if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int");
- if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int");
- if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
- SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- arg5 = (char *)lua_tostring(L, 5);
- arg6 = (char *)lua_tostring(L, 6);
- arg7 = (char *)lua_tostring(L, 7);
- arg8 = (char *)lua_tostring(L, 8);
- arg9 = (int)lua_tonumber(L, 9);
- arg10 = (int)lua_tonumber(L, 10);
- arg11 = (int)lua_tonumber(L, 11);
- arg12 = (int)lua_tonumber(L, 12);
- arg13 = (int)lua_tonumber(L, 13);
- result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_IVRMenu(lua_State * L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ SWIG_check_num_args("IVRMenu", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("IVRMenu", 1, "IVRMenu *");
-static int _wrap_delete_IVRMenu(lua_State* L) {
- int SWIG_arg = -1;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
-
- SWIG_check_num_args("IVRMenu",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_IVRMenu", 1, SWIGTYPE_p_IVRMenu);
+ }
+ delete arg1;
-static int _wrap_IVRMenu_bindAction(lua_State* L) {
- int SWIG_arg = -1;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
-
- SWIG_check_num_args("bindAction",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *");
- if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
- SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_IVRMenu_execute(lua_State* L) {
- int SWIG_arg = -1;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("execute",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){
- SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession);
- }
-
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->execute(arg2,(char const *)arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static void swig_delete_IVRMenu(void *obj) {
-IVRMenu *arg1 = (IVRMenu *) obj;
-delete arg1;
-}
-static swig_lua_method swig_IVRMenu_methods[] = {
- {"bindAction", _wrap_IVRMenu_bindAction},
- {"execute", _wrap_IVRMenu_execute},
- {0,0}
-};
-static swig_lua_attribute swig_IVRMenu_attributes[] = {
- {0,0,0}
-};
-static swig_lua_class *swig_IVRMenu_bases[] = {0};
-static const char *swig_IVRMenu_base_names[] = {0};
-static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names };
-
-static int _wrap_new_API(lua_State* L) {
- int SWIG_arg = -1;
- API *result = 0 ;
-
- SWIG_check_num_args("API",0,0)
- result = (API *)new API();
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_IVRMenu_bindAction(lua_State * L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+
+ SWIG_check_num_args("bindAction", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("bindAction", 1, "IVRMenu *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("bindAction", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("bindAction", 3, "char const *");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("bindAction", 4, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+ SWIG_fail_ptr("IVRMenu_bindAction", 1, SWIGTYPE_p_IVRMenu);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ (arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_delete_API(lua_State* L) {
- int SWIG_arg = -1;
- API *arg1 = (API *) 0 ;
-
- SWIG_check_num_args("API",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_IVRMenu_execute(lua_State * L) {
+ int SWIG_arg = -1;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("execute", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("execute", 1, "IVRMenu *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("execute", 2, "CoreSession *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("execute", 3, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_IVRMenu, 0))) {
+ SWIG_fail_ptr("IVRMenu_execute", 1, SWIGTYPE_p_IVRMenu);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("IVRMenu_execute", 2, SWIGTYPE_p_CoreSession);
+ }
+
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->execute(arg2, (char const *) arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_API_execute(lua_State* L) {
- int SWIG_arg = -1;
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("execute",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
- SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_IVRMenu(void *obj) {
+ IVRMenu *arg1 = (IVRMenu *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_IVRMenu_methods[] = {
+ {"bindAction", _wrap_IVRMenu_bindAction},
+ {"execute", _wrap_IVRMenu_execute},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_IVRMenu_attributes[] = {
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_IVRMenu_bases[] = { 0 };
+ static const char *swig_IVRMenu_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_IVRMenu =
+ { "IVRMenu", &SWIGTYPE_p_IVRMenu, _wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases,
+swig_IVRMenu_base_names };
+
+ static int _wrap_new_API(lua_State * L) {
+ int SWIG_arg = -1;
+ API *result = 0;
+
+ SWIG_check_num_args("API", 0, 0)
+ result = (API *) new API();
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_API, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_API_executeString(lua_State* L) {
- int SWIG_arg = -1;
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("executeString",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){
- SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (char *)(arg1)->executeString((char const *)arg2);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_API(lua_State * L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0;
-static void swig_delete_API(void *obj) {
-API *arg1 = (API *) obj;
-delete arg1;
-}
-static swig_lua_method swig_API_methods[] = {
- {"execute", _wrap_API_execute},
- {"executeString", _wrap_API_executeString},
- {0,0}
-};
-static swig_lua_attribute swig_API_attributes[] = {
- {0,0,0}
-};
-static swig_lua_class *swig_API_bases[] = {0};
-static const char *swig_API_base_names[] = {0};
-static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
-
-static int _wrap_input_callback_state_t_function_set(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
-
- SWIG_check_num_args("function",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("function",2,"void *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_function_set",1,SWIGTYPE_p_input_callback_state);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_function_set");
- if (arg1) (arg1)->function = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("API", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("API", 1, "API *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_API", 1, SWIGTYPE_p_API);
+ }
-static int _wrap_input_callback_state_t_function_get(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
-
- SWIG_check_num_args("function",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_function_get",1,SWIGTYPE_p_input_callback_state);
- }
-
- result = (void *) ((arg1)->function);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ delete arg1;
+ SWIG_arg = 0;
-static int _wrap_input_callback_state_t_threadState_set(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
-
- SWIG_check_num_args("threadState",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("threadState",2,"void *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_threadState_set",1,SWIGTYPE_p_input_callback_state);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_threadState_set");
- if (arg1) (arg1)->threadState = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ return SWIG_arg;
+ if (0)
+ SWIG_fail;
-static int _wrap_input_callback_state_t_threadState_get(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
-
- SWIG_check_num_args("threadState",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_threadState_get",1,SWIGTYPE_p_input_callback_state);
- }
-
- result = (void *) ((arg1)->threadState);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_input_callback_state_t_extra_set(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
-
- SWIG_check_num_args("extra",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("extra",2,"void *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_extra_set",1,SWIGTYPE_p_input_callback_state);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_extra_set");
- if (arg1) (arg1)->extra = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_API_execute(lua_State * L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("execute", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("execute", 1, "API *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("execute", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("execute", 3, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
+ SWIG_fail_ptr("API_execute", 1, SWIGTYPE_p_API);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_input_callback_state_t_extra_get(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
-
- SWIG_check_num_args("extra",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_extra_get",1,SWIGTYPE_p_input_callback_state);
- }
-
- result = (void *) ((arg1)->extra);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_API_executeString(lua_State * L) {
+ int SWIG_arg = -1;
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("executeString", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("executeString", 1, "API *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("executeString", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_API, 0))) {
+ SWIG_fail_ptr("API_executeString", 1, SWIGTYPE_p_API);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (char *) (arg1)->executeString((char const *) arg2);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("funcargs",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("funcargs",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_funcargs_set",1,SWIGTYPE_p_input_callback_state);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->funcargs) delete [] arg1->funcargs;
- if (arg2) {
- arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->funcargs, (const char *)arg2);
- } else {
- arg1->funcargs = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_API(void *obj) {
+ API *arg1 = (API *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_API_methods[] = {
+ {"execute", _wrap_API_execute},
+ {"executeString", _wrap_API_executeString},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_API_attributes[] = {
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_API_bases[] = { 0 };
+ static const char *swig_API_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_API =
+ { "API", &SWIGTYPE_p_API, _wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names };
+
+ static int _wrap_input_callback_state_t_function_set(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+
+ SWIG_check_num_args("function", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("function", 1, "input_callback_state_t *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("function", 2, "void *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_function_set", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_function_set");
+ if (arg1)
+ (arg1)->function = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_input_callback_state_t_funcargs_get(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("funcargs",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("input_callback_state_t_funcargs_get",1,SWIGTYPE_p_input_callback_state);
- }
-
- result = (char *) ((arg1)->funcargs);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_function_get(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+
+ SWIG_check_num_args("function", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("function", 1, "input_callback_state_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_function_get", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ result = (void *) ((arg1)->function);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_input_callback_state_t(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *result = 0 ;
-
- SWIG_check_num_args("input_callback_state_t::input_callback_state_t",0,0)
- result = (input_callback_state_t *)new input_callback_state_t();
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_threadState_set(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+
+ SWIG_check_num_args("threadState", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("threadState", 2, "void *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_threadState_set", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_threadState_set");
+ if (arg1)
+ (arg1)->threadState = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_delete_input_callback_state_t(lua_State* L) {
- int SWIG_arg = -1;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-
- SWIG_check_num_args("input_callback_state_t::~input_callback_state_t",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("input_callback_state_t::~input_callback_state_t",1,"input_callback_state_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_input_callback_state_t",1,SWIGTYPE_p_input_callback_state);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_threadState_get(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+
+ SWIG_check_num_args("threadState", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("threadState", 1, "input_callback_state_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_threadState_get", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ result = (void *) ((arg1)->threadState);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static void swig_delete_input_callback_state_t(void *obj) {
-input_callback_state_t *arg1 = (input_callback_state_t *) obj;
-delete arg1;
-}
-static swig_lua_method swig_input_callback_state_t_methods[] = {
- {0,0}
-};
-static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
- { "function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
- { "threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
- { "extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
- { "funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
- {0,0,0}
-};
-static swig_lua_class *swig_input_callback_state_t_bases[] = {0};
-static const char *swig_input_callback_state_t_base_names[] = {0};
-static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
-
-static int _wrap_new_Stream__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- Stream *result = 0 ;
-
- SWIG_check_num_args("Stream",0,0)
- result = (Stream *)new Stream();
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_extra_set(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+
+ SWIG_check_num_args("extra", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("extra", 1, "input_callback_state_t *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("extra", 2, "void *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_extra_set", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "input_callback_state_t_extra_set");
+ if (arg1)
+ (arg1)->extra = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_Stream__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
- Stream *result = 0 ;
-
- SWIG_check_num_args("Stream",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"switch_stream_handle_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_stream_handle_t,0))){
- SWIG_fail_ptr("new_Stream",1,SWIGTYPE_p_switch_stream_handle_t);
- }
-
- result = (Stream *)new Stream(arg1);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_extra_get(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+
+ SWIG_check_num_args("extra", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("extra", 1, "input_callback_state_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_extra_get", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ result = (void *) ((arg1)->extra);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_Stream(lua_State* L) {
- int argc;
- int argv[2]={
- 1,2
- };
-
- argc = lua_gettop(L);
- if (argc == 0) {
- return _wrap_new_Stream__SWIG_0(L);
- }
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_new_Stream__SWIG_1(L);
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'new_Stream'");
- lua_error(L);return 0;
-}
+ static int _wrap_input_callback_state_t_funcargs_set(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("funcargs", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("funcargs", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_funcargs_set", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->funcargs)
+ delete[]arg1->funcargs;
+ if (arg2) {
+ arg1->funcargs = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->funcargs, (const char *) arg2);
+ } else {
+ arg1->funcargs = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_delete_Stream(lua_State* L) {
- int SWIG_arg = -1;
- Stream *arg1 = (Stream *) 0 ;
-
- SWIG_check_num_args("Stream",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"Stream *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_Stream",1,SWIGTYPE_p_Stream);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_input_callback_state_t_funcargs_get(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("funcargs", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("funcargs", 1, "input_callback_state_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("input_callback_state_t_funcargs_get", 1, SWIGTYPE_p_input_callback_state);
+ }
+
+ result = (char *) ((arg1)->funcargs);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Stream_write(lua_State* L) {
- int SWIG_arg = -1;
- Stream *arg1 = (Stream *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("write",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("write",1,"Stream *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("write",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
- SWIG_fail_ptr("Stream_write",1,SWIGTYPE_p_Stream);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- (arg1)->write((char const *)arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_input_callback_state_t(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *result = 0;
+
+ SWIG_check_num_args("input_callback_state_t::input_callback_state_t", 0, 0)
+ result = (input_callback_state_t *) new input_callback_state_t();
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Stream_get_data(lua_State* L) {
- int SWIG_arg = -1;
- Stream *arg1 = (Stream *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("get_data",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_data",1,"Stream *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){
- SWIG_fail_ptr("Stream_get_data",1,SWIGTYPE_p_Stream);
- }
-
- result = (char *)(arg1)->get_data();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_input_callback_state_t(lua_State * L) {
+ int SWIG_arg = -1;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ SWIG_check_num_args("input_callback_state_t::~input_callback_state_t", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("input_callback_state_t::~input_callback_state_t", 1, "input_callback_state_t *");
-static void swig_delete_Stream(void *obj) {
-Stream *arg1 = (Stream *) obj;
-delete arg1;
-}
-static swig_lua_method swig_Stream_methods[] = {
- {"write", _wrap_Stream_write},
- {"get_data", _wrap_Stream_get_data},
- {0,0}
-};
-static swig_lua_attribute swig_Stream_attributes[] = {
- {0,0,0}
-};
-static swig_lua_class *swig_Stream_bases[] = {0};
-static const char *swig_Stream_base_names[] = {0};
-static swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases, swig_Stream_base_names };
-
-static int _wrap_Event_event_set(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- switch_event_t *arg2 = (switch_event_t *) 0 ;
-
- SWIG_check_num_args("event",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"switch_event_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_event_set",1,SWIGTYPE_p_Event);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_t,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("Event_event_set",2,SWIGTYPE_p_switch_event_t);
- }
-
- if (arg1) (arg1)->event = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_input_callback_state_t", 1, SWIGTYPE_p_input_callback_state);
+ }
+ delete arg1;
-static int _wrap_Event_event_get(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- switch_event_t *result = 0 ;
-
- SWIG_check_num_args("event",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_event_get",1,SWIGTYPE_p_Event);
- }
-
- result = (switch_event_t *) ((arg1)->event);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_t,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_Event_serialized_string_set(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("serialized_string",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_serialized_string_set",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->serialized_string) delete [] arg1->serialized_string;
- if (arg2) {
- arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->serialized_string, (const char *)arg2);
- } else {
- arg1->serialized_string = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_serialized_string_get(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("serialized_string",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_serialized_string_get",1,SWIGTYPE_p_Event);
- }
-
- result = (char *) ((arg1)->serialized_string);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_input_callback_state_t(void *obj) {
+ input_callback_state_t *arg1 = (input_callback_state_t *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_input_callback_state_t_methods[] = {
+ {0, 0}
+ };
+ static swig_lua_attribute swig_input_callback_state_t_attributes[] = {
+ {"function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set},
+ {"threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set},
+ {"extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set},
+ {"funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set},
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_input_callback_state_t_bases[] = { 0 };
+ static const char *swig_input_callback_state_t_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_input_callback_state_t =
+ { "input_callback_state_t", &SWIGTYPE_p_input_callback_state, _wrap_new_input_callback_state_t, swig_delete_input_callback_state_t,
+swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names };
+
+ static int _wrap_new_Stream__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ Stream *result = 0;
+
+ SWIG_check_num_args("Stream", 0, 0)
+ result = (Stream *) new Stream();
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_mine_set(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- int arg2 ;
-
- SWIG_check_num_args("mine",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_mine_set",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- if (arg1) (arg1)->mine = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Stream__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+ Stream *result = 0;
+
+ SWIG_check_num_args("Stream", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("Stream", 1, "switch_stream_handle_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_stream_handle_t, 0))) {
+ SWIG_fail_ptr("new_Stream", 1, SWIGTYPE_p_switch_stream_handle_t);
+ }
+
+ result = (Stream *) new Stream(arg1);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Stream, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_mine_get(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- int result;
-
- SWIG_check_num_args("mine",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_mine_get",1,SWIGTYPE_p_Event);
- }
-
- result = (int) ((arg1)->mine);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Stream(lua_State * L) {
+ int argc;
+ int argv[2] = {
+ 1, 2
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 0) {
+ return _wrap_new_Stream__SWIG_0(L);
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_new_Stream__SWIG_1(L);
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'new_Stream'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_new_Event__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- Event *result = 0 ;
-
- SWIG_check_num_args("Event",2,2)
- if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("Event",2,"char const *");
- arg1 = (char *)lua_tostring(L, 1);
- arg2 = (char *)lua_tostring(L, 2);
- result = (Event *)new Event((char const *)arg1,(char const *)arg2);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_Stream(lua_State * L) {
+ int SWIG_arg = -1;
+ Stream *arg1 = (Stream *) 0;
-static int _wrap_new_Event__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- Event *result = 0 ;
-
- SWIG_check_num_args("Event",1,1)
- if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *");
- arg1 = (char *)lua_tostring(L, 1);
- result = (Event *)new Event((char const *)arg1);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("Stream", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("Stream", 1, "Stream *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_Stream", 1, SWIGTYPE_p_Stream);
+ }
-static int _wrap_new_Event__SWIG_2(lua_State* L) {
- int SWIG_arg = -1;
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- int arg2 ;
- Event *result = 0 ;
-
- SWIG_check_num_args("Event",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("Event",2,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
- SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- result = (Event *)new Event(arg1,arg2);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ delete arg1;
+ SWIG_arg = 0;
-static int _wrap_new_Event__SWIG_3(lua_State* L) {
- int SWIG_arg = -1;
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- Event *result = 0 ;
-
- SWIG_check_num_args("Event",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){
- SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t);
- }
-
- result = (Event *)new Event(arg1);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ return SWIG_arg;
+ if (0)
+ SWIG_fail;
-static int _wrap_new_Event(lua_State* L) {
- int argc;
- int argv[3]={
- 1,2,3
- };
-
- argc = lua_gettop(L);
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_new_Event__SWIG_3(L);
- }
- }
- if (argc == 1) {
- int _v;
- {
- _v = lua_isstring(L,argv[0]);
- }
- if (_v) {
- return _wrap_new_Event__SWIG_1(L);
- }
- }
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[1]);
- }
- if (_v) {
- return _wrap_new_Event__SWIG_2(L);
- }
- }
- }
- if (argc == 2) {
- int _v;
- {
- _v = lua_isstring(L,argv[0]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_new_Event__SWIG_0(L);
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'new_Event'");
- lua_error(L);return 0;
-}
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_delete_Event(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
-
- SWIG_check_num_args("Event",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_Event",1,SWIGTYPE_p_Event);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Stream_write(lua_State * L) {
+ int SWIG_arg = -1;
+ Stream *arg1 = (Stream *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("write", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("write", 1, "Stream *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("write", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
+ SWIG_fail_ptr("Stream_write", 1, SWIGTYPE_p_Stream);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ (arg1)->write((char const *) arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_serialize__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("serialize",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (char *)(arg1)->serialize((char const *)arg2);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Stream_get_data(lua_State * L) {
+ int SWIG_arg = -1;
+ Stream *arg1 = (Stream *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("get_data", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("get_data", 1, "Stream *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Stream, 0))) {
+ SWIG_fail_ptr("Stream_get_data", 1, SWIGTYPE_p_Stream);
+ }
+
+ result = (char *) (arg1)->get_data();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_serialize__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("serialize",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event);
- }
-
- result = (char *)(arg1)->serialize();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_Stream(void *obj) {
+ Stream *arg1 = (Stream *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_Stream_methods[] = {
+ {"write", _wrap_Stream_write},
+ {"get_data", _wrap_Stream_get_data},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_Stream_attributes[] = {
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_Stream_bases[] = { 0 };
+ static const char *swig_Stream_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_Stream =
+ { "Stream", &SWIGTYPE_p_Stream, _wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases,
+swig_Stream_base_names };
+
+ static int _wrap_Event_event_set(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ switch_event_t *arg2 = (switch_event_t *) 0;
+
+ SWIG_check_num_args("event", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("event", 1, "Event *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("event", 2, "switch_event_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_event_set", 1, SWIGTYPE_p_Event);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("Event_event_set", 2, SWIGTYPE_p_switch_event_t);
+ }
+
+ if (arg1)
+ (arg1)->event = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_serialize(lua_State* L) {
- int argc;
- int argv[3]={
- 1,2,3
- };
-
- argc = lua_gettop(L);
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_Event_serialize__SWIG_1(L);
- }
- }
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_Event_serialize__SWIG_0(L);
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'Event_serialize'");
- lua_error(L);return 0;
-}
+ static int _wrap_Event_event_get(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ switch_event_t *result = 0;
+
+ SWIG_check_num_args("event", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("event", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_event_get", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (switch_event_t *) ((arg1)->event);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_event_t, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_setPriority__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- switch_priority_t arg2 ;
- bool result;
- switch_priority_t *argp2 ;
-
- SWIG_check_num_args("setPriority",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
- if(!lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"switch_priority_t");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_priority_t,0))){
- SWIG_fail_ptr("Event_setPriority",2,SWIGTYPE_p_switch_priority_t);
- }
- arg2 = *argp2;
-
- result = (bool)(arg1)->setPriority(arg2);
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_serialized_string_set(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("serialized_string", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("serialized_string", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("serialized_string", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_serialized_string_set", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->serialized_string)
+ delete[]arg1->serialized_string;
+ if (arg2) {
+ arg1->serialized_string = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->serialized_string, (const char *) arg2);
+ } else {
+ arg1->serialized_string = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_setPriority__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- bool result;
-
- SWIG_check_num_args("setPriority",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event);
- }
-
- result = (bool)(arg1)->setPriority();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_serialized_string_get(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("serialized_string", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("serialized_string", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_serialized_string_get", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (char *) ((arg1)->serialized_string);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_setPriority(lua_State* L) {
- int argc;
- int argv[3]={
- 1,2,3
- };
-
- argc = lua_gettop(L);
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_Event_setPriority__SWIG_1(L);
- }
- }
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- void *ptr;
- if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_Event_setPriority__SWIG_0(L);
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'Event_setPriority'");
- lua_error(L);return 0;
-}
+ static int _wrap_Event_mine_set(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ int arg2;
+
+ SWIG_check_num_args("mine", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("mine", 1, "Event *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("mine", 2, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_mine_set", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ if (arg1)
+ (arg1)->mine = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_getHeader(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getHeader",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (char *)(arg1)->getHeader(arg2);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_mine_get(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ int result;
+
+ SWIG_check_num_args("mine", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("mine", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_mine_get", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (int) ((arg1)->mine);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_getBody(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getBody",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_getBody",1,SWIGTYPE_p_Event);
- }
-
- result = (char *)(arg1)->getBody();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Event__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ Event *result = 0;
+
+ SWIG_check_num_args("Event", 2, 2)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("Event", 1, "char const *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("Event", 2, "char const *");
+ arg1 = (char *) lua_tostring(L, 1);
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_getType(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getType",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_getType",1,SWIGTYPE_p_Event);
- }
-
- result = (char *)(arg1)->getType();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Event__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+ Event *result = 0;
+
+ SWIG_check_num_args("Event", 1, 1)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("Event", 1, "char const *");
+ arg1 = (char *) lua_tostring(L, 1);
+ result = (Event *) new Event((char const *) arg1);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_addBody(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
-
- SWIG_check_num_args("addBody",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_addBody",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (bool)(arg1)->addBody((char const *)arg2);
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Event__SWIG_2(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ int arg2;
+ Event *result = 0;
+
+ SWIG_check_num_args("Event", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("Event", 1, "switch_event_t *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("Event", 2, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
+ SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ result = (Event *) new Event(arg1, arg2);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_addHeader(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- bool result;
-
- SWIG_check_num_args("addHeader",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_addHeader",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Event__SWIG_3(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ Event *result = 0;
+
+ SWIG_check_num_args("Event", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("Event", 1, "switch_event_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_event_t, 0))) {
+ SWIG_fail_ptr("new_Event", 1, SWIGTYPE_p_switch_event_t);
+ }
+
+ result = (Event *) new Event(arg1);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_Event, 1);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Event_delHeader(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
-
- SWIG_check_num_args("delHeader",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"Event *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_delHeader",1,SWIGTYPE_p_Event);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (bool)(arg1)->delHeader((char const *)arg2);
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Event(lua_State * L) {
+ int argc;
+ int argv[3] = {
+ 1, 2, 3
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_3(L);
+ }
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ _v = lua_isstring(L, argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_1(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_2(L);
+ }
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ _v = lua_isstring(L, argv[0]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_0(L);
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'new_Event'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_Event_fire(lua_State* L) {
- int SWIG_arg = -1;
- Event *arg1 = (Event *) 0 ;
- bool result;
-
- SWIG_check_num_args("fire",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("fire",1,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("Event_fire",1,SWIGTYPE_p_Event);
- }
-
- result = (bool)(arg1)->fire();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_Event(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ SWIG_check_num_args("Event", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("Event", 1, "Event *");
-static void swig_delete_Event(void *obj) {
-Event *arg1 = (Event *) obj;
-delete arg1;
-}
-static swig_lua_method swig_Event_methods[] = {
- {"serialize", _wrap_Event_serialize},
- {"setPriority", _wrap_Event_setPriority},
- {"getHeader", _wrap_Event_getHeader},
- {"getBody", _wrap_Event_getBody},
- {"getType", _wrap_Event_getType},
- {"addBody", _wrap_Event_addBody},
- {"addHeader", _wrap_Event_addHeader},
- {"delHeader", _wrap_Event_delHeader},
- {"fire", _wrap_Event_fire},
- {0,0}
-};
-static swig_lua_attribute swig_Event_attributes[] = {
- { "event", _wrap_Event_event_get, _wrap_Event_event_set},
- { "serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
- { "mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
- {0,0,0}
-};
-static swig_lua_class *swig_Event_bases[] = {0};
-static const char *swig_Event_base_names[] = {0};
-static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names };
-
-static int _wrap_delete_CoreSession(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
-
- SWIG_check_num_args("CoreSession",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_CoreSession",1,SWIGTYPE_p_CoreSession);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_Event", 1, SWIGTYPE_p_Event);
+ }
+ delete arg1;
-static int _wrap_CoreSession_session_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-
- SWIG_check_num_args("session",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("session",2,"switch_core_session_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_session_set",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("CoreSession_session_set",2,SWIGTYPE_p_switch_core_session_t);
- }
-
- if (arg1) (arg1)->session = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_session_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *result = 0 ;
-
- SWIG_check_num_args("session",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_session_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (switch_core_session_t *) ((arg1)->session);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_core_session_t,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_channel_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-
- SWIG_check_num_args("channel",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("channel",2,"switch_channel_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_channel_set",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_channel_t,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("CoreSession_channel_set",2,SWIGTYPE_p_switch_channel_t);
- }
-
- if (arg1) (arg1)->channel = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_serialize__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("serialize", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("serialize", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("serialize", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (char *) (arg1)->serialize((char const *) arg2);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_channel_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *result = 0 ;
-
- SWIG_check_num_args("channel",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_channel_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (switch_channel_t *) ((arg1)->channel);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_channel_t,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_serialize__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("serialize", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("serialize", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_serialize", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (char *) (arg1)->serialize();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_flags_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int arg2 ;
-
- SWIG_check_num_args("flags",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("flags",2,"unsigned int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_flags_set",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (unsigned int)lua_tonumber(L, 2);
- if (arg1) (arg1)->flags = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_serialize(lua_State * L) {
+ int argc;
+ int argv[3] = {
+ 1, 2, 3
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_serialize__SWIG_1(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_Event_serialize__SWIG_0(L);
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'Event_serialize'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_CoreSession_flags_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int result;
-
- SWIG_check_num_args("flags",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_flags_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (unsigned int) ((arg1)->flags);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_setPriority__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ switch_priority_t arg2;
+ bool result;
+ switch_priority_t *argp2;
+
+ SWIG_check_num_args("setPriority", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setPriority", 1, "Event *");
+ if (!lua_isuserdata(L, 2))
+ SWIG_fail_arg("setPriority", 2, "switch_priority_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_priority_t, 0))) {
+ SWIG_fail_ptr("Event_setPriority", 2, SWIGTYPE_p_switch_priority_t);
+ }
+ arg2 = *argp2;
+
+ result = (bool) (arg1)->setPriority(arg2);
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_allocated_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
-
- SWIG_check_num_args("allocated",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("allocated",2,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_allocated_set",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- if (arg1) (arg1)->allocated = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_setPriority__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ bool result;
+
+ SWIG_check_num_args("setPriority", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setPriority", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_setPriority", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (bool) (arg1)->setPriority();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_allocated_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
-
- SWIG_check_num_args("allocated",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_allocated_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (int) ((arg1)->allocated);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_setPriority(lua_State * L) {
+ int argc;
+ int argv[3] = {
+ 1, 2, 3
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_setPriority__SWIG_1(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_Event, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (lua_isuserdata(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_switch_priority_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_Event_setPriority__SWIG_0(L);
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'Event_setPriority'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_CoreSession_cb_state_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *arg2 = (input_callback_state *) 0 ;
-
- SWIG_check_num_args("cb_state",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cb_state",2,"input_callback_state *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_cb_state_set",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_input_callback_state,0))){
- SWIG_fail_ptr("CoreSession_cb_state_set",2,SWIGTYPE_p_input_callback_state);
- }
-
- if (arg1) (arg1)->cb_state = *arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_getHeader(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("getHeader", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getHeader", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("getHeader", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_getHeader", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (char *) (arg1)->getHeader(arg2);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_cb_state_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *result = 0 ;
-
- SWIG_check_num_args("cb_state",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_cb_state_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (input_callback_state *)& ((arg1)->cb_state);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_getBody(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("getBody", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getBody", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_getBody", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (char *) (arg1)->getBody();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_hook_state_set(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t arg2 ;
- switch_channel_state_t *argp2 ;
-
- SWIG_check_num_args("hook_state",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
- if(!lua_isuserdata(L,2)) SWIG_fail_arg("hook_state",2,"switch_channel_state_t");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_hook_state_set",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_channel_state_t,0))){
- SWIG_fail_ptr("CoreSession_hook_state_set",2,SWIGTYPE_p_switch_channel_state_t);
- }
- arg2 = *argp2;
-
- if (arg1) (arg1)->hook_state = arg2;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_getType(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("getType", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getType", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_getType", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (char *) (arg1)->getType();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_hook_state_get(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t result;
-
- SWIG_check_num_args("hook_state",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_hook_state_get",1,SWIGTYPE_p_CoreSession);
- }
-
- result = ((arg1)->hook_state);
- SWIG_arg=0;
- {
- switch_channel_state_t * resultptr = new switch_channel_state_t((switch_channel_state_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_channel_state_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_addBody(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+
+ SWIG_check_num_args("addBody", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("addBody", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("addBody", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_addBody", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (bool) (arg1)->addBody((char const *) arg2);
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_answer(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
-
- SWIG_check_num_args("answer",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answer",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_answer",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (int)(arg1)->answer();
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_addHeader(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ bool result;
+
+ SWIG_check_num_args("addHeader", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("addHeader", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("addHeader", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("addHeader", 3, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_addHeader", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_preAnswer(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
-
- SWIG_check_num_args("preAnswer",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("preAnswer",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_preAnswer",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (int)(arg1)->preAnswer();
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_delHeader(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+
+ SWIG_check_num_args("delHeader", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("delHeader", 1, "Event *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("delHeader", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_delHeader", 1, SWIGTYPE_p_Event);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (bool) (arg1)->delHeader((char const *) arg2);
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_hangup__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("hangup",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("hangup",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- (arg1)->hangup(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Event_fire(lua_State * L) {
+ int SWIG_arg = -1;
+ Event *arg1 = (Event *) 0;
+ bool result;
+
+ SWIG_check_num_args("fire", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("fire", 1, "Event *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("Event_fire", 1, SWIGTYPE_p_Event);
+ }
+
+ result = (bool) (arg1)->fire();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_hangup__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
-
- SWIG_check_num_args("hangup",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession);
- }
-
- (arg1)->hangup();
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_Event(void *obj) {
+ Event *arg1 = (Event *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_Event_methods[] = {
+ {"serialize", _wrap_Event_serialize},
+ {"setPriority", _wrap_Event_setPriority},
+ {"getHeader", _wrap_Event_getHeader},
+ {"getBody", _wrap_Event_getBody},
+ {"getType", _wrap_Event_getType},
+ {"addBody", _wrap_Event_addBody},
+ {"addHeader", _wrap_Event_addHeader},
+ {"delHeader", _wrap_Event_delHeader},
+ {"fire", _wrap_Event_fire},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_Event_attributes[] = {
+ {"event", _wrap_Event_event_get, _wrap_Event_event_set},
+ {"serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set},
+ {"mine", _wrap_Event_mine_get, _wrap_Event_mine_set},
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_Event_bases[] = { 0 };
+ static const char *swig_Event_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_Event =
+ { "Event", &SWIGTYPE_p_Event, _wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases,
+swig_Event_base_names };
+
+ static int _wrap_delete_CoreSession(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+
+ SWIG_check_num_args("CoreSession", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("CoreSession", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_CoreSession", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ delete arg1;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_hangup(lua_State* L) {
- int argc;
- int argv[3]={
- 1,2,3
- };
-
- argc = lua_gettop(L);
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_CoreSession_hangup__SWIG_1(L);
- }
- }
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_CoreSession_hangup__SWIG_0(L);
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_hangup'");
- lua_error(L);return 0;
-}
+ static int _wrap_CoreSession_session_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *arg2 = (switch_core_session_t *) 0;
-static int _wrap_CoreSession_setVariable(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setVariable",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setVariable",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setVariable",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setVariable",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setVariable",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setVariable(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("session", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("session", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("session", 2, "switch_core_session_t *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_session_set", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_setPrivate(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *arg3 = (void *) 0 ;
-
- SWIG_check_num_args("setPrivate",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPrivate",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setPrivate",2,"char *");
- if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("setPrivate",3,"void *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setPrivate",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"CoreSession_setPrivate");
- (arg1)->setPrivate(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("CoreSession_session_set", 2, SWIGTYPE_p_switch_core_session_t);
+ }
-static int _wrap_CoreSession_getPrivate(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *result = 0 ;
-
- SWIG_check_num_args("getPrivate",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getPrivate",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("getPrivate",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_getPrivate",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (void *)(arg1)->getPrivate(arg2);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (arg1)
+ (arg1)->session = arg2;
+ SWIG_arg = 0;
-static int _wrap_CoreSession_getVariable(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getVariable",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getVariable",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("getVariable",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_getVariable",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (char *)(arg1)->getVariable(arg2);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ return SWIG_arg;
+ if (0)
+ SWIG_fail;
-static int _wrap_CoreSession_process_callback_result(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- switch_status_t result;
-
- SWIG_check_num_args("process_callback_result",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("process_callback_result",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("process_callback_result",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_process_callback_result",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (arg1)->process_callback_result(arg2);
- SWIG_arg=0;
- {
- switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_say(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
-
- SWIG_check_num_args("say",5,5)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *");
- if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *");
- if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- arg5 = (char *)lua_tostring(L, 5);
- (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_session_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *result = 0;
+
+ SWIG_check_num_args("session", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("session", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_session_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (switch_core_session_t *) ((arg1)->session);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_core_session_t, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
-
- SWIG_check_num_args("sayPhrase",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
- if(!lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_channel_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *arg2 = (switch_channel_t *) 0;
+ SWIG_check_num_args("channel", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("channel", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("channel", 2, "switch_channel_t *");
-static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("sayPhrase",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_channel_set", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("sayPhrase",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- (arg1)->sayPhrase((char const *)arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("CoreSession_channel_set", 2, SWIGTYPE_p_switch_channel_t);
+ }
+ if (arg1)
+ (arg1)->channel = arg2;
-static int _wrap_CoreSession_sayPhrase(lua_State* L) {
- int argc;
- int argv[5]={
- 1,2,3,4,5
- };
-
- argc = lua_gettop(L);
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_2(L);
- }
- }
- }
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_1(L);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[3]);
- }
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_0(L);
- }
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_sayPhrase'");
- lua_error(L);return 0;
-}
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_recordFile__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- int result;
-
- SWIG_check_num_args("recordFile",5,5)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
- if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
- if(!lua_isnumber(L,5)) SWIG_fail_arg("recordFile",5,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- arg4 = (int)lua_tonumber(L, 4);
- arg5 = (int)lua_tonumber(L, 5);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_recordFile__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int result;
-
- SWIG_check_num_args("recordFile",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
- if(!lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- arg4 = (int)lua_tonumber(L, 4);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_channel_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *result = 0;
+
+ SWIG_check_num_args("channel", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("channel", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_channel_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (switch_channel_t *) ((arg1)->channel);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_channel_t, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_recordFile__SWIG_2(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
-
- SWIG_check_num_args("recordFile",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- result = (int)(arg1)->recordFile(arg2,arg3);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_flags_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int arg2;
+
+ SWIG_check_num_args("flags", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("flags", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("flags", 2, "unsigned int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_flags_set", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (unsigned int) lua_tonumber(L, 2);
+ if (arg1)
+ (arg1)->flags = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_recordFile__SWIG_3(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
-
- SWIG_check_num_args("recordFile",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (int)(arg1)->recordFile(arg2);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_flags_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int result;
+
+ SWIG_check_num_args("flags", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("flags", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_flags_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (unsigned int) ((arg1)->flags);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_recordFile(lua_State* L) {
- int argc;
- int argv[6]={
- 1,2,3,4,5,6
- };
-
- argc = lua_gettop(L);
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_3(L);
- }
- }
- }
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[2]);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_2(L);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[2]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[3]);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_1(L);
- }
- }
- }
- }
- }
- if (argc == 5) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[2]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[3]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[4]);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_0(L);
- }
- }
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_recordFile'");
- lua_error(L);return 0;
-}
+ static int _wrap_CoreSession_allocated_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+
+ SWIG_check_num_args("allocated", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("allocated", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("allocated", 2, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_allocated_set", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ if (arg1)
+ (arg1)->allocated = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_allocated_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+
+ SWIG_check_num_args("allocated", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("allocated", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_allocated_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (int) ((arg1)->allocated);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_cb_state_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *arg2 = (input_callback_state *) 0;
+
+ SWIG_check_num_args("cb_state", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_state", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("cb_state", 2, "input_callback_state *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_cb_state_set", 1, SWIGTYPE_p_CoreSession);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_input_callback_state, 0))) {
+ SWIG_fail_ptr("CoreSession_cb_state_set", 2, SWIGTYPE_p_input_callback_state);
+ }
+
+ if (arg1)
+ (arg1)->cb_state = *arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_cb_state_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *result = 0;
+
+ SWIG_check_num_args("cb_state", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_state", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_cb_state_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (input_callback_state *) & ((arg1)->cb_state);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_input_callback_state, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_hook_state_set(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t arg2;
+ switch_channel_state_t *argp2;
+
+ SWIG_check_num_args("hook_state", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hook_state", 1, "CoreSession *");
+ if (!lua_isuserdata(L, 2))
+ SWIG_fail_arg("hook_state", 2, "switch_channel_state_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_hook_state_set", 1, SWIGTYPE_p_CoreSession);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &argp2, SWIGTYPE_p_switch_channel_state_t, 0))) {
+ SWIG_fail_ptr("CoreSession_hook_state_set", 2, SWIGTYPE_p_switch_channel_state_t);
+ }
+ arg2 = *argp2;
+
+ if (arg1)
+ (arg1)->hook_state = arg2;
+
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_setCallerData(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setCallerData",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setCallerData",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setCallerData",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setCallerData",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setCallerData",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setCallerData(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_hook_state_get(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t result;
+
+ SWIG_check_num_args("hook_state", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hook_state", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_hook_state_get", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = ((arg1)->hook_state);
+ SWIG_arg = 0;
+ {
+ switch_channel_state_t *resultptr = new switch_channel_state_t ((switch_channel_state_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_channel_state_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_answer(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+
+ SWIG_check_num_args("answer", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("answer", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_answer", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (int) (arg1)->answer();
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_preAnswer(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+
+ SWIG_check_num_args("preAnswer", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("preAnswer", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_preAnswer", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (int) (arg1)->preAnswer();
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_hangup__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("hangup", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("hangup", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ (arg1)->hangup(arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_hangup__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+
+ SWIG_check_num_args("hangup", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_hangup", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ (arg1)->hangup();
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_hangup(lua_State * L) {
+ int argc;
+ int argv[3] = {
+ 1, 2, 3
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_CoreSession_hangup__SWIG_1(L);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_hangup__SWIG_0(L);
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_hangup'");
+ lua_error(L);
+ return 0;
+ }
+
+
+ static int _wrap_CoreSession_setVariable(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("setVariable", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setVariable", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setVariable", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("setVariable", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setVariable", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->setVariable(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_setPrivate(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *arg3 = (void *) 0;
+
+ SWIG_check_num_args("setPrivate", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setPrivate", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setPrivate", 2, "char *");
+ if (!SWIG_isptrtype(L, 3))
+ SWIG_fail_arg("setPrivate", 3, "void *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setPrivate", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (void *) SWIG_MustGetPtr(L, 3, 0, 0, 3, "CoreSession_setPrivate");
+ (arg1)->setPrivate(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_getPrivate(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *result = 0;
+
+ SWIG_check_num_args("getPrivate", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getPrivate", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("getPrivate", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_getPrivate", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (void *) (arg1)->getPrivate(arg2);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_void, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_getVariable(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("getVariable", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getVariable", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("getVariable", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_getVariable", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (char *) (arg1)->getVariable(arg2);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_process_callback_result(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ switch_status_t result;
+
+ SWIG_check_num_args("process_callback_result", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("process_callback_result", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("process_callback_result", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_process_callback_result", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (arg1)->process_callback_result(arg2);
+ SWIG_arg = 0;
+ {
+ switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_say(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+
+ SWIG_check_num_args("say", 5, 5)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("say", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("say", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("say", 3, "char const *");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("say", 4, "char const *");
+ if (!lua_isstring(L, 5))
+ SWIG_fail_arg("say", 5, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_say", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ arg5 = (char *) lua_tostring(L, 5);
+ (arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+
+ SWIG_check_num_args("sayPhrase", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("sayPhrase", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("sayPhrase", 3, "char const *");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("sayPhrase", 4, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("sayPhrase", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("sayPhrase", 2, "char const *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("sayPhrase", 3, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("sayPhrase", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("sayPhrase", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("sayPhrase", 2, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_sayPhrase", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ (arg1)->sayPhrase((char const *) arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_sayPhrase(lua_State * L) {
+ int argc;
+ int argv[5] = {
+ 1, 2, 3, 4, 5
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_2(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_1(L);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[3]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_0(L);
+ }
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_sayPhrase'");
+ lua_error(L);
+ return 0;
+ }
+
+
+ static int _wrap_CoreSession_recordFile__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int arg5;
+ int result;
+
+ SWIG_check_num_args("recordFile", 5, 5)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("recordFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("recordFile", 2, "char *");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("recordFile", 3, "int");
+ if (!lua_isnumber(L, 4))
+ SWIG_fail_arg("recordFile", 4, "int");
+ if (!lua_isnumber(L, 5))
+ SWIG_fail_arg("recordFile", 5, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ arg4 = (int) lua_tonumber(L, 4);
+ arg5 = (int) lua_tonumber(L, 5);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_recordFile__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int result;
+
+ SWIG_check_num_args("recordFile", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("recordFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("recordFile", 2, "char *");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("recordFile", 3, "int");
+ if (!lua_isnumber(L, 4))
+ SWIG_fail_arg("recordFile", 4, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ arg4 = (int) lua_tonumber(L, 4);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_recordFile__SWIG_2(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+
+ SWIG_check_num_args("recordFile", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("recordFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("recordFile", 2, "char *");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("recordFile", 3, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ result = (int) (arg1)->recordFile(arg2, arg3);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_recordFile__SWIG_3(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+
+ SWIG_check_num_args("recordFile", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("recordFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("recordFile", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_recordFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (int) (arg1)->recordFile(arg2);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_recordFile(lua_State * L) {
+ int argc;
+ int argv[6] = {
+ 1, 2, 3, 4, 5, 6
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_3(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_2(L);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[2]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[3]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_1(L);
+ }
+ }
+ }
+ }
+ }
+ if (argc == 5) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[2]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[3]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[4]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_0(L);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_recordFile'");
+ lua_error(L);
+ return 0;
+ }
+
+
+ static int _wrap_CoreSession_setCallerData(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("setCallerData", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setCallerData", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setCallerData", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("setCallerData", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setCallerData", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->setCallerData(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_originate__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int arg4;
+ int result;
+
+ SWIG_check_num_args("originate", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("originate", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("originate", 2, "CoreSession *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("originate", 3, "char *");
+ if (!lua_isnumber(L, 4))
+ SWIG_fail_arg("originate", 4, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
+ }
+
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (int) lua_tonumber(L, 4);
+ result = (int) (arg1)->originate(arg2, arg3, arg4);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_originate__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int result;
+
+ SWIG_check_num_args("originate", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("originate", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("originate", 2, "CoreSession *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("originate", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_originate", 1, SWIGTYPE_p_CoreSession);
+ }
+
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_originate", 2, SWIGTYPE_p_CoreSession);
+ }
+
+ arg3 = (char *) lua_tostring(L, 3);
+ result = (int) (arg1)->originate(arg2, arg3);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_originate(lua_State * L) {
+ int argc;
+ int argv[5] = {
+ 1, 2, 3, 4, 5
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_originate__SWIG_1(L);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[1]) == 0 || SWIG_ConvertPtr(L, argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[3]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_originate__SWIG_0(L);
+ }
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_originate'");
+ lua_error(L);
+ return 0;
+ }
+
+
+ static int _wrap_CoreSession_setDTMFCallback(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("setDTMFCallback", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setDTMFCallback", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("setDTMFCallback", 2, "void *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("setDTMFCallback", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setDTMFCallback", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setDTMFCallback");
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->setDTMFCallback(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_speak(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+
+ SWIG_check_num_args("speak", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("speak", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("speak", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_speak", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (int) (arg1)->speak(arg2);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_set_tts_parms(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("set_tts_parms", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("set_tts_parms", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("set_tts_parms", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("set_tts_parms", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_set_tts_parms", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->set_tts_parms(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_collectDigits(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int result;
+
+ SWIG_check_num_args("collectDigits", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("collectDigits", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("collectDigits", 2, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_collectDigits", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ result = (int) (arg1)->collectDigits(arg2);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_getDigits(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ char *arg3 = (char *) 0;
+ int arg4;
+ char *result = 0;
+
+ SWIG_check_num_args("getDigits", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getDigits", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("getDigits", 2, "int");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("getDigits", 3, "char *");
+ if (!lua_isnumber(L, 4))
+ SWIG_fail_arg("getDigits", 4, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_getDigits", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (int) lua_tonumber(L, 4);
+ result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_transfer(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ int result;
+
+ SWIG_check_num_args("transfer", 4, 4)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("transfer", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("transfer", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("transfer", 3, "char *");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("transfer", 4, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_transfer", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ result = (int) (arg1)->transfer(arg2, arg3, arg4);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_read(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ char *arg4 = (char *) 0;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("read", 6, 6)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("read", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("read", 2, "int");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("read", 3, "int");
+ if (!lua_isstring(L, 4))
+ SWIG_fail_arg("read", 4, "char const *");
+ if (!lua_isnumber(L, 5))
+ SWIG_fail_arg("read", 5, "int");
+ if (!lua_isstring(L, 6))
+ SWIG_fail_arg("read", 6, "char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_read", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ arg4 = (char *) lua_tostring(L, 4);
+ arg5 = (int) lua_tonumber(L, 5);
+ arg6 = (char *) lua_tostring(L, 6);
+ result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_playAndGetDigits(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ int arg4;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ char *arg9 = (char *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("playAndGetDigits", 9, 9)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("playAndGetDigits", 1, "CoreSession *");
+ if (!lua_isnumber(L, 2))
+ SWIG_fail_arg("playAndGetDigits", 2, "int");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("playAndGetDigits", 3, "int");
+ if (!lua_isnumber(L, 4))
+ SWIG_fail_arg("playAndGetDigits", 4, "int");
+ if (!lua_isnumber(L, 5))
+ SWIG_fail_arg("playAndGetDigits", 5, "int");
+ if (!lua_isstring(L, 6))
+ SWIG_fail_arg("playAndGetDigits", 6, "char *");
+ if (!lua_isstring(L, 7))
+ SWIG_fail_arg("playAndGetDigits", 7, "char *");
+ if (!lua_isstring(L, 8))
+ SWIG_fail_arg("playAndGetDigits", 8, "char *");
+ if (!lua_isstring(L, 9))
+ SWIG_fail_arg("playAndGetDigits", 9, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_playAndGetDigits", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (int) lua_tonumber(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ arg4 = (int) lua_tonumber(L, 4);
+ arg5 = (int) lua_tonumber(L, 5);
+ arg6 = (char *) lua_tostring(L, 6);
+ arg7 = (char *) lua_tostring(L, 7);
+ arg8 = (char *) lua_tostring(L, 8);
+ arg9 = (char *) lua_tostring(L, 9);
+ result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_streamFile__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+
+ SWIG_check_num_args("streamFile", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("streamFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("streamFile", 2, "char *");
+ if (!lua_isnumber(L, 3))
+ SWIG_fail_arg("streamFile", 3, "int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (int) lua_tonumber(L, 3);
+ result = (int) (arg1)->streamFile(arg2, arg3);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_streamFile__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+
+ SWIG_check_num_args("streamFile", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("streamFile", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("streamFile", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_streamFile", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ result = (int) (arg1)->streamFile(arg2);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_streamFile(lua_State * L) {
+ int argc;
+ int argv[4] = {
+ 1, 2, 3, 4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_streamFile__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isnumber(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_streamFile__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_streamFile'");
+ lua_error(L);
+ return 0;
+ }
+
+
+ static int _wrap_CoreSession_flushEvents(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+
+ SWIG_check_num_args("flushEvents", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("flushEvents", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_flushEvents", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (int) (arg1)->flushEvents();
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_flushDigits(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+
+ SWIG_check_num_args("flushDigits", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("flushDigits", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_flushDigits", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (int) (arg1)->flushDigits();
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_setAutoHangup(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool arg2;
+ int result;
+
+ SWIG_check_num_args("setAutoHangup", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setAutoHangup", 1, "CoreSession *");
+ if (!lua_isboolean(L, 2))
+ SWIG_fail_arg("setAutoHangup", 2, "bool");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setAutoHangup", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (lua_toboolean(L, 2) != 0);
+ result = (int) (arg1)->setAutoHangup(arg2);
+ SWIG_arg = 0;
+ lua_pushnumber(L, (lua_Number) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_setHangupHook(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+
+ SWIG_check_num_args("setHangupHook", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setHangupHook", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("setHangupHook", 2, "void *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setHangupHook", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_setHangupHook");
+ (arg1)->setHangupHook(arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_ready(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+
+ SWIG_check_num_args("ready", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("ready", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_ready", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (bool) (arg1)->ready();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_execute__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("execute", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("execute", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("execute", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("execute", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->execute(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_execute__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("execute", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("execute", 1, "CoreSession *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("execute", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_execute", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ (arg1)->execute(arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
+
+
+ static int _wrap_CoreSession_execute(lua_State * L) {
+ int argc;
+ int argv[4] = {
+ 1, 2, 3, 4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'CoreSession_execute'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_CoreSession_originate__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- int result;
-
- SWIG_check_num_args("originate",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
- if(!lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
- }
-
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (int)lua_tonumber(L, 4);
- result = (int)(arg1)->originate(arg2,arg3,arg4);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_sendEvent(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
-static int _wrap_CoreSession_originate__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int result;
-
- SWIG_check_num_args("originate",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession);
- }
-
- arg3 = (char *)lua_tostring(L, 3);
- result = (int)(arg1)->originate(arg2,arg3);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("sendEvent", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("sendEvent", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("sendEvent", 2, "Event *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_sendEvent", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_originate(lua_State* L) {
- int argc;
- int argv[5]={
- 1,2,3,4,5
- };
-
- argc = lua_gettop(L);
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- return _wrap_CoreSession_originate__SWIG_1(L);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[3]);
- }
- if (_v) {
- return _wrap_CoreSession_originate__SWIG_0(L);
- }
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_originate'");
- lua_error(L);return 0;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("CoreSession_sendEvent", 2, SWIGTYPE_p_Event);
+ }
-static int _wrap_CoreSession_setDTMFCallback(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setDTMFCallback",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setDTMFCallback",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setDTMFCallback",2,"void *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setDTMFCallback",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setDTMFCallback",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setDTMFCallback");
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setDTMFCallback(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ (arg1)->sendEvent(arg2);
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_speak(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
-
- SWIG_check_num_args("speak",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("speak",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("speak",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_speak",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (int)(arg1)->speak(arg2);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_set_tts_parms(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("set_tts_parms",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("set_tts_parms",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("set_tts_parms",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("set_tts_parms",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_set_tts_parms",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->set_tts_parms(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_setEventData(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
-static int _wrap_CoreSession_collectDigits(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int result;
-
- SWIG_check_num_args("collectDigits",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- result = (int)(arg1)->collectDigits(arg2);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("setEventData", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setEventData", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("setEventData", 2, "Event *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_setEventData", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_getDigits(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getDigits",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int");
- if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *");
- if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (int)lua_tonumber(L, 4);
- result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_Event, 0))) {
+ SWIG_fail_ptr("CoreSession_setEventData", 2, SWIGTYPE_p_Event);
+ }
-static int _wrap_CoreSession_transfer(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- int result;
-
- SWIG_check_num_args("transfer",4,4)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("transfer",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("transfer",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("transfer",3,"char *");
- if(!lua_isstring(L,4)) SWIG_fail_arg("transfer",4,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_transfer",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- result = (int)(arg1)->transfer(arg2,arg3,arg4);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ (arg1)->setEventData(arg2);
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_read(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- char *arg4 = (char *) 0 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("read",6,6)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int");
- if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *");
- if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int");
- if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- arg4 = (char *)lua_tostring(L, 4);
- arg5 = (int)lua_tonumber(L, 5);
- arg6 = (char *)lua_tostring(L, 6);
- result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_playAndGetDigits(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- char *arg9 = (char *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("playAndGetDigits",9,9)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *");
- if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int");
- if(!lua_isnumber(L,4)) SWIG_fail_arg("playAndGetDigits",4,"int");
- if(!lua_isnumber(L,5)) SWIG_fail_arg("playAndGetDigits",5,"int");
- if(!lua_isstring(L,6)) SWIG_fail_arg("playAndGetDigits",6,"char *");
- if(!lua_isstring(L,7)) SWIG_fail_arg("playAndGetDigits",7,"char *");
- if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *");
- if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (int)lua_tonumber(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- arg4 = (int)lua_tonumber(L, 4);
- arg5 = (int)lua_tonumber(L, 5);
- arg6 = (char *)lua_tostring(L, 6);
- arg7 = (char *)lua_tostring(L, 7);
- arg8 = (char *)lua_tostring(L, 8);
- arg9 = (char *)lua_tostring(L, 9);
- result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_getXMLCDR(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("getXMLCDR", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("getXMLCDR", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_getXMLCDR", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (char *) (arg1)->getXMLCDR();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_streamFile__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
-
- SWIG_check_num_args("streamFile",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
- if(!lua_isnumber(L,3)) SWIG_fail_arg("streamFile",3,"int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (int)lua_tonumber(L, 3);
- result = (int)(arg1)->streamFile(arg2,arg3);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_begin_allow_threads(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+
+ SWIG_check_num_args("begin_allow_threads", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("begin_allow_threads", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_begin_allow_threads", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (bool) (arg1)->begin_allow_threads();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_streamFile__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
-
- SWIG_check_num_args("streamFile",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- result = (int)(arg1)->streamFile(arg2);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_end_allow_threads(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+
+ SWIG_check_num_args("end_allow_threads", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("end_allow_threads", 1, "CoreSession *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_end_allow_threads", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (bool) (arg1)->end_allow_threads();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_streamFile(lua_State* L) {
- int argc;
- int argv[4]={
- 1,2,3,4
- };
-
- argc = lua_gettop(L);
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_CoreSession_streamFile__SWIG_1(L);
- }
- }
- }
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isnumber(L,argv[2]);
- }
- if (_v) {
- return _wrap_CoreSession_streamFile__SWIG_0(L);
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_streamFile'");
- lua_error(L);return 0;
-}
+ static int _wrap_CoreSession_get_uuid(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("get_uuid", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("get_uuid", 1, "CoreSession const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_get_uuid", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ result = (char *) ((CoreSession const *) arg1)->get_uuid();
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_flushEvents(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
-
- SWIG_check_num_args("flushEvents",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushEvents",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_flushEvents",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (int)(arg1)->flushEvents();
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_get_cb_args(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_input_args_t *result = 0;
+
+ SWIG_check_num_args("get_cb_args", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("get_cb_args", 1, "CoreSession const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_get_cb_args", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ {
+ switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+ result = (switch_input_args_t *) &_result_ref;
+ }
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_switch_input_args_t, 0);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_flushDigits(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
-
- SWIG_check_num_args("flushDigits",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushDigits",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_flushDigits",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (int)(arg1)->flushDigits();
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_check_hangup_hook(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
-static int _wrap_CoreSession_setAutoHangup(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool arg2 ;
- int result;
-
- SWIG_check_num_args("setAutoHangup",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAutoHangup",1,"CoreSession *");
- if(!lua_isboolean(L,2)) SWIG_fail_arg("setAutoHangup",2,"bool");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setAutoHangup",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (lua_toboolean(L, 2)!=0);
- result = (int)(arg1)->setAutoHangup(arg2);
- SWIG_arg=0;
- lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("check_hangup_hook", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("check_hangup_hook", 1, "CoreSession *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_check_hangup_hook", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_setHangupHook(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
-
- SWIG_check_num_args("setHangupHook",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setHangupHook",2,"void *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setHangupHook",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setHangupHook");
- (arg1)->setHangupHook(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ (arg1)->check_hangup_hook();
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_ready(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
-
- SWIG_check_num_args("ready",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_ready",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (bool)(arg1)->ready();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("execute",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->execute(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_CoreSession_run_dtmf_callback(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ switch_input_type_t *argp3;
+
+ SWIG_check_num_args("run_dtmf_callback", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("run_dtmf_callback", 1, "CoreSession *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("run_dtmf_callback", 2, "void *");
+ if (!lua_isuserdata(L, 3))
+ SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("CoreSession_run_dtmf_callback", 1, SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "CoreSession_run_dtmf_callback");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+ SWIG_fail_ptr("CoreSession_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+ }
+ arg3 = *argp3;
+
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ SWIG_arg = 0;
+ {
+ switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_execute__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("execute",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- (arg1)->execute(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static void swig_delete_CoreSession(void *obj) {
+ CoreSession *arg1 = (CoreSession *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_CoreSession_methods[] = {
+ {"answer", _wrap_CoreSession_answer},
+ {"preAnswer", _wrap_CoreSession_preAnswer},
+ {"hangup", _wrap_CoreSession_hangup},
+ {"setVariable", _wrap_CoreSession_setVariable},
+ {"setPrivate", _wrap_CoreSession_setPrivate},
+ {"getPrivate", _wrap_CoreSession_getPrivate},
+ {"getVariable", _wrap_CoreSession_getVariable},
+ {"process_callback_result", _wrap_CoreSession_process_callback_result},
+ {"say", _wrap_CoreSession_say},
+ {"sayPhrase", _wrap_CoreSession_sayPhrase},
+ {"recordFile", _wrap_CoreSession_recordFile},
+ {"setCallerData", _wrap_CoreSession_setCallerData},
+ {"originate", _wrap_CoreSession_originate},
+ {"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
+ {"speak", _wrap_CoreSession_speak},
+ {"set_tts_parms", _wrap_CoreSession_set_tts_parms},
+ {"collectDigits", _wrap_CoreSession_collectDigits},
+ {"getDigits", _wrap_CoreSession_getDigits},
+ {"transfer", _wrap_CoreSession_transfer},
+ {"read", _wrap_CoreSession_read},
+ {"playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
+ {"streamFile", _wrap_CoreSession_streamFile},
+ {"flushEvents", _wrap_CoreSession_flushEvents},
+ {"flushDigits", _wrap_CoreSession_flushDigits},
+ {"setAutoHangup", _wrap_CoreSession_setAutoHangup},
+ {"setHangupHook", _wrap_CoreSession_setHangupHook},
+ {"ready", _wrap_CoreSession_ready},
+ {"execute", _wrap_CoreSession_execute},
+ {"sendEvent", _wrap_CoreSession_sendEvent},
+ {"setEventData", _wrap_CoreSession_setEventData},
+ {"getXMLCDR", _wrap_CoreSession_getXMLCDR},
+ {"begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
+ {"end_allow_threads", _wrap_CoreSession_end_allow_threads},
+ {"get_uuid", _wrap_CoreSession_get_uuid},
+ {"get_cb_args", _wrap_CoreSession_get_cb_args},
+ {"check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
+ {"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_CoreSession_attributes[] = {
+ {"session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
+ {"channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
+ {"flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
+ {"allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
+ {"cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
+ {"hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_CoreSession_bases[] = { 0 };
+ static const char *swig_CoreSession_base_names[] = { 0 };
+ static swig_lua_class _wrap_class_CoreSession =
+ { "CoreSession", &SWIGTYPE_p_CoreSession, 0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes,
+swig_CoreSession_bases, swig_CoreSession_base_names };
+
+ static int _wrap_console_log(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("console_log", 2, 2)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("console_log", 1, "char *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("console_log", 2, "char *");
+ arg1 = (char *) lua_tostring(L, 1);
+ arg2 = (char *) lua_tostring(L, 2);
+ console_log(arg1, arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_execute(lua_State* L) {
- int argc;
- int argv[4]={
- 1,2,3,4
- };
-
- argc = lua_gettop(L);
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_CoreSession_execute__SWIG_1(L);
- }
- }
- }
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- return _wrap_CoreSession_execute__SWIG_0(L);
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'CoreSession_execute'");
- lua_error(L);return 0;
-}
+ static int _wrap_console_clean_log(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+
+ SWIG_check_num_args("console_clean_log", 1, 1)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("console_clean_log", 1, "char *");
+ arg1 = (char *) lua_tostring(L, 1);
+ console_clean_log(arg1);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_sendEvent(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
-
- SWIG_check_num_args("sendEvent",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_sendEvent",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("CoreSession_sendEvent",2,SWIGTYPE_p_Event);
- }
-
- (arg1)->sendEvent(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_bridge(lua_State * L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = 0;
+ CoreSession *arg2 = 0;
-static int _wrap_CoreSession_setEventData(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
-
- SWIG_check_num_args("setEventData",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){
- SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event);
- }
-
- (arg1)->setEventData(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("bridge", 2, 2)
+ if (!lua_isuserdata(L, 1))
+ SWIG_fail_arg("bridge", 1, "CoreSession &");
+ if (!lua_isuserdata(L, 2))
+ SWIG_fail_arg("bridge", 2, "CoreSession &");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("bridge", 1, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_getXMLCDR(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("getXMLCDR",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (char *)(arg1)->getXMLCDR();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 2, (void **) &arg2, SWIGTYPE_p_CoreSession, 0))) {
+ SWIG_fail_ptr("bridge", 2, SWIGTYPE_p_CoreSession);
+ }
-static int _wrap_CoreSession_begin_allow_threads(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
-
- SWIG_check_num_args("begin_allow_threads",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_begin_allow_threads",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (bool)(arg1)->begin_allow_threads();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ bridge(*arg1, *arg2);
+ SWIG_arg = 0;
+ return SWIG_arg;
-static int _wrap_CoreSession_end_allow_threads(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
-
- SWIG_check_num_args("end_allow_threads",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_end_allow_threads",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (bool)(arg1)->end_allow_threads();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (0)
+ SWIG_fail;
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_get_uuid(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("get_uuid",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_uuid",1,"CoreSession const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_get_uuid",1,SWIGTYPE_p_CoreSession);
- }
-
- result = (char *)((CoreSession const *)arg1)->get_uuid();
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_hanguphook(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ switch_status_t result;
+
+ SWIG_check_num_args("hanguphook", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hanguphook", 1, "switch_core_session_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+ SWIG_fail_ptr("hanguphook", 1, SWIGTYPE_p_switch_core_session_t);
+ }
+
+ result = hanguphook(arg1);
+ SWIG_arg = 0;
+ {
+ switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_get_cb_args(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_input_args_t *result = 0 ;
-
- SWIG_check_num_args("get_cb_args",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_cb_args",1,"CoreSession const *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_get_cb_args",1,SWIGTYPE_p_CoreSession);
- }
-
- {
- switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
- result = (switch_input_args_t *) &_result_ref;
- }
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_input_args_t,0); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_dtmf_callback(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ void *arg4 = (void *) 0;
+ unsigned int arg5;
+ switch_status_t result;
+ switch_input_type_t *argp3;
+
+ SWIG_check_num_args("dtmf_callback", 5, 5)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("dtmf_callback", 1, "switch_core_session_t *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("dtmf_callback", 2, "void *");
+ if (!lua_isuserdata(L, 3))
+ SWIG_fail_arg("dtmf_callback", 3, "switch_input_type_t");
+ if (!SWIG_isptrtype(L, 4))
+ SWIG_fail_arg("dtmf_callback", 4, "void *");
+ if (!lua_isnumber(L, 5))
+ SWIG_fail_arg("dtmf_callback", 5, "unsigned int");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+ SWIG_fail_ptr("dtmf_callback", 1, SWIGTYPE_p_switch_core_session_t);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "dtmf_callback");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+ SWIG_fail_ptr("dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+ }
+ arg3 = *argp3;
+
+ arg4 = (void *) SWIG_MustGetPtr(L, 4, 0, 0, 4, "dtmf_callback");
+ arg5 = (unsigned int) lua_tonumber(L, 5);
+ result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+ SWIG_arg = 0;
+ {
+ switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_check_hangup_hook(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
-
- SWIG_check_num_args("check_hangup_hook",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"CoreSession *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_check_hangup_hook",1,SWIGTYPE_p_CoreSession);
- }
-
- (arg1)->check_hangup_hook();
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Session__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * result = 0;
+
+ SWIG_check_num_args("LUA::Session", 0, 0)
+ result = (LUA::Session *) new LUA::Session();
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+ SWIG_arg++;
+ result->setLUA(L);
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_CoreSession_run_dtmf_callback(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- switch_input_type_t *argp3 ;
-
- SWIG_check_num_args("run_dtmf_callback",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"CoreSession *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
- if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("CoreSession_run_dtmf_callback",1,SWIGTYPE_p_CoreSession);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_run_dtmf_callback");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
- SWIG_fail_ptr("CoreSession_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
- }
- arg3 = *argp3;
-
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- SWIG_arg=0;
- {
- switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Session__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ char *arg1 = (char *) 0;
+ LUA::Session * result = 0;
+
+ SWIG_check_num_args("LUA::Session", 1, 1)
+ if (!lua_isstring(L, 1))
+ SWIG_fail_arg("LUA::Session", 1, "char *");
+ arg1 = (char *) lua_tostring(L, 1);
+ result = (LUA::Session *) new LUA::Session(arg1);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+ SWIG_arg++;
+ result->setLUA(L);
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static void swig_delete_CoreSession(void *obj) {
-CoreSession *arg1 = (CoreSession *) obj;
-delete arg1;
-}
-static swig_lua_method swig_CoreSession_methods[] = {
- {"answer", _wrap_CoreSession_answer},
- {"preAnswer", _wrap_CoreSession_preAnswer},
- {"hangup", _wrap_CoreSession_hangup},
- {"setVariable", _wrap_CoreSession_setVariable},
- {"setPrivate", _wrap_CoreSession_setPrivate},
- {"getPrivate", _wrap_CoreSession_getPrivate},
- {"getVariable", _wrap_CoreSession_getVariable},
- {"process_callback_result", _wrap_CoreSession_process_callback_result},
- {"say", _wrap_CoreSession_say},
- {"sayPhrase", _wrap_CoreSession_sayPhrase},
- {"recordFile", _wrap_CoreSession_recordFile},
- {"setCallerData", _wrap_CoreSession_setCallerData},
- {"originate", _wrap_CoreSession_originate},
- {"setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
- {"speak", _wrap_CoreSession_speak},
- {"set_tts_parms", _wrap_CoreSession_set_tts_parms},
- {"collectDigits", _wrap_CoreSession_collectDigits},
- {"getDigits", _wrap_CoreSession_getDigits},
- {"transfer", _wrap_CoreSession_transfer},
- {"read", _wrap_CoreSession_read},
- {"playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
- {"streamFile", _wrap_CoreSession_streamFile},
- {"flushEvents", _wrap_CoreSession_flushEvents},
- {"flushDigits", _wrap_CoreSession_flushDigits},
- {"setAutoHangup", _wrap_CoreSession_setAutoHangup},
- {"setHangupHook", _wrap_CoreSession_setHangupHook},
- {"ready", _wrap_CoreSession_ready},
- {"execute", _wrap_CoreSession_execute},
- {"sendEvent", _wrap_CoreSession_sendEvent},
- {"setEventData", _wrap_CoreSession_setEventData},
- {"getXMLCDR", _wrap_CoreSession_getXMLCDR},
- {"begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
- {"end_allow_threads", _wrap_CoreSession_end_allow_threads},
- {"get_uuid", _wrap_CoreSession_get_uuid},
- {"get_cb_args", _wrap_CoreSession_get_cb_args},
- {"check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
- {"run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
- {0,0}
-};
-static swig_lua_attribute swig_CoreSession_attributes[] = {
- { "session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set},
- { "channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set},
- { "flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set},
- { "allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set},
- { "cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set},
- { "hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set},
- {0,0,0}
-};
-static swig_lua_class *swig_CoreSession_bases[] = {0};
-static const char *swig_CoreSession_base_names[] = {0};
-static swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases, swig_CoreSession_base_names };
-
-static int _wrap_console_log(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("console_log",2,2)
- if(!lua_isstring(L,1)) SWIG_fail_arg("console_log",1,"char *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("console_log",2,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- arg2 = (char *)lua_tostring(L, 2);
- console_log(arg1,arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Session__SWIG_2(lua_State * L) {
+ int SWIG_arg = -1;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ LUA::Session * result = 0;
+
+ SWIG_check_num_args("LUA::Session", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("LUA::Session", 1, "switch_core_session_t *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_switch_core_session_t, 0))) {
+ SWIG_fail_ptr("new_Session", 1, SWIGTYPE_p_switch_core_session_t);
+ }
+
+ result = (LUA::Session *) new LUA::Session(arg1);
+ SWIG_arg = 0;
+ SWIG_NewPointerObj(L, result, SWIGTYPE_p_LUA__Session, 1);
+ SWIG_arg++;
+ result->setLUA(L);
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_console_clean_log(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
-
- SWIG_check_num_args("console_clean_log",1,1)
- if(!lua_isstring(L,1)) SWIG_fail_arg("console_clean_log",1,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- console_clean_log(arg1);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_new_Session(lua_State * L) {
+ int argc;
+ int argv[2] = {
+ 1, 2
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 0) {
+ return _wrap_new_Session__SWIG_0(L);
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ return _wrap_new_Session__SWIG_2(L);
+ }
+ }
+ if (argc == 1) {
+ int _v;
+ {
+ _v = lua_isstring(L, argv[0]);
+ }
+ if (_v) {
+ return _wrap_new_Session__SWIG_1(L);
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'new_Session'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_bridge(lua_State* L) {
- int SWIG_arg = -1;
- CoreSession *arg1 = 0 ;
- CoreSession *arg2 = 0 ;
-
- SWIG_check_num_args("bridge",2,2)
- if(!lua_isuserdata(L,1)) SWIG_fail_arg("bridge",1,"CoreSession &");
- if(!lua_isuserdata(L,2)) SWIG_fail_arg("bridge",2,"CoreSession &");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("bridge",1,SWIGTYPE_p_CoreSession);
- }
-
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){
- SWIG_fail_ptr("bridge",2,SWIGTYPE_p_CoreSession);
- }
-
- bridge(*arg1,*arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_delete_Session(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
-static int _wrap_hanguphook(lua_State* L) {
- int SWIG_arg = -1;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- switch_status_t result;
-
- SWIG_check_num_args("hanguphook",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hanguphook",1,"switch_core_session_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
- SWIG_fail_ptr("hanguphook",1,SWIGTYPE_p_switch_core_session_t);
- }
-
- result = hanguphook(arg1);
- SWIG_arg=0;
- {
- switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ SWIG_check_num_args("LUA::~Session", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("LUA::~Session", 1, "LUA::Session *");
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, SWIG_POINTER_DISOWN))) {
+ SWIG_fail_ptr("delete_Session", 1, SWIGTYPE_p_LUA__Session);
+ }
-static int _wrap_dtmf_callback(lua_State* L) {
- int SWIG_arg = -1;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- void *arg4 = (void *) 0 ;
- unsigned int arg5 ;
- switch_status_t result;
- switch_input_type_t *argp3 ;
-
- SWIG_check_num_args("dtmf_callback",5,5)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dtmf_callback",1,"switch_core_session_t *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("dtmf_callback",2,"void *");
- if(!lua_isuserdata(L,3)) SWIG_fail_arg("dtmf_callback",3,"switch_input_type_t");
- if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("dtmf_callback",4,"void *");
- if(!lua_isnumber(L,5)) SWIG_fail_arg("dtmf_callback",5,"unsigned int");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
- SWIG_fail_ptr("dtmf_callback",1,SWIGTYPE_p_switch_core_session_t);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"dtmf_callback");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
- SWIG_fail_ptr("dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
- }
- arg3 = *argp3;
-
- arg4=(void *)SWIG_MustGetPtr(L,4,0,0,4,"dtmf_callback");
- arg5 = (unsigned int)lua_tonumber(L, 5);
- result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
- SWIG_arg=0;
- {
- switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ delete arg1;
+ SWIG_arg = 0;
-static int _wrap_new_Session__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *result = 0 ;
-
- SWIG_check_num_args("LUA::Session",0,0)
- result = (LUA::Session *)new LUA::Session();
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ return SWIG_arg;
+ if (0)
+ SWIG_fail;
-static int _wrap_new_Session__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- char *arg1 = (char *) 0 ;
- LUA::Session *result = 0 ;
-
- SWIG_check_num_args("LUA::Session",1,1)
- if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *");
- arg1 = (char *)lua_tostring(L, 1);
- result = (LUA::Session *)new LUA::Session(arg1);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_Session__SWIG_2(lua_State* L) {
- int SWIG_arg = -1;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- LUA::Session *result = 0 ;
-
- SWIG_check_num_args("LUA::Session",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::Session",1,"switch_core_session_t *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){
- SWIG_fail_ptr("new_Session",1,SWIGTYPE_p_switch_core_session_t);
- }
-
- result = (LUA::Session *)new LUA::Session(arg1);
- SWIG_arg=0;
- SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L);
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_begin_allow_threads(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ bool result;
+
+ SWIG_check_num_args("begin_allow_threads", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("begin_allow_threads", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_begin_allow_threads", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (bool) (arg1)->begin_allow_threads();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_new_Session(lua_State* L) {
- int argc;
- int argv[2]={
- 1,2
- };
-
- argc = lua_gettop(L);
- if (argc == 0) {
- return _wrap_new_Session__SWIG_0(L);
- }
- if (argc == 1) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- return _wrap_new_Session__SWIG_2(L);
- }
- }
- if (argc == 1) {
- int _v;
- {
- _v = lua_isstring(L,argv[0]);
- }
- if (_v) {
- return _wrap_new_Session__SWIG_1(L);
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'new_Session'");
- lua_error(L);return 0;
-}
+ static int _wrap_Session_end_allow_threads(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ bool result;
+
+ SWIG_check_num_args("end_allow_threads", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("end_allow_threads", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_end_allow_threads", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (bool) (arg1)->end_allow_threads();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_delete_Session(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
-
- SWIG_check_num_args("LUA::~Session",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Session",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,SWIG_POINTER_DISOWN))){
- SWIG_fail_ptr("delete_Session",1,SWIGTYPE_p_LUA__Session);
- }
-
- delete arg1;
-
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_check_hangup_hook(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ SWIG_check_num_args("check_hangup_hook", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("check_hangup_hook", 1, "LUA::Session *");
-static int _wrap_Session_begin_allow_threads(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- bool result;
-
- SWIG_check_num_args("begin_allow_threads",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_begin_allow_threads",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (bool)(arg1)->begin_allow_threads();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_check_hangup_hook", 1, SWIGTYPE_p_LUA__Session);
+ }
+ (arg1)->check_hangup_hook();
+ SWIG_arg = 0;
-static int _wrap_Session_end_allow_threads(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- bool result;
-
- SWIG_check_num_args("end_allow_threads",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_end_allow_threads",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (bool)(arg1)->end_allow_threads();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ return SWIG_arg;
+ if (0)
+ SWIG_fail;
-static int _wrap_Session_check_hangup_hook(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
-
- SWIG_check_num_args("check_hangup_hook",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_check_hangup_hook",1,SWIGTYPE_p_LUA__Session);
- }
-
- (arg1)->check_hangup_hook();
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_run_dtmf_callback(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- switch_input_type_t *argp3 ;
-
- SWIG_check_num_args("run_dtmf_callback",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"LUA::Session *");
- if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *");
- if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_run_dtmf_callback",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"Session_run_dtmf_callback");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){
- SWIG_fail_ptr("Session_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t);
- }
- arg3 = *argp3;
-
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- SWIG_arg=0;
- {
- switch_status_t * resultptr = new switch_status_t((switch_status_t &) result);
- SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++;
- }
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_run_dtmf_callback(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ switch_input_type_t *argp3;
+
+ SWIG_check_num_args("run_dtmf_callback", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("run_dtmf_callback", 1, "LUA::Session *");
+ if (!SWIG_isptrtype(L, 2))
+ SWIG_fail_arg("run_dtmf_callback", 2, "void *");
+ if (!lua_isuserdata(L, 3))
+ SWIG_fail_arg("run_dtmf_callback", 3, "switch_input_type_t");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_run_dtmf_callback", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (void *) SWIG_MustGetPtr(L, 2, 0, 0, 2, "Session_run_dtmf_callback");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 3, (void **) &argp3, SWIGTYPE_p_switch_input_type_t, 0))) {
+ SWIG_fail_ptr("Session_run_dtmf_callback", 3, SWIGTYPE_p_switch_input_type_t);
+ }
+ arg3 = *argp3;
+
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ SWIG_arg = 0;
+ {
+ switch_status_t *resultptr = new switch_status_t ((switch_status_t &) result);
+ SWIG_NewPointerObj(L, (void *) resultptr, SWIGTYPE_p_switch_status_t, 1);
+ SWIG_arg++;
+ }
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_setInputCallback(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setInputCallback",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setInputCallback",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setInputCallback(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_setInputCallback(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("setInputCallback", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setInputCallback", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setInputCallback", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("setInputCallback", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_setInputCallback", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->setInputCallback(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
-
- SWIG_check_num_args("setHangupHook",3,3)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
- if(!lua_isstring(L,3)) SWIG_fail_arg("setHangupHook",3,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- arg3 = (char *)lua_tostring(L, 3);
- (arg1)->setHangupHook(arg2,arg3);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_setHangupHook__SWIG_0(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+
+ SWIG_check_num_args("setHangupHook", 3, 3)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setHangupHook", 2, "char *");
+ if (!lua_isstring(L, 3))
+ SWIG_fail_arg("setHangupHook", 3, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ arg3 = (char *) lua_tostring(L, 3);
+ (arg1)->setHangupHook(arg2, arg3);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("setHangupHook",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- (arg1)->setHangupHook(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_setHangupHook__SWIG_1(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("setHangupHook", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setHangupHook", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("setHangupHook", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_setHangupHook", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ (arg1)->setHangupHook(arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_setHangupHook(lua_State* L) {
- int argc;
- int argv[4]={
- 1,2,3,4
- };
-
- argc = lua_gettop(L);
- if (argc == 2) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- return _wrap_Session_setHangupHook__SWIG_1(L);
- }
- }
- }
- if (argc == 3) {
- int _v;
- {
- void *ptr;
- if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
- _v = 0;
- } else {
- _v = 1;
- }
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[1]);
- }
- if (_v) {
- {
- _v = lua_isstring(L,argv[2]);
- }
- if (_v) {
- return _wrap_Session_setHangupHook__SWIG_0(L);
- }
- }
- }
- }
-
- lua_pushstring(L,"No matching function for overloaded 'Session_setHangupHook'");
- lua_error(L);return 0;
-}
+ static int _wrap_Session_setHangupHook(lua_State * L) {
+ int argc;
+ int argv[4] = {
+ 1, 2, 3, 4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ return _wrap_Session_setHangupHook__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L, argv[0]) == 0 || SWIG_ConvertPtr(L, argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L, argv[2]);
+ }
+ if (_v) {
+ return _wrap_Session_setHangupHook__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L, "No matching function for overloaded 'Session_setHangupHook'");
+ lua_error(L);
+ return 0;
+ }
-static int _wrap_Session_ready(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- bool result;
-
- SWIG_check_num_args("ready",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_ready",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (bool)(arg1)->ready();
- SWIG_arg=0;
- lua_pushboolean(L,(int)(result==true)); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_ready(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ bool result;
+
+ SWIG_check_num_args("ready", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("ready", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_ready", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (bool) (arg1)->ready();
+ SWIG_arg = 0;
+ lua_pushboolean(L, (int) (result == true));
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_cb_function_set(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("cb_function",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("cb_function",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_cb_function_set",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->cb_function) delete [] arg1->cb_function;
- if (arg2) {
- arg1->cb_function = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->cb_function, (const char *)arg2);
- } else {
- arg1->cb_function = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_cb_function_set(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("cb_function", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_function", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("cb_function", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_cb_function_set", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->cb_function)
+ delete[]arg1->cb_function;
+ if (arg2) {
+ arg1->cb_function = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->cb_function, (const char *) arg2);
+ } else {
+ arg1->cb_function = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_cb_function_get(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("cb_function",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_cb_function_get",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (char *) ((arg1)->cb_function);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_cb_function_get(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("cb_function", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_function", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_cb_function_get", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (char *) ((arg1)->cb_function);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_cb_arg_set(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("cb_arg",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("cb_arg",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_cb_arg_set",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->cb_arg) delete [] arg1->cb_arg;
- if (arg2) {
- arg1->cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->cb_arg, (const char *)arg2);
- } else {
- arg1->cb_arg = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_cb_arg_set(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("cb_arg", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("cb_arg", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_cb_arg_set", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->cb_arg)
+ delete[]arg1->cb_arg;
+ if (arg2) {
+ arg1->cb_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->cb_arg, (const char *) arg2);
+ } else {
+ arg1->cb_arg = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_cb_arg_get(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("cb_arg",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_cb_arg_get",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (char *) ((arg1)->cb_arg);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_cb_arg_get(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("cb_arg", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("cb_arg", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_cb_arg_get", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (char *) ((arg1)->cb_arg);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_hangup_func_str_set(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("hangup_func_str",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_str",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_hangup_func_str_set",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->hangup_func_str) delete [] arg1->hangup_func_str;
- if (arg2) {
- arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->hangup_func_str, (const char *)arg2);
- } else {
- arg1->hangup_func_str = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_hangup_func_str_set(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("hangup_func_str", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("hangup_func_str", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_hangup_func_str_set", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->hangup_func_str)
+ delete[]arg1->hangup_func_str;
+ if (arg2) {
+ arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->hangup_func_str, (const char *) arg2);
+ } else {
+ arg1->hangup_func_str = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_hangup_func_str_get(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("hangup_func_str",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_hangup_func_str_get",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (char *) ((arg1)->hangup_func_str);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_hangup_func_str_get(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("hangup_func_str", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup_func_str", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_hangup_func_str_get", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (char *) ((arg1)->hangup_func_str);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_hangup_func_arg_set(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *arg2 = (char *) 0 ;
-
- SWIG_check_num_args("hangup_func_arg",2,2)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
- if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_arg",2,"char *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_hangup_func_arg_set",1,SWIGTYPE_p_LUA__Session);
- }
-
- arg2 = (char *)lua_tostring(L, 2);
- {
- if (arg1->hangup_func_arg) delete [] arg1->hangup_func_arg;
- if (arg2) {
- arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2)+1]);
- strcpy((char *)arg1->hangup_func_arg, (const char *)arg2);
- } else {
- arg1->hangup_func_arg = 0;
- }
- }
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_hangup_func_arg_set(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *arg2 = (char *) 0;
+
+ SWIG_check_num_args("hangup_func_arg", 2, 2)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
+ if (!lua_isstring(L, 2))
+ SWIG_fail_arg("hangup_func_arg", 2, "char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_hangup_func_arg_set", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ arg2 = (char *) lua_tostring(L, 2);
+ {
+ if (arg1->hangup_func_arg)
+ delete[]arg1->hangup_func_arg;
+ if (arg2) {
+ arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2) + 1]);
+ strcpy((char *) arg1->hangup_func_arg, (const char *) arg2);
+ } else {
+ arg1->hangup_func_arg = 0;
+ }
+ }
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_hangup_func_arg_get(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- char *result = 0 ;
-
- SWIG_check_num_args("hangup_func_arg",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_hangup_func_arg_get",1,SWIGTYPE_p_LUA__Session);
- }
-
- result = (char *) ((arg1)->hangup_func_arg);
- SWIG_arg=0;
- lua_pushstring(L,(const char*)result); SWIG_arg++;
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_hangup_func_arg_get(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ char *result = 0;
+
+ SWIG_check_num_args("hangup_func_arg", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("hangup_func_arg", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_hangup_func_arg_get", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ result = (char *) ((arg1)->hangup_func_arg);
+ SWIG_arg = 0;
+ lua_pushstring(L, (const char *) result);
+ SWIG_arg++;
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static int _wrap_Session_setLUA(lua_State* L) {
- int SWIG_arg = -1;
- LUA::Session *arg1 = (LUA::Session *) 0 ;
- lua_State *arg2 = (lua_State *) 0 ;
-
- arg2 = L;
- SWIG_check_num_args("setLUA",1,1)
- if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setLUA",1,"LUA::Session *");
-
- if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){
- SWIG_fail_ptr("Session_setLUA",1,SWIGTYPE_p_LUA__Session);
- }
-
- (arg1)->setLUA(arg2);
- SWIG_arg=0;
-
- return SWIG_arg;
-
- if(0) SWIG_fail;
-
-fail:
- lua_error(L);
- return SWIG_arg;
-}
+ static int _wrap_Session_setLUA(lua_State * L) {
+ int SWIG_arg = -1;
+ LUA::Session * arg1 = (LUA::Session *) 0;
+ lua_State *arg2 = (lua_State *) 0;
+
+ arg2 = L;
+ SWIG_check_num_args("setLUA", 1, 1)
+ if (!SWIG_isptrtype(L, 1))
+ SWIG_fail_arg("setLUA", 1, "LUA::Session *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L, 1, (void **) &arg1, SWIGTYPE_p_LUA__Session, 0))) {
+ SWIG_fail_ptr("Session_setLUA", 1, SWIGTYPE_p_LUA__Session);
+ }
+
+ (arg1)->setLUA(arg2);
+ SWIG_arg = 0;
+
+ return SWIG_arg;
+
+ if (0)
+ SWIG_fail;
+
+ fail:
+ lua_error(L);
+ return SWIG_arg;
+ }
-static void swig_delete_Session(void *obj) {
-LUA::Session *arg1 = (LUA::Session *) obj;
-delete arg1;
-}
-static swig_lua_method swig_LUA_Session_methods[] = {
- {"begin_allow_threads", _wrap_Session_begin_allow_threads},
- {"end_allow_threads", _wrap_Session_end_allow_threads},
- {"check_hangup_hook", _wrap_Session_check_hangup_hook},
- {"run_dtmf_callback", _wrap_Session_run_dtmf_callback},
- {"setInputCallback", _wrap_Session_setInputCallback},
- {"setHangupHook", _wrap_Session_setHangupHook},
- {"ready", _wrap_Session_ready},
- {"setLUA", _wrap_Session_setLUA},
- {0,0}
-};
-static swig_lua_attribute swig_LUA_Session_attributes[] = {
- { "cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
- { "cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
- { "hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
- { "hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
- {0,0,0}
-};
-static swig_lua_class *swig_LUA_Session_bases[] = {0,0};
-static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0};
-static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names };
+ static void swig_delete_Session(void *obj) {
+ LUA::Session * arg1 = (LUA::Session *) obj;
+ delete arg1;
+ }
+ static swig_lua_method swig_LUA_Session_methods[] = {
+ {"begin_allow_threads", _wrap_Session_begin_allow_threads},
+ {"end_allow_threads", _wrap_Session_end_allow_threads},
+ {"check_hangup_hook", _wrap_Session_check_hangup_hook},
+ {"run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+ {"setInputCallback", _wrap_Session_setInputCallback},
+ {"setHangupHook", _wrap_Session_setHangupHook},
+ {"ready", _wrap_Session_ready},
+ {"setLUA", _wrap_Session_setLUA},
+ {0, 0}
+ };
+ static swig_lua_attribute swig_LUA_Session_attributes[] = {
+ {"cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set},
+ {"cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set},
+ {"hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set},
+ {"hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set},
+ {0, 0, 0}
+ };
+ static swig_lua_class *swig_LUA_Session_bases[] = { 0, 0 };
+ static const char *swig_LUA_Session_base_names[] = { "CoreSession *", 0 };
+ static swig_lua_class _wrap_class_LUA_Session =
+ { "Session", &SWIGTYPE_p_LUA__Session, _wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes,
+swig_LUA_Session_bases, swig_LUA_Session_base_names };
#ifdef __cplusplus
}
#endif
static const struct luaL_reg swig_commands[] = {
- { "consoleLog", _wrap_consoleLog},
- { "consoleCleanLog", _wrap_consoleCleanLog},
- { "console_log", _wrap_console_log},
- { "console_clean_log", _wrap_console_clean_log},
- { "bridge", _wrap_bridge},
- { "hanguphook", _wrap_hanguphook},
- { "dtmf_callback", _wrap_dtmf_callback},
- {0,0}
+ {"consoleLog", _wrap_consoleLog},
+ {"consoleCleanLog", _wrap_consoleCleanLog},
+ {"console_log", _wrap_console_log},
+ {"console_clean_log", _wrap_console_clean_log},
+ {"bridge", _wrap_bridge},
+ {"hanguphook", _wrap_hanguphook},
+ {"dtmf_callback", _wrap_dtmf_callback},
+ {0, 0}
};
static swig_lua_var_info swig_variables[] = {
- {0,0,0}
+ {0, 0, 0}
};
static swig_lua_const_info swig_constants[] = {
-{ SWIG_LUA_INT, (char *)"S_HUP", (long) S_HUP, 0, 0, 0},
-{ SWIG_LUA_INT, (char *)"S_FREE", (long) S_FREE, 0, 0, 0},
-{ SWIG_LUA_INT, (char *)"S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
- {0,0,0,0,0,0}
+ {SWIG_LUA_INT, (char *) "S_HUP", (long) S_HUP, 0, 0, 0},
+ {SWIG_LUA_INT, (char *) "S_FREE", (long) S_FREE, 0, 0, 0},
+ {SWIG_LUA_INT, (char *) "S_RDLOCK", (long) S_RDLOCK, 0, 0, 0},
+ {0, 0, 0, 0, 0, 0}
};
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) {
- return (void *)((CoreSession *) ((LUA::Session *) x));
+static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory)
+{
+ return (void *) ((CoreSession *) ((LUA::Session *) x));
}
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0};
-static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0};
-static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) &_wrap_class_API, 0 };
+static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) &_wrap_class_CoreSession, 0 };
+static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) &_wrap_class_Event, 0 };
+static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) &_wrap_class_IVRMenu, 0 };
+static swig_type_info _swigt__p_LUA__Session = { "_p_LUA__Session", "LUA::Session *", 0, 0, (void *) &_wrap_class_LUA_Session, 0 };
+static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) &_wrap_class_Stream, 0 };
+static swig_type_info _swigt__p_input_callback_state =
+ { "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) &_wrap_class_input_callback_state_t, 0 };
+static swig_type_info _swigt__p_lua_State = { "_p_lua_State", "lua_State *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
static swig_type_info *swig_type_initial[] = {
- &_swigt__p_API,
- &_swigt__p_CoreSession,
- &_swigt__p_Event,
- &_swigt__p_IVRMenu,
- &_swigt__p_LUA__Session,
- &_swigt__p_Stream,
- &_swigt__p_input_callback_state,
- &_swigt__p_lua_State,
- &_swigt__p_session_flag_t,
- &_swigt__p_switch_channel_state_t,
- &_swigt__p_switch_channel_t,
- &_swigt__p_switch_core_session_t,
- &_swigt__p_switch_event_t,
- &_swigt__p_switch_input_args_t,
- &_swigt__p_switch_input_type_t,
- &_swigt__p_switch_priority_t,
- &_swigt__p_switch_status_t,
- &_swigt__p_switch_stream_handle_t,
- &_swigt__p_void,
+ &_swigt__p_API,
+ &_swigt__p_CoreSession,
+ &_swigt__p_Event,
+ &_swigt__p_IVRMenu,
+ &_swigt__p_LUA__Session,
+ &_swigt__p_Stream,
+ &_swigt__p_input_callback_state,
+ &_swigt__p_lua_State,
+ &_swigt__p_session_flag_t,
+ &_swigt__p_switch_channel_state_t,
+ &_swigt__p_switch_channel_t,
+ &_swigt__p_switch_core_session_t,
+ &_swigt__p_switch_event_t,
+ &_swigt__p_switch_input_args_t,
+ &_swigt__p_switch_input_type_t,
+ &_swigt__p_switch_priority_t,
+ &_swigt__p_switch_status_t,
+ &_swigt__p_switch_stream_handle_t,
+ &_swigt__p_void,
};
-static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_CoreSession[] =
+ { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
static swig_cast_info *swig_cast_initial[] = {
- _swigc__p_API,
- _swigc__p_CoreSession,
- _swigc__p_Event,
- _swigc__p_IVRMenu,
- _swigc__p_LUA__Session,
- _swigc__p_Stream,
- _swigc__p_input_callback_state,
- _swigc__p_lua_State,
- _swigc__p_session_flag_t,
- _swigc__p_switch_channel_state_t,
- _swigc__p_switch_channel_t,
- _swigc__p_switch_core_session_t,
- _swigc__p_switch_event_t,
- _swigc__p_switch_input_args_t,
- _swigc__p_switch_input_type_t,
- _swigc__p_switch_priority_t,
- _swigc__p_switch_status_t,
- _swigc__p_switch_stream_handle_t,
- _swigc__p_void,
+ _swigc__p_API,
+ _swigc__p_CoreSession,
+ _swigc__p_Event,
+ _swigc__p_IVRMenu,
+ _swigc__p_LUA__Session,
+ _swigc__p_Stream,
+ _swigc__p_input_callback_state,
+ _swigc__p_lua_State,
+ _swigc__p_session_flag_t,
+ _swigc__p_switch_channel_state_t,
+ _swigc__p_switch_channel_t,
+ _swigc__p_switch_core_session_t,
+ _swigc__p_switch_event_t,
+ _swigc__p_switch_input_args_t,
+ _swigc__p_switch_input_type_t,
+ _swigc__p_switch_priority_t,
+ _swigc__p_switch_status_t,
+ _swigc__p_switch_stream_handle_t,
+ _swigc__p_void,
};
@@ -6343,161 +6810,163 @@
#ifdef __cplusplus
extern "C" {
#if 0
-} /* c-mode */
+} /* c-mode */
#endif
#endif
-
#if 0
#define SWIGRUNTIME_DEBUG
#endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int found, init;
+
+ clientdata = clientdata;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next == 0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found = 0;
+ iter = module_head;
+ do {
+ if (iter == &swig_module) {
+ found = 1;
+ break;
+ }
+ iter = iter->next;
+ } while (iter != module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found)
+ return;
+ /* otherwise we must add out module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
- size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
-
- clientdata = clientdata;
-
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
-
- /* Try and load any already created modules */
- module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
- swig_module.next = module_head->next;
- module_head->next = &swig_module;
- }
-
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0)
+ return;
- /* Now work on filling in swig_module.types */
+ /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
- for (i = 0; i < swig_module.size; ++i) {
- swig_type_info *type = 0;
- swig_type_info *ret;
- swig_cast_info *cast;
-
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
- /* if there is another module already loaded */
- if (swig_module.next != &swig_module) {
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
- }
- if (type) {
- /* Overwrite clientdata field */
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found type %s\n", type->name);
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
- if (swig_module.type_initial[i]->clientdata) {
- type->clientdata = swig_module.type_initial[i]->clientdata;
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
- }
- } else {
- type = swig_module.type_initial[i];
- }
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
- /* Insert casting types */
- cast = swig_module.cast_initial[i];
- while (cast->type) {
-
- /* Don't need to add information already in the list */
- ret = 0;
+ /* Don't need to add information already in the list */
+ ret = 0;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
- if (swig_module.next != &swig_module) {
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+ if (ret)
+ printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
- }
- if (ret) {
- if (type == swig_module.type_initial[i]) {
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
- cast->type = ret;
- ret = 0;
- } else {
- /* Check for casting already in the list */
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+ if (ocast)
+ printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
- if (!ocast) ret = 0;
- }
- }
+ if (!ocast)
+ ret = 0;
+ }
+ }
- if (!ret) {
+ if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
- if (type->cast) {
- type->cast->prev = cast;
- cast->next = type->cast;
- }
- type->cast = cast;
- }
- cast++;
- }
- /* Set entry in modules->types array equal to the type */
- swig_module.types[i] = type;
- }
- swig_module.types[i] = 0;
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
#ifdef SWIGRUNTIME_DEBUG
- printf("**** SWIG_InitializeModule: Cast List ******\n");
- for (i = 0; i < swig_module.size; ++i) {
- int j = 0;
- swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
- while (cast->type) {
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
- cast++;
- ++j;
- }
- printf("---- Total casts: %d\n",j);
- }
- printf("**** SWIG_InitializeModule: Cast List ******\n");
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n", j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}
@@ -6506,32 +6975,33 @@
* of equivalent types. It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
- size_t i;
- swig_cast_info *equiv;
- static int init_run = 0;
-
- if (init_run) return;
- init_run = 1;
-
- for (i = 0; i < swig_module.size; i++) {
- if (swig_module.types[i]->clientdata) {
- equiv = swig_module.types[i]->cast;
- while (equiv) {
- if (!equiv->converter) {
- if (equiv->type && !equiv->type->clientdata)
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
- }
- equiv = equiv->next;
- }
- }
- }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run)
+ return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
}
#ifdef __cplusplus
#if 0
-{ /* c-mode */
+{ /* c-mode */
#endif
}
#endif
@@ -6539,8 +7009,8 @@
/* Forward declaration of where the user's %init{} gets inserted */
-void SWIG_init_user(lua_State* L );
-
+void SWIG_init_user(lua_State * L);
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -6548,61 +7018,58 @@
added at the very end of the code
the function is always called SWIG_init, but an eariler #define will rename it
*/
-SWIGEXPORT int SWIG_init(lua_State* L)
-{
- int i;
- /* start with global table */
- lua_pushvalue(L,LUA_GLOBALSINDEX);
- /* SWIG's internal initalisation */
- SWIG_InitializeModule((void*)L);
- SWIG_PropagateClientData();
- /* add a global fn */
- SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
- SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
- /* begin the module (its a table with the same name as the module) */
- SWIG_Lua_module_begin(L,SWIG_name);
- /* add commands/functions */
- for (i = 0; swig_commands[i].name; i++){
- SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
- }
- /* add variables */
- for (i = 0; swig_variables[i].name; i++){
- SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
- }
- /* set up base class pointers (the hierachy) */
- for (i = 0; swig_types[i]; i++){
- if (swig_types[i]->clientdata){
- SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
- }
- }
- /* additional registration structs & classes in lua */
- for (i = 0; swig_types[i]; i++){
- if (swig_types[i]->clientdata){
- SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
- }
- }
- /* constants */
- SWIG_Lua_InstallConstants(L,swig_constants);
- /* invoke user-specific initialization */
- SWIG_init_user(L);
- /* end module */
- lua_pop(L,1); /* tidy stack (remove module table)*/
- lua_pop(L,1); /* tidy stack (remove global table)*/
- return 1;
-}
+ SWIGEXPORT int SWIG_init(lua_State * L) {
+ int i;
+ /* start with global table */
+ lua_pushvalue(L, LUA_GLOBALSINDEX);
+ /* SWIG's internal initalisation */
+ SWIG_InitializeModule((void *) L);
+ SWIG_PropagateClientData();
+ /* add a global fn */
+ SWIG_Lua_add_function(L, "swig_type", SWIG_Lua_type);
+ SWIG_Lua_add_function(L, "swig_equals", SWIG_Lua_equal);
+ /* begin the module (its a table with the same name as the module) */
+ SWIG_Lua_module_begin(L, SWIG_name);
+ /* add commands/functions */
+ for (i = 0; swig_commands[i].name; i++) {
+ SWIG_Lua_module_add_function(L, swig_commands[i].name, swig_commands[i].func);
+ }
+ /* add variables */ for (i = 0; swig_variables[i].name; i++) {
+ SWIG_Lua_module_add_variable(L, swig_variables[i].name, swig_variables[i].get, swig_variables[i].set);
+ }
+ /* set up base class pointers (the hierachy) */
+ for (i = 0; swig_types[i]; i++) {
+ if (swig_types[i]->clientdata) {
+ SWIG_Lua_init_base_class(L, (swig_lua_class *) (swig_types[i]->clientdata));
+ }
+ }
+ /* additional registration structs & classes in lua */
+ for (i = 0; swig_types[i]; i++) {
+ if (swig_types[i]->clientdata) {
+ SWIG_Lua_class_register(L, (swig_lua_class *) (swig_types[i]->clientdata));
+ }
+ }
+ /* constants */
+ SWIG_Lua_InstallConstants(L, swig_constants);
+ /* invoke user-specific initialization */
+ SWIG_init_user(L);
+ /* end module */
+ lua_pop(L, 1); /* tidy stack (remove module table) */
+ lua_pop(L, 1); /* tidy stack (remove global table) */
+ return 1;
+ }
#ifdef __cplusplus
}
#endif
-const char* SWIG_LUACODE=
- "";
+const char *SWIG_LUACODE = "";
-void SWIG_init_user(lua_State* L)
+void SWIG_init_user(lua_State * L)
{
- /* exec Lua code if applicable */
- SWIG_Lua_dostring(L,SWIG_LUACODE);
+ /* exec Lua code if applicable */
+ SWIG_Lua_dostring(L, SWIG_LUACODE);
}
#include "mod_lua_extra.c"
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp Tue May 27 07:24:06 2008
@@ -27,8 +27,8 @@
*
* freeswitch_mono.cpp -- Mono-specific CoreSession subclass
*
- */
-
+ */
+
#include <switch.h>
#include <switch_cpp.h>
#include <glib.h>
@@ -38,77 +38,71 @@
#include <mono/metadata/threads.h>
#include <mono/metadata/metadata.h>
#include "freeswitch_mono.h"
+
MonoSession::MonoSession():CoreSession()
+{
+
}
MonoSession::MonoSession(char *uuid):CoreSession(uuid)
+{
+
}
MonoSession::MonoSession(switch_core_session_t *session):CoreSession(session)
+{
+
}
MonoSession::~MonoSession()
+{
+
mono_thread_attach(globals.domain);
+
if (dtmfDelegateHandle)
+ mono_gchandle_free(dtmfDelegateHandle);
+
if (hangupDelegateHandle)
+ mono_gchandle_free(hangupDelegateHandle);
+
}
+
+
bool MonoSession::begin_allow_threads()
+{
+
return true;
+
}
+
+
bool MonoSession::end_allow_threads()
+{
+
return true;
+
}
+
void MonoSession::check_hangup_hook()
+{
+
mono_thread_attach(globals.domain);
+
if (!hangupDelegateHandle) {
+
return;
+
}
+
MonoObject * hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
+
if (!hangupDelegate) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
+
return;
+
}
+
MonoObject * ex = NULL;
+
mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
+
if (ex) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
+
}
+
}
+
switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
+{
+
mono_thread_attach(globals.domain);
+
if (!dtmfDelegateHandle) {
+
return SWITCH_STATUS_SUCCESS;
+
}
+
MonoObject * dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
+
if (!dtmfDelegate) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
+
return SWITCH_STATUS_SUCCESS;
+
}
+
void *args[2];
+
args[0] = &input;
+
args[1] = &itype;
+
MonoObject * ex = NULL;
+
MonoObject * res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
+
if (ex) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
+
return SWITCH_STATUS_FALSE;
+
}
+
char *resPtr = mono_string_to_utf8((MonoString *) res);
+
switch_status_t status = process_callback_result(resPtr);
+
g_free(resPtr);
+
return status;
+
}
+
-MonoSession::MonoSession() : CoreSession()
-{
-}
-
-MonoSession::MonoSession(char *uuid) : CoreSession(uuid)
-{
-}
-
-MonoSession::MonoSession(switch_core_session_t *session) : CoreSession(session)
-{
-}
-
-MonoSession::~MonoSession()
-{
- mono_thread_attach(globals.domain);
- if (dtmfDelegateHandle) mono_gchandle_free(dtmfDelegateHandle);
- if (hangupDelegateHandle) mono_gchandle_free(hangupDelegateHandle);
-}
-
-bool MonoSession::begin_allow_threads()
-{
- return true;
-}
-
-bool MonoSession::end_allow_threads()
-{
- return true;
-}
-
-void MonoSession::check_hangup_hook()
-{
- mono_thread_attach(globals.domain);
- if (!hangupDelegateHandle) {
- return;
- }
- MonoObject *hangupDelegate = mono_gchandle_get_target(hangupDelegateHandle);
- if (!hangupDelegate) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegateHandle didn't get an object.");
- return;
- }
- MonoObject *ex = NULL;
- mono_runtime_delegate_invoke(hangupDelegate, NULL, &ex);
- if (ex) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "hangupDelegate threw an exception.");
- }
-}
-
-switch_status_t MonoSession::run_dtmf_callback(void *input, switch_input_type_t itype)
-{
- mono_thread_attach(globals.domain);
- if (!dtmfDelegateHandle) {
- return SWITCH_STATUS_SUCCESS;
- }
- MonoObject *dtmfDelegate = mono_gchandle_get_target(dtmfDelegateHandle);
- if (!dtmfDelegate) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegateHandle didn't get an object.");
- return SWITCH_STATUS_SUCCESS;
- }
- void *args[2];
- args[0] = &input;
- args[1] = &itype;
- MonoObject *ex = NULL;
- MonoObject *res = mono_runtime_delegate_invoke(dtmfDelegate, args, &ex);
- if (ex) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dtmfDelegate threw an exception.");
- return SWITCH_STATUS_FALSE;
- }
- char *resPtr = mono_string_to_utf8((MonoString*)res);
- switch_status_t status = process_callback_result(resPtr);
-
- g_free(resPtr);
- return status;
-}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp Tue May 27 07:24:06 2008
@@ -30,13 +30,10 @@
* Most of mod_mono is implmented in the mod_mono_managed Loader class.
* The native code just handles getting the Mono runtime up and down
* and passing pointers into managed code.
- */
-
+ */
+
#include <switch.h>
-
-
-SWITCH_BEGIN_EXTERN_C
-
+
SWITCH_BEGIN_EXTERN_C
#include "freeswitch_mono.h"
#include <glib.h>
#include <mono/jit/jit.h>
@@ -44,284 +41,278 @@
#include <mono/metadata/environment.h>
#include <mono/metadata/threads.h>
#include <mono/metadata/debug-helpers.h>
-
+
#ifdef WIN32
#include <shlobj.h>
#define EXPORT __declspec(dllexport)
#elif
#define EXPORT
-#endif
-
+#endif /*
*/
+
#define MOD_MONO_MANAGED_DLL "mod_mono_managed.dll"
-
-mod_mono_globals globals = { 0 };
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
-SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
-
-SWITCH_STANDARD_API(monorun_api_function); /* ExecuteBackground */
-SWITCH_STANDARD_API(mono_api_function); /* Execute */
-SWITCH_STANDARD_APP(mono_app_function); /* Run */
-
-
+
mod_mono_globals globals = {
+0};
+
+
SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load);
+
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown);
+
SWITCH_MODULE_DEFINITION(mod_mono, mod_mono_load, mod_mono_shutdown, NULL);
+
SWITCH_STANDARD_API(monorun_api_function); /* ExecuteBackground */
+
SWITCH_STANDARD_API(mono_api_function); /* Execute */
+
SWITCH_STANDARD_APP(mono_app_function); /* Run */
+
// Sets up delegates (and anything else needed) on the MonoSession object
// Called via internalcall
-SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession *session, MonoObject *dtmfDelegate, MonoObject *hangupDelegate)
-{
- switch_assert(session);
- if (!session) return;
- session->setDTMFCallback(NULL, "");
- session->setHangupHook(NULL);
- session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
- session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
-}
-
-switch_status_t setMonoDirs()
-{
+ SWITCH_MOD_DECLARE(void) InitMonoSession(MonoSession * session, MonoObject * dtmfDelegate, MonoObject * hangupDelegate)
+{
+
switch_assert(session);
+
if (!session)
+ return;
+
session->setDTMFCallback(NULL, "");
+
session->setHangupHook(NULL);
+
session->dtmfDelegateHandle = mono_gchandle_new(dtmfDelegate, FALSE);
+
session->hangupDelegateHandle = mono_gchandle_new(hangupDelegate, FALSE);
+
}
+
switch_status_t setMonoDirs()
+{
+
#ifdef WIN32
- /* Win32 Mono installs can't figure out their own path
- // Guys in #mono say we should just deploy all the libs we need
- // I think it's much nicer to let the user deal with installing Mono
- // and we'll just look for it in program files. */
- HANDLE hFind;
- WIN32_FIND_DATA findData;
- char progFilesPath[MAX_PATH];
- char findPath[MAX_PATH];
- SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
- switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
- hFind = FindFirstFile(findPath, &findData);
- if (hFind == INVALID_HANDLE_VALUE) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
- return SWITCH_STATUS_FALSE;
- }
- while((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
- if (FindNextFile(hFind, &findData) == 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
- FindClose(hFind);
- return SWITCH_STATUS_FALSE;
- }
- }
- /* Got it */
- {
- char libPath[MAX_PATH];
- char etcPath[MAX_PATH];
- switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
- switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
- FindClose(hFind);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
- mono_set_dirs(libPath, etcPath);
- return SWITCH_STATUS_SUCCESS;
- }
+ /* Win32 Mono installs can't figure out their own path
+ // Guys in #mono say we should just deploy all the libs we need
+ // I think it's much nicer to let the user deal with installing Mono
+ // and we'll just look for it in program files. */
+ HANDLE hFind;
+
WIN32_FIND_DATA findData;
+
char progFilesPath[MAX_PATH];
+
char findPath[MAX_PATH];
+
SHGetFolderPath(NULL, CSIDL_PROGRAM_FILES, NULL, SHGFP_TYPE_CURRENT, progFilesPath);
+
switch_snprintf(findPath, MAX_PATH, "%s\\Mono-*", progFilesPath);
+
hFind = FindFirstFile(findPath, &findData);
+
if (hFind == INVALID_HANDLE_VALUE) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error looking for Mono in Program Files.\n");
+
return SWITCH_STATUS_FALSE;
+
}
+
while ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) {
+
if (FindNextFile(hFind, &findData) == 0) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find Mono directory in Program Files.\n");
+
FindClose(hFind);
+
return SWITCH_STATUS_FALSE;
+
}
+
}
+
+ /* Got it */
+ {
+
char libPath[MAX_PATH];
+
char etcPath[MAX_PATH];
+
switch_snprintf(libPath, MAX_PATH, "%s\\%s\\lib", progFilesPath, findData.cFileName);
+
switch_snprintf(etcPath, MAX_PATH, "%s\\%s\\etc", progFilesPath, findData.cFileName);
+
FindClose(hFind);
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Using Mono paths '%s' and '%s'.\n", libPath, etcPath);
+
mono_set_dirs(libPath, etcPath);
+
return SWITCH_STATUS_SUCCESS;
+
}
+
#elif
- // On other platforms, it should just work if it hasn't been relocated
- mono_set_dirs(NULL, NULL);
- return SWITCH_STATUS_SUCCESS;
-#endif
-}
-
-switch_status_t loadModMonoManaged()
-{
- /* Find and load mod_mono_managed.exe */
- char filename[256];
- switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
- globals.domain = mono_jit_init(filename);
-
- if (!globals.domain) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
- return SWITCH_STATUS_FALSE;
- }
-
- /* Open the assembly */
- globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
- if (!globals.mod_mono_asm) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
- return SWITCH_STATUS_FALSE;
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-MonoMethod *getMethod(const char *name, MonoClass *klass)
-{
- MonoMethodDesc *desc;
- MonoMethod *method;
- desc = mono_method_desc_new(name, TRUE);
- method = mono_method_desc_search_in_class(desc, klass);
- if (!method) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
- return NULL;
- }
- return method;
-}
-
-switch_status_t findLoader()
-{
- /* Find loader class and methods*/
- MonoImage* img;
- MonoClass* loaderClass;
- img = mono_assembly_get_image(globals.mod_mono_asm);
- loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
- if (!loaderClass) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
- return SWITCH_STATUS_FALSE;
- }
-
- globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
- if (!globals.loadMethod) return SWITCH_STATUS_FALSE;
-
- globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
- if (!globals.unloadMethod) return SWITCH_STATUS_FALSE;
-
- globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
- if (!globals.runMethod) return SWITCH_STATUS_FALSE;
-
- globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
- if (!globals.executeMethod) return SWITCH_STATUS_FALSE;
-
- globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
- if (!globals.executeBackgroundMethod) return SWITCH_STATUS_FALSE;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load)
-{
- /* connect my internal structure to the blank pointer passed to me */
- *module_interface = switch_loadable_module_create_module_interface(pool, modname);
- globals.pool = pool;
-
- if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
- if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
- if (findLoader() != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_FALSE;
- }
-
- /* Not sure if this is necesary on the loading thread */
- mono_thread_attach(globals.domain);
- mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
-
- /* Run loader */
- MonoObject *objResult;
- MonoObject *exception = NULL;
- objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
- if (exception) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
- mono_print_unhandled_exception(exception);
- return SWITCH_STATUS_FALSE;
- }
- if (*(int*)mono_object_unbox(objResult)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
- return SWITCH_STATUS_FALSE;
- }
-
-
- /* We're good to register */
- switch_api_interface_t *api_interface;
- switch_application_interface_t *app_interface;
-
- SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
- SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
- SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
-
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_STANDARD_API(monorun_api_function)
-{
- // TODO: Should we be detaching after all this?
- mono_thread_attach(globals.domain);
- if (switch_strlen_zero(cmd)) {
- stream->write_function(stream, "-ERR no args specified!\n");
- return SWITCH_STATUS_SUCCESS;
- }
-
- // ExecuteBackground(string command)
- void *args[1];
- args[0] = mono_string_new(globals.domain, cmd);
- MonoObject *exception = NULL;
- MonoObject *objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
- if (exception) {
- stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
- mono_print_unhandled_exception(exception);
- return SWITCH_STATUS_SUCCESS;
- }
- if (*(int*)mono_object_unbox(objResult)) {
- stream->write_function(stream, "+OK\n");
- } else {
- stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_STANDARD_API(mono_api_function)
-{
- mono_thread_attach(globals.domain);
- if (switch_strlen_zero(cmd)) {
- stream->write_function(stream, "-ERR no args specified!\n");
- return SWITCH_STATUS_SUCCESS;
- }
-
- // Method is: Execute(string command, IntPtr streamPtr, IntPtr eventPtr)
- void *args[3];
- args[0] = mono_string_new(globals.domain, cmd);
- args[1] = &stream; // Address of the arguments
- args[2] = &(stream->param_event);
-
- MonoObject *exception = NULL;
- MonoObject *objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
- if (exception) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
- mono_print_unhandled_exception(exception);
- }
- if (!(*(int*)mono_object_unbox(objResult))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
- }
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_STANDARD_APP(mono_app_function)
-{
- mono_thread_attach(globals.domain);
- if (switch_strlen_zero(data)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
- }
-
- // bool Run(string command, IntPtr sessionHandle)
- void *args[2];
- args[0] = mono_string_new(globals.domain, data);
- args[1] = &session;
-
- MonoObject *exception = NULL;
- MonoObject *objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
- if (exception) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
- mono_print_unhandled_exception(exception);
- }
- if (!(*(int*)mono_object_unbox(objResult))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
- }
-}
-
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown)
-{
- mono_thread_attach(globals.domain);
- MonoObject *ex;
- mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
- if (ex) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
- mono_print_unhandled_exception(ex);
- }
- mono_runtime_set_shutting_down();
- mono_runtime_cleanup(globals.domain);
- mono_runtime_quit();
- return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_END_EXTERN_C
\ No newline at end of file
+ // On other platforms, it should just work if it hasn't been relocated
+ mono_set_dirs(NULL, NULL);
+
return SWITCH_STATUS_SUCCESS;
+
+#endif /*
*/
+}
+
switch_status_t loadModMonoManaged()
+{
+
+ /* Find and load mod_mono_managed.exe */
+ char filename[256];
+
switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MONO_MANAGED_DLL);
+
globals.domain = mono_jit_init(filename);
+
if (!globals.domain) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_jit_init failed.\n");
+
return SWITCH_STATUS_FALSE;
+
}
+
+ /* Open the assembly */
+ globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename);
+
if (!globals.mod_mono_asm) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "mono_domain_assembly_open failed.\n");
+
return SWITCH_STATUS_FALSE;
+
}
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
MonoMethod * getMethod(const char *name, MonoClass * klass)
+{
+
MonoMethodDesc * desc;
+
MonoMethod * method;
+
desc = mono_method_desc_new(name, TRUE);
+
method = mono_method_desc_search_in_class(desc, klass);
+
if (!method) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find %s method.\n", name);
+
return NULL;
+
}
+
return method;
+
}
+
switch_status_t findLoader()
+{
+
+ /* Find loader class and methods */
+ MonoImage * img;
+
MonoClass * loaderClass;
+
img = mono_assembly_get_image(globals.mod_mono_asm);
+
loaderClass = mono_class_from_name(img, "FreeSWITCH", "Loader");
+
if (!loaderClass) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not find FreeSWITCH.Loader class.\n");
+
return SWITCH_STATUS_FALSE;
+
}
+
globals.loadMethod = getMethod("FreeSWITCH.Loader:Load()", loaderClass);
+
if (!globals.loadMethod)
+ return SWITCH_STATUS_FALSE;
+
globals.unloadMethod = getMethod("FreeSWITCH.Loader:Unload()", loaderClass);
+
if (!globals.unloadMethod)
+ return SWITCH_STATUS_FALSE;
+
globals.runMethod = getMethod("FreeSWITCH.Loader:Run(string,intptr)", loaderClass);
+
if (!globals.runMethod)
+ return SWITCH_STATUS_FALSE;
+
globals.executeMethod = getMethod("FreeSWITCH.Loader:Execute(string,intptr,intptr)", loaderClass);
+
if (!globals.executeMethod)
+ return SWITCH_STATUS_FALSE;
+
globals.executeBackgroundMethod = getMethod("FreeSWITCH.Loader:ExecuteBackground(string)", loaderClass);
+
if (!globals.executeBackgroundMethod)
+ return SWITCH_STATUS_FALSE;
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found all loader functions.\n");
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
SWITCH_MODULE_LOAD_FUNCTION(mod_mono_load)
+{
+
+ /* connect my internal structure to the blank pointer passed to me */
+ *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+
globals.pool = pool;
+
if (setMonoDirs() != SWITCH_STATUS_SUCCESS) {
+
return SWITCH_STATUS_FALSE;
+
}
+
if (loadModMonoManaged() != SWITCH_STATUS_SUCCESS) {
+
return SWITCH_STATUS_FALSE;
+
}
+
if (findLoader() != SWITCH_STATUS_SUCCESS) {
+
return SWITCH_STATUS_FALSE;
+
}
+
+ /* Not sure if this is necesary on the loading thread */
+ mono_thread_attach(globals.domain);
+
mono_add_internal_call("FreeSWITCH.Native.MonoSession::InitMonoSession", InitMonoSession);
+
+ /* Run loader */
+ MonoObject * objResult;
+
MonoObject * exception = NULL;
+
objResult = mono_runtime_invoke(globals.loadMethod, NULL, NULL, &exception);
+
if (exception) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load threw an exception.\n");
+
mono_print_unhandled_exception(exception);
+
return SWITCH_STATUS_FALSE;
+
}
+
if (*(int *) mono_object_unbox(objResult)) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Load completed successfully.\n");
+
} else {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Load did not return true.\n");
+
return SWITCH_STATUS_FALSE;
+
}
+
+ /* We're good to register */
+ switch_api_interface_t *api_interface;
+
switch_application_interface_t *app_interface;
+
SWITCH_ADD_API(api_interface, "monorun", "Run a module (ExecuteBackground)", monorun_api_function, "<module> [<args>]");
+
SWITCH_ADD_API(api_interface, "mono", "Run a module as an API function (Execute)", mono_api_function, "<module> [<args>]");
+
SWITCH_ADD_APP(app_interface, "mono", "Run Mono IVR", "Run a Mono IVR on a channel", mono_app_function, "<modulename> [<args>]", SAF_NONE);
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
SWITCH_STANDARD_API(monorun_api_function)
+{
+
+ // TODO: Should we be detaching after all this?
+ mono_thread_attach(globals.domain);
+
if (switch_strlen_zero(cmd)) {
+
stream->write_function(stream, "-ERR no args specified!\n");
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+ // ExecuteBackground(string command)
+ void *args[1];
+
args[0] = mono_string_new(globals.domain, cmd);
+
MonoObject * exception = NULL;
+
MonoObject * objResult = mono_runtime_invoke(globals.executeBackgroundMethod, NULL, args, &exception);
+
if (exception) {
+
stream->write_function(stream, "-ERR FreeSWITCH.Loader.ExecuteBackground threw an exception.\n");
+
mono_print_unhandled_exception(exception);
+
return SWITCH_STATUS_SUCCESS;
+
}
+
if (*(int *) mono_object_unbox(objResult)) {
+
stream->write_function(stream, "+OK\n");
+
} else {
+
stream->write_function(stream, "-ERR ExecuteBackground returned false (unknown module?).\n");
+
}
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
SWITCH_STANDARD_API(mono_api_function)
+{
+
mono_thread_attach(globals.domain);
+
if (switch_strlen_zero(cmd)) {
+
stream->write_function(stream, "-ERR no args specified!\n");
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+ // Method is: Execute(string command, IntPtr streamPtr, IntPtr eventPtr)
+ void *args[3];
+
args[0] = mono_string_new(globals.domain, cmd);
+
args[1] = &stream; // Address of the arguments
+ args[2] = &(stream->param_event);
+
MonoObject * exception = NULL;
+
MonoObject * objResult = mono_runtime_invoke(globals.executeMethod, NULL, args, &exception);
+
if (exception) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute mono %s.\n", cmd);
+
mono_print_unhandled_exception(exception);
+
}
+
if (!(*(int *) mono_object_unbox(objResult))) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Execute failed for %s (unknown module?).\n", cmd);
+
}
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
SWITCH_STANDARD_APP(mono_app_function)
+{
+
mono_thread_attach(globals.domain);
+
if (switch_strlen_zero(data)) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");
+
}
+
+ // bool Run(string command, IntPtr sessionHandle)
+ void *args[2];
+
args[0] = mono_string_new(globals.domain, data);
+
args[1] = &session;
+
MonoObject * exception = NULL;
+
MonoObject * objResult = mono_runtime_invoke(globals.runMethod, NULL, args, &exception);
+
if (exception) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception trying to execute application mono %s.\n", data);
+
mono_print_unhandled_exception(exception);
+
}
+
if (!(*(int *) mono_object_unbox(objResult))) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Application run failed for %s (unknown module?).\n", data);
+
}
+
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_mono_shutdown)
+{
+
mono_thread_attach(globals.domain);
+
MonoObject * ex;
+
mono_runtime_invoke(globals.unloadMethod, NULL, NULL, &ex);
+
if (ex) {
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Exception occurred in Loader::Unload.\n");
+
mono_print_unhandled_exception(ex);
+
}
+
mono_runtime_set_shutting_down();
+
mono_runtime_cleanup(globals.domain);
+
mono_runtime_quit();
+
return SWITCH_STATUS_SUCCESS;
+
}
+
+
SWITCH_END_EXTERN_C
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch_perl.cpp Tue May 27 07:24:06 2008
@@ -8,17 +8,17 @@
using namespace PERL;
-Session::Session() : CoreSession()
+Session::Session():CoreSession()
{
init_me();
}
-Session::Session(char *uuid) : CoreSession(uuid)
+Session::Session(char *uuid):CoreSession(uuid)
{
init_me();
}
-Session::Session(switch_core_session_t *new_session) : CoreSession(new_session)
+Session::Session(switch_core_session_t *new_session):CoreSession(new_session)
{
init_me();
}
@@ -37,19 +37,19 @@
}
-bool Session::begin_allow_threads()
+bool Session::begin_allow_threads()
{
do_hangup_hook();
return true;
}
-bool Session::end_allow_threads()
+bool Session::end_allow_threads()
{
do_hangup_hook();
return true;
}
-void Session::setPERL(PerlInterpreter *pi)
+void Session::setPERL(PerlInterpreter * pi)
{
my_perl = pi;
}
@@ -57,30 +57,31 @@
PerlInterpreter *Session::getPERL()
{
if (!my_perl) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Doh!\n");
}
return my_perl;
}
-bool Session::ready() {
+bool Session::ready()
+{
bool r;
- sanity_check(false);
+ sanity_check(false);
r = switch_channel_ready(channel) != 0;
do_hangup_hook();
return r;
}
-void Session::check_hangup_hook()
+void Session::check_hangup_hook()
{
if (hangup_func_str && (hook_state == CS_HANGUP || hook_state == CS_ROUTING)) {
hh++;
}
}
-void Session::do_hangup_hook()
+void Session::do_hangup_hook()
{
if (hh && !mark) {
const char *err = NULL;
@@ -101,7 +102,7 @@
}
}
-static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
+static switch_status_t perl_hanguphook(switch_core_session_t *session_hungup)
{
switch_channel_t *channel = switch_core_session_get_channel(session_hungup);
CoreSession *coresession = NULL;
@@ -118,7 +119,8 @@
}
-void Session::setHangupHook(char *func, char *arg) {
+void Session::setHangupHook(char *func, char *arg)
+{
sanity_check_noreturn;
@@ -135,7 +137,8 @@
}
}
-void Session::setInputCallback(char *cbfunc, char *funcargs) {
+void Session::setInputCallback(char *cbfunc, char *funcargs)
+{
sanity_check_noreturn;
@@ -148,22 +151,22 @@
if (funcargs) {
cb_arg = strdup(funcargs);
}
-
+
args.buf = this;
switch_channel_set_private(channel, "CoreSession", this);
- args.input_callback = dtmf_callback;
+ args.input_callback = dtmf_callback;
ap = &args;
}
-switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
+switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t itype)
{
if (!getPERL()) {
return SWITCH_STATUS_FALSE;;
}
switch (itype) {
- case SWITCH_INPUT_TYPE_DTMF:
+ case SWITCH_INPUT_TYPE_DTMF:
{
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
char str[32] = "";
@@ -177,14 +180,14 @@
}
str[0] = dtmf->digit;
- this_sv = newSV(strlen(str)+1);
+ this_sv = newSV(strlen(str) + 1);
sv_setpv(this_sv, str);
hv_store(hash, "digit", 5, this_sv, 0);
switch_snprintf(str, sizeof(str), "%d", dtmf->duration);
- this_sv = newSV(strlen(str)+1);
+ this_sv = newSV(strlen(str) + 1);
sv_setpv(this_sv, str);
- hv_store(hash, "duration", 8, this_sv, 0);
+ hv_store(hash, "duration", 8, this_sv, 0);
code = switch_mprintf("$__RV = %s('dtmf', \\%%__dtmf, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, FALSE);
@@ -193,18 +196,18 @@
return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
- case SWITCH_INPUT_TYPE_EVENT:
+ case SWITCH_INPUT_TYPE_EVENT:
{
switch_event_t *event = (switch_event_t *) input;
int arg_count = 2;
char *code;
mod_perl_conjure_event(my_perl, event, "__Input_Event__");
-
+
code = switch_mprintf("$__RV = %s('event', $__Input_Event__, %s);", cb_function, switch_str_nil(cb_arg));
Perl_eval_pv(my_perl, code, TRUE);
free(code);
-
+
return process_callback_result(SvPV(get_sv("__RV", TRUE), n_a));
}
break;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c Tue May 27 07:24:06 2008
@@ -58,7 +58,7 @@
-static int Perl_safe_eval(PerlInterpreter *my_perl, const char *string)
+static int Perl_safe_eval(PerlInterpreter * my_perl, const char *string)
{
char *err = NULL;
@@ -73,7 +73,7 @@
-static int perl_parse_and_execute(PerlInterpreter *my_perl, char *input_code, char *setup_code)
+static int perl_parse_and_execute(PerlInterpreter * my_perl, char *input_code, char *setup_code)
{
int error = 0;
@@ -103,10 +103,10 @@
if ((argc = switch_separate_string(args, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_stream_handle_t stream = { 0 };
SWITCH_STANDARD_STREAM(stream);
-
+
stream.write_function(&stream, " @ARGV = ( ");
for (x = 0; x < argc; x++) {
- stream.write_function(&stream, "'%s'%s", argv[x], x == argc-1 ? "" : ", ");
+ stream.write_function(&stream, "'%s'%s", argv[x], x == argc - 1 ? "" : ", ");
}
stream.write_function(&stream, " );");
code = stream.data;
@@ -130,7 +130,7 @@
file = switch_mprintf("require '%s';", file);
switch_assert(file);
}
-
+
error = Perl_safe_eval(my_perl, file);
switch_safe_free(file);
}
@@ -154,14 +154,15 @@
}
#if 0
-static perl_parse_and_execute (PerlInterpreter *my_perl, char *input_code, char *setup_code)
+static perl_parse_and_execute(PerlInterpreter * my_perl, char *input_code, char *setup_code)
{
int error = 0;
if (*input_code == '~') {
char *buff = input_code + 1;
perl_parse(my_perl, xs_init, 3, embedding, NULL);
- if (setup_code) Perl_safe_eval(my_perl, setup_code);
+ if (setup_code)
+ Perl_safe_eval(my_perl, setup_code);
Perl_safe_eval(my_perl, buff);
} else {
int argc = 0;
@@ -169,43 +170,38 @@
char *err;
argv[0] = "FreeSWITCH";
argc++;
-
+
argc += switch_separate_string(input_code, ' ', &argv[1], (sizeof(argv) / sizeof(argv[0])) - 1);
- if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) {
+ if (!perl_parse(my_perl, xs_init, argc, argv, (char **) NULL)) {
if (setup_code) {
if (!Perl_safe_eval(my_perl, setup_code)) {
perl_run(my_perl);
}
}
}
-
+
if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
-
+
}
}
-#endif
+#endif
static void perl_function(switch_core_session_t *session, char *data)
{
char *uuid = switch_core_session_get_uuid(session);
PerlInterpreter *my_perl = clone_perl();
char code[1024];
-
+
perl_parse(my_perl, xs_init, 3, embedding, NULL);
Perl_safe_eval(my_perl, code);
- switch_snprintf(code, sizeof(code),
- "use lib '%s/perl';\n"
- "use freeswitch;\n"
- "$SWITCH_ENV{UUID} = \"%s\";\n"
- "$session = new freeswitch::Session(\"%s\")"
- ,
- SWITCH_GLOBAL_dirs.base_dir,
- uuid,
- uuid);
+ switch_snprintf(code, sizeof(code),
+ "use lib '%s/perl';\n"
+ "use freeswitch;\n"
+ "$SWITCH_ENV{UUID} = \"%s\";\n" "$session = new freeswitch::Session(\"%s\")", SWITCH_GLOBAL_dirs.base_dir, uuid, uuid);
perl_parse_and_execute(my_perl, data, code);
Perl_safe_eval(my_perl, "undef $session;");
@@ -244,16 +240,10 @@
if (session) {
uuid = switch_core_session_get_uuid(session);
}
-
- switch_snprintf(code, sizeof(code),
- "use lib '%s/perl';\n"
- "use freeswitch;\n"
- "$SWITCH_ENV{UUID} = \"%s\";\n"
- ,
-
- SWITCH_GLOBAL_dirs.base_dir,
- switch_str_nil(uuid)
- );
+
+ switch_snprintf(code, sizeof(code),
+ "use lib '%s/perl';\n" "use freeswitch;\n" "$SWITCH_ENV{UUID} = \"%s\";\n", SWITCH_GLOBAL_dirs.base_dir, switch_str_nil(uuid)
+ );
perl_parse(my_perl, xs_init, 3, embedding, NULL);
Perl_safe_eval(my_perl, code);
@@ -273,7 +263,7 @@
//Perl_safe_eval(my_perl, cmd);
perl_parse_and_execute(my_perl, cmd, NULL);
}
-
+
if (uuid) {
switch_snprintf(code, sizeof(code), "undef $session;", uuid);
Perl_safe_eval(my_perl, code);
@@ -301,7 +291,7 @@
memset(po, 0, sizeof(*po));
po->cmd = strdup(text);
po->d = 1;
-
+
switch_threadattr_create(&thd_attr, globals.pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -310,7 +300,8 @@
return 0;
}
-SWITCH_STANDARD_API(perlrun_api_function) {
+SWITCH_STANDARD_API(perlrun_api_function)
+{
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "-ERR Missing args.\n");
@@ -322,7 +313,8 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_STANDARD_API(perl_api_function) {
+SWITCH_STANDARD_API(perl_api_function)
+{
struct perl_o po = { 0 };
@@ -337,12 +329,8 @@
perl_thread_run(NULL, &po);
}
-static switch_xml_t perl_fetch(const char *section,
- const char *tag_name,
- const char *key_name,
- const char *key_value,
- switch_event_t *params,
- void *user_data)
+static switch_xml_t perl_fetch(const char *section,
+ const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
{
char *argv[128] = { 0 };
@@ -359,10 +347,10 @@
argv[argc++] = "FreeSWITCH";
argv[argc++] = globals.xml_handler;
-
+
PERL_SET_CONTEXT(my_perl);
-
- if (perl_parse(my_perl, xs_init, argc, argv, (char **)NULL)) {
+
+ if (perl_parse(my_perl, xs_init, argc, argv, (char **) NULL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
return NULL;
}
@@ -375,15 +363,15 @@
section = "";
}
- this = newSV(strlen(section)+1);
+ this = newSV(strlen(section) + 1);
sv_setpv(this, section);
hv_store(hash, "section", 7, this, 0);
-
+
if (switch_strlen_zero(tag_name)) {
tag_name = "";
}
- this = newSV(strlen(tag_name)+1);
+ this = newSV(strlen(tag_name) + 1);
sv_setpv(this, tag_name);
hv_store(hash, "tag_name", 8, this, 0);
@@ -391,7 +379,7 @@
key_name = "";
}
- this = newSV(strlen(key_name)+1);
+ this = newSV(strlen(key_name) + 1);
sv_setpv(this, key_name);
hv_store(hash, "key_name", 8, this, 0);
@@ -399,28 +387,23 @@
key_value = "";
}
- this = newSV(strlen(key_value)+1);
+ this = newSV(strlen(key_value) + 1);
sv_setpv(this, key_value);
hv_store(hash, "key_value", 9, this, 0);
-
+
if (!(hash = get_hv("XML_DATA", TRUE))) {
abort();
}
if (params) {
for (hp = params->headers; hp; hp = hp->next) {
- this = newSV(strlen(hp->value)+1);
+ this = newSV(strlen(hp->value) + 1);
sv_setpv(this, hp->value);
hv_store(hash, hp->name, strlen(hp->name), this, 0);
}
}
- switch_snprintf(code, sizeof(code),
- "use lib '%s/perl';\n"
- "use freeswitch;\n"
- ,
- SWITCH_GLOBAL_dirs.base_dir
- );
+ switch_snprintf(code, sizeof(code), "use lib '%s/perl';\n" "use freeswitch;\n", SWITCH_GLOBAL_dirs.base_dir);
Perl_safe_eval(my_perl, code);
if (params) {
@@ -437,7 +420,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
}
}
-
+
destroy_perl(&my_perl);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_extra.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_extra.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_extra.c Tue May 27 07:24:06 2008
@@ -1,24 +1,21 @@
-SWITCH_BEGIN_EXTERN_C
-
-
-void mod_perl_conjure_event(PerlInterpreter *my_perl, switch_event_t *event, const char *name)
+SWITCH_BEGIN_EXTERN_C void mod_perl_conjure_event(PerlInterpreter * my_perl, switch_event_t *event, const char *name)
{
- Event *result = 0 ;
+ Event *result = 0;
SV *sv;
PERL_SET_CONTEXT(my_perl);
- sv = sv_2mortal(get_sv(name, TRUE));
- result = (Event *)new Event(event);
+ sv = sv_2mortal(get_sv(name, TRUE));
+ result = (Event *) new Event(event);
SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
}
-void mod_perl_conjure_stream(PerlInterpreter *my_perl, switch_stream_handle_t *stream, const char *name)
+void mod_perl_conjure_stream(PerlInterpreter * my_perl, switch_stream_handle_t *stream, const char *name)
{
- Stream *result = 0 ;
+ Stream *result = 0;
SV *sv;
PERL_SET_CONTEXT(my_perl);
- sv = sv_2mortal(get_sv(name, TRUE));
- result = (Stream *)new Stream(stream);
+ sv = sv_2mortal(get_sv(name, TRUE));
+ result = (Stream *) new Stream(stream);
SWIG_Perl_MakePtr(sv, result, SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp Tue May 27 07:24:06 2008
@@ -12,22 +12,35 @@
#define SWIG_CASTRANK_MODE
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
- T *tt;
-public:
- SwigValueWrapper() : tt(0) { }
- SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
- SwigValueWrapper(const T& t) : tt(new T(t)) { }
- ~SwigValueWrapper() { delete tt; }
- SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
- operator T&() const { return *tt; }
- T *operator&() { return tt; }
-private:
- SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+ T *tt;
+ public:
+ SwigValueWrapper():tt(0) {
+ }
+ SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+ }
+ SwigValueWrapper(const T & t):tt(new T(t)) {
+ }
+ ~SwigValueWrapper() {
+ delete tt;
+ }
+ SwigValueWrapper & operator=(const T & t) {
+ delete tt;
+ tt = new T(t);
+ return *this;
+ }
+ operator T & () const {
+ return *tt;
+ } T *operator&() {
+ return tt;
+ }
+ private:
+ SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
};
-template <typename T> T SwigValueInit() {
- return T();
+template < typename T > T SwigValueInit()
+{
+ return T();
}
#endif
@@ -62,14 +75,14 @@
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
-# define SWIGUNUSED
+# define SWIGUNUSED
# endif
#endif
@@ -77,7 +90,7 @@
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
@@ -120,7 +133,7 @@
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
-# endif
+# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -264,10 +277,10 @@
*/
-#define SWIG_OK (0)
+#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
@@ -294,16 +307,18 @@
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
-# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) {
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
-SWIGINTERNINLINE int SWIG_CheckState(int r) {
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
@@ -319,38 +334,38 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+ typedef void *(*swig_converter_func) (void *, int *);
+ typedef struct swig_type_info *(*swig_dycast_func) (void **);
/* Structure to store information on one type */
-typedef struct swig_type_info {
- const char *name; /* mangled name of this type */
- const char *str; /* human readable name of this type */
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
- void *clientdata; /* language specific type data */
- int owndata; /* flag if the structure owns the clientdata */
-} swig_type_info;
+ typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+ } swig_type_info;
/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
- swig_type_info *type; /* pointer to type that is equivalent to this type */
- swig_converter_func converter; /* function to cast the void pointers */
- struct swig_cast_info *next; /* pointer to next cast in linked list */
- struct swig_cast_info *prev; /* pointer to the previous cast */
-} swig_cast_info;
+ typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+ } swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
- size_t size; /* Number of types in this module */
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
- swig_type_info **type_initial; /* Array of initially generated type structures */
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
- void *clientdata; /* Language specific module data */
-} swig_module_info;
+ typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+ } swig_module_info;
/*
Compare two type names skipping the space characters, therefore
@@ -359,54 +374,56 @@
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
- const char *f2, const char *l2) {
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
- }
- return (int)((l1 - f1) - (l2 - f2));
-}
+ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+ for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1))
+ ++f1;
+ while ((*f2 == ' ') && (f2 != l2))
+ ++f2;
+ if (*f1 != *f2)
+ return (*f1 > *f2) ? 1 : -1;
+ } return (int) ((l1 - f1) - (l2 - f2));
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/* think of this as a c++ template<> or a scheme macro */
@@ -434,94 +451,89 @@
/*
Check the typename
*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+ }
/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
- SWIG_TypeCheck_Template(iter->type == from, into);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+ SWIG_TypeCheck_Template(iter->type == from, into);
+ }
/*
Cast a pointer up an inheritance hierarchy
*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+ SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+ }
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast) return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast)(ptr);
- if (ty) lastty = ty;
- }
- return lastty;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast)
+ return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast) (ptr);
+ if (ty)
+ lastty = ty;
+ }
+ return lastty;
+ }
/*
Return the name associated with this type
*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
- return ty->name;
-}
+ SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+ return ty->name;
+ }
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
- /* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
- if (!type) return NULL;
- if (type->str != NULL) {
- const char *last_name = type->str;
- const char *s;
- for (s = type->str; *s; s++)
- if (*s == '|') last_name = s+1;
- return last_name;
- }
- else
- return type->name;
-}
+ SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type)
+ return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|')
+ last_name = s + 1;
+ return last_name;
+ } else
+ return type->name;
+ }
/*
Set the clientdata field for a type
*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_cast_info *cast = ti->cast;
- /* if (ti->clientdata == clientdata) return; */
- ti->clientdata = clientdata;
-
- while (cast) {
- if (!cast->converter) {
- swig_type_info *tc = cast->type;
- if (!tc->clientdata) {
- SWIG_TypeClientData(tc, clientdata);
- }
- }
- cast = cast->next;
- }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
- SWIG_TypeClientData(ti, clientdata);
- ti->owndata = 1;
-}
-
+ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+ }
+ SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+ }
+
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
@@ -530,41 +542,38 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- swig_module_info *iter = start;
- do {
- if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
- do {
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
- const char *iname = iter->types[i]->name;
- if (iname) {
- register int compare = strcmp(name, iname);
- if (compare == 0) {
- return iter->types[i];
- } else if (compare < 0) {
- if (i) {
- r = i - 1;
- } else {
- break;
- }
- } else if (compare > 0) {
- l = i + 1;
- }
- } else {
- break; /* should never happen */
+ SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ register size_t l = 0;
+ register size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ register size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ register int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
}
- } while (l <= r);
- }
- iter = iter->next;
- } while (iter != end);
- return 0;
-}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -575,148 +584,142 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- /* STEP 1: Search the name field using binary search */
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
- if (ret) {
- return ret;
- } else {
- /* STEP 2: If the type hasn't been found, do a complete search
- of the str field (the human readable name) */
- swig_module_info *iter = start;
- do {
- register size_t i = 0;
- for (; i < iter->size; ++i) {
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
- return iter->types[i];
- }
- iter = iter->next;
- } while (iter != end);
- }
-
- /* neither found a match */
- return 0;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ register size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+ }
/*
Pack binary data into a string
*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
- static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register unsigned char uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
-}
+ SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ register const unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+ }
/*
Unpack binary data from a string
*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a'-10)) << 4);
- else
- return (char *) 0;
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a'-10));
- else
- return (char *) 0;
- *u = uu;
- }
- return c;
-}
+ SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ register unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register char d = *(c++);
+ register unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a' - 10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a' - 10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+ }
/*
Pack 'void *' into a string buffer.
*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
- char *r = buff;
- if ((2*sizeof(void *) + 2) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
- strcpy(r,name);
- return buff;
-}
+ SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2 * sizeof(void *) + 2) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, &ptr, sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff)))
+ return 0;
+ strcpy(r, name);
+ return buff;
+ }
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- *ptr = (void *) 0;
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+ SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sizeof(void *));
+ }
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
- char *r = buff;
- size_t lname = (name ? strlen(name) : 0);
- if ((2*sz + 2 + lname) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- if (lname) {
- strncpy(r,name,lname+1);
- } else {
- *r = 0;
- }
- return buff;
-}
+ SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2 * sz + 2 + lname) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, ptr, sz);
+ if (lname) {
+ strncpy(r, name, lname + 1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+ }
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- memset(ptr,0,sz);
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sz);
-}
+ SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ memset(ptr, 0, sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sz);
+ }
#ifdef __cplusplus
}
#endif
/* Errors in SWIG */
-#define SWIG_UnknownError -1
-#define SWIG_IOError -2
-#define SWIG_RuntimeError -3
-#define SWIG_IndexError -4
-#define SWIG_TypeError -5
-#define SWIG_DivisionByZero -6
-#define SWIG_OverflowError -7
-#define SWIG_SyntaxError -8
-#define SWIG_ValueError -9
+#define SWIG_UnknownError -1
+#define SWIG_IOError -2
+#define SWIG_RuntimeError -3
+#define SWIG_IndexError -4
+#define SWIG_TypeError -5
+#define SWIG_DivisionByZero -6
+#define SWIG_OverflowError -7
+#define SWIG_SyntaxError -8
+#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
-#define SWIG_MemoryError -12
+#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
@@ -774,7 +777,7 @@
# ifdef LONGSIZE
# define IVSIZE LONGSIZE
# else
-# define IVSIZE 4 /* A bold guess, but the best we can make. */
+# define IVSIZE 4 /* A bold guess, but the best we can make. */
# endif
#endif
@@ -801,7 +804,7 @@
# else
# define PTR2ul(p) INT2PTR(unsigned long,p)
# endif
-#endif /* !INT2PTR */
+#endif /* !INT2PTR */
#ifndef SvPV_nolen
# define SvPV_nolen(x) SvPV(x,PL_na)
@@ -817,58 +820,56 @@
#ifndef pTHX_
#define pTHX_
-#endif
+#endif
#include <string.h>
#ifdef __cplusplus
}
#endif
-
/* -----------------------------------------------------------------------------
* error manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGINTERN const char*
-SWIG_Perl_ErrorType(int code) {
- const char* type = 0;
- switch(code) {
- case SWIG_MemoryError:
- type = "MemoryError";
- break;
- case SWIG_IOError:
- type = "IOError";
- break;
- case SWIG_RuntimeError:
- type = "RuntimeError";
- break;
- case SWIG_IndexError:
- type = "IndexError";
- break;
- case SWIG_TypeError:
- type = "TypeError";
- break;
- case SWIG_DivisionByZero:
- type = "ZeroDivisionError";
- break;
- case SWIG_OverflowError:
- type = "OverflowError";
- break;
- case SWIG_SyntaxError:
- type = "SyntaxError";
- break;
- case SWIG_ValueError:
- type = "ValueError";
- break;
- case SWIG_SystemError:
- type = "SystemError";
- break;
- case SWIG_AttributeError:
- type = "AttributeError";
- break;
- default:
- type = "RuntimeError";
- }
- return type;
+ * ----------------------------------------------------------------------------- */ SWIGINTERN const char *
+SWIG_Perl_ErrorType(int code)
+{
+ const char *type = 0;
+ switch (code) {
+ case SWIG_MemoryError:
+ type = "MemoryError";
+ break;
+ case SWIG_IOError:
+ type = "IOError";
+ break;
+ case SWIG_RuntimeError:
+ type = "RuntimeError";
+ break;
+ case SWIG_IndexError:
+ type = "IndexError";
+ break;
+ case SWIG_TypeError:
+ type = "TypeError";
+ break;
+ case SWIG_DivisionByZero:
+ type = "ZeroDivisionError";
+ break;
+ case SWIG_OverflowError:
+ type = "OverflowError";
+ break;
+ case SWIG_SyntaxError:
+ type = "SyntaxError";
+ break;
+ case SWIG_ValueError:
+ type = "ValueError";
+ break;
+ case SWIG_SystemError:
+ type = "SystemError";
+ break;
+ case SWIG_AttributeError:
+ type = "AttributeError";
+ break;
+ default:
+ type = "RuntimeError";
+ }
+ return type;
}
@@ -921,9 +922,9 @@
/* Error manipulation */
-#define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code)
+#define SWIG_ErrorType(code) SWIG_Perl_ErrorType(code)
#define SWIG_Error(code, msg) sv_setpvf(GvSV(PL_errgv),"%s %s\n", SWIG_ErrorType(code), msg)
-#define SWIG_fail goto fail
+#define SWIG_fail goto fail
/* Perl-specific SWIG API */
@@ -961,31 +962,29 @@
#endif
/* Macro to call an XS function */
-#ifdef PERL_OBJECT
-# define SWIG_CALLXS(_name) _name(cv,pPerl)
-#else
-# ifndef MULTIPLICITY
-# define SWIG_CALLXS(_name) _name(cv)
-# else
-# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
-# endif
-#endif
+#ifdef PERL_OBJECT
+# define SWIG_CALLXS(_name) _name(cv,pPerl)
+#else
+# ifndef MULTIPLICITY
+# define SWIG_CALLXS(_name) _name(cv)
+# else
+# define SWIG_CALLXS(_name) _name(PERL_GET_THX, cv)
+# endif
+#endif
#ifdef PERL_OBJECT
#define MAGIC_PPERL CPerlObj *pPerl = (CPerlObj *) this;
#ifdef __cplusplus
-extern "C" {
+ extern "C" {
#endif
-typedef int (CPerlObj::*SwigMagicFunc)(SV *, MAGIC *);
+ typedef int (CPerlObj::*SwigMagicFunc) (SV *, MAGIC *);
#ifdef __cplusplus
-}
+ }
#endif
-
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#define SWIGCLASS_STATIC
-
-#else /* PERL_OBJECT */
+#else /* PERL_OBJECT */
#define MAGIC_PPERL
#define SWIGCLASS_STATIC static SWIGUNUSED
@@ -994,50 +993,46 @@
#define SWIG_MAGIC(a,b) (SV *a, MAGIC *b)
#ifdef __cplusplus
-extern "C" {
+ extern "C" {
#endif
-typedef int (*SwigMagicFunc)(SV *, MAGIC *);
+ typedef int (*SwigMagicFunc) (SV *, MAGIC *);
#ifdef __cplusplus
-}
+ }
#endif
-
-#else /* MULTIPLICITY */
+#else /* MULTIPLICITY */
#define SWIG_MAGIC(a,b) (struct interpreter *interp, SV *a, MAGIC *b)
#ifdef __cplusplus
-extern "C" {
+ extern "C" {
#endif
-typedef int (*SwigMagicFunc)(struct interpreter *, SV *, MAGIC *);
+ typedef int (*SwigMagicFunc) (struct interpreter *, SV *, MAGIC *);
#ifdef __cplusplus
-}
+ }
#endif
-
-#endif /* MULTIPLICITY */
-#endif /* PERL_OBJECT */
-
+#endif /* MULTIPLICITY */
+#endif /* PERL_OBJECT */
/* Workaround for bug in perl 5.6.x croak and earlier */
#if (PERL_VERSION < 8)
# ifdef PERL_OBJECT
# define SWIG_croak_null() SWIG_Perl_croak_null(pPerl)
-static void SWIG_Perl_croak_null(CPerlObj *pPerl)
+ static void SWIG_Perl_croak_null(CPerlObj * pPerl)
# else
-static void SWIG_croak_null()
+ static void SWIG_croak_null()
# endif
-{
- SV *err=ERRSV;
+ {
+ SV *err = ERRSV;
# if (PERL_VERSION < 6)
- croak("%_", err);
+ croak("%_", err);
# else
- if (SvOK(err) && !SvROK(err)) croak("%_", err);
- croak(Nullch);
+ if (SvOK(err) && !SvROK(err))
+ croak("%_", err);
+ croak(Nullch);
# endif
-}
+ }
#else
# define SWIG_croak_null() croak(Nullch)
#endif
-
-
/*
Define how strict is the cast between strings and integers/doubles
when overloading between these types occurs.
@@ -1060,206 +1055,201 @@
#endif
#ifdef SWIG_PERL_STRICT_STR2NUM
/* string takes precedence */
-#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
+#define SWIG_Str2NumCast(x) SWIG_AddCast(x)
#else
/* number takes precedence */
#define SWIG_Str2NumCast(x) x
#endif
-
-
-
#include <stdlib.h>
+ SWIGRUNTIME const char *SWIG_Perl_TypeProxyName(const swig_type_info * type) {
+ if (!type)
+ return NULL;
+ if (type->clientdata != NULL) {
+ return (const char *) type->clientdata;
+ } else {
+ return type->name;
+ }
+ }
-SWIGRUNTIME const char *
-SWIG_Perl_TypeProxyName(const swig_type_info *type) {
- if (!type) return NULL;
- if (type->clientdata != NULL) {
- return (const char*) type->clientdata;
- }
- else {
- return type->name;
- }
-}
-
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeProxyCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(( (!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
- || (iter->type->clientdata && (strcmp((char*)iter->type->clientdata, c) == 0))), ty);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeProxyCheck(const char *c, swig_type_info * ty) {
+ SWIG_TypeCheck_Template(((!iter->type->clientdata && (strcmp(iter->type->name, c) == 0))
+ || (iter->type->clientdata && (strcmp((char *) iter->type->clientdata, c) == 0))), ty);
+ }
/* Function for getting a pointer value */
-SWIGRUNTIME int
-SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *_t, int flags) {
- swig_cast_info *tc;
- void *voidptr = (void *)0;
- SV *tsv = 0;
- /* If magical, apply more magic */
- if (SvGMAGICAL(sv))
- mg_get(sv);
-
- /* Check to see if this is an object */
- if (sv_isobject(sv)) {
- IV tmp = 0;
- tsv = (SV*) SvRV(sv);
- if ((SvTYPE(tsv) == SVt_PVHV)) {
- MAGIC *mg;
- if (SvMAGICAL(tsv)) {
- mg = mg_find(tsv,'P');
- if (mg) {
- sv = mg->mg_obj;
- if (sv_isobject(sv)) {
- tsv = (SV*)SvRV(sv);
- tmp = SvIV(tsv);
- }
- }
- } else {
- return SWIG_ERROR;
- }
- } else {
- tmp = SvIV(tsv);
- }
- voidptr = INT2PTR(void *,tmp);
- } else if (! SvOK(sv)) { /* Check for undef */
- *(ptr) = (void *) 0;
- return SWIG_OK;
- } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
- if (!SvROK(sv)) {
- *(ptr) = (void *) 0;
- return SWIG_OK;
- } else {
- return SWIG_ERROR;
- }
- } else { /* Don't know what it is */
- return SWIG_ERROR;
- }
- if (_t) {
- /* Now see if the types match */
- char *_c = HvNAME(SvSTASH(SvRV(sv)));
- tc = SWIG_TypeProxyCheck(_c,_t);
- if (!tc) {
- return SWIG_ERROR;
- }
- {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,voidptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- }
- } else {
- *ptr = voidptr;
- }
-
- /*
- * DISOWN implementation: we need a perl guru to check this one.
- */
- if (tsv && (flags & SWIG_POINTER_DISOWN)) {
- /*
- * almost copy paste code from below SWIG_POINTER_OWN setting
- */
- SV *obj = sv;
- HV *stash = SvSTASH(SvRV(obj));
- GV *gv = *(GV**) hv_fetch(stash, "OWNER", 5, TRUE);
- if (isGV(gv)) {
- HV *hv = GvHVn(gv);
- /*
- * To set ownership (see below), a newSViv(1) entry is added.
- * Hence, to remove ownership, we delete the entry.
- */
- if (hv_exists_ent(hv, obj, 0)) {
- hv_delete_ent(hv, obj, 0, 0);
- }
- }
- }
- return SWIG_OK;
-}
+ SWIGRUNTIME int
+ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void **ptr, swig_type_info * _t, int flags) {
+ swig_cast_info *tc;
+ void *voidptr = (void *) 0;
+ SV *tsv = 0;
+ /* If magical, apply more magic */
+ if (SvGMAGICAL(sv))
+ mg_get(sv);
+
+ /* Check to see if this is an object */
+ if (sv_isobject(sv)) {
+ IV tmp = 0;
+ tsv = (SV *) SvRV(sv);
+ if ((SvTYPE(tsv) == SVt_PVHV)) {
+ MAGIC *mg;
+ if (SvMAGICAL(tsv)) {
+ mg = mg_find(tsv, 'P');
+ if (mg) {
+ sv = mg->mg_obj;
+ if (sv_isobject(sv)) {
+ tsv = (SV *) SvRV(sv);
+ tmp = SvIV(tsv);
+ }
+ }
+ } else {
+ return SWIG_ERROR;
+ }
+ } else {
+ tmp = SvIV(tsv);
+ }
+ voidptr = INT2PTR(void *, tmp);
+ } else if (!SvOK(sv)) { /* Check for undef */
+ *(ptr) = (void *) 0;
+ return SWIG_OK;
+ } else if (SvTYPE(sv) == SVt_RV) { /* Check for NULL pointer */
+ if (!SvROK(sv)) {
+ *(ptr) = (void *) 0;
+ return SWIG_OK;
+ } else {
+ return SWIG_ERROR;
+ }
+ } else { /* Don't know what it is */
+ return SWIG_ERROR;
+ }
+ if (_t) {
+ /* Now see if the types match */
+ char *_c = HvNAME(SvSTASH(SvRV(sv)));
+ tc = SWIG_TypeProxyCheck(_c, _t);
+ if (!tc) {
+ return SWIG_ERROR;
+ }
+ {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, voidptr, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ }
+ } else {
+ *ptr = voidptr;
+ }
+
+ /*
+ * DISOWN implementation: we need a perl guru to check this one.
+ */
+ if (tsv && (flags & SWIG_POINTER_DISOWN)) {
+ /*
+ * almost copy paste code from below SWIG_POINTER_OWN setting
+ */
+ SV *obj = sv;
+ HV *stash = SvSTASH(SvRV(obj));
+ GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
+ if (isGV(gv)) {
+ HV *hv = GvHVn(gv);
+ /*
+ * To set ownership (see below), a newSViv(1) entry is added.
+ * Hence, to remove ownership, we delete the entry.
+ */
+ if (hv_exists_ent(hv, obj, 0)) {
+ hv_delete_ent(hv, obj, 0, 0);
+ }
+ }
+ }
+ return SWIG_OK;
+ }
-SWIGRUNTIME void
-SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, swig_type_info *t, int flags) {
- if (ptr && (flags & SWIG_SHADOW)) {
- SV *self;
- SV *obj=newSV(0);
- HV *hash=newHV();
- HV *stash;
- sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
- stash=SvSTASH(SvRV(obj));
- if (flags & SWIG_POINTER_OWN) {
- HV *hv;
- GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
- if (!isGV(gv))
- gv_init(gv, stash, "OWNER", 5, FALSE);
- hv=GvHVn(gv);
- hv_store_ent(hv, obj, newSViv(1), 0);
- }
- sv_magic((SV *)hash, (SV *)obj, 'P', Nullch, 0);
- SvREFCNT_dec(obj);
- self=newRV_noinc((SV *)hash);
- sv_setsv(sv, self);
- SvREFCNT_dec((SV *)self);
- sv_bless(sv, stash);
- }
- else {
- sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
- }
-}
+ SWIGRUNTIME void
+ SWIG_Perl_MakePtr(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, swig_type_info * t, int flags) {
+ if (ptr && (flags & SWIG_SHADOW)) {
+ SV *self;
+ SV *obj = newSV(0);
+ HV *hash = newHV();
+ HV *stash;
+ sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+ stash = SvSTASH(SvRV(obj));
+ if (flags & SWIG_POINTER_OWN) {
+ HV *hv;
+ GV *gv = *(GV **) hv_fetch(stash, "OWNER", 5, TRUE);
+ if (!isGV(gv))
+ gv_init(gv, stash, "OWNER", 5, FALSE);
+ hv = GvHVn(gv);
+ hv_store_ent(hv, obj, newSViv(1), 0);
+ }
+ sv_magic((SV *) hash, (SV *) obj, 'P', Nullch, 0);
+ SvREFCNT_dec(obj);
+ self = newRV_noinc((SV *) hash);
+ sv_setsv(sv, self);
+ SvREFCNT_dec((SV *) self);
+ sv_bless(sv, stash);
+ } else {
+ sv_setref_pv(sv, (char *) SWIG_Perl_TypeProxyName(t), ptr);
+ }
+ }
-SWIGRUNTIMEINLINE SV *
-SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
- SV *result = sv_newmortal();
- SWIG_MakePtr(result, ptr, t, flags);
- return result;
-}
+ SWIGRUNTIMEINLINE SV *SWIG_Perl_NewPointerObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info * t, int flags) {
+ SV *result = sv_newmortal();
+ SWIG_MakePtr(result, ptr, t, flags);
+ return result;
+ }
-SWIGRUNTIME void
-SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV *sv, void *ptr, int sz, swig_type_info *type) {
- char result[1024];
- char *r = result;
- if ((2*sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000) return;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- strcpy(r,SWIG_Perl_TypeProxyName(type));
- sv_setpv(sv, result);
-}
+ SWIGRUNTIME void
+ SWIG_Perl_MakePackedObj(SWIG_MAYBE_PERL_OBJECT SV * sv, void *ptr, int sz, swig_type_info * type) {
+ char result[1024];
+ char *r = result;
+ if ((2 * sz + 1 + strlen(SWIG_Perl_TypeProxyName(type))) > 1000)
+ return;
+ *(r++) = '_';
+ r = SWIG_PackData(r, ptr, sz);
+ strcpy(r, SWIG_Perl_TypeProxyName(type));
+ sv_setpv(sv, result);
+ }
-SWIGRUNTIME SV *
-SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info *type) {
- SV *result = sv_newmortal();
- SWIG_Perl_MakePackedObj(result, ptr, sz, type);
- return result;
-}
+ SWIGRUNTIME SV *SWIG_Perl_NewPackedObj(SWIG_MAYBE_PERL_OBJECT void *ptr, int sz, swig_type_info * type) {
+ SV *result = sv_newmortal();
+ SWIG_Perl_MakePackedObj(result, ptr, sz, type);
+ return result;
+ }
/* Convert a packed value value */
-SWIGRUNTIME int
-SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV *obj, void *ptr, int sz, swig_type_info *ty) {
- swig_cast_info *tc;
- const char *c = 0;
-
- if ((!obj) || (!SvOK(obj))) return SWIG_ERROR;
- c = SvPV_nolen(obj);
- /* Pointer values must start with leading underscore */
- if (*c != '_') return SWIG_ERROR;
- c++;
- c = SWIG_UnpackData(c,ptr,sz);
- if (ty) {
- tc = SWIG_TypeCheck(c,ty);
- if (!tc) return SWIG_ERROR;
- }
- return SWIG_OK;
-}
+ SWIGRUNTIME int
+ SWIG_Perl_ConvertPacked(SWIG_MAYBE_PERL_OBJECT SV * obj, void *ptr, int sz, swig_type_info * ty) {
+ swig_cast_info *tc;
+ const char *c = 0;
+
+ if ((!obj) || (!SvOK(obj)))
+ return SWIG_ERROR;
+ c = SvPV_nolen(obj);
+ /* Pointer values must start with leading underscore */
+ if (*c != '_')
+ return SWIG_ERROR;
+ c++;
+ c = SWIG_UnpackData(c, ptr, sz);
+ if (ty) {
+ tc = SWIG_TypeCheck(c, ty);
+ if (!tc)
+ return SWIG_ERROR;
+ }
+ return SWIG_OK;
+ }
/* Macros for low-level exception handling */
#define SWIG_croak(x) { SWIG_Error(SWIG_RuntimeError, x); SWIG_fail; }
-typedef XSPROTO(SwigPerlWrapper);
-typedef SwigPerlWrapper *SwigPerlWrapperPtr;
+ typedef XSPROTO(SwigPerlWrapper);
+ typedef SwigPerlWrapper *SwigPerlWrapperPtr;
/* Structure for command table */
-typedef struct {
- const char *name;
- SwigPerlWrapperPtr wrapper;
-} swig_command_info;
+ typedef struct {
+ const char *name;
+ SwigPerlWrapperPtr wrapper;
+ } swig_command_info;
/* Information for constant table */
@@ -1270,73 +1260,74 @@
#define SWIG_BINARY 5
/* Constant information structure */
-typedef struct swig_constant_info {
- int type;
- const char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
-} swig_constant_info;
+ typedef struct swig_constant_info {
+ int type;
+ const char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
+ } swig_constant_info;
/* Structure for variable table */
-typedef struct {
- const char *name;
- SwigMagicFunc set;
- SwigMagicFunc get;
- swig_type_info **type;
-} swig_variable_info;
+ typedef struct {
+ const char *name;
+ SwigMagicFunc set;
+ SwigMagicFunc get;
+ swig_type_info **type;
+ } swig_variable_info;
/* Magic variable code */
#ifndef PERL_OBJECT
#define swig_create_magic(s,a,b,c) _swig_create_magic(s,a,b,c)
- #ifndef MULTIPLICITY
- SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(SV *, MAGIC *), int (*get)(SV *,MAGIC *))
- #else
- SWIGRUNTIME void _swig_create_magic(SV *sv, char *name, int (*set)(struct interpreter*, SV *, MAGIC *), int (*get)(struct interpreter*, SV *,MAGIC *))
- #endif
+#ifndef MULTIPLICITY
+ SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (SV *, MAGIC *), int (*get) (SV *, MAGIC *))
+#else
+ SWIGRUNTIME void _swig_create_magic(SV * sv, char *name, int (*set) (struct interpreter *, SV *, MAGIC *),
+ int (*get) (struct interpreter *, SV *, MAGIC *))
+#endif
#else
# define swig_create_magic(s,a,b,c) _swig_create_magic(pPerl,s,a,b,c)
-SWIGRUNTIME void _swig_create_magic(CPerlObj *pPerl, SV *sv, const char *name, int (CPerlObj::*set)(SV *, MAGIC *), int (CPerlObj::*get)(SV *, MAGIC *))
+ SWIGRUNTIME void _swig_create_magic(CPerlObj * pPerl, SV * sv, const char *name, int (CPerlObj::*set) (SV *, MAGIC *),
+ int (CPerlObj::*get) (SV *, MAGIC *))
#endif
-{
- MAGIC *mg;
- sv_magic(sv,sv,'U',(char *) name,strlen(name));
- mg = mg_find(sv,'U');
- mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
- mg->mg_virtual->svt_get = (SwigMagicFunc) get;
- mg->mg_virtual->svt_set = (SwigMagicFunc) set;
- mg->mg_virtual->svt_len = 0;
- mg->mg_virtual->svt_clear = 0;
- mg->mg_virtual->svt_free = 0;
-}
+ {
+ MAGIC *mg;
+ sv_magic(sv, sv, 'U', (char *) name, strlen(name));
+ mg = mg_find(sv, 'U');
+ mg->mg_virtual = (MGVTBL *) malloc(sizeof(MGVTBL));
+ mg->mg_virtual->svt_get = (SwigMagicFunc) get;
+ mg->mg_virtual->svt_set = (SwigMagicFunc) set;
+ mg->mg_virtual->svt_len = 0;
+ mg->mg_virtual->svt_clear = 0;
+ mg->mg_virtual->svt_free = 0;
+ }
-SWIGRUNTIME swig_module_info *
-SWIG_Perl_GetModule(void) {
- static void *type_pointer = (void *)0;
- SV *pointer;
-
- /* first check if pointer already created */
- if (!type_pointer) {
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
- if (pointer && SvOK(pointer)) {
- type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
- }
- }
+ SWIGRUNTIME swig_module_info *SWIG_Perl_GetModule(void) {
+ static void *type_pointer = (void *) 0;
+ SV *pointer;
+
+ /* first check if pointer already created */
+ if (!type_pointer) {
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, FALSE | GV_ADDMULTI);
+ if (pointer && SvOK(pointer)) {
+ type_pointer = INT2PTR(swig_type_info **, SvIV(pointer));
+ }
+ }
- return (swig_module_info *) type_pointer;
-}
+ return (swig_module_info *) type_pointer;
+ }
-SWIGRUNTIME void
-SWIG_Perl_SetModule(swig_module_info *module) {
- SV *pointer;
-
- /* create a new pointer */
- pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
- sv_setiv(pointer, PTR2IV(module));
-}
+ SWIGRUNTIME void
+ SWIG_Perl_SetModule(swig_module_info * module) {
+ SV *pointer;
+
+ /* create a new pointer */
+ pointer = get_sv("swig_runtime_data::type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TRUE | GV_ADDMULTI);
+ sv_setiv(pointer, PTR2IV(module));
+ }
#ifdef __cplusplus
}
@@ -1346,101 +1337,101 @@
* functions like fopen will not solve the problem on all platforms as fopen
* might be a macro on Windows but not necessarily on other operating systems. */
#ifdef do_open
- #undef do_open
+#undef do_open
#endif
#ifdef do_close
- #undef do_close
+#undef do_close
#endif
#ifdef scalar
- #undef scalar
+#undef scalar
#endif
#ifdef list
- #undef list
+#undef list
#endif
#ifdef apply
- #undef apply
+#undef apply
#endif
#ifdef convert
- #undef convert
+#undef convert
#endif
#ifdef Error
- #undef Error
+#undef Error
#endif
#ifdef form
- #undef form
+#undef form
#endif
#ifdef vform
- #undef vform
+#undef vform
#endif
#ifdef LABEL
- #undef LABEL
+#undef LABEL
#endif
#ifdef METHOD
- #undef METHOD
+#undef METHOD
#endif
#ifdef Move
- #undef Move
+#undef Move
#endif
#ifdef yylex
- #undef yylex
+#undef yylex
#endif
#ifdef yyparse
- #undef yyparse
+#undef yyparse
#endif
#ifdef yyerror
- #undef yyerror
+#undef yyerror
#endif
#ifdef invert
- #undef invert
+#undef invert
#endif
#ifdef ref
- #undef ref
+#undef ref
#endif
#ifdef read
- #undef read
+#undef read
#endif
#ifdef write
- #undef write
+#undef write
#endif
#ifdef eof
- #undef eof
+#undef eof
#endif
#ifdef bool
- #undef bool
+#undef bool
#endif
#ifdef close
- #undef close
+#undef close
#endif
#ifdef rewind
- #undef rewind
+#undef rewind
#endif
#ifdef free
- #undef free
+#undef free
#endif
#ifdef malloc
- #undef malloc
+#undef malloc
#endif
#ifdef calloc
- #undef calloc
+#undef calloc
#endif
#ifdef Stat
- #undef Stat
+#undef Stat
#endif
#ifdef check
- #undef check
+#undef check
#endif
#ifdef seekdir
- #undef seekdir
+#undef seekdir
#endif
#ifdef open
- #undef open
+#undef open
#endif
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
@@ -1467,7 +1458,8 @@
#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
#define SWIGTYPE_p_void swig_types[19]
static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
+
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -1478,12 +1470,12 @@
#define SWIG_name "freeswitchc::boot_freeswitch"
#define SWIG_prefix "freeswitchc::"
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
#include <stdexcept>
@@ -1494,12 +1486,12 @@
#endif
#ifndef PERL_OBJECT
#ifndef MULTIPLICITY
-SWIGEXPORT void SWIG_init (CV* cv);
+ SWIGEXPORT void SWIG_init(CV * cv);
#else
-SWIGEXPORT void SWIG_init (pTHXo_ CV* cv);
+ SWIGEXPORT void SWIG_init(pTHXo_ CV * cv);
#endif
#else
-SWIGEXPORT void SWIG_init (CV *cv, CPerlObj *);
+ SWIGEXPORT void SWIG_init(CV * cv, CPerlObj *);
#endif
@@ -1507,51 +1499,53 @@
#include "freeswitch_perl.h"
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
{
- static int init = 0;
- static swig_type_info* info = 0;
- if (!init) {
- info = SWIG_TypeQuery("_p_char");
- init = 1;
- }
- return info;
+ static int init = 0;
+ static swig_type_info *info = 0;
+ if (!init) {
+ info = SWIG_TypeQuery("_p_char");
+ init = 1;
+ }
+ return info;
}
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(SV *obj, char** cptr, size_t* psize, int *alloc)
+SWIGINTERN int SWIG_AsCharPtrAndSize(SV * obj, char **cptr, size_t *psize, int *alloc)
{
- if (SvPOK(obj)) {
- STRLEN len = 0;
- char *cstr = SvPV(obj, len);
- size_t size = len + 1;
- if (cptr) {
- if (alloc) {
- if (*alloc == SWIG_NEWOBJ) {
- *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
+ if (SvPOK(obj)) {
+ STRLEN len = 0;
+ char *cstr = SvPV(obj, len);
+ size_t size = len + 1;
+ if (cptr) {
+ if (alloc) {
+ if (*alloc == SWIG_NEWOBJ) {
+ *cptr = reinterpret_cast < char *>(memcpy((new char[size]), cstr, sizeof(char) * (size)));
+ } else {
+ *cptr = cstr;
+ *alloc = SWIG_OLDOBJ;
+ }
+ }
+ }
+ if (psize)
+ *psize = size;
+ return SWIG_OK;
} else {
- *cptr = cstr;
- *alloc = SWIG_OLDOBJ;
+ swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+ if (pchar_descriptor) {
+ char *vptr = 0;
+ if (SWIG_ConvertPtr(obj, (void **) &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr)
+ *cptr = vptr;
+ if (psize)
+ *psize = vptr ? (strlen(vptr) + 1) : 0;
+ if (alloc)
+ *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
}
- }
- }
- if (psize) *psize = size;
- return SWIG_OK;
- } else {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- if (pchar_descriptor) {
- char* vptr = 0;
- if (SWIG_ConvertPtr(obj, (void**)&vptr, pchar_descriptor, 0) == SWIG_OK) {
- if (cptr) *cptr = vptr;
- if (psize) *psize = vptr ? (strlen(vptr) + 1) : 0;
- if (alloc) *alloc = SWIG_OLDOBJ;
- return SWIG_OK;
- }
- }
- }
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
@@ -1569,31 +1563,34 @@
SWIGINTERN int
-SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV *obj, double *val)
+SWIG_AsVal_double SWIG_PERL_DECL_ARGS_2(SV * obj, double *val)
{
- if (SvNIOK(obj)) {
- if (val) *val = SvNV(obj);
- return SWIG_OK;
- } else if (SvIOK(obj)) {
- if (val) *val = (double) SvIV(obj);
- return SWIG_AddCast(SWIG_OK);
- } else {
- const char *nptr = SvPV_nolen(obj);
- if (nptr) {
- char *endptr;
- double v = strtod(nptr, &endptr);
- if (errno == ERANGE) {
- errno = 0;
- return SWIG_OverflowError;
- } else {
- if (*endptr == '\0') {
- if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ if (SvNIOK(obj)) {
+ if (val)
+ *val = SvNV(obj);
+ return SWIG_OK;
+ } else if (SvIOK(obj)) {
+ if (val)
+ *val = (double) SvIV(obj);
+ return SWIG_AddCast(SWIG_OK);
+ } else {
+ const char *nptr = SvPV_nolen(obj);
+ if (nptr) {
+ char *endptr;
+ double v = strtod(nptr, &endptr);
+ if (errno == ERANGE) {
+ errno = 0;
+ return SWIG_OverflowError;
+ } else {
+ if (*endptr == '\0') {
+ if (val)
+ *val = v;
+ return SWIG_Str2NumCast(SWIG_OK);
+ }
+ }
+ }
}
- }
- }
- }
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
@@ -1603,229 +1600,234 @@
#include <math.h>
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
- double x = *d;
- if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
- if ((errno == EDOM) || (errno == ERANGE)) {
- errno = 0;
- } else {
- double summ, reps, diff;
- if (rd < x) {
- diff = x - rd;
- } else if (rd > x) {
- diff = rd - x;
- } else {
- return 1;
- }
- summ = rd + x;
- reps = diff/summ;
- if (reps < 8*DBL_EPSILON) {
- *d = rd;
- return 1;
- }
- }
- }
- return 0;
+SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
+{
+ double x = *d;
+ if ((min <= x && x <= max)) {
+ double fx = floor(x);
+ double cx = ceil(x);
+ double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ if ((errno == EDOM) || (errno == ERANGE)) {
+ errno = 0;
+ } else {
+ double summ, reps, diff;
+ if (rd < x) {
+ diff = x - rd;
+ } else if (rd > x) {
+ diff = rd - x;
+ } else {
+ return 1;
+ }
+ summ = rd + x;
+ reps = diff / summ;
+ if (reps < 8 * DBL_EPSILON) {
+ *d = rd;
+ return 1;
+ }
+ }
+ }
+ return 0;
}
SWIGINTERN int
-SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV *obj, long* val)
+SWIG_AsVal_long SWIG_PERL_DECL_ARGS_2(SV * obj, long *val)
{
- if (SvIOK(obj)) {
- if (val) *val = SvIV(obj);
- return SWIG_OK;
- } else {
- int dispatch = 0;
- const char *nptr = SvPV_nolen(obj);
- if (nptr) {
- char *endptr;
- long v;
- errno = 0;
- v = strtol(nptr, &endptr,0);
- if (errno == ERANGE) {
- errno = 0;
- return SWIG_OverflowError;
- } else {
- if (*endptr == '\0') {
- if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ if (SvIOK(obj)) {
+ if (val)
+ *val = SvIV(obj);
+ return SWIG_OK;
+ } else {
+ int dispatch = 0;
+ const char *nptr = SvPV_nolen(obj);
+ if (nptr) {
+ char *endptr;
+ long v;
+ errno = 0;
+ v = strtol(nptr, &endptr, 0);
+ if (errno == ERANGE) {
+ errno = 0;
+ return SWIG_OverflowError;
+ } else {
+ if (*endptr == '\0') {
+ if (val)
+ *val = v;
+ return SWIG_Str2NumCast(SWIG_OK);
+ }
+ }
+ }
+ if (!dispatch) {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+ if (val)
+ *val = (long) (d);
+ return res;
+ }
+ }
}
- }
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
- if (val) *val = (long)(d);
- return res;
- }
- }
- }
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_int SWIG_PERL_DECL_ARGS_2(SV * obj, int *val)
{
- long v;
- int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = static_cast< int >(v);
- }
- }
- return res;
+ long v;
+ int res = SWIG_AsVal_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v < INT_MIN || v > INT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val)
+ *val = static_cast < int >(v);
+ }
+ }
+ return res;
}
-SWIGINTERNINLINE SV *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+SWIGINTERNINLINE SV *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
{
- SV *obj = sv_newmortal();
- if (carray) {
- sv_setpvn(obj, carray, size);
- } else {
- sv_setsv(obj, &PL_sv_undef);
- }
- return obj;
+ SV *obj = sv_newmortal();
+ if (carray) {
+ sv_setpvn(obj, carray, size);
+ } else {
+ sv_setsv(obj, &PL_sv_undef);
+ }
+ return obj;
}
-SWIGINTERNINLINE SV *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE SV *SWIG_FromCharPtr(const char *cptr)
+{
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
-SWIGINTERNINLINE SV *
-SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
-{
- SV *obj = sv_newmortal();
- sv_setiv(obj, (IV) value);
- return obj;
+SWIGINTERNINLINE SV *SWIG_From_long SWIG_PERL_DECL_ARGS_1(long value)
+{
+ SV *obj = sv_newmortal();
+ sv_setiv(obj, (IV) value);
+ return obj;
}
-SWIGINTERNINLINE SV *
-SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
-{
- return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *SWIG_From_int SWIG_PERL_DECL_ARGS_1(int value)
+{
+ return SWIG_From_long SWIG_PERL_CALL_ARGS_1(value);
}
-SWIGINTERNINLINE SV *
-SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value)
-{
- SV *obj = sv_newmortal();
- if (value) {
- sv_setsv(obj, &PL_sv_yes);
- } else {
- sv_setsv(obj, &PL_sv_no);
- }
- return obj;
+SWIGINTERNINLINE SV *SWIG_From_bool SWIG_PERL_DECL_ARGS_1(bool value)
+{
+ SV *obj = sv_newmortal();
+ if (value) {
+ sv_setsv(obj, &PL_sv_yes);
+ } else {
+ sv_setsv(obj, &PL_sv_no);
+ }
+ return obj;
}
SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV *obj, unsigned long *val)
+SWIG_AsVal_unsigned_SS_long SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned long *val)
{
- if (SvUOK(obj)) {
- if (val) *val = SvUV(obj);
- return SWIG_OK;
- } else if (SvIOK(obj)) {
- long v = SvIV(obj);
- if (v >= 0) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- return SWIG_OverflowError;
- }
- } else {
- int dispatch = 0;
- const char *nptr = SvPV_nolen(obj);
- if (nptr) {
- char *endptr;
- unsigned long v;
- errno = 0;
- v = strtoul(nptr, &endptr,0);
- if (errno == ERANGE) {
- errno = 0;
- return SWIG_OverflowError;
- } else {
- if (*endptr == '\0') {
- if (val) *val = v;
- return SWIG_Str2NumCast(SWIG_OK);
+ if (SvUOK(obj)) {
+ if (val)
+ *val = SvUV(obj);
+ return SWIG_OK;
+ } else if (SvIOK(obj)) {
+ long v = SvIV(obj);
+ if (v >= 0) {
+ if (val)
+ *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else {
+ int dispatch = 0;
+ const char *nptr = SvPV_nolen(obj);
+ if (nptr) {
+ char *endptr;
+ unsigned long v;
+ errno = 0;
+ v = strtoul(nptr, &endptr, 0);
+ if (errno == ERANGE) {
+ errno = 0;
+ return SWIG_OverflowError;
+ } else {
+ if (*endptr == '\0') {
+ if (val)
+ *val = v;
+ return SWIG_Str2NumCast(SWIG_OK);
+ }
+ }
+ }
+ if (!dispatch) {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj, &d));
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+ if (val)
+ *val = (unsigned long) (d);
+ return res;
+ }
+ }
}
- }
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double SWIG_PERL_CALL_ARGS_2(obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
- if (val) *val = (unsigned long)(d);
- return res;
- }
- }
- }
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_int SWIG_PERL_DECL_ARGS_2(SV * obj, unsigned int *val)
{
- unsigned long v;
- int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v > UINT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = static_cast< unsigned int >(v);
- }
- }
- return res;
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long SWIG_PERL_CALL_ARGS_2(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > UINT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val)
+ *val = static_cast < unsigned int >(v);
+ }
+ }
+ return res;
}
-SWIGINTERNINLINE SV *
-SWIG_From_unsigned_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long value)
-{
- SV *obj = sv_newmortal();
- sv_setuv(obj, (UV) value);
- return obj;
+SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_long SWIG_PERL_DECL_ARGS_1(unsigned long value)
+{
+ SV *obj = sv_newmortal();
+ sv_setuv(obj, (UV) value);
+ return obj;
}
-SWIGINTERNINLINE SV *
-SWIG_From_unsigned_SS_int SWIG_PERL_DECL_ARGS_1(unsigned int value)
-{
- return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(value);
+SWIGINTERNINLINE SV *SWIG_From_unsigned_SS_int SWIG_PERL_DECL_ARGS_1(unsigned int value)
+{
+ return SWIG_From_unsigned_SS_long SWIG_PERL_CALL_ARGS_1(value);
}
SWIGINTERN int
-SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV *obj, bool* val)
+SWIG_AsVal_bool SWIG_PERL_DECL_ARGS_2(SV * obj, bool * val)
{
- if (obj == &PL_sv_yes) {
- if (val) *val = true;
- return SWIG_OK;
- } else if (obj == &PL_sv_no) {
- if (val) *val = false;
- return SWIG_OK;
- } else {
- if (val) *val = SvTRUE(obj) ? true: false;
- return SWIG_AddCast(SWIG_OK);
- }
- return SWIG_TypeError;
+ if (obj == &PL_sv_yes) {
+ if (val)
+ *val = true;
+ return SWIG_OK;
+ } else if (obj == &PL_sv_no) {
+ if (val)
+ *val = false;
+ return SWIG_OK;
+ } else {
+ if (val)
+ *val = SvTRUE(obj) ? true : false;
+ return SWIG_AddCast(SWIG_OK);
+ }
+ return SWIG_TypeError;
}
#ifdef __cplusplus
@@ -1834,18 +1836,15 @@
#ifdef PERL_OBJECT
#define MAGIC_CLASS _wrap_freeswitch_var::
-class _wrap_freeswitch_var : public CPerlObj {
-public:
+ class _wrap_freeswitch_var:public CPerlObj {
+ public:
#else
#define MAGIC_CLASS
#endif
-SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV *SWIGUNUSEDPARM(sv), MAGIC *SWIGUNUSEDPARM(mg)) {
- MAGIC_PPERL
- croak("Value is read-only.");
- return 0;
-}
-
-
+ SWIGCLASS_STATIC int swig_magic_readonly(pTHX_ SV * SWIGUNUSEDPARM(sv), MAGIC * SWIGUNUSEDPARM(mg)) {
+ MAGIC_PPERL croak("Value is read-only.");
+ return 0;
+ }
#ifdef PERL_OBJECT
};
#endif
@@ -1857,6474 +1856,6984 @@
#ifdef __cplusplus
extern "C" {
#endif
-XS(_wrap_consoleLog) {
- {
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: consoleLog(level_str,msg);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- consoleLog(arg1,arg2);
-
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_consoleLog) {
+ {
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: consoleLog(level_str,msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ consoleLog(arg1, arg2);
+
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_consoleCleanLog) {
- {
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: consoleCleanLog(msg);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- consoleCleanLog(arg1);
-
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_consoleCleanLog) {
+ {
+ char *arg1 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: consoleCleanLog(msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ consoleCleanLog(arg1);
+
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_IVRMenu) {
- {
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- int arg9 ;
- int arg10 ;
- int arg11 ;
- int arg12 ;
- int arg13 ;
- IVRMenu *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int res5 ;
- char *buf5 = 0 ;
- int alloc5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int res7 ;
- char *buf7 = 0 ;
- int alloc7 = 0 ;
- int res8 ;
- char *buf8 = 0 ;
- int alloc8 = 0 ;
- int val9 ;
- int ecode9 = 0 ;
- int val10 ;
- int ecode10 = 0 ;
- int val11 ;
- int ecode11 = 0 ;
- int val12 ;
- int ecode12 = 0 ;
- int val13 ;
- int ecode13 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 13) || (items > 13)) {
- SWIG_croak("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
- }
- arg5 = reinterpret_cast< char * >(buf5);
- res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
- if (!SWIG_IsOK(res7)) {
- SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
- }
- arg7 = reinterpret_cast< char * >(buf7);
- res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
- if (!SWIG_IsOK(res8)) {
- SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
- }
- arg8 = reinterpret_cast< char * >(buf8);
- ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
- if (!SWIG_IsOK(ecode9)) {
- SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
- }
- arg9 = static_cast< int >(val9);
- ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
- if (!SWIG_IsOK(ecode10)) {
- SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
- }
- arg10 = static_cast< int >(val10);
- ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
- if (!SWIG_IsOK(ecode11)) {
- SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
- }
- arg11 = static_cast< int >(val11);
- ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
- if (!SWIG_IsOK(ecode12)) {
- SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
- }
- arg12 = static_cast< int >(val12);
- ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
- if (!SWIG_IsOK(ecode13)) {
- SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
- }
- arg13 = static_cast< int >(val13);
- result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-
-
-
-
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
-
-
-
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_IVRMenu) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ int arg9;
+ int arg10;
+ int arg11;
+ int arg12;
+ int arg13;
+ IVRMenu *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int res5;
+ char *buf5 = 0;
+ int alloc5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ int res7;
+ char *buf7 = 0;
+ int alloc7 = 0;
+ int res8;
+ char *buf8 = 0;
+ int alloc8 = 0;
+ int val9;
+ int ecode9 = 0;
+ int val10;
+ int ecode10 = 0;
+ int val11;
+ int ecode11 = 0;
+ int val12;
+ int ecode12 = 0;
+ int val13;
+ int ecode13 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 13) || (items > 13)) {
+ SWIG_croak
+ ("Usage: new_IVRMenu(main,name,greeting_sound,short_greeting_sound,invalid_sound,exit_sound,confirm_macro,confirm_key,confirm_attempts,inter_timeout,digit_len,timeout,max_failures);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
+ }
+ arg5 = reinterpret_cast < char *>(buf5);
+ res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
+ }
+ arg7 = reinterpret_cast < char *>(buf7);
+ res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
+ }
+ arg8 = reinterpret_cast < char *>(buf8);
+ ecode9 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(8), &val9);
+ if (!SWIG_IsOK(ecode9)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
+ }
+ arg9 = static_cast < int >(val9);
+ ecode10 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(9), &val10);
+ if (!SWIG_IsOK(ecode10)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
+ }
+ arg10 = static_cast < int >(val10);
+ ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11);
+ if (!SWIG_IsOK(ecode11)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
+ }
+ arg11 = static_cast < int >(val11);
+ ecode12 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(11), &val12);
+ if (!SWIG_IsOK(ecode12)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
+ }
+ arg12 = static_cast < int >(val12);
+ ecode13 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(12), &val13);
+ if (!SWIG_IsOK(ecode13)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
+ }
+ arg13 = static_cast < int >(val13);
+ result =
+ (IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+ (char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
-XS(_wrap_delete_IVRMenu) {
- {
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_IVRMenu(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_IVRMenu_bindAction) {
- {
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
-XS(_wrap_IVRMenu_execute) {
- {
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->execute(arg2,(char const *)arg3);
-
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
-XS(_wrap_new_API) {
- {
- API *result = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: new_API();");
- }
- result = (API *)new API();
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- XSRETURN(argvi);
- fail:
- SWIG_croak_null();
- }
-}
-XS(_wrap_delete_API) {
- {
- API *arg1 = (API *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_API(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_API_execute) {
- {
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: API_execute(self,command,data);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_IVRMenu) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_IVRMenu(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ delete arg1;
-XS(_wrap_API_executeString) {
- {
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: API_executeString(self,command);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_API, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->executeString((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_input_callback_state_t_function_set) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->function = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_input_callback_state_t_function_get) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: input_callback_state_t_function_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->function);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_IVRMenu_bindAction) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: IVRMenu_bindAction(self,action,arg,bind);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ (arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_input_callback_state_t_threadState_set) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->threadState = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_IVRMenu_execute) {
+ {
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: IVRMenu_execute(self,session,name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->execute(arg2, (char const *) arg3);
-XS(_wrap_input_callback_state_t_threadState_get) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->threadState);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_input_callback_state_t_extra_set) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->extra = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_API) {
+ {
+ API *result = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_API();");
+ }
+ result = (API *) new API();
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_input_callback_state_t_extra_get) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->extra);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_API) {
+ {
+ API *arg1 = (API *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_API(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ delete arg1;
-XS(_wrap_input_callback_state_t_funcargs_set) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->funcargs) delete[] arg1->funcargs;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->funcargs = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
-XS(_wrap_input_callback_state_t_funcargs_get) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (char *) ((arg1)->funcargs);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_input_callback_state_t) {
- {
- input_callback_state_t *result = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: new_input_callback_state_t();");
- }
- result = (input_callback_state_t *)new input_callback_state_t();
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- XSRETURN(argvi);
- fail:
- SWIG_croak_null();
- }
-}
+ XS(_wrap_API_execute) {
+ {
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: API_execute(self,command,data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_delete_input_callback_state_t) {
- {
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_input_callback_state_t(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_API_executeString) {
+ {
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: API_executeString(self,command);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_API, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->executeString((char const *) arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_Stream__SWIG_0) {
- {
- Stream *result = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: new_Stream();");
- }
- result = (Stream *)new Stream();
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- XSRETURN(argvi);
- fail:
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_function_set) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: input_callback_state_t_function_set(self,function);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->function = arg2;
-XS(_wrap_new_Stream__SWIG_1) {
- {
- switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
- Stream *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'");
- }
- arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
- result = (Stream *)new Stream(arg1);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_new_Stream) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 0) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_0); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Stream__SWIG_1); return;
- }
- }
-
- croak("No matching function for overloaded 'new_Stream'");
- XSRETURN(0);
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_delete_Stream) {
- {
- Stream *arg1 = (Stream *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_Stream(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Stream_write) {
- {
- Stream *arg1 = (Stream *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Stream_write(self,data);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->write((char const *)arg2);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_function_get) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: input_callback_state_t_function_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->function);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ argvi++;
-XS(_wrap_Stream_get_data) {
- {
- Stream *arg1 = (Stream *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Stream_get_data(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Stream, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- result = (char *)(arg1)->get_data();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_event_set) {
- {
- Event *arg1 = (Event *) 0 ;
- switch_event_t *arg2 = (switch_event_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_event_set(self,event);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'");
- }
- arg2 = reinterpret_cast< switch_event_t * >(argp2);
- if (arg1) (arg1)->event = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_threadState_set) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: input_callback_state_t_threadState_set(self,threadState);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->threadState = arg2;
-XS(_wrap_Event_event_get) {
- {
- Event *arg1 = (Event *) 0 ;
- switch_event_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_event_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (switch_event_t *) ((arg1)->event);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_Event_serialized_string_set) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->serialized_string) delete[] arg1->serialized_string;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->serialized_string = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Event_serialized_string_get) {
- {
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_serialized_string_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *) ((arg1)->serialized_string);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_mine_set) {
- {
- Event *arg1 = (Event *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_mine_set(self,mine);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- if (arg1) (arg1)->mine = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_threadState_get) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: input_callback_state_t_threadState_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->threadState);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ argvi++;
-XS(_wrap_Event_mine_get) {
- {
- Event *arg1 = (Event *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_mine_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (int) ((arg1)->mine);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_Event__SWIG_0) {
- {
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- Event *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: new_Event(type,subclass_name);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (Event *)new Event((char const *)arg1,(char const *)arg2);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_extra_set) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: input_callback_state_t_extra_set(self,extra);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->extra = arg2;
-XS(_wrap_new_Event__SWIG_1) {
- {
- char *arg1 = (char *) 0 ;
- Event *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: new_Event(type);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- result = (Event *)new Event((char const *)arg1);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- SWIG_croak_null();
- }
-}
-XS(_wrap_new_Event__SWIG_2) {
- {
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- int arg2 ;
- Event *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: new_Event(wrap_me,free_me);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'");
- }
- arg1 = reinterpret_cast< switch_event_t * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- result = (Event *)new Event(arg1,arg2);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_new_Event__SWIG_3) {
- {
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- Event *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: new_Event(wrap_me);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_event_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'");
- }
- arg1 = reinterpret_cast< switch_event_t * >(argp1);
- result = (Event *)new Event(arg1);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_Event) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 3;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_3:
-
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 4;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_4:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_3); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_1); return;
- case 3:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_2); return;
- case 4:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Event__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'new_Event'");
- XSRETURN(0);
-}
+ XS(_wrap_input_callback_state_t_extra_get) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: input_callback_state_t_extra_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->extra);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ argvi++;
-XS(_wrap_delete_Event) {
- {
- Event *arg1 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_Event(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_serialize__SWIG_0) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_serialize(self,format);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->serialize((char const *)arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_funcargs_set) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: input_callback_state_t_funcargs_set(self,funcargs);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->funcargs)
+ delete[]arg1->funcargs;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->funcargs =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->funcargs = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_serialize__SWIG_1) {
- {
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_serialize(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->serialize();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_input_callback_state_t_funcargs_get) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: input_callback_state_t_funcargs_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (char *) ((arg1)->funcargs);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
-XS(_wrap_Event_serialize) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_serialize__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'Event_serialize'");
- XSRETURN(0);
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_setPriority__SWIG_0) {
- {
- Event *arg1 = (Event *) 0 ;
- switch_priority_t arg2 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_setPriority(self,priority);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- {
- res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
- } else {
- arg2 = *(reinterpret_cast< switch_priority_t * >(argp2));
- }
- }
- result = (bool)(arg1)->setPriority(arg2);
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_input_callback_state_t) {
+ {
+ input_callback_state_t *result = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_input_callback_state_t();");
+ }
+ result = (input_callback_state_t *) new input_callback_state_t();
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_setPriority__SWIG_1) {
- {
- Event *arg1 = (Event *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_setPriority(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (bool)(arg1)->setPriority();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_input_callback_state_t) {
+ {
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_input_callback_state_t(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ delete arg1;
-XS(_wrap_Event_setPriority) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'Event_setPriority'");
- XSRETURN(0);
-}
-XS(_wrap_Event_getHeader) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_getHeader(self,header_name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->getHeader(arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_getBody) {
- {
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_getBody(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->getBody();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Stream__SWIG_0) {
+ {
+ Stream *result = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_Stream();");
+ }
+ result = (Stream *) new Stream();
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_getType) {
- {
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_getType(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->getType();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Stream__SWIG_1) {
+ {
+ switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+ Stream *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: new_Stream(switch_stream_handle_t *);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
+ result = (Stream *) new Stream(arg1);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
-XS(_wrap_Event_addBody) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_addBody(self,value);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (bool)(arg1)->addBody((char const *)arg2);
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Event_addHeader) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Stream) {
+ dXSARGS;
-XS(_wrap_Event_delHeader) {
- {
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Event_delHeader(self,header_name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (bool)(arg1)->delHeader((char const *)arg2);
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 0) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Stream__SWIG_0);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Stream__SWIG_1);
+ return;
+ }
+ }
+ croak("No matching function for overloaded 'new_Stream'");
+ XSRETURN(0);
+ }
-XS(_wrap_Event_fire) {
- {
- Event *arg1 = (Event *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Event_fire(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (bool)(arg1)->fire();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_Stream) {
+ {
+ Stream *arg1 = (Stream *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_Stream(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ delete arg1;
-XS(_wrap_delete_CoreSession) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_CoreSession(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_session_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_session_set(self,session);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'");
- }
- arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
- if (arg1) (arg1)->session = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_session_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_session_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_core_session_t *) ((arg1)->session);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Stream_write) {
+ {
+ Stream *arg1 = (Stream *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Stream_write(self,data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->write((char const *) arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_channel_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *arg2 = (switch_channel_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'");
- }
- arg2 = reinterpret_cast< switch_channel_t * >(argp2);
- if (arg1) (arg1)->channel = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Stream_get_data) {
+ {
+ Stream *arg1 = (Stream *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Stream_get_data(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Stream, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ result = (char *) (arg1)->get_data();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
-XS(_wrap_CoreSession_channel_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_channel_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_channel_t *) ((arg1)->channel);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_flags_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- unsigned int val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
- }
- arg2 = static_cast< unsigned int >(val2);
- if (arg1) (arg1)->flags = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_event_set) {
+ {
+ Event *arg1 = (Event *) 0;
+ switch_event_t *arg2 = (switch_event_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_event_set(self,event);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_event_t *>(argp2);
+ if (arg1)
+ (arg1)->event = arg2;
-XS(_wrap_CoreSession_flags_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_flags_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (unsigned int) ((arg1)->flags);
- ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast< unsigned int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_allocated_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- if (arg1) (arg1)->allocated = arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_allocated_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_allocated_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int) ((arg1)->allocated);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_cb_state_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *arg2 = (input_callback_state *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'");
- }
- arg2 = reinterpret_cast< input_callback_state * >(argp2);
- if (arg1) (arg1)->cb_state = *arg2;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_event_get) {
+ {
+ Event *arg1 = (Event *) 0;
+ switch_event_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_event_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (switch_event_t *) ((arg1)->event);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
+ argvi++;
-XS(_wrap_CoreSession_cb_state_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_cb_state_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (input_callback_state *)& ((arg1)->cb_state);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_hook_state_set) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
- } else {
- arg2 = *(reinterpret_cast< switch_channel_state_t * >(argp2));
- }
- }
- if (arg1) (arg1)->hook_state = arg2;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_serialized_string_set) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_serialized_string_set(self,serialized_string);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->serialized_string)
+ delete[]arg1->serialized_string;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->serialized_string =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->serialized_string = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_hook_state_get) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_hook_state_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = ((arg1)->hook_state);
- ST(argvi) = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_serialized_string_get) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_serialized_string_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) ((arg1)->serialized_string);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
-XS(_wrap_CoreSession_answer) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_answer(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->answer();
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_preAnswer) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_preAnswer(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->preAnswer();
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_mine_set) {
+ {
+ Event *arg1 = (Event *) 0;
+ int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_mine_set(self,mine);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ if (arg1)
+ (arg1)->mine = arg2;
-XS(_wrap_CoreSession_hangup__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_hangup(self,cause);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->hangup(arg2);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_hangup__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_hangup(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->hangup();
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_hangup) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_hangup'");
- XSRETURN(0);
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_setVariable) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setVariable(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_mine_get) {
+ {
+ Event *arg1 = (Event *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_mine_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (int) ((arg1)->mine);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
-XS(_wrap_CoreSession_setPrivate) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *arg3 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_ConvertPtr(ST(2),SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'");
- }
- (arg1)->setPrivate(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_getPrivate) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (void *)(arg1)->getPrivate(arg2);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Event__SWIG_0) {
+ {
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ Event *result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: new_Event(type,subclass_name);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_getVariable) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_getVariable(self,var);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->getVariable(arg2);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Event__SWIG_1) {
+ {
+ char *arg1 = (char *) 0;
+ Event *result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: new_Event(type);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ result = (Event *) new Event((char const *) arg1);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_process_callback_result) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (arg1)->process_callback_result(arg2);
- ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Event__SWIG_2) {
+ {
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ int arg2;
+ Event *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: new_Event(wrap_me,free_me);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_event_t *>(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ result = (Event *) new Event(arg1, arg2);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
-XS(_wrap_CoreSession_say) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int res5 ;
- char *buf5 = 0 ;
- int alloc5 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
- }
- arg5 = reinterpret_cast< char * >(buf5);
- (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Event__SWIG_3) {
+ {
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ Event *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: new_Event(wrap_me);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_event_t *>(argp1);
+ result = (Event *) new Event(arg1);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
-XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->sayPhrase((char const *)arg2);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_sayPhrase) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- if (items == 4) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 3;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_3:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1); return;
- case 3:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_sayPhrase'");
- XSRETURN(0);
-}
+ XS(_wrap_new_Event) {
+ dXSARGS;
-XS(_wrap_CoreSession_recordFile__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
-
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
-
-
- SWIG_croak_null();
- }
-}
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_event_t, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 3;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_3:
+
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 4;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_4:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Event__SWIG_3);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Event__SWIG_1);
+ return;
+ case 3:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Event__SWIG_2);
+ return;
+ case 4:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Event__SWIG_0);
+ return;
+ }
+ }
+ croak("No matching function for overloaded 'new_Event'");
+ XSRETURN(0);
+ }
-XS(_wrap_CoreSession_recordFile__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_Event) {
+ {
+ Event *arg1 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_Event(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ delete arg1;
-XS(_wrap_CoreSession_recordFile__SWIG_2) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- result = (int)(arg1)->recordFile(arg2,arg3);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_recordFile__SWIG_3) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->recordFile(arg2);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_recordFile) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- if (items == 4) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 3;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_3:
-
- if (items == 5) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_4;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 4;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_4:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2); return;
- case 3:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1); return;
- case 4:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_recordFile'");
- XSRETURN(0);
-}
+ XS(_wrap_Event_serialize__SWIG_0) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_serialize(self,format);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->serialize((char const *) arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_setCallerData) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setCallerData(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_serialize__SWIG_1) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_serialize(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->serialize();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
-XS(_wrap_CoreSession_originate__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (int)(arg1)->originate(arg2,arg3,arg4);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-
- XSRETURN(argvi);
- fail:
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_originate__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (int)(arg1)->originate(arg2,arg3);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_serialize) {
+ dXSARGS;
-XS(_wrap_CoreSession_originate) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 4) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_originate'");
- XSRETURN(0);
-}
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Event_serialize__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Event_serialize__SWIG_0);
+ return;
+ }
+ }
+ croak("No matching function for overloaded 'Event_serialize'");
+ XSRETURN(0);
+ }
-XS(_wrap_CoreSession_setDTMFCallback) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'");
- }
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setDTMFCallback(arg2,arg3);
-
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_setPriority__SWIG_0) {
+ {
+ Event *arg1 = (Event *) 0;
+ switch_priority_t arg2;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_setPriority(self,priority);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ {
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_priority_t, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t"
+ "'");
+ } else {
+ arg2 = *(reinterpret_cast < switch_priority_t *>(argp2));
+ }
+ }
+ result = (bool) (arg1)->setPriority(arg2);
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
-XS(_wrap_CoreSession_speak) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_speak(self,text);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->speak(arg2);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_set_tts_parms) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->set_tts_parms(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_setPriority__SWIG_1) {
+ {
+ Event *arg1 = (Event *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_setPriority(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (bool) (arg1)->setPriority();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
-XS(_wrap_CoreSession_collectDigits) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- result = (int)(arg1)->collectDigits(arg2);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_getDigits) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-
- XSRETURN(argvi);
- fail:
-
-
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Event_setPriority) {
+ dXSARGS;
-XS(_wrap_CoreSession_transfer) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 4) || (items > 4)) {
- SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- result = (int)(arg1)->transfer(arg2,arg3,arg4);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- SWIG_croak_null();
- }
-}
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_switch_priority_t, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Event_setPriority__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Event_setPriority__SWIG_0);
+ return;
+ }
+ }
+ croak("No matching function for overloaded 'Event_setPriority'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_Event_getHeader) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_getHeader(self,header_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->getHeader(arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_getBody) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_getBody(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->getBody();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_getType) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_getType(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->getType();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_addBody) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_addBody(self,value);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (bool) (arg1)->addBody((char const *) arg2);
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_addHeader) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: Event_addHeader(self,header_name,value);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_delHeader) {
+ {
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Event_delHeader(self,header_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (bool) (arg1)->delHeader((char const *) arg2);
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Event_fire) {
+ {
+ Event *arg1 = (Event *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Event_fire(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (bool) (arg1)->fire();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_delete_CoreSession) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_CoreSession(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ delete arg1;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_session_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *arg2 = (switch_core_session_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_session_set(self,session);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
+ if (arg1)
+ (arg1)->session = arg2;
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_session_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_session_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (switch_core_session_t *) ((arg1)->session);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_channel_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *arg2 = (switch_channel_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_channel_set(self,channel);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_channel_t *>(argp2);
+ if (arg1)
+ (arg1)->channel = arg2;
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_channel_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_channel_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (switch_channel_t *) ((arg1)->channel);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_flags_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ unsigned int val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_flags_set(self,flags);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
+ }
+ arg2 = static_cast < unsigned int >(val2);
+ if (arg1)
+ (arg1)->flags = arg2;
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_flags_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_flags_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (unsigned int) ((arg1)->flags);
+ ST(argvi) = SWIG_From_unsigned_SS_int SWIG_PERL_CALL_ARGS_1(static_cast < unsigned int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_allocated_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_allocated_set(self,allocated);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ if (arg1)
+ (arg1)->allocated = arg2;
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_allocated_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_allocated_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) ((arg1)->allocated);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_cb_state_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *arg2 = (input_callback_state *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_cb_state_set(self,cb_state);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
+ }
+ arg2 = reinterpret_cast < input_callback_state * >(argp2);
+ if (arg1)
+ (arg1)->cb_state = *arg2;
+
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_cb_state_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_cb_state_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (input_callback_state *) & ((arg1)->cb_state);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | SWIG_SHADOW);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_hook_state_set) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_hook_state_set(self,hook_state);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ {
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_switch_channel_state_t, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
+ "switch_channel_state_t" "'");
+ } else {
+ arg2 = *(reinterpret_cast < switch_channel_state_t *>(argp2));
+ }
+ }
+ if (arg1)
+ (arg1)->hook_state = arg2;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_hook_state_get) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_hook_state_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = ((arg1)->hook_state);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_answer) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_answer(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->answer();
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_preAnswer) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_preAnswer(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->preAnswer();
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_hangup__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_hangup(self,cause);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->hangup(arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_hangup__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_hangup(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ (arg1)->hangup();
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_hangup) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_hangup__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_hangup'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_setVariable) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_setVariable(self,var,val);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setVariable(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_setPrivate) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *arg3 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_setPrivate(self,var,val);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_ConvertPtr(ST(2), SWIG_as_voidptrptr(&arg3), 0, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
+ }
+ (arg1)->setPrivate(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_getPrivate) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_getPrivate(self,var);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (void *) (arg1)->getPrivate(arg2);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_getVariable) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_getVariable(self,var);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->getVariable(arg2);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_process_callback_result) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (arg1)->process_callback_result(arg2);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_say) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int res5;
+ char *buf5 = 0;
+ int alloc5 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
+ }
+ arg5 = reinterpret_cast < char *>(buf5);
+ (arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->sayPhrase((char const *) arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_sayPhrase) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ if (items == 4) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 3;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_3:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1);
+ return;
+ case 3:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_sayPhrase'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_recordFile__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int arg5;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int val5;
+ int ecode5 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold,silence_secs);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_recordFile__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len,silence_threshold);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_recordFile__SWIG_2) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_recordFile(self,file_name,max_len);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ result = (int) (arg1)->recordFile(arg2, arg3);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_recordFile__SWIG_3) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_recordFile(self,file_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->recordFile(arg2);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_recordFile) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ if (items == 4) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 3;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_3:
+
+ if (items == 5) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_4;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 4;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_4:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_3);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_2);
+ return;
+ case 3:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_1);
+ return;
+ case 4:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_recordFile__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_recordFile'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_setCallerData) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_setCallerData(self,var,val);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setCallerData(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_originate__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int arg4;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest,timeout);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (int) (arg1)->originate(arg2, arg3, arg4);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_originate__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_originate(self,a_leg_session,dest);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (int) (arg1)->originate(arg2, arg3);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_originate) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 4) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(1), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_originate__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_originate'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_setDTMFCallback) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_setDTMFCallback(self,cbfunc,funcargs);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
+ }
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setDTMFCallback(arg2, arg3);
+
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_speak) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_speak(self,text);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->speak(arg2);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_set_tts_parms) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_set_tts_parms(self,tts_name,voice_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->set_tts_parms(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_collectDigits) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_collectDigits(self,timeout);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ result = (int) (arg1)->collectDigits(arg2);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_getDigits) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ char *arg3 = (char *) 0;
+ int arg4;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_getDigits(self,maxdigits,terminators,timeout);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+
+ XSRETURN(argvi);
+ fail:
+
+
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_transfer) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_transfer(self,extensions,dialplan,context);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ result = (int) (arg1)->transfer(arg2, arg3, arg4);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_read) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ char *arg4 = (char *) 0;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int val5;
+ int ecode5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 6) || (items > 6)) {
+ SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+
+
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ XSRETURN(argvi);
+ fail:
+
+
+
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_playAndGetDigits) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ int arg4;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ char *arg9 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int val5;
+ int ecode5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ int res7;
+ char *buf7 = 0;
+ int alloc7 = 0;
+ int res8;
+ char *buf8 = 0;
+ int alloc8 = 0;
+ int res9;
+ char *buf9 = 0;
+ int alloc9 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 9) || (items > 9)) {
+ SWIG_croak
+ ("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
+ }
+ arg7 = reinterpret_cast < char *>(buf7);
+ res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
+ }
+ arg8 = reinterpret_cast < char *>(buf8);
+ res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
+ if (!SWIG_IsOK(res9)) {
+ SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
+ }
+ arg9 = reinterpret_cast < char *>(buf9);
+ result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+
+
+
+
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ if (alloc9 == SWIG_NEWOBJ)
+ delete[]buf9;
+ XSRETURN(argvi);
+ fail:
+
+
+
+
+
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ if (alloc9 == SWIG_NEWOBJ)
+ delete[]buf9;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_streamFile__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ result = (int) (arg1)->streamFile(arg2, arg3);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_streamFile__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_streamFile(self,file);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->streamFile(arg2);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_streamFile) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ {
+ int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
+ _v = SWIG_CheckState(res);
+ }
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_streamFile'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_flushEvents) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_flushEvents(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->flushEvents();
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_flushDigits) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_flushDigits(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->flushDigits();
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_setAutoHangup) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool arg2;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ bool val2;
+ int ecode2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
+ }
+ arg2 = static_cast < bool > (val2);
+ result = (int) (arg1)->setAutoHangup(arg2);
+ ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(result));
+ argvi++;
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_setHangupHook) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
+ }
+ (arg1)->setHangupHook(arg2);
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_ready) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_ready(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->ready();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_execute__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_execute(self,app,data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->execute(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_execute__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_execute(self,app);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->execute(arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_execute) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0);
+ return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_execute'");
+ XSRETURN(0);
+ }
+
+
+ XS(_wrap_CoreSession_sendEvent) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
+ }
+ arg2 = reinterpret_cast < Event * >(argp2);
+ (arg1)->sendEvent(arg2);
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_setEventData) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_setEventData(self,e);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
+ }
+ arg2 = reinterpret_cast < Event * >(argp2);
+ (arg1)->setEventData(arg2);
+
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_getXMLCDR) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (char *) (arg1)->getXMLCDR();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_begin_allow_threads) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->begin_allow_threads();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_end_allow_threads) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->end_allow_threads();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_get_uuid) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_get_uuid(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (char *) ((CoreSession const *) arg1)->get_uuid();
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_get_cb_args) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_input_args_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_get_cb_args(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ {
+ switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+ result = (switch_input_args_t *) &_result_ref;
+ }
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
+ argvi++;
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_check_hangup_hook) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ (arg1)->check_hangup_hook();
+
+
+ XSRETURN(argvi);
+ fail:
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_CoreSession_run_dtmf_callback) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3),
+ "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
+ "switch_input_type_t" "'");
+ } else {
+ arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+ }
+ }
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
+
+
+ XSRETURN(argvi);
+ fail:
+
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_console_log) {
+ {
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: console_log(level_str,msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ console_log(arg1, arg2);
+
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_console_clean_log) {
+ {
+ char *arg1 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: console_clean_log(msg);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ console_clean_log(arg1);
+
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_read) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- char *arg4 = (char *) 0 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 6) || (items > 6)) {
- SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
-
-
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- XSRETURN(argvi);
- fail:
-
-
-
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
-
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_bridge) {
+ {
+ CoreSession *arg1 = 0;
+ CoreSession *arg2 = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: bridge(session_a,session_b);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ bridge(*arg1, *arg2);
-XS(_wrap_CoreSession_playAndGetDigits) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- char *arg9 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int res7 ;
- char *buf7 = 0 ;
- int alloc7 = 0 ;
- int res8 ;
- char *buf8 = 0 ;
- int alloc8 = 0 ;
- int res9 ;
- char *buf9 = 0 ;
- int alloc9 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 9) || (items > 9)) {
- SWIG_croak("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- ecode5 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- res6 = SWIG_AsCharPtrAndSize(ST(5), &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- res7 = SWIG_AsCharPtrAndSize(ST(6), &buf7, NULL, &alloc7);
- if (!SWIG_IsOK(res7)) {
- SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
- }
- arg7 = reinterpret_cast< char * >(buf7);
- res8 = SWIG_AsCharPtrAndSize(ST(7), &buf8, NULL, &alloc8);
- if (!SWIG_IsOK(res8)) {
- SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
- }
- arg8 = reinterpret_cast< char * >(buf8);
- res9 = SWIG_AsCharPtrAndSize(ST(8), &buf9, NULL, &alloc9);
- if (!SWIG_IsOK(res9)) {
- SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
- }
- arg9 = reinterpret_cast< char * >(buf9);
- result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
-
-
-
-
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
- XSRETURN(argvi);
- fail:
-
-
-
-
-
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_streamFile__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_streamFile(self,file,starting_sample_count);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- result = (int)(arg1)->streamFile(arg2,arg3);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_streamFile__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_streamFile(self,file);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->streamFile(arg2);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_streamFile) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- {
- int res = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(2), NULL);
- _v = SWIG_CheckState(res);
- }
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_streamFile__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_streamFile'");
- XSRETURN(0);
-}
+ XS(_wrap_hanguphook) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: hanguphook(session);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ result = hanguphook(arg1);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_flushEvents) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_flushEvents(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->flushEvents();
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_flushDigits) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_flushDigits(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->flushDigits();
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_dtmf_callback) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ void *arg4 = (void *) 0;
+ unsigned int arg5;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ int res4;
+ unsigned int val5;
+ int ecode5 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ } else {
+ arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+ }
+ }
+ res4 = SWIG_ConvertPtr(ST(3), SWIG_as_voidptrptr(&arg4), 0, 0);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
+ }
+ ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
+ }
+ arg5 = static_cast < unsigned int >(val5);
+ result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
-XS(_wrap_CoreSession_setAutoHangup) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- bool val2 ;
- int ecode2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_setAutoHangup(self,val);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_bool SWIG_PERL_CALL_ARGS_2(ST(1), &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
- }
- arg2 = static_cast< bool >(val2);
- result = (int)(arg1)->setAutoHangup(arg2);
- ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_setHangupHook) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_setHangupHook(self,hangup_func);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'");
- }
- (arg1)->setHangupHook(arg2);
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_ready) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_ready(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->ready();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
-XS(_wrap_CoreSession_execute__SWIG_0) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_execute(self,app,data);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->execute(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_execute__SWIG_1) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_execute(self,app);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->execute(arg2);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Session__SWIG_0) {
+ {
+ PERL::Session * result = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 0) || (items > 0)) {
+ SWIG_croak("Usage: new_Session();");
+ }
+ result = (PERL::Session *) new PERL::Session();
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_execute) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'CoreSession_execute'");
- XSRETURN(0);
-}
+ XS(_wrap_new_Session__SWIG_1) {
+ {
+ char *arg1 = (char *) 0;
+ PERL::Session * result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: new_Session(uuid);");
+ }
+ res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ result = (PERL::Session *) new PERL::Session(arg1);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ XSRETURN(argvi);
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_sendEvent) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_sendEvent(self,sendME);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'");
- }
- arg2 = reinterpret_cast< Event * >(argp2);
- (arg1)->sendEvent(arg2);
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Session__SWIG_2) {
+ {
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ PERL::Session * result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: new_Session(session);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ result = (PERL::Session *) new PERL::Session(arg1);
+ ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_setEventData) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_setEventData(self,e);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'");
- }
- arg2 = reinterpret_cast< Event * >(argp2);
- (arg1)->setEventData(arg2);
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_getXMLCDR) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_getXMLCDR(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (char *)(arg1)->getXMLCDR();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_new_Session) {
+ dXSARGS;
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 0) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ if (items == 1) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_3;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 3;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_3:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Session__SWIG_0);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Session__SWIG_2);
+ return;
+ case 3:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_new_Session__SWIG_1);
+ return;
+ }
+ }
-XS(_wrap_CoreSession_begin_allow_threads) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_begin_allow_threads(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->begin_allow_threads();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ croak("No matching function for overloaded 'new_Session'");
+ XSRETURN(0);
+ }
-XS(_wrap_CoreSession_end_allow_threads) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_end_allow_threads(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->end_allow_threads();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_delete_Session) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: delete_Session(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ delete arg1;
-XS(_wrap_CoreSession_get_uuid) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_get_uuid(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (char *)((CoreSession const *)arg1)->get_uuid();
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_get_cb_args) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_input_args_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_get_cb_args(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
- result = (switch_input_args_t *) &_result_ref;
- }
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_CoreSession_check_hangup_hook) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: CoreSession_check_hangup_hook(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->check_hangup_hook();
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_begin_allow_threads) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_begin_allow_threads(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "Session_begin_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (bool) (arg1)->begin_allow_threads();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_CoreSession_run_dtmf_callback) {
- {
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: CoreSession_run_dtmf_callback(self,input,itype);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0 );
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
- }
- }
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_console_log) {
- {
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: console_log(level_str,msg);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- console_log(arg1,arg2);
-
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_end_allow_threads) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_end_allow_threads(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (bool) (arg1)->end_allow_threads();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_console_clean_log) {
- {
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: console_clean_log(msg);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- console_clean_log(arg1);
-
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_bridge) {
- {
- CoreSession *arg1 = 0 ;
- CoreSession *arg2 = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: bridge(session_a,session_b);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_CoreSession, 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
- }
- if (!argp1) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_CoreSession, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- bridge(*arg1,*arg2);
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_check_hangup_hook) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_check_hangup_hook(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ (arg1)->check_hangup_hook();
-XS(_wrap_hanguphook) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: hanguphook(session);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = hanguphook(arg1);
- ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_dtmf_callback) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- void *arg4 = (void *) 0 ;
- unsigned int arg5 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- int res4 ;
- unsigned int val5 ;
- int ecode5 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 5) || (items > 5)) {
- SWIG_croak("Usage: dtmf_callback(session,input,itype,buf,buflen);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0 );
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
- }
- }
- res4 = SWIG_ConvertPtr(ST(3),SWIG_as_voidptrptr(&arg4), 0, 0);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'");
- }
- ecode5 = SWIG_AsVal_unsigned_SS_int SWIG_PERL_CALL_ARGS_2(ST(4), &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
- }
- arg5 = static_cast< unsigned int >(val5);
- result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
- ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
-
-
-
- XSRETURN(argvi);
- fail:
-
-
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_run_dtmf_callback) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3),
+ "in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3" " of type '"
+ "switch_input_type_t" "'");
+ } else {
+ arg3 = *(reinterpret_cast < switch_input_type_t *>(argp3));
+ }
+ }
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ ST(argvi) =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t,
+ SWIG_POINTER_OWN | 0);
+ argvi++;
-XS(_wrap_new_Session__SWIG_0) {
- {
- PERL::Session *result = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 0) || (items > 0)) {
- SWIG_croak("Usage: new_Session();");
- }
- result = (PERL::Session *)new PERL::Session();
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- XSRETURN(argvi);
- fail:
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_new_Session__SWIG_1) {
- {
- char *arg1 = (char *) 0 ;
- PERL::Session *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: new_Session(uuid);");
- }
- res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- result = (PERL::Session *)new PERL::Session(arg1);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- XSRETURN(argvi);
- fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- SWIG_croak_null();
- }
-}
+
+ SWIG_croak_null();
+ }
+ }
+
+
+ XS(_wrap_Session_setInputCallback) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setInputCallback(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_Session__SWIG_2) {
- {
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- PERL::Session *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: new_Session(session);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Session" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = (PERL::Session *)new PERL::Session(arg1);
- ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PERL__Session, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_setHangupHook__SWIG_0) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setHangupHook(arg2, arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_new_Session) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 0) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_switch_core_session_t, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- if (items == 1) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_3;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 3;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_3:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_0); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_2); return;
- case 3:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_Session__SWIG_1); return;
- }
- }
-
- croak("No matching function for overloaded 'new_Session'");
- XSRETURN(0);
-}
+ XS(_wrap_Session_setHangupHook__SWIG_1) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_setHangupHook(self,func);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->setHangupHook(arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_delete_Session) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: delete_Session(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Session" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- delete arg1;
-
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_setHangupHook) {
+ dXSARGS;
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_1;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 1;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v)
+ goto check_2;
+ _ranki += _v * _pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki;
+ _index = 2;
+ if (_rank == _rankm)
+ goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch (_index) {
+ case 1:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1);
+ return;
+ case 2:
+ ++PL_markstack_ptr;
+ SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0);
+ return;
+ }
+ }
-XS(_wrap_Session_begin_allow_threads) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_begin_allow_threads(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_begin_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (bool)(arg1)->begin_allow_threads();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ croak("No matching function for overloaded 'Session_setHangupHook'");
+ XSRETURN(0);
+ }
-XS(_wrap_Session_end_allow_threads) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_end_allow_threads(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_end_allow_threads" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (bool)(arg1)->end_allow_threads();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_ready) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_ready(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (bool) (arg1)->ready();
+ ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast < bool > (result));
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_check_hangup_hook) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_check_hangup_hook(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_check_hangup_hook" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- (arg1)->check_hangup_hook();
-
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_run_dtmf_callback) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: Session_run_dtmf_callback(self,input,itype);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_run_dtmf_callback" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1),SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_run_dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(ST(2), &argp3, SWIGTYPE_p_switch_input_type_t, 0 );
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Session_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- arg3 = *(reinterpret_cast< switch_input_type_t * >(argp3));
- }
- }
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- ST(argvi) = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0); argvi++ ;
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_cb_function_set) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->cb_function)
+ delete[]arg1->cb_function;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->cb_function =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->cb_function = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_setInputCallback) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: Session_setInputCallback(self,cbfunc,funcargs);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setInputCallback" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setInputCallback" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setInputCallback" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setInputCallback(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_cb_function_get) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_cb_function_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (char *) ((arg1)->cb_function);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_setHangupHook__SWIG_0) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 3) || (items > 3)) {
- SWIG_croak("Usage: Session_setHangupHook(self,func,arg);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Session_setHangupHook" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setHangupHook(arg2,arg3);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_setHangupHook__SWIG_1) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_setHangupHook(self,func);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setHangupHook" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setHangupHook" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->setHangupHook(arg2);
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_cb_arg_set) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->cb_arg)
+ delete[]arg1->cb_arg;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->cb_arg =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->cb_arg = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_setHangupHook) {
- dXSARGS;
-
- {
- unsigned long _index = 0;
- SWIG_TypeRank _rank = 0;
- if (items == 2) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_1;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 1;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_1:
-
- if (items == 3) {
- SWIG_TypeRank _ranki = 0;
- SWIG_TypeRank _rankm = 0;
- SWIG_TypeRank _pi = 1;
- int _v = 0;
- {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_PERL__Session, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- {
- int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
- _v = SWIG_CheckState(res);
- }
- if (!_v) goto check_2;
- _ranki += _v*_pi;
- _rankm += _pi;
- _pi *= SWIG_MAXCASTRANK;
- if (!_index || (_ranki < _rank)) {
- _rank = _ranki; _index = 2;
- if (_rank == _rankm) goto dispatch;
- }
- }
- check_2:
-
- dispatch:
- switch(_index) {
- case 1:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_1); return;
- case 2:
- ++PL_markstack_ptr; SWIG_CALLXS(_wrap_Session_setHangupHook__SWIG_0); return;
- }
- }
-
- croak("No matching function for overloaded 'Session_setHangupHook'");
- XSRETURN(0);
-}
+ XS(_wrap_Session_cb_arg_get) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_cb_arg_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (char *) ((arg1)->cb_arg);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_ready) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_ready(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_ready" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (bool)(arg1)->ready();
- ST(argvi) = SWIG_From_bool SWIG_PERL_CALL_ARGS_1(static_cast< bool >(result)); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_cb_function_set) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_cb_function_set(self,cb_function);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_set" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_function_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->cb_function) delete[] arg1->cb_function;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->cb_function = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->cb_function = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_hangup_func_str_set) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "Session_hangup_func_str_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->hangup_func_str)
+ delete[]arg1->hangup_func_str;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->hangup_func_str =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->hangup_func_str = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_cb_function_get) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_cb_function_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_function_get" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (char *) ((arg1)->cb_function);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_hangup_func_str_get) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_hangup_func_str_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "Session_hangup_func_str_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (char *) ((arg1)->hangup_func_str);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_cb_arg_set) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_cb_arg_set(self,cb_arg);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_set" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_cb_arg_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->cb_arg) delete[] arg1->cb_arg;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->cb_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->cb_arg = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_cb_arg_get) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_cb_arg_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_cb_arg_get" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (char *) ((arg1)->cb_arg);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_hangup_func_arg_set) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "Session_hangup_func_arg_set" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->hangup_func_arg)
+ delete[]arg1->hangup_func_arg;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->hangup_func_arg =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->hangup_func_arg = 0;
+ }
+
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_hangup_func_str_set) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_hangup_func_str_set(self,hangup_func_str);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_set" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_str_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->hangup_func_str) delete[] arg1->hangup_func_str;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->hangup_func_str = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->hangup_func_str = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_hangup_func_arg_get) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 1) || (items > 1)) {
+ SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "Session_hangup_func_arg_get" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ result = (char *) ((arg1)->hangup_func_arg);
+ ST(argvi) = SWIG_FromCharPtr((const char *) result);
+ argvi++;
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_hangup_func_str_get) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_hangup_func_str_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_str_get" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (char *) ((arg1)->hangup_func_str);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-XS(_wrap_Session_hangup_func_arg_set) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_hangup_func_arg_set(self,hangup_func_arg);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_set" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_hangup_func_arg_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->hangup_func_arg) delete[] arg1->hangup_func_arg;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->hangup_func_arg = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->hangup_func_arg = 0;
- }
-
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- XSRETURN(argvi);
- fail:
-
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- SWIG_croak_null();
- }
-}
+ XS(_wrap_Session_setPERL) {
+ {
+ PERL::Session * arg1 = (PERL::Session *) 0;
+ PerlInterpreter *arg2 = (PerlInterpreter *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: Session_setPERL(self,pi);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1, SWIGTYPE_p_PERL__Session, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1" " of type '" "PERL::Session *" "'");
+ }
+ arg1 = reinterpret_cast < PERL::Session * >(argp1);
+ res2 = SWIG_ConvertPtr(ST(1), &argp2, SWIGTYPE_p_PerlInterpreter, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2" " of type '" "PerlInterpreter *" "'");
+ }
+ arg2 = reinterpret_cast < PerlInterpreter * >(argp2);
+ (arg1)->setPERL(arg2);
-XS(_wrap_Session_hangup_func_arg_get) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 1) || (items > 1)) {
- SWIG_croak("Usage: Session_hangup_func_arg_get(self);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_hangup_func_arg_get" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- result = (char *) ((arg1)->hangup_func_arg);
- ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
-
- XSRETURN(argvi);
- fail:
-
- SWIG_croak_null();
- }
-}
+ XSRETURN(argvi);
+ fail:
-XS(_wrap_Session_setPERL) {
- {
- PERL::Session *arg1 = (PERL::Session *) 0 ;
- PerlInterpreter *arg2 = (PerlInterpreter *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int argvi = 0;
- dXSARGS;
-
- if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: Session_setPERL(self,pi);");
- }
- res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_PERL__Session, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Session_setPERL" "', argument " "1"" of type '" "PERL::Session *""'");
- }
- arg1 = reinterpret_cast< PERL::Session * >(argp1);
- res2 = SWIG_ConvertPtr(ST(1), &argp2,SWIGTYPE_p_PerlInterpreter, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Session_setPERL" "', argument " "2"" of type '" "PerlInterpreter *""'");
- }
- arg2 = reinterpret_cast< PerlInterpreter * >(argp2);
- (arg1)->setPERL(arg2);
-
-
-
- XSRETURN(argvi);
- fail:
-
-
- SWIG_croak_null();
- }
-}
+ SWIG_croak_null();
+ }
+ }
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
- return (void *)((CoreSession *) ((PERL::Session *) x));
-}
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)"freeswitch::API", 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)"freeswitch::CoreSession", 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)"freeswitch::Event", 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)"freeswitch::IVRMenu", 0};
-static swig_type_info _swigt__p_PERL__Session = {"_p_PERL__Session", "PERL::Session *", 0, 0, (void*)"freeswitch::Session", 0};
-static swig_type_info _swigt__p_PerlInterpreter = {"_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)"freeswitch::Stream", 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)"freeswitch::input_callback_state_t", 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
- &_swigt__p_API,
- &_swigt__p_CoreSession,
- &_swigt__p_Event,
- &_swigt__p_IVRMenu,
- &_swigt__p_PERL__Session,
- &_swigt__p_PerlInterpreter,
- &_swigt__p_Stream,
- &_swigt__p_char,
- &_swigt__p_input_callback_state,
- &_swigt__p_session_flag_t,
- &_swigt__p_switch_channel_state_t,
- &_swigt__p_switch_channel_t,
- &_swigt__p_switch_core_session_t,
- &_swigt__p_switch_event_t,
- &_swigt__p_switch_input_args_t,
- &_swigt__p_switch_input_type_t,
- &_swigt__p_switch_priority_t,
- &_swigt__p_switch_status_t,
- &_swigt__p_switch_stream_handle_t,
- &_swigt__p_void,
-};
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PERL__Session[] = { {&_swigt__p_PERL__Session, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
- _swigc__p_API,
- _swigc__p_CoreSession,
- _swigc__p_Event,
- _swigc__p_IVRMenu,
- _swigc__p_PERL__Session,
- _swigc__p_PerlInterpreter,
- _swigc__p_Stream,
- _swigc__p_char,
- _swigc__p_input_callback_state,
- _swigc__p_session_flag_t,
- _swigc__p_switch_channel_state_t,
- _swigc__p_switch_channel_t,
- _swigc__p_switch_core_session_t,
- _swigc__p_switch_event_t,
- _swigc__p_switch_input_args_t,
- _swigc__p_switch_input_type_t,
- _swigc__p_switch_priority_t,
- _swigc__p_switch_status_t,
- _swigc__p_switch_stream_handle_t,
- _swigc__p_void,
-};
+ static void *_p_PERL__SessionTo_p_CoreSession(void *x, int *newmemory) {
+ return (void *) ((CoreSession *) ((PERL::Session *) x));
+ }
+ static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) "freeswitch::API", 0 };
+ static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) "freeswitch::CoreSession", 0 };
+ static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) "freeswitch::Event", 0 };
+ static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) "freeswitch::IVRMenu", 0 };
+ static swig_type_info _swigt__p_PERL__Session = { "_p_PERL__Session", "PERL::Session *", 0, 0, (void *) "freeswitch::Session", 0 };
+ static swig_type_info _swigt__p_PerlInterpreter = { "_p_PerlInterpreter", "PerlInterpreter *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) "freeswitch::Stream", 0 };
+ static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_input_callback_state =
+ { "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) "freeswitch::input_callback_state_t", 0 };
+ static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
+
+ static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_API,
+ &_swigt__p_CoreSession,
+ &_swigt__p_Event,
+ &_swigt__p_IVRMenu,
+ &_swigt__p_PERL__Session,
+ &_swigt__p_PerlInterpreter,
+ &_swigt__p_Stream,
+ &_swigt__p_char,
+ &_swigt__p_input_callback_state,
+ &_swigt__p_session_flag_t,
+ &_swigt__p_switch_channel_state_t,
+ &_swigt__p_switch_channel_t,
+ &_swigt__p_switch_core_session_t,
+ &_swigt__p_switch_event_t,
+ &_swigt__p_switch_input_args_t,
+ &_swigt__p_switch_input_type_t,
+ &_swigt__p_switch_priority_t,
+ &_swigt__p_switch_status_t,
+ &_swigt__p_switch_stream_handle_t,
+ &_swigt__p_void,
+ };
+
+ static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_CoreSession[] =
+ { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PERL__Session, _p_PERL__SessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_PERL__Session[] = { {&_swigt__p_PERL__Session, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_PerlInterpreter[] = { {&_swigt__p_PerlInterpreter, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
+
+ static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_API,
+ _swigc__p_CoreSession,
+ _swigc__p_Event,
+ _swigc__p_IVRMenu,
+ _swigc__p_PERL__Session,
+ _swigc__p_PerlInterpreter,
+ _swigc__p_Stream,
+ _swigc__p_char,
+ _swigc__p_input_callback_state,
+ _swigc__p_session_flag_t,
+ _swigc__p_switch_channel_state_t,
+ _swigc__p_switch_channel_t,
+ _swigc__p_switch_core_session_t,
+ _swigc__p_switch_event_t,
+ _swigc__p_switch_input_args_t,
+ _swigc__p_switch_input_type_t,
+ _swigc__p_switch_priority_t,
+ _swigc__p_switch_status_t,
+ _swigc__p_switch_stream_handle_t,
+ _swigc__p_void,
+ };
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-static swig_constant_info swig_constants[] = {
-{0,0,0,0,0,0}
-};
+ static swig_constant_info swig_constants[] = {
+ {0, 0, 0, 0, 0, 0}
+ };
#ifdef __cplusplus
}
#endif
static swig_variable_info swig_variables[] = {
-{0,0,0,0}
+ {0, 0, 0, 0}
};
static swig_command_info swig_commands[] = {
-{"freeswitchc::consoleLog", _wrap_consoleLog},
-{"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
-{"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
-{"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
-{"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
-{"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
-{"freeswitchc::new_API", _wrap_new_API},
-{"freeswitchc::delete_API", _wrap_delete_API},
-{"freeswitchc::API_execute", _wrap_API_execute},
-{"freeswitchc::API_executeString", _wrap_API_executeString},
-{"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
-{"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
-{"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
-{"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
-{"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
-{"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
-{"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
-{"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
-{"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
-{"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
-{"freeswitchc::new_Stream", _wrap_new_Stream},
-{"freeswitchc::delete_Stream", _wrap_delete_Stream},
-{"freeswitchc::Stream_write", _wrap_Stream_write},
-{"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
-{"freeswitchc::Event_event_set", _wrap_Event_event_set},
-{"freeswitchc::Event_event_get", _wrap_Event_event_get},
-{"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
-{"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
-{"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
-{"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
-{"freeswitchc::new_Event", _wrap_new_Event},
-{"freeswitchc::delete_Event", _wrap_delete_Event},
-{"freeswitchc::Event_serialize", _wrap_Event_serialize},
-{"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
-{"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
-{"freeswitchc::Event_getBody", _wrap_Event_getBody},
-{"freeswitchc::Event_getType", _wrap_Event_getType},
-{"freeswitchc::Event_addBody", _wrap_Event_addBody},
-{"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
-{"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
-{"freeswitchc::Event_fire", _wrap_Event_fire},
-{"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
-{"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
-{"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
-{"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
-{"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
-{"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
-{"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
-{"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
-{"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
-{"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
-{"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
-{"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
-{"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
-{"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
-{"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
-{"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
-{"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
-{"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
-{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
-{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
-{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
-{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
-{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
-{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
-{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
-{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
-{"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
-{"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
-{"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
-{"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
-{"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
-{"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
-{"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
-{"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
-{"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
-{"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
-{"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
-{"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
-{"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
-{"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
-{"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
-{"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
-{"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
-{"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
-{"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
-{"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
-{"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
-{"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
-{"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
-{"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
-{"freeswitchc::console_log", _wrap_console_log},
-{"freeswitchc::console_clean_log", _wrap_console_clean_log},
-{"freeswitchc::bridge", _wrap_bridge},
-{"freeswitchc::hanguphook", _wrap_hanguphook},
-{"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
-{"freeswitchc::new_Session", _wrap_new_Session},
-{"freeswitchc::delete_Session", _wrap_delete_Session},
-{"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
-{"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
-{"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
-{"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
-{"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
-{"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
-{"freeswitchc::Session_ready", _wrap_Session_ready},
-{"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
-{"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
-{"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
-{"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
-{"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
-{"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
-{"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
-{"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
-{"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
-{0,0}
+ {"freeswitchc::consoleLog", _wrap_consoleLog},
+ {"freeswitchc::consoleCleanLog", _wrap_consoleCleanLog},
+ {"freeswitchc::new_IVRMenu", _wrap_new_IVRMenu},
+ {"freeswitchc::delete_IVRMenu", _wrap_delete_IVRMenu},
+ {"freeswitchc::IVRMenu_bindAction", _wrap_IVRMenu_bindAction},
+ {"freeswitchc::IVRMenu_execute", _wrap_IVRMenu_execute},
+ {"freeswitchc::new_API", _wrap_new_API},
+ {"freeswitchc::delete_API", _wrap_delete_API},
+ {"freeswitchc::API_execute", _wrap_API_execute},
+ {"freeswitchc::API_executeString", _wrap_API_executeString},
+ {"freeswitchc::input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set},
+ {"freeswitchc::input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get},
+ {"freeswitchc::input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set},
+ {"freeswitchc::input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get},
+ {"freeswitchc::input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set},
+ {"freeswitchc::input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get},
+ {"freeswitchc::input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set},
+ {"freeswitchc::input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get},
+ {"freeswitchc::new_input_callback_state_t", _wrap_new_input_callback_state_t},
+ {"freeswitchc::delete_input_callback_state_t", _wrap_delete_input_callback_state_t},
+ {"freeswitchc::new_Stream", _wrap_new_Stream},
+ {"freeswitchc::delete_Stream", _wrap_delete_Stream},
+ {"freeswitchc::Stream_write", _wrap_Stream_write},
+ {"freeswitchc::Stream_get_data", _wrap_Stream_get_data},
+ {"freeswitchc::Event_event_set", _wrap_Event_event_set},
+ {"freeswitchc::Event_event_get", _wrap_Event_event_get},
+ {"freeswitchc::Event_serialized_string_set", _wrap_Event_serialized_string_set},
+ {"freeswitchc::Event_serialized_string_get", _wrap_Event_serialized_string_get},
+ {"freeswitchc::Event_mine_set", _wrap_Event_mine_set},
+ {"freeswitchc::Event_mine_get", _wrap_Event_mine_get},
+ {"freeswitchc::new_Event", _wrap_new_Event},
+ {"freeswitchc::delete_Event", _wrap_delete_Event},
+ {"freeswitchc::Event_serialize", _wrap_Event_serialize},
+ {"freeswitchc::Event_setPriority", _wrap_Event_setPriority},
+ {"freeswitchc::Event_getHeader", _wrap_Event_getHeader},
+ {"freeswitchc::Event_getBody", _wrap_Event_getBody},
+ {"freeswitchc::Event_getType", _wrap_Event_getType},
+ {"freeswitchc::Event_addBody", _wrap_Event_addBody},
+ {"freeswitchc::Event_addHeader", _wrap_Event_addHeader},
+ {"freeswitchc::Event_delHeader", _wrap_Event_delHeader},
+ {"freeswitchc::Event_fire", _wrap_Event_fire},
+ {"freeswitchc::delete_CoreSession", _wrap_delete_CoreSession},
+ {"freeswitchc::CoreSession_session_set", _wrap_CoreSession_session_set},
+ {"freeswitchc::CoreSession_session_get", _wrap_CoreSession_session_get},
+ {"freeswitchc::CoreSession_channel_set", _wrap_CoreSession_channel_set},
+ {"freeswitchc::CoreSession_channel_get", _wrap_CoreSession_channel_get},
+ {"freeswitchc::CoreSession_flags_set", _wrap_CoreSession_flags_set},
+ {"freeswitchc::CoreSession_flags_get", _wrap_CoreSession_flags_get},
+ {"freeswitchc::CoreSession_allocated_set", _wrap_CoreSession_allocated_set},
+ {"freeswitchc::CoreSession_allocated_get", _wrap_CoreSession_allocated_get},
+ {"freeswitchc::CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set},
+ {"freeswitchc::CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get},
+ {"freeswitchc::CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set},
+ {"freeswitchc::CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get},
+ {"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer},
+ {"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer},
+ {"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup},
+ {"freeswitchc::CoreSession_setVariable", _wrap_CoreSession_setVariable},
+ {"freeswitchc::CoreSession_setPrivate", _wrap_CoreSession_setPrivate},
+ {"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
+ {"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
+ {"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
+ {"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
+ {"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
+ {"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
+ {"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
+ {"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
+ {"freeswitchc::CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback},
+ {"freeswitchc::CoreSession_speak", _wrap_CoreSession_speak},
+ {"freeswitchc::CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms},
+ {"freeswitchc::CoreSession_collectDigits", _wrap_CoreSession_collectDigits},
+ {"freeswitchc::CoreSession_getDigits", _wrap_CoreSession_getDigits},
+ {"freeswitchc::CoreSession_transfer", _wrap_CoreSession_transfer},
+ {"freeswitchc::CoreSession_read", _wrap_CoreSession_read},
+ {"freeswitchc::CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits},
+ {"freeswitchc::CoreSession_streamFile", _wrap_CoreSession_streamFile},
+ {"freeswitchc::CoreSession_flushEvents", _wrap_CoreSession_flushEvents},
+ {"freeswitchc::CoreSession_flushDigits", _wrap_CoreSession_flushDigits},
+ {"freeswitchc::CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup},
+ {"freeswitchc::CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook},
+ {"freeswitchc::CoreSession_ready", _wrap_CoreSession_ready},
+ {"freeswitchc::CoreSession_execute", _wrap_CoreSession_execute},
+ {"freeswitchc::CoreSession_sendEvent", _wrap_CoreSession_sendEvent},
+ {"freeswitchc::CoreSession_setEventData", _wrap_CoreSession_setEventData},
+ {"freeswitchc::CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR},
+ {"freeswitchc::CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads},
+ {"freeswitchc::CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads},
+ {"freeswitchc::CoreSession_get_uuid", _wrap_CoreSession_get_uuid},
+ {"freeswitchc::CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args},
+ {"freeswitchc::CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook},
+ {"freeswitchc::CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback},
+ {"freeswitchc::console_log", _wrap_console_log},
+ {"freeswitchc::console_clean_log", _wrap_console_clean_log},
+ {"freeswitchc::bridge", _wrap_bridge},
+ {"freeswitchc::hanguphook", _wrap_hanguphook},
+ {"freeswitchc::dtmf_callback", _wrap_dtmf_callback},
+ {"freeswitchc::new_Session", _wrap_new_Session},
+ {"freeswitchc::delete_Session", _wrap_delete_Session},
+ {"freeswitchc::Session_begin_allow_threads", _wrap_Session_begin_allow_threads},
+ {"freeswitchc::Session_end_allow_threads", _wrap_Session_end_allow_threads},
+ {"freeswitchc::Session_check_hangup_hook", _wrap_Session_check_hangup_hook},
+ {"freeswitchc::Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback},
+ {"freeswitchc::Session_setInputCallback", _wrap_Session_setInputCallback},
+ {"freeswitchc::Session_setHangupHook", _wrap_Session_setHangupHook},
+ {"freeswitchc::Session_ready", _wrap_Session_ready},
+ {"freeswitchc::Session_cb_function_set", _wrap_Session_cb_function_set},
+ {"freeswitchc::Session_cb_function_get", _wrap_Session_cb_function_get},
+ {"freeswitchc::Session_cb_arg_set", _wrap_Session_cb_arg_set},
+ {"freeswitchc::Session_cb_arg_get", _wrap_Session_cb_arg_get},
+ {"freeswitchc::Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set},
+ {"freeswitchc::Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get},
+ {"freeswitchc::Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set},
+ {"freeswitchc::Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get},
+ {"freeswitchc::Session_setPERL", _wrap_Session_setPERL},
+ {0, 0}
};
+
/* -----------------------------------------------------------------------------
* Type initialization:
* This problem is tough by the requirement that no dynamic
@@ -8369,160 +8878,162 @@
#ifdef __cplusplus
extern "C" {
#if 0
-} /* c-mode */
+} /* c-mode */
#endif
#endif
-
#if 0
#define SWIGRUNTIME_DEBUG
#endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int found, init;
+
+ clientdata = clientdata;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next == 0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found = 0;
+ iter = module_head;
+ do {
+ if (iter == &swig_module) {
+ found = 1;
+ break;
+ }
+ iter = iter->next;
+ } while (iter != module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found)
+ return;
+ /* otherwise we must add out module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
- size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
-
- clientdata = clientdata;
-
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
-
- /* Try and load any already created modules */
- module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
- swig_module.next = module_head->next;
- module_head->next = &swig_module;
- }
-
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
- /* Now work on filling in swig_module.types */
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0)
+ return;
+
+ /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
- for (i = 0; i < swig_module.size; ++i) {
- swig_type_info *type = 0;
- swig_type_info *ret;
- swig_cast_info *cast;
-
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
-
- /* if there is another module already loaded */
- if (swig_module.next != &swig_module) {
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
- }
- if (type) {
- /* Overwrite clientdata field */
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found type %s\n", type->name);
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
- if (swig_module.type_initial[i]->clientdata) {
- type->clientdata = swig_module.type_initial[i]->clientdata;
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
- }
- } else {
- type = swig_module.type_initial[i];
- }
-
- /* Insert casting types */
- cast = swig_module.cast_initial[i];
- while (cast->type) {
- /* Don't need to add information already in the list */
- ret = 0;
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+ /* Don't need to add information already in the list */
+ ret = 0;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
- if (swig_module.next != &swig_module) {
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+ if (ret)
+ printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
- }
- if (ret) {
- if (type == swig_module.type_initial[i]) {
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
- cast->type = ret;
- ret = 0;
- } else {
- /* Check for casting already in the list */
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+ if (ocast)
+ printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
- if (!ocast) ret = 0;
- }
- }
-
- if (!ret) {
+ if (!ocast)
+ ret = 0;
+ }
+ }
+
+ if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
- if (type->cast) {
- type->cast->prev = cast;
- cast->next = type->cast;
- }
- type->cast = cast;
- }
- cast++;
- }
- /* Set entry in modules->types array equal to the type */
- swig_module.types[i] = type;
- }
- swig_module.types[i] = 0;
-
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
#ifdef SWIGRUNTIME_DEBUG
- printf("**** SWIG_InitializeModule: Cast List ******\n");
- for (i = 0; i < swig_module.size; ++i) {
- int j = 0;
- swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
- while (cast->type) {
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
- cast++;
- ++j;
- }
- printf("---- Total casts: %d\n",j);
- }
- printf("**** SWIG_InitializeModule: Cast List ******\n");
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n", j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}
@@ -8531,33 +9042,34 @@
* of equivalent types. It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
- size_t i;
- swig_cast_info *equiv;
- static int init_run = 0;
-
- if (init_run) return;
- init_run = 1;
-
- for (i = 0; i < swig_module.size; i++) {
- if (swig_module.types[i]->clientdata) {
- equiv = swig_module.types[i]->cast;
- while (equiv) {
- if (!equiv->converter) {
- if (equiv->type && !equiv->type->clientdata)
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
- }
- equiv = equiv->next;
- }
- }
- }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run)
+ return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
}
#ifdef __cplusplus
#if 0
{
- /* c-mode */
+ /* c-mode */
#endif
}
#endif
@@ -8567,80 +9079,86 @@
#ifdef __cplusplus
extern "C"
#endif
+ XS(SWIG_init)
+{
+ dXSARGS;
+ int i;
-XS(SWIG_init) {
- dXSARGS;
- int i;
-
- SWIG_InitializeModule(0);
-
- /* Install commands */
- for (i = 0; swig_commands[i].name; i++) {
- newXS((char*) swig_commands[i].name,swig_commands[i].wrapper, (char*)__FILE__);
- }
-
- /* Install variables */
- for (i = 0; swig_variables[i].name; i++) {
- SV *sv;
- sv = get_sv((char*) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
- if (swig_variables[i].type) {
- SWIG_MakePtr(sv,(void *)1, *swig_variables[i].type,0);
- } else {
- sv_setiv(sv,(IV) 0);
- }
- swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
- }
-
- /* Install constant */
- for (i = 0; swig_constants[i].type; i++) {
- SV *sv;
- sv = get_sv((char*)swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
- switch(swig_constants[i].type) {
- case SWIG_INT:
- sv_setiv(sv, (IV) swig_constants[i].lvalue);
- break;
- case SWIG_FLOAT:
- sv_setnv(sv, (double) swig_constants[i].dvalue);
- break;
- case SWIG_STRING:
- sv_setpv(sv, (char *) swig_constants[i].pvalue);
- break;
- case SWIG_POINTER:
- SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype),0);
- break;
- case SWIG_BINARY:
- SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
- break;
- default:
- break;
- }
- SvREADONLY_on(sv);
- }
-
- SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu");
- SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API");
- SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t");
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
- SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
- sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP)));
- SvREADONLY_on(sv);
- } while(0) /*@SWIG@*/;
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
- SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
- sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE)));
- SvREADONLY_on(sv);
- } while(0) /*@SWIG@*/;
- /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do {
- SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
- sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK)));
- SvREADONLY_on(sv);
- } while(0) /*@SWIG@*/;
- SWIG_TypeClientData(SWIGTYPE_p_Stream, (void*) "freeswitch::Stream");
- SWIG_TypeClientData(SWIGTYPE_p_Event, (void*) "freeswitch::Event");
- SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void*) "freeswitch::CoreSession");
- SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void*) "freeswitch::Session");
- ST(0) = &PL_sv_yes;
- XSRETURN(1);
+ SWIG_InitializeModule(0);
+
+ /* Install commands */
+ for (i = 0; swig_commands[i].name; i++) {
+ newXS((char *) swig_commands[i].name, swig_commands[i].wrapper, (char *) __FILE__);
+ }
+
+ /* Install variables */
+ for (i = 0; swig_variables[i].name; i++) {
+ SV *sv;
+ sv = get_sv((char *) swig_variables[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ if (swig_variables[i].type) {
+ SWIG_MakePtr(sv, (void *) 1, *swig_variables[i].type, 0);
+ } else {
+ sv_setiv(sv, (IV) 0);
+ }
+ swig_create_magic(sv, (char *) swig_variables[i].name, swig_variables[i].set, swig_variables[i].get);
+ }
+
+ /* Install constant */
+ for (i = 0; swig_constants[i].type; i++) {
+ SV *sv;
+ sv = get_sv((char *) swig_constants[i].name, TRUE | 0x2 | GV_ADDMULTI);
+ switch (swig_constants[i].type) {
+ case SWIG_INT:
+ sv_setiv(sv, (IV) swig_constants[i].lvalue);
+ break;
+ case SWIG_FLOAT:
+ sv_setnv(sv, (double) swig_constants[i].dvalue);
+ break;
+ case SWIG_STRING:
+ sv_setpv(sv, (char *) swig_constants[i].pvalue);
+ break;
+ case SWIG_POINTER:
+ SWIG_MakePtr(sv, swig_constants[i].pvalue, *(swig_constants[i].ptype), 0);
+ break;
+ case SWIG_BINARY:
+ SWIG_MakePackedObj(sv, swig_constants[i].pvalue, swig_constants[i].lvalue, *(swig_constants[i].ptype));
+ break;
+ default:
+ break;
+ }
+ SvREADONLY_on(sv);
+ }
+
+ SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void *) "freeswitch::IVRMenu");
+ SWIG_TypeClientData(SWIGTYPE_p_API, (void *) "freeswitch::API");
+ SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void *) "freeswitch::input_callback_state_t");
+ /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+ do {
+ SV *sv = get_sv((char *) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_HUP)));
+ SvREADONLY_on(sv);
+ } while (0) /*@SWIG@ */
+ ;
+ /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+ do {
+ SV *sv = get_sv((char *) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_FREE)));
+ SvREADONLY_on(sv);
+ } while (0) /*@SWIG@ */
+ ;
+ /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@ */
+ do {
+ SV *sv = get_sv((char *) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI);
+ sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast < int >(S_RDLOCK)));
+ SvREADONLY_on(sv);
+ } while (0) /*@SWIG@ */
+ ;
+ SWIG_TypeClientData(SWIGTYPE_p_Stream, (void *) "freeswitch::Stream");
+ SWIG_TypeClientData(SWIGTYPE_p_Event, (void *) "freeswitch::Event");
+ SWIG_TypeClientData(SWIGTYPE_p_CoreSession, (void *) "freeswitch::CoreSession");
+ SWIG_TypeClientData(SWIGTYPE_p_PERL__Session, (void *) "freeswitch::Session");
+ ST(0) = &PL_sv_yes;
+ XSRETURN(1);
}
#include "mod_perl_extra.c"
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/perlxsi.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/perlxsi.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/perlxsi.c Tue May 27 07:24:06 2008
@@ -1,13 +1,12 @@
#include <EXTERN.h>
#include <perl.h>
-EXTERN_C void xs_init (pTHX);
+EXTERN_C void xs_init(pTHX);
-EXTERN_C void boot_DynaLoader (pTHX_ CV* cv);
-EXTERN_C void boot_freeswitch (pTHX_ CV* cv);
+EXTERN_C void boot_DynaLoader(pTHX_ CV * cv);
+EXTERN_C void boot_freeswitch(pTHX_ CV * cv);
-EXTERN_C void
-xs_init(pTHX)
+EXTERN_C void xs_init(pTHX)
{
char *file = __FILE__;
dXSUB_SYS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch_python.cpp Tue May 27 07:24:06 2008
@@ -3,336 +3,317 @@
#define sanity_check(x) do { if (!session) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
#define init_vars() do { caller_profile.source = "mod_python"; swapstate = S_SWAPPED_IN; } while(0)
-PySession::PySession() : CoreSession()
+PySession::PySession():CoreSession()
{
init_vars();
}
-PySession::PySession(char *uuid) : CoreSession(uuid)
+PySession::PySession(char *uuid):CoreSession(uuid)
{
init_vars();
}
-PySession::PySession(switch_core_session_t *new_session) : CoreSession(new_session)
+PySession::PySession(switch_core_session_t *new_session):CoreSession(new_session)
{
init_vars();
}
-void PySession::setDTMFCallback(PyObject *pyfunc, char *funcargs)
+void PySession::setDTMFCallback(PyObject * pyfunc, char *funcargs)
{
- sanity_check();
+ sanity_check();
- if (!PyCallable_Check(pyfunc)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
- return;
- }
- Py_XINCREF(pyfunc);
- CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
+ if (!PyCallable_Check(pyfunc)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF function is not a python function.\n");
+ return;
+ }
+ Py_XINCREF(pyfunc);
+ CoreSession::setDTMFCallback((void *) pyfunc, funcargs);
}
-void PySession::setHangupHook(PyObject *pyfunc) {
+void PySession::setHangupHook(PyObject * pyfunc)
+{
+
+ if (!PyCallable_Check(pyfunc)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
+ return;
+ }
+ // without this Py_XINCREF, there will be segfaults. basically the python
+ // interpreter will not know that it should not GC this object.
+ // callback example: http://docs.python.org/ext/callingPython.html
+ Py_XINCREF(pyfunc);
+ CoreSession::setHangupHook((void *) pyfunc);
+
+}
+
+
+void PySession::check_hangup_hook()
+{
+ PyObject *func;
+ PyObject *result;
+ char *resultStr;
+ bool did_swap_in = false;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+ "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
+
+ if (!session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+ return;
+ }
- if (!PyCallable_Check(pyfunc)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hangup hook is not a python function.\n");
return;
- }
- // without this Py_XINCREF, there will be segfaults. basically the python
- // interpreter will not know that it should not GC this object.
- // callback example: http://docs.python.org/ext/callingPython.html
- Py_XINCREF(pyfunc);
- CoreSession::setHangupHook((void *) pyfunc);
+ /*! NEEDS TO BE FIXED:
+
+ // The did_swap_in boolean was added to fix the following problem:
+ // Design flaw - we swap in threadstate based on the assumption that thread state
+ // is currently _swapped out_ when this hangup hook is called. However, nothing known to
+ // guarantee that, and if thread state is already swapped in when this is invoked,
+ // bad things will happen.
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
+ did_swap_in = end_allow_threads();
+
+ if (on_hangup == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
+ return;
+ }
+
+ func = (PyObject *) on_hangup;
+
+ // TODO: to match js implementation, should pass the _python_ PySession
+ // object instance wrapping this C++ PySession instance. but how do we do that?
+ // for now, pass the uuid since its better than nothing
+ PyObject* func_arg = Py_BuildValue("(s)", uuid);
+
+ result = PyEval_CallObject(func, func_arg);
+ Py_XDECREF(func_arg);
+
+ if (result) {
+ resultStr = (char *) PyString_AsString(result);
+ // currently just ignore the result
+ }
+ else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
+ PyErr_Print();
+ PyErr_Clear();
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
+ if (did_swap_in) {
+ begin_allow_threads();
+ }
+ Py_XDECREF(result);
+ */
}
+switch_status_t PySession::run_dtmf_callback(void *input, switch_input_type_t itype)
+{
+
+ PyObject *func, *arglist;
+ PyObject *pyresult;
+ PyObject *headerdict;
-void PySession::check_hangup_hook() {
- PyObject *func;
- PyObject *result;
- char *resultStr;
- bool did_swap_in = false;
+ char *resultStr;
+ char *funcargs;
+ switch_file_handle_t *fh = NULL;
+ bool did_swap_in = false;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "check_hangup_hook has been DISABLED, please do not use hangup hooks in python code until further notice!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");
+
+
+ if (!cb_state.function) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ func = (PyObject *) cb_state.function;
+ if (!func) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
+ return SWITCH_STATUS_FALSE;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
+ }
+ if (!PyCallable_Check(func)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ funcargs = (char *) cb_state.funcargs;
+
+ if (itype == SWITCH_INPUT_TYPE_DTMF) {
+
+ arglist = Py_BuildValue("(sis)", input, itype, funcargs);
+ } else if (itype == SWITCH_INPUT_TYPE_EVENT) {
+ // DUNNO if this is correct in the case we have an event
+ // will be of type switch_event_t *event;
+ // http://www.freeswitch.org/docs/structswitch__event.html
+ switch_event_t *event = (switch_event_t *) input;
+ arglist = Py_BuildValue("({s:s}is)", "body", event->body, itype, funcargs);
+
+ // build a dictionary with all the headers
+
+ switch_event_header_t *hp;
+ headerdict = PyDict_New();
+ for (hp = event->headers; hp; hp = hp->next) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");
+
+ // TODO: create PyObject pointers for name and value
+ // and explicitly decref them. all ref counting stuff is
+ // a mess and needs to be tested and looked at closer.
+ PyDict_SetItem(headerdict, Py_BuildValue("s", hp->name), Py_BuildValue("s", hp->value));
+
+ }
+
+ // add it to the main event dictionary (first arg in list)
+ // under key 'headers'
+ PyObject *dict = PyTuple_GetItem(arglist, 0);
+ PyDict_SetItemString(dict, "headers", headerdict);
+
+ Py_XDECREF(headerdict);
+
+
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);
+ return SWITCH_STATUS_FALSE;
+ }
- if (!session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
- return;
- }
- return;
+ if (!arglist) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
+ return SWITCH_STATUS_FALSE;
+ }
- /*! NEEDS TO BE FIXED:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
+ did_swap_in = end_allow_threads();
+
+ pyresult = PyEval_CallObject(func, arglist);
+
+
+ Py_XDECREF(arglist); // Trash arglist
+
+ if (pyresult && pyresult != Py_None) {
+ resultStr = (char *) PyString_AsString(pyresult);
+ switch_status_t cbresult = process_callback_result(resultStr);
+ return cbresult;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
+ PyErr_Print();
+ PyErr_Clear();
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
+ if (did_swap_in) {
+ begin_allow_threads();
+ }
+
+ Py_XDECREF(pyresult);
+
+ return SWITCH_STATUS_SUCCESS;
- // The did_swap_in boolean was added to fix the following problem:
- // Design flaw - we swap in threadstate based on the assumption that thread state
- // is currently _swapped out_ when this hangup hook is called. However, nothing known to
- // guarantee that, and if thread state is already swapped in when this is invoked,
- // bad things will happen.
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook end_allow_threads\n");
- did_swap_in = end_allow_threads();
-
- if (on_hangup == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "on_hangup is null\n");
- return;
- }
-
- func = (PyObject *) on_hangup;
-
- // TODO: to match js implementation, should pass the _python_ PySession
- // object instance wrapping this C++ PySession instance. but how do we do that?
- // for now, pass the uuid since its better than nothing
- PyObject* func_arg = Py_BuildValue("(s)", uuid);
-
- result = PyEval_CallObject(func, func_arg);
- Py_XDECREF(func_arg);
-
- if (result) {
- resultStr = (char *) PyString_AsString(result);
- // currently just ignore the result
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to call python hangup callback\n");
- PyErr_Print();
- PyErr_Clear();
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "check hangup hook begin_allow_threads\n");
- if (did_swap_in) {
- begin_allow_threads();
- }
-
- Py_XDECREF(result);
- */
-}
-
-switch_status_t PySession::run_dtmf_callback(void *input,
- switch_input_type_t itype) {
-
- PyObject *func, *arglist;
- PyObject *pyresult;
- PyObject *headerdict;
-
- char *resultStr;
- char *funcargs;
- switch_file_handle_t *fh = NULL;
- bool did_swap_in = false;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback\n");
-
-
- if (!cb_state.function) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
- return SWITCH_STATUS_FALSE;
- }
-
- func = (PyObject *) cb_state.function;
- if (!func) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cb_state->function is null\n");
- return SWITCH_STATUS_FALSE;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state->function is NOT null\n");
- }
- if (!PyCallable_Check(func)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "function not callable\n");
- return SWITCH_STATUS_FALSE;
- }
-
- funcargs = (char *) cb_state.funcargs;
-
- if (itype == SWITCH_INPUT_TYPE_DTMF) {
-
- arglist = Py_BuildValue("(sis)", input, itype, funcargs);
- }
- else if (itype == SWITCH_INPUT_TYPE_EVENT) {
- // DUNNO if this is correct in the case we have an event
- // will be of type switch_event_t *event;
- // http://www.freeswitch.org/docs/structswitch__event.html
- switch_event_t *event = (switch_event_t *) input;
- arglist = Py_BuildValue("({s:s}is)",
- "body", event->body,
- itype,
- funcargs);
-
- // build a dictionary with all the headers
-
- switch_event_header_t *hp;
- headerdict = PyDict_New();
- for (hp = event->headers; hp; hp = hp->next) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding event header to result");
-
- // TODO: create PyObject pointers for name and value
- // and explicitly decref them. all ref counting stuff is
- // a mess and needs to be tested and looked at closer.
- PyDict_SetItem(headerdict,
- Py_BuildValue("s", hp->name),
- Py_BuildValue("s", hp->value));
-
- }
-
- // add it to the main event dictionary (first arg in list)
- // under key 'headers'
- PyObject *dict = PyTuple_GetItem(arglist, 0);
- PyDict_SetItemString(dict,
- "headers",
- headerdict);
-
- Py_XDECREF(headerdict);
-
-
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown input type: %d\n", itype);
- return SWITCH_STATUS_FALSE;
- }
-
-
- if (!arglist) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error building arglist");
- return SWITCH_STATUS_FALSE;
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback end_allow_threads\n");
- did_swap_in = end_allow_threads();
-
- pyresult = PyEval_CallObject(func, arglist);
-
-
- Py_XDECREF(arglist); // Trash arglist
-
- if (pyresult && pyresult != Py_None) {
- resultStr = (char *) PyString_AsString(pyresult);
- switch_status_t cbresult = process_callback_result(resultStr);
- return cbresult;
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Python callback\n returned None");
- PyErr_Print();
- PyErr_Clear();
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "run_dtmf_callback begin_allow_threads\n");
- if (did_swap_in) {
- begin_allow_threads();
- }
-
- Py_XDECREF(pyresult);
-
- return SWITCH_STATUS_SUCCESS;
-
-}
-
-bool PySession::begin_allow_threads(void) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
-
- if (!session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
- return false;
- }
-
- // swap out threadstate and store in instance variable
- switch_channel_t *channel = switch_core_session_get_channel(session);
- PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
- // so lets assume the thread state was swapped in when the python script was started,
- // therefore swapin_tstate will be NULL (because there is nothing to swap in, since its
- // _already_ swapped in.)
- if (swapin_tstate == NULL) {
- // currently swapped in
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");
- swapin_tstate = PyEval_SaveThread();
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
- // give future swapper-inners something to actually swap in
- switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate);
- cb_state.threadState = threadState; // TODO: get rid of this
- args.buf = &cb_state;
- ap = &args;
- return true;
-
- }
- else {
- // currently swapped out
- return false;
- }
-
-}
-
-bool PySession::end_allow_threads(void) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
- // swap in threadstate from instance variable saved earlier
- if (!session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
- return false;
- }
-
- switch_channel_t *channel = switch_core_session_get_channel(session);
- PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
- if (swapin_tstate == NULL) {
- // currently swapped in
- return false;
- }
- else {
- // currently swapped out
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
- PyEval_RestoreThread(swapin_tstate);
- // dont give any swapper-inners the opportunity to do a double swap
- switch_channel_set_private(channel, "SwapInThreadState", NULL);
- return true;
- }
-
-
-}
-
-void PySession::hangup(char *cause) {
-
-
- // since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
- // we have to DECREF it, or else the PySession dtor will never get called and
- // a zombie channel will be left over using up resources
-
- if (cb_state.function != NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");
- PyObject * func = (PyObject *) cb_state.function;
- Py_XDECREF(func);
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");
- }
-
-
- CoreSession::hangup(cause);
-
-}
-
-
-PySession::~PySession() {
- // Should we do any cleanup here?
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
-
- if (on_hangup) {
- PyObject * func = (PyObject *) on_hangup;
- Py_XDECREF(func);
- }
-
-
- if (cb_state.function != NULL) {
- PyObject * func = (PyObject *) cb_state.function;
- Py_XDECREF(func);
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
-
}
+bool PySession::begin_allow_threads(void)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::begin_allow_threads() called\n");
+
+ if (!session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+ return false;
+ }
+ // swap out threadstate and store in instance variable
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
+ // so lets assume the thread state was swapped in when the python script was started,
+ // therefore swapin_tstate will be NULL (because there is nothing to swap in, since its
+ // _already_ swapped in.)
+ if (swapin_tstate == NULL) {
+ // currently swapped in
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-out!\n");
+ swapin_tstate = PyEval_SaveThread();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
+ // give future swapper-inners something to actually swap in
+ switch_channel_set_private(channel, "SwapInThreadState", (void *) swapin_tstate);
+ cb_state.threadState = threadState; // TODO: get rid of this
+ args.buf = &cb_state;
+ ap = &args;
+ return true;
+
+ } else {
+ // currently swapped out
+ return false;
+ }
+}
+bool PySession::end_allow_threads(void)
+{
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::end_allow_threads() called\n");
+ // swap in threadstate from instance variable saved earlier
+ if (!session) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No valid session\n");
+ return false;
+ }
+
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ PyThreadState *swapin_tstate = (PyThreadState *) switch_channel_get_private(channel, "SwapInThreadState");
+ if (swapin_tstate == NULL) {
+ // currently swapped in
+ return false;
+ } else {
+ // currently swapped out
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Threadstate swap-in!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "swapin_tstate: %p\n", swapin_tstate);
+ PyEval_RestoreThread(swapin_tstate);
+ // dont give any swapper-inners the opportunity to do a double swap
+ switch_channel_set_private(channel, "SwapInThreadState", NULL);
+ return true;
+ }
+}
+void PySession::hangup(char *cause)
+{
+ // since we INCREF'd this function pointer earlier (so the py gc didnt reclaim it)
+ // we have to DECREF it, or else the PySession dtor will never get called and
+ // a zombie channel will be left over using up resources
+ if (cb_state.function != NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "xdecref on cb_state_function\n");
+ PyObject *func = (PyObject *) cb_state.function;
+ Py_XDECREF(func);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cb_state.function is null\n");
+ }
+
+ CoreSession::hangup(cause);
+
+}
+
+
+PySession::~PySession()
+{
+ // Should we do any cleanup here?
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession started\n");
+
+ if (on_hangup) {
+ PyObject *func = (PyObject *) on_hangup;
+ Py_XDECREF(func);
+ }
+
+
+ if (cb_state.function != NULL) {
+ PyObject *func = (PyObject *) cb_state.function;
+ Py_XDECREF(func);
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PySession::~PySession finished\n");
+
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python.c Tue May 27 07:24:06 2008
@@ -58,7 +58,7 @@
{
PyThreadState *tstate = NULL;
char *dupargs = NULL;
- char *argv[128] = {0};
+ char *argv[128] = { 0 };
int argc;
int lead = 0;
char *script = NULL;
@@ -68,16 +68,16 @@
PyObject *result = NULL;
if (args) {
- dupargs = strdup(args);
+ dupargs = strdup(args);
} else {
- return;
+ return;
}
assert(dupargs != NULL);
-
+
if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
- goto done;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
+ goto done;
}
script = argv[0];
@@ -87,80 +87,76 @@
tstate = PyThreadState_New(mainThreadState->interp);
if (!tstate) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
- goto done;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
+ goto done;
}
-
// swap in thread state
PyEval_AcquireThread(tstate);
if (session) {
- // record the fact that thread state is swapped in
- switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_channel_set_private(channel, "SwapInThreadState", NULL);
+ // record the fact that thread state is swapped in
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_channel_set_private(channel, "SwapInThreadState", NULL);
}
- init_freeswitch();
+ init_freeswitch();
// import the module
- module = PyImport_ImportModule( (char *) script);
+ module = PyImport_ImportModule((char *) script);
if (!module) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n");
- PyErr_Print();
- PyErr_Clear();
- goto done_swap_out;
- }
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error importing module\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
// reload the module
module = PyImport_ReloadModule(module);
if (!module) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n");
- PyErr_Print();
- PyErr_Clear();
- goto done_swap_out;
- }
-
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error reloading module\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
// get the handler function to be called
function = PyObject_GetAttrString(module, "handler");
if (!function) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
- PyErr_Print();
- PyErr_Clear();
- goto done_swap_out;
- }
-
- if (uuid) {
- // build a tuple to pass the args, the uuid of session
- arg = Py_BuildValue("(s)", uuid);
- if (!arg) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define handler(uuid)\n");
PyErr_Print();
PyErr_Clear();
goto done_swap_out;
- }
}
- else {
- arg = PyTuple_New(1);
- PyObject *nada = Py_BuildValue("");
- PyTuple_SetItem(arg, 0, nada);
+
+ if (uuid) {
+ // build a tuple to pass the args, the uuid of session
+ arg = Py_BuildValue("(s)", uuid);
+ if (!arg) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error building args\n");
+ PyErr_Print();
+ PyErr_Clear();
+ goto done_swap_out;
+ }
+ } else {
+ arg = PyTuple_New(1);
+ PyObject *nada = Py_BuildValue("");
+ PyTuple_SetItem(arg, 0, nada);
}
// invoke the handler
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
- result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *)NULL);
+ result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n");
// check the result and print out any errors
if (!result) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
- PyErr_Print();
- PyErr_Clear();
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error calling python script\n");
+ PyErr_Print();
+ PyErr_Clear();
}
goto done_swap_out;
- done:
+ done:
switch_safe_free(dupargs);
- done_swap_out:
+ done_swap_out:
// decrement ref counts
Py_XDECREF(module);
Py_XDECREF(function);
@@ -183,14 +179,12 @@
PyThreadState *cur_tstate = PyThreadState_Get();
PyThreadState_Clear(cur_tstate);
PyEval_ReleaseThread(cur_tstate);
- PyThreadState_Delete(cur_tstate);
- }
- else {
+ PyThreadState_Delete(cur_tstate);
+ } else {
// thread state is already swapped out, so, nothing for us to do
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "according to chan priv data, already swapped out \n");
}
- }
- else {
+ } else {
// they ran python script from cmd line, behave a bit differently (untested)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No session: Threadstate mod_python.c swap-out! \n");
PyEval_ReleaseThread(tstate);
@@ -203,8 +197,8 @@
SWITCH_STANDARD_APP(python_function)
{
- eval_some_python(switch_core_session_get_uuid(session), (char *)data, session);
-
+ eval_some_python(switch_core_session_get_uuid(session), (char *) data, session);
+
}
struct switch_py_thread {
@@ -228,7 +222,7 @@
SWITCH_STANDARD_API(launch_python)
{
switch_thread_t *thread;
- switch_threadattr_t *thd_attr = NULL;
+ switch_threadattr_t *thd_attr = NULL;
switch_memory_pool_t *pool;
struct switch_py_thread *pt;
@@ -236,7 +230,7 @@
stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
return SWITCH_STATUS_SUCCESS;
}
-
+
switch_core_new_memory_pool(&pool);
assert(pool != NULL);
@@ -245,11 +239,11 @@
pt->pool = pool;
pt->args = switch_core_strdup(pt->pool, cmd);
-
- switch_threadattr_create(&thd_attr, pt->pool);
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
+
+ switch_threadattr_create(&thd_attr, pt->pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, py_thread_run, pt, pt->pool);
stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS;
@@ -290,7 +284,7 @@
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &python_module_interface;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Python Framework Loading...\n");
-
+
if (!Py_IsInitialized()) {
// initialize python system
@@ -302,13 +296,13 @@
// save threadstate since it's interp field will be needed
// to create new threadstates, and will be needed for shutdown
mainThreadState = PyThreadState_Get();
-
+
// swap out threadstate since the call threads will create
// their own and swap in their threadstate
- PyThreadState_Swap(NULL);
+ PyThreadState_Swap(NULL);
// release GIL
- PyEval_ReleaseLock();
+ PyEval_ReleaseLock();
}
/* indicate that the module should continue to be loaded */
@@ -319,18 +313,18 @@
Called when the system shuts down*/
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_python_shutdown)
{
- PyInterpreterState *mainInterpreterState;
- PyThreadState *myThreadState;
+ PyInterpreterState *mainInterpreterState;
+ PyThreadState *myThreadState;
- PyEval_AcquireLock();
- mainInterpreterState = mainThreadState->interp;
- myThreadState = PyThreadState_New(mainInterpreterState);
- PyThreadState_Swap(myThreadState);
- PyEval_ReleaseLock();
-
- Py_Finalize();
- PyEval_ReleaseLock();
- return SWITCH_STATUS_SUCCESS;
+ PyEval_AcquireLock();
+ mainInterpreterState = mainThreadState->interp;
+ myThreadState = PyThreadState_New(mainInterpreterState);
+ PyThreadState_Swap(myThreadState);
+ PyEval_ReleaseLock();
+
+ Py_Finalize();
+ PyEval_ReleaseLock();
+ return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp Tue May 27 07:24:06 2008
@@ -12,22 +12,35 @@
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
- T *tt;
-public:
- SwigValueWrapper() : tt(0) { }
- SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
- SwigValueWrapper(const T& t) : tt(new T(t)) { }
- ~SwigValueWrapper() { delete tt; }
- SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
- operator T&() const { return *tt; }
- T *operator&() { return tt; }
-private:
- SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+template < typename T > class SwigValueWrapper {
+ T *tt;
+ public:
+ SwigValueWrapper():tt(0) {
+ }
+ SwigValueWrapper(const SwigValueWrapper < T > &rhs):tt(new T(*rhs.tt)) {
+ }
+ SwigValueWrapper(const T & t):tt(new T(t)) {
+ }
+ ~SwigValueWrapper() {
+ delete tt;
+ }
+ SwigValueWrapper & operator=(const T & t) {
+ delete tt;
+ tt = new T(t);
+ return *this;
+ }
+ operator T & () const {
+ return *tt;
+ } T *operator&() {
+ return tt;
+ }
+ private:
+ SwigValueWrapper & operator=(const SwigValueWrapper < T > &rhs);
};
-template <typename T> T SwigValueInit() {
- return T();
+template < typename T > T SwigValueInit()
+{
+ return T();
}
#endif
@@ -62,14 +75,14 @@
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
-# define SWIGUNUSED __attribute__ ((__unused__))
+# define SWIGUNUSED __attribute__ ((__unused__))
# else
-# define SWIGUNUSED
+# define SWIGUNUSED
# endif
#endif
@@ -77,7 +90,7 @@
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
-# define SWIGUNUSEDPARM(p) p SWIGUNUSED
+# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
@@ -120,7 +133,7 @@
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
-# endif
+# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
@@ -268,10 +281,10 @@
*/
-#define SWIG_OK (0)
+#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
-#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
+#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
@@ -298,16 +311,18 @@
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
-# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
+# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) {
- return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+SWIGINTERNINLINE int SWIG_AddCast(int r)
+{
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
-SWIGINTERNINLINE int SWIG_CheckState(int r) {
- return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
+SWIGINTERNINLINE int SWIG_CheckState(int r)
+{
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast
@@ -323,38 +338,38 @@
extern "C" {
#endif
-typedef void *(*swig_converter_func)(void *, int *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
+ typedef void *(*swig_converter_func) (void *, int *);
+ typedef struct swig_type_info *(*swig_dycast_func) (void **);
/* Structure to store information on one type */
-typedef struct swig_type_info {
- const char *name; /* mangled name of this type */
- const char *str; /* human readable name of this type */
- swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
- struct swig_cast_info *cast; /* linked list of types that can cast into this type */
- void *clientdata; /* language specific type data */
- int owndata; /* flag if the structure owns the clientdata */
-} swig_type_info;
+ typedef struct swig_type_info {
+ const char *name; /* mangled name of this type */
+ const char *str; /* human readable name of this type */
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
+ void *clientdata; /* language specific type data */
+ int owndata; /* flag if the structure owns the clientdata */
+ } swig_type_info;
/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
- swig_type_info *type; /* pointer to type that is equivalent to this type */
- swig_converter_func converter; /* function to cast the void pointers */
- struct swig_cast_info *next; /* pointer to next cast in linked list */
- struct swig_cast_info *prev; /* pointer to the previous cast */
-} swig_cast_info;
+ typedef struct swig_cast_info {
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
+ swig_converter_func converter; /* function to cast the void pointers */
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
+ struct swig_cast_info *prev; /* pointer to the previous cast */
+ } swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
- swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
- size_t size; /* Number of types in this module */
- struct swig_module_info *next; /* Pointer to next element in circularly linked list */
- swig_type_info **type_initial; /* Array of initially generated type structures */
- swig_cast_info **cast_initial; /* Array of initially generated casting structures */
- void *clientdata; /* Language specific module data */
-} swig_module_info;
+ typedef struct swig_module_info {
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
+ size_t size; /* Number of types in this module */
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
+ swig_type_info **type_initial; /* Array of initially generated type structures */
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
+ void *clientdata; /* Language specific module data */
+ } swig_module_info;
/*
Compare two type names skipping the space characters, therefore
@@ -363,54 +378,56 @@
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
- const char *f2, const char *l2) {
- for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
- while ((*f1 == ' ') && (f1 != l1)) ++f1;
- while ((*f2 == ' ') && (f2 != l2)) ++f2;
- if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
- }
- return (int)((l1 - f1) - (l2 - f2));
-}
+ SWIGRUNTIME int SWIG_TypeNameComp(const char *f1, const char *l1, const char *f2, const char *l2) {
+ for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
+ while ((*f1 == ' ') && (f1 != l1))
+ ++f1;
+ while ((*f2 == ' ') && (f2 != l2))
+ ++f2;
+ if (*f1 != *f2)
+ return (*f1 > *f2) ? 1 : -1;
+ } return (int) ((l1 - f1) - (l2 - f2));
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if not equal, 1 if equal
*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeEquiv(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/*
Check type equivalence in a name list like <name1>|<name2>|...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
- int equiv = 0;
- const char* te = tb + strlen(tb);
- const char* ne = nb;
- while (!equiv && *ne) {
- for (nb = ne; *ne; ++ne) {
- if (*ne == '|') break;
- }
- equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
- if (*ne) ++ne;
- }
- return equiv;
-}
+ SWIGRUNTIME int SWIG_TypeCompare(const char *nb, const char *tb) {
+ int equiv = 0;
+ const char *te = tb + strlen(tb);
+ const char *ne = nb;
+ while (!equiv && *ne) {
+ for (nb = ne; *ne; ++ne) {
+ if (*ne == '|')
+ break;
+ }
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+ if (*ne)
+ ++ne;
+ }
+ return equiv;
+ }
/* think of this as a c++ template<> or a scheme macro */
@@ -438,94 +455,89 @@
/*
Check the typename
*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
- SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheck(const char *c, swig_type_info * ty) {
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+ }
/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
- SWIG_TypeCheck_Template(iter->type == from, into);
-}
+ SWIGRUNTIME swig_cast_info *SWIG_TypeCheckStruct(swig_type_info * from, swig_type_info * into) {
+ SWIG_TypeCheck_Template(iter->type == from, into);
+ }
/*
Cast a pointer up an inheritance hierarchy
*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
- return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
-}
+ SWIGRUNTIMEINLINE void *SWIG_TypeCast(swig_cast_info * ty, void *ptr, int *newmemory) {
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter) (ptr, newmemory);
+ }
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
- swig_type_info *lastty = ty;
- if (!ty || !ty->dcast) return ty;
- while (ty && (ty->dcast)) {
- ty = (*ty->dcast)(ptr);
- if (ty) lastty = ty;
- }
- return lastty;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeDynamicCast(swig_type_info * ty, void **ptr) {
+ swig_type_info *lastty = ty;
+ if (!ty || !ty->dcast)
+ return ty;
+ while (ty && (ty->dcast)) {
+ ty = (*ty->dcast) (ptr);
+ if (ty)
+ lastty = ty;
+ }
+ return lastty;
+ }
/*
Return the name associated with this type
*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
- return ty->name;
-}
+ SWIGRUNTIMEINLINE const char *SWIG_TypeName(const swig_type_info * ty) {
+ return ty->name;
+ }
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
- /* The "str" field contains the equivalent pretty names of the
- type, separated by vertical-bar characters. We choose
- to print the last name, as it is often (?) the most
- specific. */
- if (!type) return NULL;
- if (type->str != NULL) {
- const char *last_name = type->str;
- const char *s;
- for (s = type->str; *s; s++)
- if (*s == '|') last_name = s+1;
- return last_name;
- }
- else
- return type->name;
-}
+ SWIGRUNTIME const char *SWIG_TypePrettyName(const swig_type_info * type) {
+ /* The "str" field contains the equivalent pretty names of the
+ type, separated by vertical-bar characters. We choose
+ to print the last name, as it is often (?) the most
+ specific. */
+ if (!type)
+ return NULL;
+ if (type->str != NULL) {
+ const char *last_name = type->str;
+ const char *s;
+ for (s = type->str; *s; s++)
+ if (*s == '|')
+ last_name = s + 1;
+ return last_name;
+ } else
+ return type->name;
+ }
/*
Set the clientdata field for a type
*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
- swig_cast_info *cast = ti->cast;
- /* if (ti->clientdata == clientdata) return; */
- ti->clientdata = clientdata;
-
- while (cast) {
- if (!cast->converter) {
- swig_type_info *tc = cast->type;
- if (!tc->clientdata) {
- SWIG_TypeClientData(tc, clientdata);
- }
- }
- cast = cast->next;
- }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
- SWIG_TypeClientData(ti, clientdata);
- ti->owndata = 1;
-}
-
+ SWIGRUNTIME void SWIG_TypeClientData(swig_type_info * ti, void *clientdata) {
+ swig_cast_info *cast = ti->cast;
+ /* if (ti->clientdata == clientdata) return; */
+ ti->clientdata = clientdata;
+
+ while (cast) {
+ if (!cast->converter) {
+ swig_type_info *tc = cast->type;
+ if (!tc->clientdata) {
+ SWIG_TypeClientData(tc, clientdata);
+ }
+ }
+ cast = cast->next;
+ }
+ }
+ SWIGRUNTIME void SWIG_TypeNewClientData(swig_type_info * ti, void *clientdata) {
+ SWIG_TypeClientData(ti, clientdata);
+ ti->owndata = 1;
+ }
+
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
@@ -534,41 +546,38 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- swig_module_info *iter = start;
- do {
- if (iter->size) {
- register size_t l = 0;
- register size_t r = iter->size - 1;
- do {
- /* since l+r >= 0, we can (>> 1) instead (/ 2) */
- register size_t i = (l + r) >> 1;
- const char *iname = iter->types[i]->name;
- if (iname) {
- register int compare = strcmp(name, iname);
- if (compare == 0) {
- return iter->types[i];
- } else if (compare < 0) {
- if (i) {
- r = i - 1;
- } else {
- break;
- }
- } else if (compare > 0) {
- l = i + 1;
- }
- } else {
- break; /* should never happen */
+ SWIGRUNTIME swig_type_info *SWIG_MangledTypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ swig_module_info *iter = start;
+ do {
+ if (iter->size) {
+ register size_t l = 0;
+ register size_t r = iter->size - 1;
+ do {
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
+ register size_t i = (l + r) >> 1;
+ const char *iname = iter->types[i]->name;
+ if (iname) {
+ register int compare = strcmp(name, iname);
+ if (compare == 0) {
+ return iter->types[i];
+ } else if (compare < 0) {
+ if (i) {
+ r = i - 1;
+ } else {
+ break;
+ }
+ } else if (compare > 0) {
+ l = i + 1;
+ }
+ } else {
+ break; /* should never happen */
+ }
+ } while (l <= r);
+ }
+ iter = iter->next;
+ } while (iter != end);
+ return 0;
}
- } while (l <= r);
- }
- iter = iter->next;
- } while (iter != end);
- return 0;
-}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
@@ -579,148 +588,142 @@
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start,
- swig_module_info *end,
- const char *name) {
- /* STEP 1: Search the name field using binary search */
- swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
- if (ret) {
- return ret;
- } else {
- /* STEP 2: If the type hasn't been found, do a complete search
- of the str field (the human readable name) */
- swig_module_info *iter = start;
- do {
- register size_t i = 0;
- for (; i < iter->size; ++i) {
- if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
- return iter->types[i];
- }
- iter = iter->next;
- } while (iter != end);
- }
-
- /* neither found a match */
- return 0;
-}
+ SWIGRUNTIME swig_type_info *SWIG_TypeQueryModule(swig_module_info * start, swig_module_info * end, const char *name) {
+ /* STEP 1: Search the name field using binary search */
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+ if (ret) {
+ return ret;
+ } else {
+ /* STEP 2: If the type hasn't been found, do a complete search
+ of the str field (the human readable name) */
+ swig_module_info *iter = start;
+ do {
+ register size_t i = 0;
+ for (; i < iter->size; ++i) {
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+ return iter->types[i];
+ }
+ iter = iter->next;
+ } while (iter != end);
+ }
+
+ /* neither found a match */
+ return 0;
+ }
/*
Pack binary data into a string
*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
- static const char hex[17] = "0123456789abcdef";
- register const unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register unsigned char uu = *u;
- *(c++) = hex[(uu & 0xf0) >> 4];
- *(c++) = hex[uu & 0xf];
- }
- return c;
-}
+ SWIGRUNTIME char *SWIG_PackData(char *c, void *ptr, size_t sz) {
+ static const char hex[17] = "0123456789abcdef";
+ register const unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register unsigned char uu = *u;
+ *(c++) = hex[(uu & 0xf0) >> 4];
+ *(c++) = hex[uu & 0xf];
+ }
+ return c;
+ }
/*
Unpack binary data from a string
*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
- register unsigned char *u = (unsigned char *) ptr;
- register const unsigned char *eu = u + sz;
- for (; u != eu; ++u) {
- register char d = *(c++);
- register unsigned char uu;
- if ((d >= '0') && (d <= '9'))
- uu = ((d - '0') << 4);
- else if ((d >= 'a') && (d <= 'f'))
- uu = ((d - ('a'-10)) << 4);
- else
- return (char *) 0;
- d = *(c++);
- if ((d >= '0') && (d <= '9'))
- uu |= (d - '0');
- else if ((d >= 'a') && (d <= 'f'))
- uu |= (d - ('a'-10));
- else
- return (char *) 0;
- *u = uu;
- }
- return c;
-}
+ SWIGRUNTIME const char *SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+ register unsigned char *u = (unsigned char *) ptr;
+ register const unsigned char *eu = u + sz;
+ for (; u != eu; ++u) {
+ register char d = *(c++);
+ register unsigned char uu;
+ if ((d >= '0') && (d <= '9'))
+ uu = ((d - '0') << 4);
+ else if ((d >= 'a') && (d <= 'f'))
+ uu = ((d - ('a' - 10)) << 4);
+ else
+ return (char *) 0;
+ d = *(c++);
+ if ((d >= '0') && (d <= '9'))
+ uu |= (d - '0');
+ else if ((d >= 'a') && (d <= 'f'))
+ uu |= (d - ('a' - 10));
+ else
+ return (char *) 0;
+ *u = uu;
+ }
+ return c;
+ }
/*
Pack 'void *' into a string buffer.
*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
- char *r = buff;
- if ((2*sizeof(void *) + 2) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,&ptr,sizeof(void *));
- if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
- strcpy(r,name);
- return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- *ptr = (void *) 0;
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
+ SWIGRUNTIME char *SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+ char *r = buff;
+ if ((2 * sizeof(void *) + 2) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, &ptr, sizeof(void *));
+ if (strlen(name) + 1 > (bsz - (r - buff)))
+ return 0;
+ strcpy(r, name);
+ return buff;
+ }
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
- char *r = buff;
- size_t lname = (name ? strlen(name) : 0);
- if ((2*sz + 2 + lname) > bsz) return 0;
- *(r++) = '_';
- r = SWIG_PackData(r,ptr,sz);
- if (lname) {
- strncpy(r,name,lname+1);
- } else {
- *r = 0;
- }
- return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
- if (*c != '_') {
- if (strcmp(c,"NULL") == 0) {
- memset(ptr,0,sz);
- return name;
- } else {
- return 0;
- }
- }
- return SWIG_UnpackData(++c,ptr,sz);
-}
+ SWIGRUNTIME const char *SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ *ptr = (void *) 0;
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sizeof(void *));
+ }
+
+ SWIGRUNTIME char *SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+ char *r = buff;
+ size_t lname = (name ? strlen(name) : 0);
+ if ((2 * sz + 2 + lname) > bsz)
+ return 0;
+ *(r++) = '_';
+ r = SWIG_PackData(r, ptr, sz);
+ if (lname) {
+ strncpy(r, name, lname + 1);
+ } else {
+ *r = 0;
+ }
+ return buff;
+ }
+
+ SWIGRUNTIME const char *SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+ if (*c != '_') {
+ if (strcmp(c, "NULL") == 0) {
+ memset(ptr, 0, sz);
+ return name;
+ } else {
+ return 0;
+ }
+ }
+ return SWIG_UnpackData(++c, ptr, sz);
+ }
#ifdef __cplusplus
}
#endif
/* Errors in SWIG */
-#define SWIG_UnknownError -1
-#define SWIG_IOError -2
-#define SWIG_RuntimeError -3
-#define SWIG_IndexError -4
-#define SWIG_TypeError -5
-#define SWIG_DivisionByZero -6
-#define SWIG_OverflowError -7
-#define SWIG_SyntaxError -8
-#define SWIG_ValueError -9
+#define SWIG_UnknownError -1
+#define SWIG_IOError -2
+#define SWIG_RuntimeError -3
+#define SWIG_IndexError -4
+#define SWIG_TypeError -5
+#define SWIG_DivisionByZero -6
+#define SWIG_OverflowError -7
+#define SWIG_SyntaxError -8
+#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
-#define SWIG_MemoryError -12
+#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
@@ -742,15 +745,15 @@
# define SWIG_PYBUFFER_SIZE 1024
#endif
-static PyObject *
-PyString_FromFormat(const char *fmt, ...) {
- va_list ap;
- char buf[SWIG_PYBUFFER_SIZE * 2];
- int res;
- va_start(ap, fmt);
- res = vsnprintf(buf, sizeof(buf), fmt, ap);
- va_end(ap);
- return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
+static PyObject *PyString_FromFormat(const char *fmt, ...)
+{
+ va_list ap;
+ char buf[SWIG_PYBUFFER_SIZE * 2];
+ int res;
+ va_start(ap, fmt);
+ res = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+ return (res < 0 || res >= (int) sizeof(buf)) ? 0 : PyString_FromString(buf);
}
#endif
@@ -799,9 +802,9 @@
static
PyObject *PyBool_FromLong(long ok)
{
- PyObject *result = ok ? Py_True : Py_False;
- Py_INCREF(result);
- return result;
+ PyObject *result = ok ? Py_True : Py_False;
+ Py_INCREF(result);
+ return result;
}
#endif
@@ -818,68 +821,68 @@
* error manipulation
* ----------------------------------------------------------------------------- */
-SWIGRUNTIME PyObject*
-SWIG_Python_ErrorType(int code) {
- PyObject* type = 0;
- switch(code) {
- case SWIG_MemoryError:
- type = PyExc_MemoryError;
- break;
- case SWIG_IOError:
- type = PyExc_IOError;
- break;
- case SWIG_RuntimeError:
- type = PyExc_RuntimeError;
- break;
- case SWIG_IndexError:
- type = PyExc_IndexError;
- break;
- case SWIG_TypeError:
- type = PyExc_TypeError;
- break;
- case SWIG_DivisionByZero:
- type = PyExc_ZeroDivisionError;
- break;
- case SWIG_OverflowError:
- type = PyExc_OverflowError;
- break;
- case SWIG_SyntaxError:
- type = PyExc_SyntaxError;
- break;
- case SWIG_ValueError:
- type = PyExc_ValueError;
- break;
- case SWIG_SystemError:
- type = PyExc_SystemError;
- break;
- case SWIG_AttributeError:
- type = PyExc_AttributeError;
- break;
- default:
- type = PyExc_RuntimeError;
- }
- return type;
+SWIGRUNTIME PyObject *SWIG_Python_ErrorType(int code)
+{
+ PyObject *type = 0;
+ switch (code) {
+ case SWIG_MemoryError:
+ type = PyExc_MemoryError;
+ break;
+ case SWIG_IOError:
+ type = PyExc_IOError;
+ break;
+ case SWIG_RuntimeError:
+ type = PyExc_RuntimeError;
+ break;
+ case SWIG_IndexError:
+ type = PyExc_IndexError;
+ break;
+ case SWIG_TypeError:
+ type = PyExc_TypeError;
+ break;
+ case SWIG_DivisionByZero:
+ type = PyExc_ZeroDivisionError;
+ break;
+ case SWIG_OverflowError:
+ type = PyExc_OverflowError;
+ break;
+ case SWIG_SyntaxError:
+ type = PyExc_SyntaxError;
+ break;
+ case SWIG_ValueError:
+ type = PyExc_ValueError;
+ break;
+ case SWIG_SystemError:
+ type = PyExc_SystemError;
+ break;
+ case SWIG_AttributeError:
+ type = PyExc_AttributeError;
+ break;
+ default:
+ type = PyExc_RuntimeError;
+ }
+ return type;
}
-SWIGRUNTIME void
-SWIG_Python_AddErrorMsg(const char* mesg)
-{
- PyObject *type = 0;
- PyObject *value = 0;
- PyObject *traceback = 0;
-
- if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
- if (value) {
- PyObject *old_str = PyObject_Str(value);
- PyErr_Clear();
- Py_XINCREF(type);
- PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
- Py_DECREF(old_str);
- Py_DECREF(value);
- } else {
- PyErr_SetString(PyExc_RuntimeError, mesg);
- }
+SWIGRUNTIME void SWIG_Python_AddErrorMsg(const char *mesg)
+{
+ PyObject *type = 0;
+ PyObject *value = 0;
+ PyObject *traceback = 0;
+
+ if (PyErr_Occurred())
+ PyErr_Fetch(&type, &value, &traceback);
+ if (value) {
+ PyObject *old_str = PyObject_Str(value);
+ PyErr_Clear();
+ Py_XINCREF(type);
+ PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+ Py_DECREF(old_str);
+ Py_DECREF(value);
+ } else {
+ PyErr_SetString(PyExc_RuntimeError, mesg);
+ }
}
@@ -889,33 +892,48 @@
# undef SWIG_PYTHON_THREADS
# endif
#endif
-#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
+#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
+# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
# define SWIG_PYTHON_USE_GIL
# endif
# endif
-# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
+# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
# ifndef SWIG_PYTHON_INITIALIZE_THREADS
-# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
+# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
# endif
-# ifdef __cplusplus /* C++ code */
- class SWIG_Python_Thread_Block {
- bool status;
- PyGILState_STATE state;
- public:
- void end() { if (status) { PyGILState_Release(state); status = false;} }
- SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
- ~SWIG_Python_Thread_Block() { end(); }
- };
- class SWIG_Python_Thread_Allow {
- bool status;
- PyThreadState *save;
- public:
- void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
- SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
- ~SWIG_Python_Thread_Allow() { end(); }
- };
+# ifdef __cplusplus /* C++ code */
+class SWIG_Python_Thread_Block {
+ bool status;
+ PyGILState_STATE state;
+ public:
+ void end() {
+ if (status) {
+ PyGILState_Release(state);
+ status = false;
+ }
+ } SWIG_Python_Thread_Block():status(true), state(PyGILState_Ensure()) {
+ }
+ ~SWIG_Python_Thread_Block() {
+ end();
+ }
+};
+class SWIG_Python_Thread_Allow {
+ bool status;
+ PyThreadState *save;
+ public:
+ void end() {
+ if (status) {
+ PyEval_RestoreThread(save);
+ status = false;
+ }
+ } SWIG_Python_Thread_Allow():status(true), save(PyEval_SaveThread()) {
+ }
+ ~SWIG_Python_Thread_Allow() {
+ end();
+ }
+};
+
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
@@ -926,7 +944,7 @@
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
# endif
-# else /* Old thread way, not implemented, user must provide it */
+# else /* Old thread way, not implemented, user must provide it */
# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
# define SWIG_PYTHON_INITIALIZE_THREADS
# endif
@@ -958,31 +976,26 @@
#ifdef __cplusplus
extern "C" {
#if 0
-} /* cc-mode */
+} /* cc-mode */
#endif
#endif
-
/* -----------------------------------------------------------------------------
* Constant declarations
- * ----------------------------------------------------------------------------- */
-
-/* Constant Types */
+ * ----------------------------------------------------------------------------- *//* Constant Types */
#define SWIG_PY_POINTER 4
#define SWIG_PY_BINARY 5
-
-/* Constant information structure */
-typedef struct swig_const_info {
- int type;
- char *name;
- long lvalue;
- double dvalue;
- void *pvalue;
- swig_type_info **ptype;
+/* Constant information structure */ typedef struct swig_const_info {
+ int type;
+ char *name;
+ long lvalue;
+ double dvalue;
+ void *pvalue;
+ swig_type_info **ptype;
} swig_const_info;
#ifdef __cplusplus
#if 0
-{ /* cc-mode */
+{ /* cc-mode */
#endif
}
#endif
@@ -1007,7 +1020,7 @@
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
-#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
+#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
#define swig_owntype int
@@ -1034,125 +1047,121 @@
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) PySwigClientData_New(obj)
-#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
-#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
-#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
-#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
-#define SWIG_fail goto fail
+#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
+#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
+#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
+#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
+#define SWIG_fail goto fail
/* Runtime API implementation */
/* Error manipulation */
-SWIGINTERN void
-SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetObject(errtype, obj);
- Py_DECREF(obj);
- SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void SWIG_Python_SetErrorObj(PyObject * errtype, PyObject * obj)
+{
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ PyErr_SetObject(errtype, obj);
+ Py_DECREF(obj);
+ SWIG_PYTHON_THREAD_END_BLOCK;
}
-SWIGINTERN void
-SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
- SWIG_PYTHON_THREAD_BEGIN_BLOCK;
- PyErr_SetString(errtype, (char *) msg);
- SWIG_PYTHON_THREAD_END_BLOCK;
+SWIGINTERN void SWIG_Python_SetErrorMsg(PyObject * errtype, const char *msg)
+{
+ SWIG_PYTHON_THREAD_BEGIN_BLOCK;
+ PyErr_SetString(errtype, (char *) msg);
+ SWIG_PYTHON_THREAD_END_BLOCK;
}
#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
/* Set a constant value */
-SWIGINTERN void
-SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
- PyDict_SetItemString(d, (char*) name, obj);
- Py_DECREF(obj);
+SWIGINTERN void SWIG_Python_SetConstant(PyObject * d, const char *name, PyObject * obj)
+{
+ PyDict_SetItemString(d, (char *) name, obj);
+ Py_DECREF(obj);
}
/* Append a value to the result obj */
-SWIGINTERN PyObject*
-SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
+SWIGINTERN PyObject *SWIG_Python_AppendOutput(PyObject * result, PyObject * obj)
+{
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
- if (!result) {
- result = obj;
- } else if (result == Py_None) {
- Py_DECREF(result);
- result = obj;
- } else {
- if (!PyList_Check(result)) {
- PyObject *o2 = result;
- result = PyList_New(1);
- PyList_SetItem(result, 0, o2);
- }
- PyList_Append(result,obj);
- Py_DECREF(obj);
- }
- return result;
+ if (!result) {
+ result = obj;
+ } else if (result == Py_None) {
+ Py_DECREF(result);
+ result = obj;
+ } else {
+ if (!PyList_Check(result)) {
+ PyObject *o2 = result;
+ result = PyList_New(1);
+ PyList_SetItem(result, 0, o2);
+ }
+ PyList_Append(result, obj);
+ Py_DECREF(obj);
+ }
+ return result;
#else
- PyObject* o2;
- PyObject* o3;
- if (!result) {
- result = obj;
- } else if (result == Py_None) {
- Py_DECREF(result);
- result = obj;
- } else {
- if (!PyTuple_Check(result)) {
- o2 = result;
- result = PyTuple_New(1);
- PyTuple_SET_ITEM(result, 0, o2);
- }
- o3 = PyTuple_New(1);
- PyTuple_SET_ITEM(o3, 0, obj);
- o2 = result;
- result = PySequence_Concat(o2, o3);
- Py_DECREF(o2);
- Py_DECREF(o3);
- }
- return result;
+ PyObject *o2;
+ PyObject *o3;
+ if (!result) {
+ result = obj;
+ } else if (result == Py_None) {
+ Py_DECREF(result);
+ result = obj;
+ } else {
+ if (!PyTuple_Check(result)) {
+ o2 = result;
+ result = PyTuple_New(1);
+ PyTuple_SET_ITEM(result, 0, o2);
+ }
+ o3 = PyTuple_New(1);
+ PyTuple_SET_ITEM(o3, 0, obj);
+ o2 = result;
+ result = PySequence_Concat(o2, o3);
+ Py_DECREF(o2);
+ Py_DECREF(o3);
+ }
+ return result;
#endif
}
/* Unpack the argument tuple */
-SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
+SWIGINTERN int SWIG_Python_UnpackTuple(PyObject * args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject ** objs)
{
- if (!args) {
- if (!min && !max) {
- return 1;
- } else {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
- name, (min == max ? "" : "at least "), (int)min);
- return 0;
- }
- }
- if (!PyTuple_Check(args)) {
- PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
- return 0;
- } else {
- register Py_ssize_t l = PyTuple_GET_SIZE(args);
- if (l < min) {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at least "), (int)min, (int)l);
- return 0;
- } else if (l > max) {
- PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
- name, (min == max ? "" : "at most "), (int)max, (int)l);
- return 0;
- } else {
- register int i;
- for (i = 0; i < l; ++i) {
- objs[i] = PyTuple_GET_ITEM(args, i);
- }
- for (; l < max; ++l) {
- objs[l] = 0;
- }
- return i + 1;
- }
- }
+ if (!args) {
+ if (!min && !max) {
+ return 1;
+ } else {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", name, (min == max ? "" : "at least "), (int) min);
+ return 0;
+ }
+ }
+ if (!PyTuple_Check(args)) {
+ PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
+ return 0;
+ } else {
+ register Py_ssize_t l = PyTuple_GET_SIZE(args);
+ if (l < min) {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at least "), (int) min, (int) l);
+ return 0;
+ } else if (l > max) {
+ PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", name, (min == max ? "" : "at most "), (int) max, (int) l);
+ return 0;
+ } else {
+ register int i;
+ for (i = 0; i < l; ++i) {
+ objs[i] = PyTuple_GET_ITEM(args, i);
+ }
+ for (; l < max; ++l) {
+ objs[l] = 0;
+ }
+ return i + 1;
+ }
+ }
}
/* A functor is a function object with one single object argument */
@@ -1185,10 +1194,9 @@
#ifdef __cplusplus
extern "C" {
#if 0
-} /* cc-mode */
+} /* cc-mode */
#endif
#endif
-
/* How to access Py_None */
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# ifndef SWIG_PYTHON_NO_BUILD_NONE
@@ -1197,520 +1205,494 @@
# endif
# endif
#endif
-
#ifdef SWIG_PYTHON_BUILD_NONE
# ifdef Py_None
# undef Py_None
# define Py_None SWIG_Py_None()
# endif
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_Py_None(void)
+SWIGRUNTIMEINLINE PyObject *_SWIG_Py_None(void)
{
- PyObject *none = Py_BuildValue((char*)"");
- Py_DECREF(none);
- return none;
+ PyObject *none = Py_BuildValue((char *) "");
+ Py_DECREF(none);
+ return none;
}
-SWIGRUNTIME PyObject *
-SWIG_Py_None(void)
+SWIGRUNTIME PyObject *SWIG_Py_None(void)
{
- static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
- return none;
+ static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
+ return none;
}
#endif
/* The python void return value */
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Py_Void(void)
+SWIGRUNTIMEINLINE PyObject *SWIG_Py_Void(void)
{
- PyObject *none = Py_None;
- Py_INCREF(none);
- return none;
+ PyObject *none = Py_None;
+ Py_INCREF(none);
+ return none;
}
/* PySwigClientData */
typedef struct {
- PyObject *klass;
- PyObject *newraw;
- PyObject *newargs;
- PyObject *destroy;
- int delargs;
- int implicitconv;
+ PyObject *klass;
+ PyObject *newraw;
+ PyObject *newargs;
+ PyObject *destroy;
+ int delargs;
+ int implicitconv;
} PySwigClientData;
-SWIGRUNTIMEINLINE int
-SWIG_Python_CheckImplicit(swig_type_info *ty)
+SWIGRUNTIMEINLINE int SWIG_Python_CheckImplicit(swig_type_info * ty)
{
- PySwigClientData *data = (PySwigClientData *)ty->clientdata;
- return data ? data->implicitconv : 0;
+ PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+ return data ? data->implicitconv : 0;
}
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_ExceptionType(swig_type_info *desc) {
- PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
- PyObject *klass = data ? data->klass : 0;
- return (klass ? klass : PyExc_RuntimeError);
+SWIGRUNTIMEINLINE PyObject *SWIG_Python_ExceptionType(swig_type_info * desc)
+{
+ PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
+ PyObject *klass = data ? data->klass : 0;
+ return (klass ? klass : PyExc_RuntimeError);
}
-SWIGRUNTIME PySwigClientData *
-PySwigClientData_New(PyObject* obj)
-{
- if (!obj) {
- return 0;
- } else {
- PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
- /* the klass element */
- data->klass = obj;
- Py_INCREF(data->klass);
- /* the newraw method and newargs arguments used to create a new raw instance */
- if (PyClass_Check(obj)) {
- data->newraw = 0;
- data->newargs = obj;
- Py_INCREF(obj);
- } else {
+SWIGRUNTIME PySwigClientData *PySwigClientData_New(PyObject * obj)
+{
+ if (!obj) {
+ return 0;
+ } else {
+ PySwigClientData *data = (PySwigClientData *) malloc(sizeof(PySwigClientData));
+ /* the klass element */
+ data->klass = obj;
+ Py_INCREF(data->klass);
+ /* the newraw method and newargs arguments used to create a new raw instance */
+ if (PyClass_Check(obj)) {
+ data->newraw = 0;
+ data->newargs = obj;
+ Py_INCREF(obj);
+ } else {
#if (PY_VERSION_HEX < 0x02020000)
- data->newraw = 0;
+ data->newraw = 0;
#else
- data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
+ data->newraw = PyObject_GetAttrString(data->klass, (char *) "__new__");
#endif
- if (data->newraw) {
- Py_INCREF(data->newraw);
- data->newargs = PyTuple_New(1);
- PyTuple_SetItem(data->newargs, 0, obj);
- } else {
- data->newargs = obj;
- }
- Py_INCREF(data->newargs);
- }
- /* the destroy method, aka as the C++ delete method */
- data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
- if (PyErr_Occurred()) {
- PyErr_Clear();
- data->destroy = 0;
- }
- if (data->destroy) {
- int flags;
- Py_INCREF(data->destroy);
- flags = PyCFunction_GET_FLAGS(data->destroy);
+ if (data->newraw) {
+ Py_INCREF(data->newraw);
+ data->newargs = PyTuple_New(1);
+ PyTuple_SetItem(data->newargs, 0, obj);
+ } else {
+ data->newargs = obj;
+ }
+ Py_INCREF(data->newargs);
+ }
+ /* the destroy method, aka as the C++ delete method */
+ data->destroy = PyObject_GetAttrString(data->klass, (char *) "__swig_destroy__");
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ data->destroy = 0;
+ }
+ if (data->destroy) {
+ int flags;
+ Py_INCREF(data->destroy);
+ flags = PyCFunction_GET_FLAGS(data->destroy);
#ifdef METH_O
- data->delargs = !(flags & (METH_O));
+ data->delargs = !(flags & (METH_O));
#else
- data->delargs = 0;
+ data->delargs = 0;
#endif
- } else {
- data->delargs = 0;
- }
- data->implicitconv = 0;
- return data;
- }
+ } else {
+ data->delargs = 0;
+ }
+ data->implicitconv = 0;
+ return data;
+ }
}
-SWIGRUNTIME void
-PySwigClientData_Del(PySwigClientData* data)
+SWIGRUNTIME void PySwigClientData_Del(PySwigClientData * data)
{
- Py_XDECREF(data->newraw);
- Py_XDECREF(data->newargs);
- Py_XDECREF(data->destroy);
+ Py_XDECREF(data->newraw);
+ Py_XDECREF(data->newargs);
+ Py_XDECREF(data->destroy);
}
/* =============== PySwigObject =====================*/
typedef struct {
- PyObject_HEAD
- void *ptr;
- swig_type_info *ty;
- int own;
- PyObject *next;
+ PyObject_HEAD void *ptr;
+ swig_type_info *ty;
+ int own;
+ PyObject *next;
} PySwigObject;
-SWIGRUNTIME PyObject *
-PySwigObject_long(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_long(PySwigObject * v)
{
- return PyLong_FromVoidPtr(v->ptr);
+ return PyLong_FromVoidPtr(v->ptr);
}
-SWIGRUNTIME PyObject *
-PySwigObject_format(const char* fmt, PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_format(const char *fmt, PySwigObject * v)
{
- PyObject *res = NULL;
- PyObject *args = PyTuple_New(1);
- if (args) {
- if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
- PyObject *ofmt = PyString_FromString(fmt);
- if (ofmt) {
- res = PyString_Format(ofmt,args);
- Py_DECREF(ofmt);
- }
- Py_DECREF(args);
- }
- }
- return res;
+ PyObject *res = NULL;
+ PyObject *args = PyTuple_New(1);
+ if (args) {
+ if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
+ PyObject *ofmt = PyString_FromString(fmt);
+ if (ofmt) {
+ res = PyString_Format(ofmt, args);
+ Py_DECREF(ofmt);
+ }
+ Py_DECREF(args);
+ }
+ }
+ return res;
}
-SWIGRUNTIME PyObject *
-PySwigObject_oct(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_oct(PySwigObject * v)
{
- return PySwigObject_format("%o",v);
+ return PySwigObject_format("%o", v);
}
-SWIGRUNTIME PyObject *
-PySwigObject_hex(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_hex(PySwigObject * v)
{
- return PySwigObject_format("%x",v);
+ return PySwigObject_format("%x", v);
}
SWIGRUNTIME PyObject *
#ifdef METH_NOARGS
-PySwigObject_repr(PySwigObject *v)
+PySwigObject_repr(PySwigObject * v)
#else
-PySwigObject_repr(PySwigObject *v, PyObject *args)
+PySwigObject_repr(PySwigObject * v, PyObject * args)
#endif
{
- const char *name = SWIG_TypePrettyName(v->ty);
- PyObject *hex = PySwigObject_hex(v);
- PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
- Py_DECREF(hex);
- if (v->next) {
+ const char *name = SWIG_TypePrettyName(v->ty);
+ PyObject *hex = PySwigObject_hex(v);
+ PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
+ Py_DECREF(hex);
+ if (v->next) {
#ifdef METH_NOARGS
- PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
+ PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next);
#else
- PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
+ PyObject *nrep = PySwigObject_repr((PySwigObject *) v->next, args);
#endif
- PyString_ConcatAndDel(&repr,nrep);
- }
- return repr;
+ PyString_ConcatAndDel(&repr, nrep);
+ }
+ return repr;
}
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+SWIGRUNTIME int PySwigObject_print(PySwigObject * v, FILE * fp, int SWIGUNUSEDPARM(flags))
{
#ifdef METH_NOARGS
- PyObject *repr = PySwigObject_repr(v);
+ PyObject *repr = PySwigObject_repr(v);
#else
- PyObject *repr = PySwigObject_repr(v, NULL);
+ PyObject *repr = PySwigObject_repr(v, NULL);
#endif
- if (repr) {
- fputs(PyString_AsString(repr), fp);
- Py_DECREF(repr);
- return 0;
- } else {
- return 1;
- }
+ if (repr) {
+ fputs(PyString_AsString(repr), fp);
+ Py_DECREF(repr);
+ return 0;
+ } else {
+ return 1;
+ }
}
-SWIGRUNTIME PyObject *
-PySwigObject_str(PySwigObject *v)
+SWIGRUNTIME PyObject *PySwigObject_str(PySwigObject * v)
{
- char result[SWIG_BUFFER_SIZE];
- return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
- PyString_FromString(result) : 0;
+ char result[SWIG_BUFFER_SIZE];
+ return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ? PyString_FromString(result) : 0;
}
-SWIGRUNTIME int
-PySwigObject_compare(PySwigObject *v, PySwigObject *w)
+SWIGRUNTIME int PySwigObject_compare(PySwigObject * v, PySwigObject * w)
{
- void *i = v->ptr;
- void *j = w->ptr;
- return (i < j) ? -1 : ((i > j) ? 1 : 0);
+ void *i = v->ptr;
+ void *j = w->ptr;
+ return (i < j) ? -1 : ((i > j) ? 1 : 0);
}
-SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
+SWIGRUNTIME PyTypeObject *_PySwigObject_type(void);
-SWIGRUNTIME PyTypeObject*
-PySwigObject_type(void) {
- static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
- return type;
+SWIGRUNTIME PyTypeObject *PySwigObject_type(void)
+{
+ static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
+ return type;
}
-SWIGRUNTIMEINLINE int
-PySwigObject_Check(PyObject *op) {
- return ((op)->ob_type == PySwigObject_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
+SWIGRUNTIMEINLINE int PySwigObject_Check(PyObject * op)
+{
+ return ((op)->ob_type == PySwigObject_type())
+ || (strcmp((op)->ob_type->tp_name, "PySwigObject") == 0);
}
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own);
+SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own);
-SWIGRUNTIME void
-PySwigObject_dealloc(PyObject *v)
+SWIGRUNTIME void PySwigObject_dealloc(PyObject * v)
{
- PySwigObject *sobj = (PySwigObject *) v;
- PyObject *next = sobj->next;
- if (sobj->own == SWIG_POINTER_OWN) {
- swig_type_info *ty = sobj->ty;
- PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
- PyObject *destroy = data ? data->destroy : 0;
- if (destroy) {
- /* destroy is always a VARARGS method */
- PyObject *res;
- if (data->delargs) {
- /* we need to create a temporal object to carry the destroy operation */
- PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
- res = SWIG_Python_CallFunctor(destroy, tmp);
- Py_DECREF(tmp);
- } else {
- PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
- PyObject *mself = PyCFunction_GET_SELF(destroy);
- res = ((*meth)(mself, v));
- }
- Py_XDECREF(res);
- }
+ PySwigObject *sobj = (PySwigObject *) v;
+ PyObject *next = sobj->next;
+ if (sobj->own == SWIG_POINTER_OWN) {
+ swig_type_info *ty = sobj->ty;
+ PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+ PyObject *destroy = data ? data->destroy : 0;
+ if (destroy) {
+ /* destroy is always a VARARGS method */
+ PyObject *res;
+ if (data->delargs) {
+ /* we need to create a temporal object to carry the destroy operation */
+ PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
+ res = SWIG_Python_CallFunctor(destroy, tmp);
+ Py_DECREF(tmp);
+ } else {
+ PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
+ PyObject *mself = PyCFunction_GET_SELF(destroy);
+ res = ((*meth) (mself, v));
+ }
+ Py_XDECREF(res);
+ }
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
- else {
- const char *name = SWIG_TypePrettyName(ty);
- printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
- }
+ else {
+ const char *name = SWIG_TypePrettyName(ty);
+ printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
+ }
#endif
- }
- Py_XDECREF(next);
- PyObject_DEL(v);
+ }
+ Py_XDECREF(next);
+ PyObject_DEL(v);
}
-SWIGRUNTIME PyObject*
-PySwigObject_append(PyObject* v, PyObject* next)
+SWIGRUNTIME PyObject *PySwigObject_append(PyObject * v, PyObject * next)
{
- PySwigObject *sobj = (PySwigObject *) v;
+ PySwigObject *sobj = (PySwigObject *) v;
#ifndef METH_O
- PyObject *tmp = 0;
- if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
- next = tmp;
-#endif
- if (!PySwigObject_Check(next)) {
- return NULL;
- }
- sobj->next = next;
- Py_INCREF(next);
- return SWIG_Py_Void();
+ PyObject *tmp = 0;
+ if (!PyArg_ParseTuple(next, (char *) "O:append", &tmp))
+ return NULL;
+ next = tmp;
+#endif
+ if (!PySwigObject_Check(next)) {
+ return NULL;
+ }
+ sobj->next = next;
+ Py_INCREF(next);
+ return SWIG_Py_Void();
}
-SWIGRUNTIME PyObject*
+SWIGRUNTIME PyObject *
#ifdef METH_NOARGS
-PySwigObject_next(PyObject* v)
+PySwigObject_next(PyObject * v)
#else
-PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_next(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
#endif
{
- PySwigObject *sobj = (PySwigObject *) v;
- if (sobj->next) {
- Py_INCREF(sobj->next);
- return sobj->next;
- } else {
- return SWIG_Py_Void();
- }
+ PySwigObject *sobj = (PySwigObject *) v;
+ if (sobj->next) {
+ Py_INCREF(sobj->next);
+ return sobj->next;
+ } else {
+ return SWIG_Py_Void();
+ }
}
-SWIGINTERN PyObject*
+SWIGINTERN PyObject *
#ifdef METH_NOARGS
-PySwigObject_disown(PyObject *v)
+PySwigObject_disown(PyObject * v)
#else
-PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_disown(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
#endif
{
- PySwigObject *sobj = (PySwigObject *)v;
- sobj->own = 0;
- return SWIG_Py_Void();
+ PySwigObject *sobj = (PySwigObject *) v;
+ sobj->own = 0;
+ return SWIG_Py_Void();
}
-SWIGINTERN PyObject*
+SWIGINTERN PyObject *
#ifdef METH_NOARGS
-PySwigObject_acquire(PyObject *v)
+PySwigObject_acquire(PyObject * v)
#else
-PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
+PySwigObject_acquire(PyObject * v, PyObject * SWIGUNUSEDPARM(args))
#endif
{
- PySwigObject *sobj = (PySwigObject *)v;
- sobj->own = SWIG_POINTER_OWN;
- return SWIG_Py_Void();
+ PySwigObject *sobj = (PySwigObject *) v;
+ sobj->own = SWIG_POINTER_OWN;
+ return SWIG_Py_Void();
}
-SWIGINTERN PyObject*
-PySwigObject_own(PyObject *v, PyObject *args)
+SWIGINTERN PyObject *PySwigObject_own(PyObject * v, PyObject * args)
{
- PyObject *val = 0;
+ PyObject *val = 0;
#if (PY_VERSION_HEX < 0x02020000)
- if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
+ if (!PyArg_ParseTuple(args, (char *) "|O:own", &val))
#else
- if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
+ if (!PyArg_UnpackTuple(args, (char *) "own", 0, 1, &val))
#endif
- {
- return NULL;
- }
- else
- {
- PySwigObject *sobj = (PySwigObject *)v;
- PyObject *obj = PyBool_FromLong(sobj->own);
- if (val) {
-#ifdef METH_NOARGS
- if (PyObject_IsTrue(val)) {
- PySwigObject_acquire(v);
+ {
+ return NULL;
} else {
- PySwigObject_disown(v);
- }
+ PySwigObject *sobj = (PySwigObject *) v;
+ PyObject *obj = PyBool_FromLong(sobj->own);
+ if (val) {
+#ifdef METH_NOARGS
+ if (PyObject_IsTrue(val)) {
+ PySwigObject_acquire(v);
+ } else {
+ PySwigObject_disown(v);
+ }
#else
- if (PyObject_IsTrue(val)) {
- PySwigObject_acquire(v,args);
- } else {
- PySwigObject_disown(v,args);
- }
+ if (PyObject_IsTrue(val)) {
+ PySwigObject_acquire(v, args);
+ } else {
+ PySwigObject_disown(v, args);
+ }
#endif
- }
- return obj;
- }
+ }
+ return obj;
+ }
}
#ifdef METH_O
-static PyMethodDef
-swigobject_methods[] = {
- {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
- {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
- {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
- {(char *)"append", (PyCFunction)PySwigObject_append, METH_O, (char *)"appends another 'this' object"},
- {(char *)"next", (PyCFunction)PySwigObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
- {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_NOARGS, (char *)"returns object representation"},
- {0, 0, 0, 0}
+static PyMethodDef swigobject_methods[] = {
+ {(char *) "disown", (PyCFunction) PySwigObject_disown, METH_NOARGS, (char *) "releases ownership of the pointer"},
+ {(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_NOARGS, (char *) "aquires ownership of the pointer"},
+ {(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
+ {(char *) "append", (PyCFunction) PySwigObject_append, METH_O, (char *) "appends another 'this' object"},
+ {(char *) "next", (PyCFunction) PySwigObject_next, METH_NOARGS, (char *) "returns the next 'this' object"},
+ {(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_NOARGS, (char *) "returns object representation"},
+ {0, 0, 0, 0}
};
#else
-static PyMethodDef
-swigobject_methods[] = {
- {(char *)"disown", (PyCFunction)PySwigObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
- {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
- {(char *)"own", (PyCFunction)PySwigObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
- {(char *)"append", (PyCFunction)PySwigObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
- {(char *)"next", (PyCFunction)PySwigObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
- {(char *)"__repr__",(PyCFunction)PySwigObject_repr, METH_VARARGS, (char *)"returns object representation"},
- {0, 0, 0, 0}
+static PyMethodDef swigobject_methods[] = {
+ {(char *) "disown", (PyCFunction) PySwigObject_disown, METH_VARARGS, (char *) "releases ownership of the pointer"},
+ {(char *) "acquire", (PyCFunction) PySwigObject_acquire, METH_VARARGS, (char *) "aquires ownership of the pointer"},
+ {(char *) "own", (PyCFunction) PySwigObject_own, METH_VARARGS, (char *) "returns/sets ownership of the pointer"},
+ {(char *) "append", (PyCFunction) PySwigObject_append, METH_VARARGS, (char *) "appends another 'this' object"},
+ {(char *) "next", (PyCFunction) PySwigObject_next, METH_VARARGS, (char *) "returns the next 'this' object"},
+ {(char *) "__repr__", (PyCFunction) PySwigObject_repr, METH_VARARGS, (char *) "returns object representation"},
+ {0, 0, 0, 0}
};
#endif
#if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *
-PySwigObject_getattr(PySwigObject *sobj,char *name)
+SWIGINTERN PyObject *PySwigObject_getattr(PySwigObject * sobj, char *name)
{
- return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
+ return Py_FindMethod(swigobject_methods, (PyObject *) sobj, name);
}
#endif
-SWIGRUNTIME PyTypeObject*
-_PySwigObject_type(void) {
- static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-
- static PyNumberMethods PySwigObject_as_number = {
- (binaryfunc)0, /*nb_add*/
- (binaryfunc)0, /*nb_subtract*/
- (binaryfunc)0, /*nb_multiply*/
- (binaryfunc)0, /*nb_divide*/
- (binaryfunc)0, /*nb_remainder*/
- (binaryfunc)0, /*nb_divmod*/
- (ternaryfunc)0,/*nb_power*/
- (unaryfunc)0, /*nb_negative*/
- (unaryfunc)0, /*nb_positive*/
- (unaryfunc)0, /*nb_absolute*/
- (inquiry)0, /*nb_nonzero*/
- 0, /*nb_invert*/
- 0, /*nb_lshift*/
- 0, /*nb_rshift*/
- 0, /*nb_and*/
- 0, /*nb_xor*/
- 0, /*nb_or*/
- (coercion)0, /*nb_coerce*/
- (unaryfunc)PySwigObject_long, /*nb_int*/
- (unaryfunc)PySwigObject_long, /*nb_long*/
- (unaryfunc)0, /*nb_float*/
- (unaryfunc)PySwigObject_oct, /*nb_oct*/
- (unaryfunc)PySwigObject_hex, /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
- 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
-#endif
- };
-
- static PyTypeObject pyswigobject_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
- (char *)"PySwigObject", /* tp_name */
- sizeof(PySwigObject), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PySwigObject_dealloc, /* tp_dealloc */
- (printfunc)PySwigObject_print, /* tp_print */
+SWIGRUNTIME PyTypeObject *_PySwigObject_type(void)
+{
+ static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
+
+ static PyNumberMethods PySwigObject_as_number = {
+ (binaryfunc) 0, /*nb_add */
+ (binaryfunc) 0, /*nb_subtract */
+ (binaryfunc) 0, /*nb_multiply */
+ (binaryfunc) 0, /*nb_divide */
+ (binaryfunc) 0, /*nb_remainder */
+ (binaryfunc) 0, /*nb_divmod */
+ (ternaryfunc) 0, /*nb_power */
+ (unaryfunc) 0, /*nb_negative */
+ (unaryfunc) 0, /*nb_positive */
+ (unaryfunc) 0, /*nb_absolute */
+ (inquiry) 0, /*nb_nonzero */
+ 0, /*nb_invert */
+ 0, /*nb_lshift */
+ 0, /*nb_rshift */
+ 0, /*nb_and */
+ 0, /*nb_xor */
+ 0, /*nb_or */
+ (coercion) 0, /*nb_coerce */
+ (unaryfunc) PySwigObject_long, /*nb_int */
+ (unaryfunc) PySwigObject_long, /*nb_long */
+ (unaryfunc) 0, /*nb_float */
+ (unaryfunc) PySwigObject_oct, /*nb_oct */
+ (unaryfunc) PySwigObject_hex, /*nb_hex */
+#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index */
+#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_inplace_true_divide */
+#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_inplace_or */
+#endif
+ };
+
+ static PyTypeObject pyswigobject_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ (char *) "PySwigObject", /* tp_name */
+ sizeof(PySwigObject), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor) PySwigObject_dealloc, /* tp_dealloc */
+ (printfunc) PySwigObject_print, /* tp_print */
#if PY_VERSION_HEX < 0x02020000
- (getattrfunc)PySwigObject_getattr, /* tp_getattr */
+ (getattrfunc) PySwigObject_getattr, /* tp_getattr */
#else
- (getattrfunc)0, /* tp_getattr */
+ (getattrfunc) 0, /* tp_getattr */
#endif
- (setattrfunc)0, /* tp_setattr */
- (cmpfunc)PySwigObject_compare, /* tp_compare */
- (reprfunc)PySwigObject_repr, /* tp_repr */
- &PySwigObject_as_number, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- (hashfunc)0, /* tp_hash */
- (ternaryfunc)0, /* tp_call */
- (reprfunc)PySwigObject_str, /* tp_str */
- PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- swigobject_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
+ (setattrfunc) 0, /* tp_setattr */
+ (cmpfunc) PySwigObject_compare, /* tp_compare */
+ (reprfunc) PySwigObject_repr, /* tp_repr */
+ &PySwigObject_as_number, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ (hashfunc) 0, /* tp_hash */
+ (ternaryfunc) 0, /* tp_call */
+ (reprfunc) PySwigObject_str, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ swigobject_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
- 0, /* tp_iter */
- 0, /* tp_iternext */
- swigobject_methods, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ swigobject_methods, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
+ 0, /* tp_del */
#endif
#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
+ 0, 0, 0, 0 /* tp_alloc -> tp_next */
#endif
- };
- pyswigobject_type = tmp;
- pyswigobject_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &pyswigobject_type;
+ };
+ pyswigobject_type = tmp;
+ pyswigobject_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &pyswigobject_type;
}
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own)
+SWIGRUNTIME PyObject *PySwigObject_New(void *ptr, swig_type_info * ty, int own)
{
- PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
- if (sobj) {
- sobj->ptr = ptr;
- sobj->ty = ty;
- sobj->own = own;
- sobj->next = 0;
- }
- return (PyObject *)sobj;
+ PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
+ if (sobj) {
+ sobj->ptr = ptr;
+ sobj->ty = ty;
+ sobj->own = own;
+ sobj->next = 0;
+ }
+ return (PyObject *) sobj;
}
/* -----------------------------------------------------------------------------
@@ -1718,404 +1700,402 @@
* ----------------------------------------------------------------------------- */
typedef struct {
- PyObject_HEAD
- void *pack;
- swig_type_info *ty;
- size_t size;
+ PyObject_HEAD void *pack;
+ swig_type_info *ty;
+ size_t size;
} PySwigPacked;
-SWIGRUNTIME int
-PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
+SWIGRUNTIME int PySwigPacked_print(PySwigPacked * v, FILE * fp, int SWIGUNUSEDPARM(flags))
{
- char result[SWIG_BUFFER_SIZE];
- fputs("<Swig Packed ", fp);
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
- fputs("at ", fp);
- fputs(result, fp);
- }
- fputs(v->ty->name,fp);
- fputs(">", fp);
- return 0;
+ char result[SWIG_BUFFER_SIZE];
+ fputs("<Swig Packed ", fp);
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ fputs("at ", fp);
+ fputs(result, fp);
+ }
+ fputs(v->ty->name, fp);
+ fputs(">", fp);
+ return 0;
}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_repr(PySwigPacked *v)
+
+SWIGRUNTIME PyObject *PySwigPacked_repr(PySwigPacked * v)
{
- char result[SWIG_BUFFER_SIZE];
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
- return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
- } else {
- return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
- }
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
+ } else {
+ return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
+ }
}
-SWIGRUNTIME PyObject *
-PySwigPacked_str(PySwigPacked *v)
+SWIGRUNTIME PyObject *PySwigPacked_str(PySwigPacked * v)
+{
+ char result[SWIG_BUFFER_SIZE];
+ if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
+ return PyString_FromFormat("%s%s", result, v->ty->name);
+ } else {
+ return PyString_FromString(v->ty->name);
+ }
+}
+
+SWIGRUNTIME int PySwigPacked_compare(PySwigPacked * v, PySwigPacked * w)
+{
+ size_t i = v->size;
+ size_t j = w->size;
+ int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
+ return s ? s : strncmp((char *) v->pack, (char *) w->pack, 2 * v->size);
+}
+
+SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void);
+
+SWIGRUNTIME PyTypeObject *PySwigPacked_type(void)
{
- char result[SWIG_BUFFER_SIZE];
- if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
- return PyString_FromFormat("%s%s", result, v->ty->name);
- } else {
- return PyString_FromString(v->ty->name);
- }
-}
-
-SWIGRUNTIME int
-PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
-{
- size_t i = v->size;
- size_t j = w->size;
- int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
- return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigPacked_type(void) {
- static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
- return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
- return ((op)->ob_type == _PySwigPacked_type())
- || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
-}
-
-SWIGRUNTIME void
-PySwigPacked_dealloc(PyObject *v)
-{
- if (PySwigPacked_Check(v)) {
- PySwigPacked *sobj = (PySwigPacked *) v;
- free(sobj->pack);
- }
- PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyTypeObject*
-_PySwigPacked_type(void) {
- static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
- static PyTypeObject pyswigpacked_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* ob_size */
- (char *)"PySwigPacked", /* tp_name */
- sizeof(PySwigPacked), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PySwigPacked_dealloc, /* tp_dealloc */
- (printfunc)PySwigPacked_print, /* tp_print */
- (getattrfunc)0, /* tp_getattr */
- (setattrfunc)0, /* tp_setattr */
- (cmpfunc)PySwigPacked_compare, /* tp_compare */
- (reprfunc)PySwigPacked_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- (hashfunc)0, /* tp_hash */
- (ternaryfunc)0, /* tp_call */
- (reprfunc)PySwigPacked_str, /* tp_str */
- PyObject_GenericGetAttr, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- Py_TPFLAGS_DEFAULT, /* tp_flags */
- swigpacked_doc, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
+ static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
+ return type;
+}
+
+SWIGRUNTIMEINLINE int PySwigPacked_Check(PyObject * op)
+{
+ return ((op)->ob_type == _PySwigPacked_type())
+ || (strcmp((op)->ob_type->tp_name, "PySwigPacked") == 0);
+}
+
+SWIGRUNTIME void PySwigPacked_dealloc(PyObject * v)
+{
+ if (PySwigPacked_Check(v)) {
+ PySwigPacked *sobj = (PySwigPacked *) v;
+ free(sobj->pack);
+ }
+ PyObject_DEL(v);
+}
+
+SWIGRUNTIME PyTypeObject *_PySwigPacked_type(void)
+{
+ static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
+ static PyTypeObject pyswigpacked_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* ob_size */
+ (char *) "PySwigPacked", /* tp_name */
+ sizeof(PySwigPacked), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor) PySwigPacked_dealloc, /* tp_dealloc */
+ (printfunc) PySwigPacked_print, /* tp_print */
+ (getattrfunc) 0, /* tp_getattr */
+ (setattrfunc) 0, /* tp_setattr */
+ (cmpfunc) PySwigPacked_compare, /* tp_compare */
+ (reprfunc) PySwigPacked_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ (hashfunc) 0, /* tp_hash */
+ (ternaryfunc) 0, /* tp_call */
+ (reprfunc) PySwigPacked_str, /* tp_str */
+ PyObject_GenericGetAttr, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ Py_TPFLAGS_DEFAULT, /* tp_flags */
+ swigpacked_doc, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
- 0, /* tp_iter */
- 0, /* tp_iternext */
- 0, /* tp_methods */
- 0, /* tp_members */
- 0, /* tp_getset */
- 0, /* tp_base */
- 0, /* tp_dict */
- 0, /* tp_descr_get */
- 0, /* tp_descr_set */
- 0, /* tp_dictoffset */
- 0, /* tp_init */
- 0, /* tp_alloc */
- 0, /* tp_new */
- 0, /* tp_free */
- 0, /* tp_is_gc */
- 0, /* tp_bases */
- 0, /* tp_mro */
- 0, /* tp_cache */
- 0, /* tp_subclasses */
- 0, /* tp_weaklist */
+ 0, /* tp_iter */
+ 0, /* tp_iternext */
+ 0, /* tp_methods */
+ 0, /* tp_members */
+ 0, /* tp_getset */
+ 0, /* tp_base */
+ 0, /* tp_dict */
+ 0, /* tp_descr_get */
+ 0, /* tp_descr_set */
+ 0, /* tp_dictoffset */
+ 0, /* tp_init */
+ 0, /* tp_alloc */
+ 0, /* tp_new */
+ 0, /* tp_free */
+ 0, /* tp_is_gc */
+ 0, /* tp_bases */
+ 0, /* tp_mro */
+ 0, /* tp_cache */
+ 0, /* tp_subclasses */
+ 0, /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
+ 0, /* tp_del */
#endif
#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
+ 0, 0, 0, 0 /* tp_alloc -> tp_next */
#endif
- };
- pyswigpacked_type = tmp;
- pyswigpacked_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &pyswigpacked_type;
+ };
+ pyswigpacked_type = tmp;
+ pyswigpacked_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &pyswigpacked_type;
}
-SWIGRUNTIME PyObject *
-PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
+SWIGRUNTIME PyObject *PySwigPacked_New(void *ptr, size_t size, swig_type_info * ty)
{
- PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
- if (sobj) {
- void *pack = malloc(size);
- if (pack) {
- memcpy(pack, ptr, size);
- sobj->pack = pack;
- sobj->ty = ty;
- sobj->size = size;
- } else {
- PyObject_DEL((PyObject *) sobj);
- sobj = 0;
- }
- }
- return (PyObject *) sobj;
+ PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
+ if (sobj) {
+ void *pack = malloc(size);
+ if (pack) {
+ memcpy(pack, ptr, size);
+ sobj->pack = pack;
+ sobj->ty = ty;
+ sobj->size = size;
+ } else {
+ PyObject_DEL((PyObject *) sobj);
+ sobj = 0;
+ }
+ }
+ return (PyObject *) sobj;
}
-SWIGRUNTIME swig_type_info *
-PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
+SWIGRUNTIME swig_type_info *PySwigPacked_UnpackData(PyObject * obj, void *ptr, size_t size)
{
- if (PySwigPacked_Check(obj)) {
- PySwigPacked *sobj = (PySwigPacked *)obj;
- if (sobj->size != size) return 0;
- memcpy(ptr, sobj->pack, size);
- return sobj->ty;
- } else {
- return 0;
- }
+ if (PySwigPacked_Check(obj)) {
+ PySwigPacked *sobj = (PySwigPacked *) obj;
+ if (sobj->size != size)
+ return 0;
+ memcpy(ptr, sobj->pack, size);
+ return sobj->ty;
+ } else {
+ return 0;
+ }
}
/* -----------------------------------------------------------------------------
* pointers/data manipulation
* ----------------------------------------------------------------------------- */
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_This(void)
+SWIGRUNTIMEINLINE PyObject *_SWIG_This(void)
{
- return PyString_FromString("this");
+ return PyString_FromString("this");
}
-SWIGRUNTIME PyObject *
-SWIG_This(void)
+SWIGRUNTIME PyObject *SWIG_This(void)
{
- static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
- return swig_this;
+ static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
+ return swig_this;
}
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
-SWIGRUNTIME PySwigObject *
-SWIG_Python_GetSwigThis(PyObject *pyobj)
+SWIGRUNTIME PySwigObject *SWIG_Python_GetSwigThis(PyObject * pyobj)
{
- if (PySwigObject_Check(pyobj)) {
- return (PySwigObject *) pyobj;
- } else {
- PyObject *obj = 0;
+ if (PySwigObject_Check(pyobj)) {
+ return (PySwigObject *) pyobj;
+ } else {
+ PyObject *obj = 0;
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
- if (PyInstance_Check(pyobj)) {
- obj = _PyInstance_Lookup(pyobj, SWIG_This());
- } else {
- PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
- if (dictptr != NULL) {
- PyObject *dict = *dictptr;
- obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
- } else {
+ if (PyInstance_Check(pyobj)) {
+ obj = _PyInstance_Lookup(pyobj, SWIG_This());
+ } else {
+ PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
+ if (dictptr != NULL) {
+ PyObject *dict = *dictptr;
+ obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
+ } else {
#ifdef PyWeakref_CheckProxy
- if (PyWeakref_CheckProxy(pyobj)) {
- PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
- return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
- }
-#endif
- obj = PyObject_GetAttr(pyobj,SWIG_This());
- if (obj) {
- Py_DECREF(obj);
- } else {
- if (PyErr_Occurred()) PyErr_Clear();
- return 0;
- }
- }
- }
+ if (PyWeakref_CheckProxy(pyobj)) {
+ PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
+ return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
+ }
+#endif
+ obj = PyObject_GetAttr(pyobj, SWIG_This());
+ if (obj) {
+ Py_DECREF(obj);
+ } else {
+ if (PyErr_Occurred())
+ PyErr_Clear();
+ return 0;
+ }
+ }
+ }
#else
- obj = PyObject_GetAttr(pyobj,SWIG_This());
- if (obj) {
- Py_DECREF(obj);
- } else {
- if (PyErr_Occurred()) PyErr_Clear();
- return 0;
- }
+ obj = PyObject_GetAttr(pyobj, SWIG_This());
+ if (obj) {
+ Py_DECREF(obj);
+ } else {
+ if (PyErr_Occurred())
+ PyErr_Clear();
+ return 0;
+ }
#endif
- if (obj && !PySwigObject_Check(obj)) {
- /* a PyObject is called 'this', try to get the 'real this'
- PySwigObject from it */
- return SWIG_Python_GetSwigThis(obj);
- }
- return (PySwigObject *)obj;
- }
+ if (obj && !PySwigObject_Check(obj)) {
+ /* a PyObject is called 'this', try to get the 'real this'
+ PySwigObject from it */
+ return SWIG_Python_GetSwigThis(obj);
+ }
+ return (PySwigObject *) obj;
+ }
}
/* Acquire a pointer value */
-SWIGRUNTIME int
-SWIG_Python_AcquirePtr(PyObject *obj, int own) {
- if (own == SWIG_POINTER_OWN) {
- PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
- if (sobj) {
- int oldown = sobj->own;
- sobj->own = own;
- return oldown;
- }
- }
- return 0;
+SWIGRUNTIME int SWIG_Python_AcquirePtr(PyObject * obj, int own)
+{
+ if (own == SWIG_POINTER_OWN) {
+ PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (sobj) {
+ int oldown = sobj->own;
+ sobj->own = own;
+ return oldown;
+ }
+ }
+ return 0;
}
/* Convert a pointer value */
-SWIGRUNTIME int
-SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
- if (!obj) return SWIG_ERROR;
- if (obj == Py_None) {
- if (ptr) *ptr = 0;
- return SWIG_OK;
- } else {
- PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
- if (own)
- *own = 0;
- while (sobj) {
- void *vptr = sobj->ptr;
- if (ty) {
- swig_type_info *to = sobj->ty;
- if (to == ty) {
- /* no type cast needed */
- if (ptr) *ptr = vptr;
- break;
+SWIGRUNTIME int SWIG_Python_ConvertPtrAndOwn(PyObject * obj, void **ptr, swig_type_info * ty, int flags, int *own)
+{
+ if (!obj)
+ return SWIG_ERROR;
+ if (obj == Py_None) {
+ if (ptr)
+ *ptr = 0;
+ return SWIG_OK;
} else {
- swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
- if (!tc) {
- sobj = (PySwigObject *)sobj->next;
- } else {
- if (ptr) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- if (newmemory == SWIG_CAST_NEW_MEMORY) {
- assert(own);
- if (own)
- *own = *own | SWIG_CAST_NEW_MEMORY;
- }
- }
- break;
- }
- }
- } else {
- if (ptr) *ptr = vptr;
- break;
- }
- }
- if (sobj) {
- if (own)
- *own = *own | sobj->own;
- if (flags & SWIG_POINTER_DISOWN) {
- sobj->own = 0;
- }
- return SWIG_OK;
- } else {
- int res = SWIG_ERROR;
- if (flags & SWIG_POINTER_IMPLICIT_CONV) {
- PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
- if (data && !data->implicitconv) {
- PyObject *klass = data->klass;
- if (klass) {
- PyObject *impconv;
- data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
- impconv = SWIG_Python_CallFunctor(klass, obj);
- data->implicitconv = 0;
- if (PyErr_Occurred()) {
- PyErr_Clear();
- impconv = 0;
- }
- if (impconv) {
- PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
- if (iobj) {
- void *vptr;
- res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
- if (SWIG_IsOK(res)) {
- if (ptr) {
- *ptr = vptr;
- /* transfer the ownership to 'ptr' */
- iobj->own = 0;
- res = SWIG_AddCast(res);
- res = SWIG_AddNewMask(res);
- } else {
- res = SWIG_AddCast(res);
- }
- }
- }
- Py_DECREF(impconv);
- }
- }
+ PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+ if (own)
+ *own = 0;
+ while (sobj) {
+ void *vptr = sobj->ptr;
+ if (ty) {
+ swig_type_info *to = sobj->ty;
+ if (to == ty) {
+ /* no type cast needed */
+ if (ptr)
+ *ptr = vptr;
+ break;
+ } else {
+ swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
+ if (!tc) {
+ sobj = (PySwigObject *) sobj->next;
+ } else {
+ if (ptr) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+ if (newmemory == SWIG_CAST_NEW_MEMORY) {
+ assert(own);
+ if (own)
+ *own = *own | SWIG_CAST_NEW_MEMORY;
+ }
+ }
+ break;
+ }
+ }
+ } else {
+ if (ptr)
+ *ptr = vptr;
+ break;
+ }
+ }
+ if (sobj) {
+ if (own)
+ *own = *own | sobj->own;
+ if (flags & SWIG_POINTER_DISOWN) {
+ sobj->own = 0;
+ }
+ return SWIG_OK;
+ } else {
+ int res = SWIG_ERROR;
+ if (flags & SWIG_POINTER_IMPLICIT_CONV) {
+ PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
+ if (data && !data->implicitconv) {
+ PyObject *klass = data->klass;
+ if (klass) {
+ PyObject *impconv;
+ data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors */
+ impconv = SWIG_Python_CallFunctor(klass, obj);
+ data->implicitconv = 0;
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ impconv = 0;
+ }
+ if (impconv) {
+ PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
+ if (iobj) {
+ void *vptr;
+ res = SWIG_Python_ConvertPtrAndOwn((PyObject *) iobj, &vptr, ty, 0, 0);
+ if (SWIG_IsOK(res)) {
+ if (ptr) {
+ *ptr = vptr;
+ /* transfer the ownership to 'ptr' */
+ iobj->own = 0;
+ res = SWIG_AddCast(res);
+ res = SWIG_AddNewMask(res);
+ } else {
+ res = SWIG_AddCast(res);
+ }
+ }
+ }
+ Py_DECREF(impconv);
+ }
+ }
+ }
+ }
+ return res;
+ }
}
- }
- return res;
- }
- }
}
/* Convert a function ptr value */
-SWIGRUNTIME int
-SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
- if (!PyCFunction_Check(obj)) {
- return SWIG_ConvertPtr(obj, ptr, ty, 0);
- } else {
- void *vptr = 0;
-
- /* here we get the method pointer for callbacks */
- const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
- const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
- if (desc) {
- desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
- if (!desc) return SWIG_ERROR;
- }
- if (ty) {
- swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
- if (tc) {
- int newmemory = 0;
- *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
- assert(!newmemory); /* newmemory handling not yet implemented */
- } else {
- return SWIG_ERROR;
- }
- } else {
- *ptr = vptr;
- }
- return SWIG_OK;
- }
+SWIGRUNTIME int SWIG_Python_ConvertFunctionPtr(PyObject * obj, void **ptr, swig_type_info * ty)
+{
+ if (!PyCFunction_Check(obj)) {
+ return SWIG_ConvertPtr(obj, ptr, ty, 0);
+ } else {
+ void *vptr = 0;
+
+ /* here we get the method pointer for callbacks */
+ const char *doc = (((PyCFunctionObject *) obj)->m_ml->ml_doc);
+ const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
+ if (desc) {
+ desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
+ if (!desc)
+ return SWIG_ERROR;
+ }
+ if (ty) {
+ swig_cast_info *tc = SWIG_TypeCheck(desc, ty);
+ if (tc) {
+ int newmemory = 0;
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
+ assert(!newmemory); /* newmemory handling not yet implemented */
+ } else {
+ return SWIG_ERROR;
+ }
+ } else {
+ *ptr = vptr;
+ }
+ return SWIG_OK;
+ }
}
/* Convert a packed value value */
-SWIGRUNTIME int
-SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
- swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
- if (!to) return SWIG_ERROR;
- if (ty) {
- if (to != ty) {
- /* check type cast? */
- swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
- if (!tc) return SWIG_ERROR;
- }
- }
- return SWIG_OK;
-}
+SWIGRUNTIME int SWIG_Python_ConvertPacked(PyObject * obj, void *ptr, size_t sz, swig_type_info * ty)
+{
+ swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
+ if (!to)
+ return SWIG_ERROR;
+ if (ty) {
+ if (to != ty) {
+ /* check type cast? */
+ swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
+ if (!tc)
+ return SWIG_ERROR;
+ }
+ }
+ return SWIG_OK;
+}
/* -----------------------------------------------------------------------------
* Create a new pointer object
@@ -2126,133 +2106,131 @@
'this' attribute.
*/
-SWIGRUNTIME PyObject*
-SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
+SWIGRUNTIME PyObject *SWIG_Python_NewShadowInstance(PySwigClientData * data, PyObject * swig_this)
{
#if (PY_VERSION_HEX >= 0x02020000)
- PyObject *inst = 0;
- PyObject *newraw = data->newraw;
- if (newraw) {
- inst = PyObject_Call(newraw, data->newargs, NULL);
- if (inst) {
+ PyObject *inst = 0;
+ PyObject *newraw = data->newraw;
+ if (newraw) {
+ inst = PyObject_Call(newraw, data->newargs, NULL);
+ if (inst) {
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
- PyObject *dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- }
- }
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+ PyObject *dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ }
+ }
#else
- PyObject *key = SWIG_This();
- PyObject_SetAttr(inst, key, swig_this);
+ PyObject *key = SWIG_This();
+ PyObject_SetAttr(inst, key, swig_this);
#endif
- }
- } else {
- PyObject *dict = PyDict_New();
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- inst = PyInstance_NewRaw(data->newargs, dict);
- Py_DECREF(dict);
- }
- return inst;
+ }
+ } else {
+ PyObject *dict = PyDict_New();
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ inst = PyInstance_NewRaw(data->newargs, dict);
+ Py_DECREF(dict);
+ }
+ return inst;
#else
#if (PY_VERSION_HEX >= 0x02010000)
- PyObject *inst;
- PyObject *dict = PyDict_New();
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- inst = PyInstance_NewRaw(data->newargs, dict);
- Py_DECREF(dict);
- return (PyObject *) inst;
+ PyObject *inst;
+ PyObject *dict = PyDict_New();
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ inst = PyInstance_NewRaw(data->newargs, dict);
+ Py_DECREF(dict);
+ return (PyObject *) inst;
#else
- PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
- if (inst == NULL) {
- return NULL;
- }
- inst->in_class = (PyClassObject *)data->newargs;
- Py_INCREF(inst->in_class);
- inst->in_dict = PyDict_New();
- if (inst->in_dict == NULL) {
- Py_DECREF(inst);
- return NULL;
- }
+ PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
+ if (inst == NULL) {
+ return NULL;
+ }
+ inst->in_class = (PyClassObject *) data->newargs;
+ Py_INCREF(inst->in_class);
+ inst->in_dict = PyDict_New();
+ if (inst->in_dict == NULL) {
+ Py_DECREF(inst);
+ return NULL;
+ }
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
- inst->in_weakreflist = NULL;
+ inst->in_weakreflist = NULL;
#endif
#ifdef Py_TPFLAGS_GC
- PyObject_GC_Init(inst);
+ PyObject_GC_Init(inst);
#endif
- PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
- return (PyObject *) inst;
+ PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
+ return (PyObject *) inst;
#endif
#endif
}
-SWIGRUNTIME void
-SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
+SWIGRUNTIME void SWIG_Python_SetSwigThis(PyObject * inst, PyObject * swig_this)
{
- PyObject *dict;
+ PyObject *dict;
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
- dict = *dictptr;
- if (dict == NULL) {
- dict = PyDict_New();
- *dictptr = dict;
- }
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- return;
- }
-#endif
- dict = PyObject_GetAttrString(inst, (char*)"__dict__");
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- Py_DECREF(dict);
-}
+ PyObject **dictptr = _PyObject_GetDictPtr(inst);
+ if (dictptr != NULL) {
+ dict = *dictptr;
+ if (dict == NULL) {
+ dict = PyDict_New();
+ *dictptr = dict;
+ }
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ return;
+ }
+#endif
+ dict = PyObject_GetAttrString(inst, (char *) "__dict__");
+ PyDict_SetItem(dict, SWIG_This(), swig_this);
+ Py_DECREF(dict);
+}
-SWIGINTERN PyObject *
-SWIG_Python_InitShadowInstance(PyObject *args) {
- PyObject *obj[2];
- if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
- return NULL;
- } else {
- PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
- if (sthis) {
- PySwigObject_append((PyObject*) sthis, obj[1]);
- } else {
- SWIG_Python_SetSwigThis(obj[0], obj[1]);
- }
- return SWIG_Py_Void();
- }
+SWIGINTERN PyObject *SWIG_Python_InitShadowInstance(PyObject * args)
+{
+ PyObject *obj[2];
+ if (!SWIG_Python_UnpackTuple(args, (char *) "swiginit", 2, 2, obj)) {
+ return NULL;
+ } else {
+ PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
+ if (sthis) {
+ PySwigObject_append((PyObject *) sthis, obj[1]);
+ } else {
+ SWIG_Python_SetSwigThis(obj[0], obj[1]);
+ }
+ return SWIG_Py_Void();
+ }
}
/* Create a new pointer object */
-SWIGRUNTIME PyObject *
-SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
- if (!ptr) {
- return SWIG_Py_Void();
- } else {
- int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
- PyObject *robj = PySwigObject_New(ptr, type, own);
- PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
- if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
- PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
- if (inst) {
- Py_DECREF(robj);
- robj = inst;
- }
- }
- return robj;
- }
+SWIGRUNTIME PyObject *SWIG_Python_NewPointerObj(void *ptr, swig_type_info * type, int flags)
+{
+ if (!ptr) {
+ return SWIG_Py_Void();
+ } else {
+ int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
+ PyObject *robj = PySwigObject_New(ptr, type, own);
+ PySwigClientData *clientdata = type ? (PySwigClientData *) (type->clientdata) : 0;
+ if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
+ PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
+ if (inst) {
+ Py_DECREF(robj);
+ robj = inst;
+ }
+ }
+ return robj;
+ }
}
/* Create a new packed object */
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
- return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
+SWIGRUNTIMEINLINE PyObject *SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info * type)
+{
+ return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
}
/* -----------------------------------------------------------------------------*
@@ -2263,114 +2241,108 @@
void *SWIG_ReturnGlobalTypeList(void *);
#endif
-SWIGRUNTIME swig_module_info *
-SWIG_Python_GetModule(void) {
- static void *type_pointer = (void *)0;
- /* first check if module already created */
- if (!type_pointer) {
+SWIGRUNTIME swig_module_info *SWIG_Python_GetModule(void)
+{
+ static void *type_pointer = (void *) 0;
+ /* first check if module already created */
+ if (!type_pointer) {
#ifdef SWIG_LINK_RUNTIME
- type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
+ type_pointer = SWIG_ReturnGlobalTypeList((void *) 0);
#else
- type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
- (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
- if (PyErr_Occurred()) {
- PyErr_Clear();
- type_pointer = (void *)0;
- }
+ type_pointer = PyCObject_Import((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME);
+ if (PyErr_Occurred()) {
+ PyErr_Clear();
+ type_pointer = (void *) 0;
+ }
#endif
- }
- return (swig_module_info *) type_pointer;
+ }
+ return (swig_module_info *) type_pointer;
}
#if PY_MAJOR_VERSION < 2
/* PyModule_AddObject function was introduced in Python 2.0. The following function
is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
+SWIGINTERN int PyModule_AddObject(PyObject * m, char *name, PyObject * o)
{
- PyObject *dict;
- if (!PyModule_Check(m)) {
- PyErr_SetString(PyExc_TypeError,
- "PyModule_AddObject() needs module as first arg");
- return SWIG_ERROR;
- }
- if (!o) {
- PyErr_SetString(PyExc_TypeError,
- "PyModule_AddObject() needs non-NULL value");
- return SWIG_ERROR;
- }
-
- dict = PyModule_GetDict(m);
- if (dict == NULL) {
- /* Internal error -- modules must have a dict! */
- PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
- PyModule_GetName(m));
- return SWIG_ERROR;
- }
- if (PyDict_SetItemString(dict, name, o))
- return SWIG_ERROR;
- Py_DECREF(o);
- return SWIG_OK;
+ PyObject *dict;
+ if (!PyModule_Check(m)) {
+ PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
+ return SWIG_ERROR;
+ }
+ if (!o) {
+ PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
+ return SWIG_ERROR;
+ }
+
+ dict = PyModule_GetDict(m);
+ if (dict == NULL) {
+ /* Internal error -- modules must have a dict! */
+ PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", PyModule_GetName(m));
+ return SWIG_ERROR;
+ }
+ if (PyDict_SetItemString(dict, name, o))
+ return SWIG_ERROR;
+ Py_DECREF(o);
+ return SWIG_OK;
}
#endif
-SWIGRUNTIME void
-SWIG_Python_DestroyModule(void *vptr)
-{
- swig_module_info *swig_module = (swig_module_info *) vptr;
- swig_type_info **types = swig_module->types;
- size_t i;
- for (i =0; i < swig_module->size; ++i) {
- swig_type_info *ty = types[i];
- if (ty->owndata) {
- PySwigClientData *data = (PySwigClientData *) ty->clientdata;
- if (data) PySwigClientData_Del(data);
- }
- }
- Py_DECREF(SWIG_This());
+SWIGRUNTIME void SWIG_Python_DestroyModule(void *vptr)
+{
+ swig_module_info *swig_module = (swig_module_info *) vptr;
+ swig_type_info **types = swig_module->types;
+ size_t i;
+ for (i = 0; i < swig_module->size; ++i) {
+ swig_type_info *ty = types[i];
+ if (ty->owndata) {
+ PySwigClientData *data = (PySwigClientData *) ty->clientdata;
+ if (data)
+ PySwigClientData_Del(data);
+ }
+ }
+ Py_DECREF(SWIG_This());
}
-SWIGRUNTIME void
-SWIG_Python_SetModule(swig_module_info *swig_module) {
- static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
-
- PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
- swig_empty_runtime_method_table);
- PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
- if (pointer && module) {
- PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
- } else {
- Py_XDECREF(pointer);
- }
+SWIGRUNTIME void SWIG_Python_SetModule(swig_module_info * swig_module)
+{
+ static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
+
+ PyObject *module = Py_InitModule((char *) "swig_runtime_data" SWIG_RUNTIME_VERSION,
+ swig_empty_runtime_method_table);
+ PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
+ if (pointer && module) {
+ PyModule_AddObject(module, (char *) "type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
+ } else {
+ Py_XDECREF(pointer);
+ }
}
/* The python cached type query */
-SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache(void) {
- static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
- return cache;
-}
-
-SWIGRUNTIME swig_type_info *
-SWIG_Python_TypeQuery(const char *type)
-{
- PyObject *cache = SWIG_Python_TypeCache();
- PyObject *key = PyString_FromString(type);
- PyObject *obj = PyDict_GetItem(cache, key);
- swig_type_info *descriptor;
- if (obj) {
- descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
- } else {
- swig_module_info *swig_module = SWIG_Python_GetModule();
- descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
- if (descriptor) {
- obj = PyCObject_FromVoidPtr(descriptor, NULL);
- PyDict_SetItem(cache, key, obj);
- Py_DECREF(obj);
- }
- }
- Py_DECREF(key);
- return descriptor;
+SWIGRUNTIME PyObject *SWIG_Python_TypeCache(void)
+{
+ static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
+ return cache;
+}
+
+SWIGRUNTIME swig_type_info *SWIG_Python_TypeQuery(const char *type)
+{
+ PyObject *cache = SWIG_Python_TypeCache();
+ PyObject *key = PyString_FromString(type);
+ PyObject *obj = PyDict_GetItem(cache, key);
+ swig_type_info *descriptor;
+ if (obj) {
+ descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
+ } else {
+ swig_module_info *swig_module = SWIG_Python_GetModule();
+ descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
+ if (descriptor) {
+ obj = PyCObject_FromVoidPtr(descriptor, NULL);
+ PyDict_SetItem(cache, key, obj);
+ Py_DECREF(obj);
+ }
+ }
+ Py_DECREF(key);
+ return descriptor;
}
/*
@@ -2380,116 +2352,109 @@
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
-SWIGRUNTIME int
-SWIG_Python_AddErrMesg(const char* mesg, int infront)
+SWIGRUNTIME int SWIG_Python_AddErrMesg(const char *mesg, int infront)
{
- if (PyErr_Occurred()) {
- PyObject *type = 0;
- PyObject *value = 0;
- PyObject *traceback = 0;
- PyErr_Fetch(&type, &value, &traceback);
- if (value) {
- PyObject *old_str = PyObject_Str(value);
- Py_XINCREF(type);
- PyErr_Clear();
- if (infront) {
- PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
- } else {
- PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
- }
- Py_DECREF(old_str);
- }
- return 1;
- } else {
- return 0;
- }
+ if (PyErr_Occurred()) {
+ PyObject *type = 0;
+ PyObject *value = 0;
+ PyObject *traceback = 0;
+ PyErr_Fetch(&type, &value, &traceback);
+ if (value) {
+ PyObject *old_str = PyObject_Str(value);
+ Py_XINCREF(type);
+ PyErr_Clear();
+ if (infront) {
+ PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
+ } else {
+ PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
+ }
+ Py_DECREF(old_str);
+ }
+ return 1;
+ } else {
+ return 0;
+ }
}
-
-SWIGRUNTIME int
-SWIG_Python_ArgFail(int argnum)
+
+SWIGRUNTIME int SWIG_Python_ArgFail(int argnum)
{
- if (PyErr_Occurred()) {
- /* add information about failing argument */
- char mesg[256];
- PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
- return SWIG_Python_AddErrMesg(mesg, 1);
- } else {
- return 0;
- }
+ if (PyErr_Occurred()) {
+ /* add information about failing argument */
+ char mesg[256];
+ PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
+ return SWIG_Python_AddErrMesg(mesg, 1);
+ } else {
+ return 0;
+ }
}
-SWIGRUNTIMEINLINE const char *
-PySwigObject_GetDesc(PyObject *self)
+SWIGRUNTIMEINLINE const char *PySwigObject_GetDesc(PyObject * self)
{
- PySwigObject *v = (PySwigObject *)self;
- swig_type_info *ty = v ? v->ty : 0;
- return ty ? ty->str : (char*)"";
+ PySwigObject *v = (PySwigObject *) self;
+ swig_type_info *ty = v ? v->ty : 0;
+ return ty ? ty->str : (char *) "";
}
-SWIGRUNTIME void
-SWIG_Python_TypeError(const char *type, PyObject *obj)
+SWIGRUNTIME void SWIG_Python_TypeError(const char *type, PyObject * obj)
{
- if (type) {
+ if (type) {
#if defined(SWIG_COBJECT_TYPES)
- if (obj && PySwigObject_Check(obj)) {
- const char *otype = (const char *) PySwigObject_GetDesc(obj);
- if (otype) {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
- type, otype);
- return;
- }
- } else
-#endif
- {
- const char *otype = (obj ? obj->ob_type->tp_name : 0);
- if (otype) {
- PyObject *str = PyObject_Str(obj);
- const char *cstr = str ? PyString_AsString(str) : 0;
- if (cstr) {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
- type, otype, cstr);
+ if (obj && PySwigObject_Check(obj)) {
+ const char *otype = (const char *) PySwigObject_GetDesc(obj);
+ if (otype) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received", type, otype);
+ return;
+ }
+ } else
+#endif
+ {
+ const char *otype = (obj ? obj->ob_type->tp_name : 0);
+ if (otype) {
+ PyObject *str = PyObject_Str(obj);
+ const char *cstr = str ? PyString_AsString(str) : 0;
+ if (cstr) {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received", type, otype, cstr);
+ } else {
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received", type, otype);
+ }
+ Py_XDECREF(str);
+ return;
+ }
+ }
+ PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
} else {
- PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
- type, otype);
+ PyErr_Format(PyExc_TypeError, "unexpected type is received");
}
- Py_XDECREF(str);
- return;
- }
- }
- PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
- } else {
- PyErr_Format(PyExc_TypeError, "unexpected type is received");
- }
}
/* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME void *
-SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
- void *result;
- if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
- PyErr_Clear();
- if (flags & SWIG_POINTER_EXCEPTION) {
- SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
- SWIG_Python_ArgFail(argnum);
- }
- }
- return result;
+SWIGRUNTIME void *SWIG_Python_MustGetPtr(PyObject * obj, swig_type_info * ty, int argnum, int flags)
+{
+ void *result;
+ if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
+ PyErr_Clear();
+ if (flags & SWIG_POINTER_EXCEPTION) {
+ SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
+ SWIG_Python_ArgFail(argnum);
+ }
+ }
+ return result;
}
#ifdef __cplusplus
#if 0
-{ /* cc-mode */
+{ /* cc-mode */
#endif
}
#endif
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
@@ -2516,7 +2481,8 @@
#define SWIGTYPE_p_switch_stream_handle_t swig_types[18]
#define SWIGTYPE_p_void swig_types[19]
static swig_type_info *swig_types[21];
-static swig_module_info swig_module = {swig_types, 20, 0, 0, 0, 0};
+static swig_module_info swig_module = { swig_types, 20, 0, 0, 0, 0 };
+
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
@@ -2535,76 +2501,59 @@
#define SWIG_name "_freeswitch"
-#define SWIGVERSION 0x010335
+#define SWIGVERSION 0x010335
#define SWIG_VERSION SWIGVERSION
-#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
#include <stdexcept>
namespace swig {
- class PyObject_ptr {
- protected:
- PyObject *_obj;
+ class PyObject_ptr {
+ protected:
+ PyObject * _obj;
+
+ public:
+ PyObject_ptr():_obj(0) {
+ } PyObject_ptr(const PyObject_ptr & item):_obj(item._obj) {
+ Py_XINCREF(_obj);
+ } PyObject_ptr(PyObject * obj, bool initial_ref = true):_obj(obj) {
+ if (initial_ref) {
+ Py_XINCREF(_obj);
+ }
+ }
- public:
- PyObject_ptr() :_obj(0)
- {
- }
+ PyObject_ptr & operator=(const PyObject_ptr & item) {
+ Py_XINCREF(item._obj);
+ Py_XDECREF(_obj);
+ _obj = item._obj;
+ return *this;
+ }
- PyObject_ptr(const PyObject_ptr& item) : _obj(item._obj)
- {
- Py_XINCREF(_obj);
- }
-
- PyObject_ptr(PyObject *obj, bool initial_ref = true) :_obj(obj)
- {
- if (initial_ref) {
- Py_XINCREF(_obj);
- }
- }
-
- PyObject_ptr & operator=(const PyObject_ptr& item)
- {
- Py_XINCREF(item._obj);
- Py_XDECREF(_obj);
- _obj = item._obj;
- return *this;
- }
-
- ~PyObject_ptr()
- {
- Py_XDECREF(_obj);
- }
-
- operator PyObject *() const
- {
- return _obj;
- }
+ ~PyObject_ptr() {
+ Py_XDECREF(_obj);
+ }
- PyObject *operator->() const
- {
- return _obj;
- }
- };
+ operator PyObject *() const {
+ return _obj;
+ } PyObject *operator->() const {
+ return _obj;
+ }};
}
namespace swig {
- struct PyObject_var : PyObject_ptr {
- PyObject_var(PyObject* obj = 0) : PyObject_ptr(obj, false) { }
-
- PyObject_var & operator = (PyObject* obj)
- {
- Py_XDECREF(_obj);
- _obj = obj;
- return *this;
- }
- };
+ struct PyObject_var:PyObject_ptr {
+ PyObject_var(PyObject * obj = 0):PyObject_ptr(obj, false) {
+ } PyObject_var & operator =(PyObject * obj) {
+ Py_XDECREF(_obj);
+ _obj = obj;
+ return *this;
+ }};
}
@@ -2612,68 +2561,70 @@
#include "freeswitch_python.h"
-SWIGINTERN swig_type_info*
-SWIG_pchar_descriptor(void)
+SWIGINTERN swig_type_info *SWIG_pchar_descriptor(void)
{
- static int init = 0;
- static swig_type_info* info = 0;
- if (!init) {
- info = SWIG_TypeQuery("_p_char");
- init = 1;
- }
- return info;
+ static int init = 0;
+ static swig_type_info *info = 0;
+ if (!init) {
+ info = SWIG_TypeQuery("_p_char");
+ init = 1;
+ }
+ return info;
}
-SWIGINTERN int
-SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
-{
- if (PyString_Check(obj)) {
- char *cstr; Py_ssize_t len;
- PyString_AsStringAndSize(obj, &cstr, &len);
- if (cptr) {
- if (alloc) {
- /*
- In python the user should not be able to modify the inner
- string representation. To warranty that, if you define
- SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
- buffer is always returned.
-
- The default behavior is just to return the pointer value,
- so, be careful.
- */
+SWIGINTERN int SWIG_AsCharPtrAndSize(PyObject * obj, char **cptr, size_t *psize, int *alloc)
+{
+ if (PyString_Check(obj)) {
+ char *cstr;
+ Py_ssize_t len;
+ PyString_AsStringAndSize(obj, &cstr, &len);
+ if (cptr) {
+ if (alloc) {
+ /*
+ In python the user should not be able to modify the inner
+ string representation. To warranty that, if you define
+ SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
+ buffer is always returned.
+
+ The default behavior is just to return the pointer value,
+ so, be careful.
+ */
#if defined(SWIG_PYTHON_SAFE_CSTRINGS)
- if (*alloc != SWIG_OLDOBJ)
+ if (*alloc != SWIG_OLDOBJ)
#else
- if (*alloc == SWIG_NEWOBJ)
+ if (*alloc == SWIG_NEWOBJ)
#endif
- {
- *cptr = reinterpret_cast< char* >(memcpy((new char[len + 1]), cstr, sizeof(char)*(len + 1)));
- *alloc = SWIG_NEWOBJ;
- }
- else {
- *cptr = cstr;
- *alloc = SWIG_OLDOBJ;
+ {
+ *cptr = reinterpret_cast < char *>(memcpy((new char[len + 1]), cstr, sizeof(char) * (len + 1)));
+ *alloc = SWIG_NEWOBJ;
+ } else {
+ *cptr = cstr;
+ *alloc = SWIG_OLDOBJ;
+ }
+ } else {
+ *cptr = PyString_AsString(obj);
+ }
+ }
+ if (psize)
+ *psize = len + 1;
+ return SWIG_OK;
+ } else {
+ swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+ if (pchar_descriptor) {
+ void *vptr = 0;
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
+ if (cptr)
+ *cptr = (char *) vptr;
+ if (psize)
+ *psize = vptr ? (strlen((char *) vptr) + 1) : 0;
+ if (alloc)
+ *alloc = SWIG_OLDOBJ;
+ return SWIG_OK;
+ }
+ }
}
- } else {
- *cptr = PyString_AsString(obj);
- }
- }
- if (psize) *psize = len + 1;
- return SWIG_OK;
- } else {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- if (pchar_descriptor) {
- void* vptr = 0;
- if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
- if (cptr) *cptr = (char *) vptr;
- if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
- if (alloc) *alloc = SWIG_OLDOBJ;
- return SWIG_OK;
- }
- }
- }
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
@@ -2690,47 +2641,51 @@
#endif
-SWIGINTERN int
-SWIG_AsVal_double (PyObject *obj, double *val)
+SWIGINTERN int SWIG_AsVal_double(PyObject * obj, double *val)
{
- int res = SWIG_TypeError;
- if (PyFloat_Check(obj)) {
- if (val) *val = PyFloat_AsDouble(obj);
- return SWIG_OK;
- } else if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- double v = PyLong_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
+ int res = SWIG_TypeError;
+ if (PyFloat_Check(obj)) {
+ if (val)
+ *val = PyFloat_AsDouble(obj);
+ return SWIG_OK;
+ } else if (PyInt_Check(obj)) {
+ if (val)
+ *val = PyInt_AsLong(obj);
+ return SWIG_OK;
+ } else if (PyLong_Check(obj)) {
+ double v = PyLong_AsDouble(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_OK;
+ } else {
+ PyErr_Clear();
+ }
+ }
#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- double d = PyFloat_AsDouble(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = d;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
- } else {
- PyErr_Clear();
- }
- }
- }
+ {
+ int dispatch = 0;
+ double d = PyFloat_AsDouble(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = d;
+ return SWIG_AddCast(SWIG_OK);
+ } else {
+ PyErr_Clear();
+ }
+ if (!dispatch) {
+ long v = PyLong_AsLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
+ } else {
+ PyErr_Clear();
+ }
+ }
+ }
#endif
- return res;
+ return res;
}
@@ -2740,5130 +2695,5461 @@
#include <math.h>
-SWIGINTERNINLINE int
-SWIG_CanCastAsInteger(double *d, double min, double max) {
- double x = *d;
- if ((min <= x && x <= max)) {
- double fx = floor(x);
- double cx = ceil(x);
- double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
- if ((errno == EDOM) || (errno == ERANGE)) {
- errno = 0;
- } else {
- double summ, reps, diff;
- if (rd < x) {
- diff = x - rd;
- } else if (rd > x) {
- diff = rd - x;
- } else {
- return 1;
- }
- summ = rd + x;
- reps = diff/summ;
- if (reps < 8*DBL_EPSILON) {
- *d = rd;
- return 1;
- }
- }
- }
- return 0;
+SWIGINTERNINLINE int SWIG_CanCastAsInteger(double *d, double min, double max)
+{
+ double x = *d;
+ if ((min <= x && x <= max)) {
+ double fx = floor(x);
+ double cx = ceil(x);
+ double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
+ if ((errno == EDOM) || (errno == ERANGE)) {
+ errno = 0;
+ } else {
+ double summ, reps, diff;
+ if (rd < x) {
+ diff = x - rd;
+ } else if (rd > x) {
+ diff = rd - x;
+ } else {
+ return 1;
+ }
+ summ = rd + x;
+ reps = diff / summ;
+ if (reps < 8 * DBL_EPSILON) {
+ *d = rd;
+ return 1;
+ }
+ }
+ }
+ return 0;
}
-SWIGINTERN int
-SWIG_AsVal_long (PyObject *obj, long* val)
-{
- if (PyInt_Check(obj)) {
- if (val) *val = PyInt_AsLong(obj);
- return SWIG_OK;
- } else if (PyLong_Check(obj)) {
- long v = PyLong_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
+SWIGINTERN int SWIG_AsVal_long(PyObject * obj, long *val)
+{
+ if (PyInt_Check(obj)) {
+ if (val)
+ *val = PyInt_AsLong(obj);
+ return SWIG_OK;
+ } else if (PyLong_Check(obj)) {
+ long v = PyLong_AsLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_OK;
+ } else {
+ PyErr_Clear();
+ }
+ }
#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- long v = PyInt_AsLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
- if (val) *val = (long)(d);
- return res;
- }
- }
- }
+ {
+ int dispatch = 0;
+ long v = PyInt_AsLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_AddCast(SWIG_OK);
+ } else {
+ PyErr_Clear();
+ }
+ if (!dispatch) {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
+ if (val)
+ *val = (long) (d);
+ return res;
+ }
+ }
+ }
#endif
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
-SWIGINTERN int
-SWIG_AsVal_int (PyObject * obj, int *val)
+SWIGINTERN int SWIG_AsVal_int(PyObject * obj, int *val)
{
- long v;
- int res = SWIG_AsVal_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v < INT_MIN || v > INT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = static_cast< int >(v);
- }
- }
- return res;
+ long v;
+ int res = SWIG_AsVal_long(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v < INT_MIN || v > INT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val)
+ *val = static_cast < int >(v);
+ }
+ }
+ return res;
}
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+SWIGINTERNINLINE PyObject *SWIG_FromCharPtrAndSize(const char *carray, size_t size)
{
- if (carray) {
- if (size > INT_MAX) {
- swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
- return pchar_descriptor ?
- SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : SWIG_Py_Void();
- } else {
- return PyString_FromStringAndSize(carray, static_cast< int >(size));
- }
- } else {
- return SWIG_Py_Void();
- }
+ if (carray) {
+ if (size > INT_MAX) {
+ swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
+ return pchar_descriptor ? SWIG_NewPointerObj(const_cast < char *>(carray), pchar_descriptor, 0) : SWIG_Py_Void();
+ } else {
+ return PyString_FromStringAndSize(carray, static_cast < int >(size));
+ }
+ } else {
+ return SWIG_Py_Void();
+ }
}
-SWIGINTERNINLINE PyObject *
-SWIG_FromCharPtr(const char *cptr)
-{
- return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+SWIGINTERNINLINE PyObject *SWIG_FromCharPtr(const char *cptr)
+{
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
}
- #define SWIG_From_long PyInt_FromLong
+#define SWIG_From_long PyInt_FromLong
-SWIGINTERNINLINE PyObject *
-SWIG_From_int (int value)
-{
- return SWIG_From_long (value);
+SWIGINTERNINLINE PyObject *SWIG_From_int(int value)
+{
+ return SWIG_From_long(value);
}
-SWIGINTERNINLINE PyObject*
- SWIG_From_bool (bool value)
+SWIGINTERNINLINE PyObject *SWIG_From_bool(bool value)
{
- return PyBool_FromLong(value ? 1 : 0);
+ return PyBool_FromLong(value ? 1 : 0);
}
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
+SWIGINTERN int SWIG_AsVal_unsigned_SS_long(PyObject * obj, unsigned long *val)
{
- if (PyInt_Check(obj)) {
- long v = PyInt_AsLong(obj);
- if (v >= 0) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- return SWIG_OverflowError;
- }
- } else if (PyLong_Check(obj)) {
- unsigned long v = PyLong_AsUnsignedLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_OK;
- } else {
- PyErr_Clear();
- }
- }
+ if (PyInt_Check(obj)) {
+ long v = PyInt_AsLong(obj);
+ if (v >= 0) {
+ if (val)
+ *val = v;
+ return SWIG_OK;
+ } else {
+ return SWIG_OverflowError;
+ }
+ } else if (PyLong_Check(obj)) {
+ unsigned long v = PyLong_AsUnsignedLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_OK;
+ } else {
+ PyErr_Clear();
+ }
+ }
#ifdef SWIG_PYTHON_CAST_MODE
- {
- int dispatch = 0;
- unsigned long v = PyLong_AsUnsignedLong(obj);
- if (!PyErr_Occurred()) {
- if (val) *val = v;
- return SWIG_AddCast(SWIG_OK);
- } else {
- PyErr_Clear();
- }
- if (!dispatch) {
- double d;
- int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
- if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
- if (val) *val = (unsigned long)(d);
- return res;
- }
- }
- }
+ {
+ int dispatch = 0;
+ unsigned long v = PyLong_AsUnsignedLong(obj);
+ if (!PyErr_Occurred()) {
+ if (val)
+ *val = v;
+ return SWIG_AddCast(SWIG_OK);
+ } else {
+ PyErr_Clear();
+ }
+ if (!dispatch) {
+ double d;
+ int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
+ if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
+ if (val)
+ *val = (unsigned long) (d);
+ return res;
+ }
+ }
+ }
#endif
- return SWIG_TypeError;
+ return SWIG_TypeError;
}
-SWIGINTERN int
-SWIG_AsVal_unsigned_SS_int (PyObject * obj, unsigned int *val)
+SWIGINTERN int SWIG_AsVal_unsigned_SS_int(PyObject * obj, unsigned int *val)
{
- unsigned long v;
- int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
- if (SWIG_IsOK(res)) {
- if ((v > UINT_MAX)) {
- return SWIG_OverflowError;
- } else {
- if (val) *val = static_cast< unsigned int >(v);
- }
- }
- return res;
+ unsigned long v;
+ int res = SWIG_AsVal_unsigned_SS_long(obj, &v);
+ if (SWIG_IsOK(res)) {
+ if ((v > UINT_MAX)) {
+ return SWIG_OverflowError;
+ } else {
+ if (val)
+ *val = static_cast < unsigned int >(v);
+ }
+ }
+ return res;
}
-SWIGINTERNINLINE PyObject*
-SWIG_From_unsigned_SS_long (unsigned long value)
+SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_long(unsigned long value)
{
- return (value > LONG_MAX) ?
- PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast< long >(value));
+ return (value > LONG_MAX) ? PyLong_FromUnsignedLong(value) : PyInt_FromLong(static_cast < long >(value));
}
-SWIGINTERNINLINE PyObject *
-SWIG_From_unsigned_SS_int (unsigned int value)
-{
- return SWIG_From_unsigned_SS_long (value);
+SWIGINTERNINLINE PyObject *SWIG_From_unsigned_SS_int(unsigned int value)
+{
+ return SWIG_From_unsigned_SS_long(value);
}
-SWIGINTERN int
-SWIG_AsVal_bool (PyObject *obj, bool *val)
+SWIGINTERN int SWIG_AsVal_bool(PyObject * obj, bool * val)
{
- int r = PyObject_IsTrue(obj);
- if (r == -1)
- return SWIG_ERROR;
- if (val) *val = r ? true : false;
- return SWIG_OK;
+ int r = PyObject_IsTrue(obj);
+ if (r == -1)
+ return SWIG_ERROR;
+ if (val)
+ *val = r ? true : false;
+ return SWIG_OK;
}
#ifdef __cplusplus
extern "C" {
#endif
-SWIGINTERN PyObject *_wrap_consoleLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:consoleLog",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- consoleLog(arg1,arg2);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_consoleLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:consoleLog", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleLog" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "consoleLog" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ consoleLog(arg1, arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:consoleCleanLog",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- consoleCleanLog(arg1);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- int arg9 ;
- int arg10 ;
- int arg11 ;
- int arg12 ;
- int arg13 ;
- IVRMenu *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int res5 ;
- char *buf5 = 0 ;
- int alloc5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int res7 ;
- char *buf7 = 0 ;
- int alloc7 = 0 ;
- int res8 ;
- char *buf8 = 0 ;
- int alloc8 = 0 ;
- int val9 ;
- int ecode9 = 0 ;
- int val10 ;
- int ecode10 = 0 ;
- int val11 ;
- int ecode11 = 0 ;
- int val12 ;
- int ecode12 = 0 ;
- int val13 ;
- int ecode13 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- PyObject * obj5 = 0 ;
- PyObject * obj6 = 0 ;
- PyObject * obj7 = 0 ;
- PyObject * obj8 = 0 ;
- PyObject * obj9 = 0 ;
- PyObject * obj10 = 0 ;
- PyObject * obj11 = 0 ;
- PyObject * obj12 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOOOOOO:new_IVRMenu",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10,&obj11,&obj12)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5"" of type '" "char const *""'");
- }
- arg5 = reinterpret_cast< char * >(buf5);
- res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6"" of type '" "char const *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
- if (!SWIG_IsOK(res7)) {
- SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7"" of type '" "char const *""'");
- }
- arg7 = reinterpret_cast< char * >(buf7);
- res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
- if (!SWIG_IsOK(res8)) {
- SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8"" of type '" "char const *""'");
- }
- arg8 = reinterpret_cast< char * >(buf8);
- ecode9 = SWIG_AsVal_int(obj8, &val9);
- if (!SWIG_IsOK(ecode9)) {
- SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9"" of type '" "int""'");
- }
- arg9 = static_cast< int >(val9);
- ecode10 = SWIG_AsVal_int(obj9, &val10);
- if (!SWIG_IsOK(ecode10)) {
- SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10"" of type '" "int""'");
- }
- arg10 = static_cast< int >(val10);
- ecode11 = SWIG_AsVal_int(obj10, &val11);
- if (!SWIG_IsOK(ecode11)) {
- SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11"" of type '" "int""'");
- }
- arg11 = static_cast< int >(val11);
- ecode12 = SWIG_AsVal_int(obj11, &val12);
- if (!SWIG_IsOK(ecode12)) {
- SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12"" of type '" "int""'");
- }
- arg12 = static_cast< int >(val12);
- ecode13 = SWIG_AsVal_int(obj12, &val13);
- if (!SWIG_IsOK(ecode13)) {
- SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13"" of type '" "int""'");
- }
- arg13 = static_cast< int >(val13);
- result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12,arg13);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0 );
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_IVRMenu",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_consoleCleanLog(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:consoleCleanLog", &obj0))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "consoleCleanLog" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ consoleCleanLog(arg1);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:IVRMenu_bindAction",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ int arg9;
+ int arg10;
+ int arg11;
+ int arg12;
+ int arg13;
+ IVRMenu *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int res5;
+ char *buf5 = 0;
+ int alloc5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ int res7;
+ char *buf7 = 0;
+ int alloc7 = 0;
+ int res8;
+ char *buf8 = 0;
+ int alloc8 = 0;
+ int val9;
+ int ecode9 = 0;
+ int val10;
+ int ecode10 = 0;
+ int val11;
+ int ecode11 = 0;
+ int val12;
+ int ecode12 = 0;
+ int val13;
+ int ecode13 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+ PyObject *obj5 = 0;
+ PyObject *obj6 = 0;
+ PyObject *obj7 = 0;
+ PyObject *obj8 = 0;
+ PyObject *obj9 = 0;
+ PyObject *obj10 = 0;
+ PyObject *obj11 = 0;
+ PyObject *obj12 = 0;
+
+ if (!PyArg_ParseTuple
+ (args, (char *) "OOOOOOOOOOOOO:new_IVRMenu", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8, &obj9, &obj10, &obj11, &obj12))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_IVRMenu" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_IVRMenu" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_IVRMenu" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "new_IVRMenu" "', argument " "5" " of type '" "char const *" "'");
+ }
+ arg5 = reinterpret_cast < char *>(buf5);
+ res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "new_IVRMenu" "', argument " "6" " of type '" "char const *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "new_IVRMenu" "', argument " "7" " of type '" "char const *" "'");
+ }
+ arg7 = reinterpret_cast < char *>(buf7);
+ res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "new_IVRMenu" "', argument " "8" " of type '" "char const *" "'");
+ }
+ arg8 = reinterpret_cast < char *>(buf8);
+ ecode9 = SWIG_AsVal_int(obj8, &val9);
+ if (!SWIG_IsOK(ecode9)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode9), "in method '" "new_IVRMenu" "', argument " "9" " of type '" "int" "'");
+ }
+ arg9 = static_cast < int >(val9);
+ ecode10 = SWIG_AsVal_int(obj9, &val10);
+ if (!SWIG_IsOK(ecode10)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode10), "in method '" "new_IVRMenu" "', argument " "10" " of type '" "int" "'");
+ }
+ arg10 = static_cast < int >(val10);
+ ecode11 = SWIG_AsVal_int(obj10, &val11);
+ if (!SWIG_IsOK(ecode11)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "new_IVRMenu" "', argument " "11" " of type '" "int" "'");
+ }
+ arg11 = static_cast < int >(val11);
+ ecode12 = SWIG_AsVal_int(obj11, &val12);
+ if (!SWIG_IsOK(ecode12)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode12), "in method '" "new_IVRMenu" "', argument " "12" " of type '" "int" "'");
+ }
+ arg12 = static_cast < int >(val12);
+ ecode13 = SWIG_AsVal_int(obj12, &val13);
+ if (!SWIG_IsOK(ecode13)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode13), "in method '" "new_IVRMenu" "', argument " "13" " of type '" "int" "'");
+ }
+ arg13 = static_cast < int >(val13);
+ result =
+ (IVRMenu *) new IVRMenu(arg1, (char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5, (char const *) arg6,
+ (char const *) arg7, (char const *) arg8, arg9, arg10, arg11, arg12, arg13);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_IVRMenu, SWIG_POINTER_NEW | 0);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- IVRMenu *arg1 = (IVRMenu *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:IVRMenu_execute",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_IVRMenu, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1"" of type '" "IVRMenu *""'");
- }
- arg1 = reinterpret_cast< IVRMenu * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->execute(arg2,(char const *)arg3);
- resultobj = SWIG_Py_Void();
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_IVRMenu(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_IVRMenu", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_IVRMenu" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *IVRMenu_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_new_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- API *result = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)":new_API")) SWIG_fail;
- result = (API *)new API();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_IVRMenu_bindAction(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:IVRMenu_bindAction", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_bindAction" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_bindAction" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_bindAction" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "IVRMenu_bindAction" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ (arg1)->bindAction(arg2, (char const *) arg3, (char const *) arg4);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_delete_API(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- API *arg1 = (API *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_API",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_IVRMenu_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ IVRMenu *arg1 = (IVRMenu *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:IVRMenu_execute", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_IVRMenu, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "IVRMenu_execute" "', argument " "1" " of type '" "IVRMenu *" "'");
+ }
+ arg1 = reinterpret_cast < IVRMenu * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "IVRMenu_execute" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "IVRMenu_execute" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->execute(arg2, (char const *) arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_API_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:API_execute",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *IVRMenu_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_IVRMenu, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
-SWIGINTERN PyObject *_wrap_API_executeString(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- API *arg1 = (API *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:API_executeString",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_API, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1"" of type '" "API *""'");
- }
- arg1 = reinterpret_cast< API * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->executeString((char const *)arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ API *result = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) ":new_API"))
+ SWIG_fail;
+ result = (API *) new API();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_API, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *API_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_function_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->function = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_API(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_API", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_API" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_function_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_function_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->function);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_API_execute(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:API_execute", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_execute" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_execute" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "API_execute" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (char *) (arg1)->execute((char const *) arg2, (char const *) arg3);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_threadState_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->threadState = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_API_executeString(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ API *arg1 = (API *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:API_executeString", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_API, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "API_executeString" "', argument " "1" " of type '" "API *" "'");
+ }
+ arg1 = reinterpret_cast < API * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "API_executeString" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->executeString((char const *) arg2);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_threadState_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_threadState_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->threadState);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *API_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_API, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_extra_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2"" of type '" "void *""'");
- }
- if (arg1) (arg1)->extra = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_function_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_function_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_function_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_function_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->function = arg2;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_extra_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_extra_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (void *) ((arg1)->extra);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_function_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_function_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_function_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->function);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:input_callback_state_t_funcargs_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_set" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->funcargs) delete[] arg1->funcargs;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->funcargs = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->funcargs = 0;
- }
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_threadState_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_threadState_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_threadState_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->threadState = arg2;
-SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:input_callback_state_t_funcargs_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "input_callback_state_t_funcargs_get" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- result = (char *) ((arg1)->funcargs);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *result = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)":new_input_callback_state_t")) SWIG_fail;
- result = (input_callback_state_t *)new input_callback_state_t();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_threadState_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_threadState_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_threadState_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->threadState);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_input_callback_state_t",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_input_callback_state_t" "', argument " "1"" of type '" "input_callback_state_t *""'");
- }
- arg1 = reinterpret_cast< input_callback_state_t * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_extra_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_extra_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, SWIG_POINTER_DISOWN);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_extra_set" "', argument " "2" " of type '" "void *" "'");
+ }
+ if (arg1)
+ (arg1)->extra = arg2;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Stream *result = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)":new_Stream")) SWIG_fail;
- result = (Stream *)new Stream();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_extra_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_extra_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_extra_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (void *) ((arg1)->extra);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
- Stream *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:new_Stream",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_stream_handle_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1"" of type '" "switch_stream_handle_t *""'");
- }
- arg1 = reinterpret_cast< switch_stream_handle_t * >(argp1);
- result = (Stream *)new Stream(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:input_callback_state_t_funcargs_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_funcargs_set" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "input_callback_state_t_funcargs_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->funcargs)
+ delete[]arg1->funcargs;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->funcargs = (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->funcargs = 0;
+ }
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Stream(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[2];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 1); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 0) {
- return _wrap_new_Stream__SWIG_0(self, args);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_Stream__SWIG_1(self, args);
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Stream'.\n"
- " Possible C/C++ prototypes are:\n"
- " Stream()\n"
- " Stream(switch_stream_handle_t *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_input_callback_state_t_funcargs_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:input_callback_state_t_funcargs_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "input_callback_state_t_funcargs_get" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ result = (char *) ((arg1)->funcargs);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_delete_Stream(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Stream *arg1 = (Stream *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_Stream",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *result = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) ":new_input_callback_state_t"))
+ SWIG_fail;
+ result = (input_callback_state_t *) new input_callback_state_t();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Stream_write(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Stream *arg1 = (Stream *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Stream_write",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->write((char const *)arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_input_callback_state_t(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ input_callback_state_t *arg1 = (input_callback_state_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_input_callback_state_t", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_input_callback_state, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "delete_input_callback_state_t" "', argument " "1" " of type '" "input_callback_state_t *" "'");
+ }
+ arg1 = reinterpret_cast < input_callback_state_t * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Stream *arg1 = (Stream *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Stream_get_data",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Stream, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1"" of type '" "Stream *""'");
- }
- arg1 = reinterpret_cast< Stream * >(argp1);
- result = (char *)(arg1)->get_data();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *input_callback_state_t_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_input_callback_state, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
-SWIGINTERN PyObject *Stream_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_Event_event_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- switch_event_t *arg2 = (switch_event_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_event_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2"" of type '" "switch_event_t *""'");
- }
- arg2 = reinterpret_cast< switch_event_t * >(argp2);
- if (arg1) (arg1)->event = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Stream__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Stream *result = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) ":new_Stream"))
+ SWIG_fail;
+ result = (Stream *) new Stream();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_event_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- switch_event_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_event_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (switch_event_t *) ((arg1)->event);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Stream__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0;
+ Stream *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:new_Stream", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_stream_handle_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Stream" "', argument " "1" " of type '" "switch_stream_handle_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_stream_handle_t *>(argp1);
+ result = (Stream *) new Stream(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialized_string_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- if (arg1->serialized_string) delete[] arg1->serialized_string;
- if (arg2) {
- size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
- arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
- } else {
- arg1->serialized_string = 0;
- }
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Stream(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[2];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 0) {
+ return _wrap_new_Stream__SWIG_0(self, args);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_stream_handle_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_Stream__SWIG_1(self, args);
+ }
+ }
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Stream'.\n"
+ " Possible C/C++ prototypes are:\n" " Stream()\n" " Stream(switch_stream_handle_t *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_serialized_string_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *) ((arg1)->serialized_string);
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_Stream(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Stream *arg1 = (Stream *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_Stream", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Stream" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ delete arg1;
-SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_mine_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- if (arg1) (arg1)->mine = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_mine_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (int) ((arg1)->mine);
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Stream_write(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Stream *arg1 = (Stream *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Stream_write", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_write" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Stream_write" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->write((char const *) arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- Event *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (Event *)new Event((char const *)arg1,(char const *)arg2);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 );
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Stream_get_data(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Stream *arg1 = (Stream *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Stream_get_data", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Stream, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Stream_get_data" "', argument " "1" " of type '" "Stream *" "'");
+ }
+ arg1 = reinterpret_cast < Stream * >(argp1);
+ result = (char *) (arg1)->get_data();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- Event *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "char const *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- result = (Event *)new Event((char const *)arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 );
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
+ SWIGINTERN PyObject *Stream_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_Stream, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
+ SWIGINTERN PyObject *_wrap_Event_event_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ switch_event_t *arg2 = (switch_event_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_event_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_event_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_event_set" "', argument " "2" " of type '" "switch_event_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_event_t *>(argp2);
+ if (arg1)
+ (arg1)->event = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- int arg2 ;
- Event *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:new_Event",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'");
- }
- arg1 = reinterpret_cast< switch_event_t * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- result = (Event *)new Event(arg1,arg2);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_event_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ switch_event_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_event_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_event_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (switch_event_t *) ((arg1)->event);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_event_t, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_event_t *arg1 = (switch_event_t *) 0 ;
- Event *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:new_Event",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_event_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1"" of type '" "switch_event_t *""'");
- }
- arg1 = reinterpret_cast< switch_event_t * >(argp1);
- result = (Event *)new Event(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_serialized_string_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialized_string_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialized_string_set" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ if (arg1->serialized_string)
+ delete[]arg1->serialized_string;
+ if (arg2) {
+ size_t size = strlen(reinterpret_cast < const char *>(arg2)) + 1;
+ arg1->serialized_string =
+ (char *) reinterpret_cast < char *>(memcpy((new char[size]), reinterpret_cast < const char *>(arg2), sizeof(char) * (size)));
+ } else {
+ arg1->serialized_string = 0;
+ }
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_Event(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[3];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 2); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_Event__SWIG_3(self, args);
- }
- }
- if (argc == 1) {
- int _v;
- int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_Event__SWIG_1(self, args);
- }
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[1], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_new_Event__SWIG_2(self, args);
- }
- }
- }
- if (argc == 2) {
- int _v;
- int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_Event__SWIG_0(self, args);
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_Event'.\n"
- " Possible C/C++ prototypes are:\n"
- " Event(char const *,char const *)\n"
- " Event(char const *)\n"
- " Event(switch_event_t *,int)\n"
- " Event(switch_event_t *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_serialized_string_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_serialized_string_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialized_string_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) ((arg1)->serialized_string);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_delete_Event(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_Event",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_mine_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_mine_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_set" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "Event_mine_set" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ if (arg1)
+ (arg1)->mine = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_serialize",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->serialize((char const *)arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_mine_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_mine_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_mine_get" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (int) ((arg1)->mine);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_serialize",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->serialize();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Event__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ Event *result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Event" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (Event *) new Event((char const *) arg1, (char const *) arg2);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_serialize(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[3];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 2); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_Event_serialize__SWIG_1(self, args);
- }
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_Event_serialize__SWIG_0(self, args);
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_serialize'.\n"
- " Possible C/C++ prototypes are:\n"
- " serialize(Event *,char const *)\n"
- " serialize(Event *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Event__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ Event *result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "char const *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ result = (Event *) new Event((char const *) arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- switch_priority_t arg2 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_setPriority",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- {
- res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t, 0 | 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "Event_setPriority" "', argument " "2"" of type '" "switch_priority_t""'");
- } else {
- switch_priority_t * temp = reinterpret_cast< switch_priority_t * >(argp2);
- arg2 = *temp;
- if (SWIG_IsNewObj(res2)) delete temp;
- }
- }
- result = (bool)(arg1)->setPriority(arg2);
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Event__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ int arg2;
+ Event *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:new_Event", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_event_t *>(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_Event" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ result = (Event *) new Event(arg1, arg2);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_setPriority",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (bool)(arg1)->setPriority();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Event__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_event_t *arg1 = (switch_event_t *) 0;
+ Event *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:new_Event", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_event_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Event" "', argument " "1" " of type '" "switch_event_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_event_t *>(argp1);
+ result = (Event *) new Event(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[3];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 2); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_Event_setPriority__SWIG_1(self, args);
- }
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_Event_setPriority__SWIG_0(self, args);
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
- " Possible C/C++ prototypes are:\n"
- " setPriority(Event *,switch_priority_t)\n"
- " setPriority(Event *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_Event(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[3];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_Event__SWIG_3(self, args);
+ }
+ }
+ if (argc == 1) {
+ int _v;
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_Event__SWIG_1(self, args);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_event_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[1], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_new_Event__SWIG_2(self, args);
+ }
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_Event__SWIG_0(self, args);
+ }
+ }
+ }
-SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_getHeader",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->getHeader(arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_Event'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " Event(char const *,char const *)\n"
+ " Event(char const *)\n" " Event(switch_event_t *,int)\n" " Event(switch_event_t *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_getBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_getBody",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->getBody();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_Event(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_Event", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_Event" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_getType(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_getType",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (char *)(arg1)->getType();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_serialize", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_serialize" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->serialize((char const *) arg2);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_addBody(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_addBody",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (bool)(arg1)->addBody((char const *)arg2);
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_serialize__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_serialize", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_serialize" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->serialize();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:Event_addHeader",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_serialize(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[3];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_Event_serialize__SWIG_1(self, args);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_Event_serialize__SWIG_0(self, args);
+ }
+ }
+ }
-SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- char *arg2 = (char *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:Event_delHeader",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (bool)(arg1)->delHeader((char const *)arg2);
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_serialize'.\n"
+ " Possible C/C++ prototypes are:\n" " serialize(Event *,char const *)\n" " serialize(Event *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_Event_fire(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- Event *arg1 = (Event *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:Event_fire",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1"" of type '" "Event *""'");
- }
- arg1 = reinterpret_cast< Event * >(argp1);
- result = (bool)(arg1)->fire();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ switch_priority_t arg2;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_setPriority", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ {
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_priority_t, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "Event_setPriority" "', argument " "2" " of type '" "switch_priority_t" "'");
+ } else {
+ switch_priority_t *temp = reinterpret_cast < switch_priority_t *>(argp2);
+ arg2 = *temp;
+ if (SWIG_IsNewObj(res2))
+ delete temp;
+ }
+ }
+ result = (bool) (arg1)->setPriority(arg2);
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *Event_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_CoreSession",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_setPriority__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_setPriority", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_setPriority" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (bool) (arg1)->setPriority();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_session_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_session_set" "', argument " "2"" of type '" "switch_core_session_t *""'");
- }
- arg2 = reinterpret_cast< switch_core_session_t * >(argp2);
- if (arg1) (arg1)->session = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_setPriority(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[3];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_Event_setPriority__SWIG_1(self, args);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Event, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_switch_priority_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_Event_setPriority__SWIG_0(self, args);
+ }
+ }
+ }
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'Event_setPriority'.\n"
+ " Possible C/C++ prototypes are:\n" " setPriority(Event *,switch_priority_t)\n" " setPriority(Event *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_core_session_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_session_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_core_session_t *) ((arg1)->session);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_getHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_getHeader", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->getHeader(arg2);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *arg2 = (switch_channel_t *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_channel_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2"" of type '" "switch_channel_t *""'");
- }
- arg2 = reinterpret_cast< switch_channel_t * >(argp2);
- if (arg1) (arg1)->channel = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_getBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_getBody", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getBody" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->getBody();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_channel_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (switch_channel_t *) ((arg1)->channel);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_getType(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_getType", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_getType" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (char *) (arg1)->getType();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- unsigned int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_flags_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2"" of type '" "unsigned int""'");
- }
- arg2 = static_cast< unsigned int >(val2);
- if (arg1) (arg1)->flags = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_addBody(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_addBody", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addBody" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addBody" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (bool) (arg1)->addBody((char const *) arg2);
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- unsigned int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flags_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (unsigned int) ((arg1)->flags);
- resultobj = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_addHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:Event_addHeader", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_addHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_addHeader" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Event_addHeader" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (bool) (arg1)->addHeader((char const *) arg2, (char const *) arg3);
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_allocated_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- if (arg1) (arg1)->allocated = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_delHeader(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ char *arg2 = (char *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:Event_delHeader", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_delHeader" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_delHeader" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (bool) (arg1)->delHeader((char const *) arg2);
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_allocated_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int) ((arg1)->allocated);
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_Event_fire(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ Event *arg1 = (Event *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:Event_fire", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Event_fire" "', argument " "1" " of type '" "Event *" "'");
+ }
+ arg1 = reinterpret_cast < Event * >(argp1);
+ result = (bool) (arg1)->fire();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *arg2 = (input_callback_state *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_cb_state_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_input_callback_state, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_cb_state_set" "', argument " "2"" of type '" "input_callback_state *""'");
- }
- arg2 = reinterpret_cast< input_callback_state * >(argp2);
- if (arg1) (arg1)->cb_state = *arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *Event_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_Event, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- input_callback_state *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_cb_state_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (input_callback_state *)& ((arg1)->cb_state);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_CoreSession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_CoreSession", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_CoreSession" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t arg2 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hook_state_set",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t, 0 | 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2"" of type '" "switch_channel_state_t""'");
- } else {
- switch_channel_state_t * temp = reinterpret_cast< switch_channel_state_t * >(argp2);
- arg2 = *temp;
- if (SWIG_IsNewObj(res2)) delete temp;
- }
- }
- if (arg1) (arg1)->hook_state = arg2;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_session_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *arg2 = (switch_core_session_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_session_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_core_session_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_session_set" "', argument " "2" " of type '" "switch_core_session_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_core_session_t *>(argp2);
+ if (arg1)
+ (arg1)->session = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_channel_state_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hook_state_get",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = ((arg1)->hook_state);
- resultobj = SWIG_NewPointerObj((new switch_channel_state_t(static_cast< const switch_channel_state_t& >(result))), SWIGTYPE_p_switch_channel_state_t, SWIG_POINTER_OWN | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_session_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_core_session_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_session_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_session_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (switch_core_session_t *) ((arg1)->session);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_answer",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->answer();
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_channel_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *arg2 = (switch_channel_t *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_channel_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_t, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_channel_set" "', argument " "2" " of type '" "switch_channel_t *" "'");
+ }
+ arg2 = reinterpret_cast < switch_channel_t *>(argp2);
+ if (arg1)
+ (arg1)->channel = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_preAnswer",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->preAnswer();
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_channel_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_channel_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_channel_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (switch_channel_t *) ((arg1)->channel);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_channel_t, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_hangup",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->hangup(arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_flags_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ unsigned int val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_flags_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_unsigned_SS_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_flags_set" "', argument " "2" " of type '" "unsigned int" "'");
+ }
+ arg2 = static_cast < unsigned int >(val2);
+ if (arg1)
+ (arg1)->flags = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_hangup",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->hangup();
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_flags_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ unsigned int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flags_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flags_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (unsigned int) ((arg1)->flags);
+ resultobj = SWIG_From_unsigned_SS_int(static_cast < unsigned int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[3];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 2); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_hangup__SWIG_1(self, args);
- }
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_hangup__SWIG_0(self, args);
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
- " Possible C/C++ prototypes are:\n"
- " hangup(CoreSession *,char *)\n"
- " hangup(CoreSession *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_allocated_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_allocated_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_allocated_set" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ if (arg1)
+ (arg1)->allocated = arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setVariable",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setVariable(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_allocated_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_allocated_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_allocated_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) ((arg1)->allocated);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *arg3 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setPrivate",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3), 0, 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3"" of type '" "void *""'");
- }
- (arg1)->setPrivate(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_cb_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *arg2 = (input_callback_state *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_cb_state_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_input_callback_state, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_cb_state_set" "', argument " "2" " of type '" "input_callback_state *" "'");
+ }
+ arg2 = reinterpret_cast < input_callback_state * >(argp2);
+ if (arg1)
+ (arg1)->cb_state = *arg2;
+
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getPrivate",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (void *)(arg1)->getPrivate(arg2);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0 );
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_cb_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ input_callback_state *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_cb_state_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_cb_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (input_callback_state *) & ((arg1)->cb_state);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_input_callback_state, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_getVariable",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (char *)(arg1)->getVariable(arg2);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_hook_state_set(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t arg2;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hook_state_set", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_set" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ {
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_switch_channel_state_t, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2),
+ "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '" "switch_channel_state_t" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "CoreSession_hook_state_set" "', argument " "2" " of type '"
+ "switch_channel_state_t" "'");
+ } else {
+ switch_channel_state_t *temp = reinterpret_cast < switch_channel_state_t *>(argp2);
+ arg2 = *temp;
+ if (SWIG_IsNewObj(res2))
+ delete temp;
+ }
+ }
+ if (arg1)
+ (arg1)->hook_state = arg2;
-SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_process_callback_result",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_process_callback_result" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (arg1)->process_callback_result(arg2);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- char *arg5 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int res5 ;
- char *buf5 = 0 ;
- int alloc5 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
- if (!SWIG_IsOK(res5)) {
- SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
- }
- arg5 = reinterpret_cast< char * >(buf5);
- (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_hook_state_get(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_channel_state_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hook_state_get", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hook_state_get" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = ((arg1)->hook_state);
+ resultobj =
+ SWIG_NewPointerObj((new switch_channel_state_t (static_cast < const switch_channel_state_t &>(result))), SWIGTYPE_p_switch_channel_state_t,
+ SWIG_POINTER_OWN | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_answer", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_answer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->answer();
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_preAnswer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_preAnswer", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_preAnswer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->preAnswer();
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sayPhrase",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->sayPhrase((char const *)arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_hangup", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_hangup" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->hangup(arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[5];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 4); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
- }
- }
- }
- if (argc == 3) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
- }
- }
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
- " Possible C/C++ prototypes are:\n"
- " sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
- " sayPhrase(CoreSession *,char const *,char const *)\n"
- " sayPhrase(CoreSession *,char const *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_hangup__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_hangup", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_hangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ (arg1)->hangup();
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_hangup(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[3];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 2); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_hangup__SWIG_1(self, args);
+ }
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_hangup__SWIG_0(self, args);
+ }
+ }
+ }
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_hangup'.\n"
+ " Possible C/C++ prototypes are:\n" " hangup(CoreSession *,char *)\n" " hangup(CoreSession *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int arg4 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_recordFile",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (int)(arg1)->recordFile(arg2,arg3,arg4);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_setVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setVariable", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setVariable" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setVariable" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setVariable(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_recordFile",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- result = (int)(arg1)->recordFile(arg2,arg3);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_setPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *arg3 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setPrivate", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setPrivate" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&arg3), 0, 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setPrivate" "', argument " "3" " of type '" "void *" "'");
+ }
+ (arg1)->setPrivate(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_recordFile",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->recordFile(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_getPrivate(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getPrivate", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getPrivate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getPrivate" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (void *) (arg1)->getPrivate(arg2);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_void, 0 | 0);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[6];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 5); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_3(self, args);
- }
- }
- }
- if (argc == 3) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[2], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_2(self, args);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[2], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[3], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_1(self, args);
- }
- }
- }
- }
- }
- if (argc == 5) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[2], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[3], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[4], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_CoreSession_recordFile__SWIG_0(self, args);
- }
- }
- }
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
- " Possible C/C++ prototypes are:\n"
- " recordFile(CoreSession *,char *,int,int,int)\n"
- " recordFile(CoreSession *,char *,int,int)\n"
- " recordFile(CoreSession *,char *,int)\n"
- " recordFile(CoreSession *,char *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_getVariable(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_getVariable", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getVariable" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_getVariable" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (char *) (arg1)->getVariable(arg2);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setCallerData",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setCallerData(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_process_callback_result(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_process_callback_result", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1),
+ "in method '" "CoreSession_process_callback_result" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_process_callback_result" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (arg1)->process_callback_result(arg2);
+ resultobj =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_originate",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (int)(arg1)->originate(arg2,arg3,arg4);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ char *arg5 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int res5;
+ char *buf5 = 0;
+ int alloc5 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_say", &obj0, &obj1, &obj2, &obj3, &obj4))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5" " of type '" "char const *" "'");
+ }
+ arg5 = reinterpret_cast < char *>(buf5);
+ (arg1)->say((char const *) arg2, (char const *) arg3, (char const *) arg4, (char const *) arg5);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc5 == SWIG_NEWOBJ)
+ delete[]buf5;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- CoreSession *arg2 = (CoreSession *) 0 ;
- char *arg3 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_originate",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2"" of type '" "CoreSession *""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- result = (int)(arg1)->originate(arg2,arg3);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3, (char const *) arg4);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[5];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 4); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 3) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_originate__SWIG_1(self, args);
- }
- }
- }
- }
- if (argc == 4) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[3], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_CoreSession_originate__SWIG_0(self, args);
- }
- }
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
- " Possible C/C++ prototypes are:\n"
- " originate(CoreSession *,CoreSession *,char *,int)\n"
- " originate(CoreSession *,CoreSession *,char *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_sayPhrase", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3" " of type '" "char const *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->sayPhrase((char const *) arg2, (char const *) arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2"" of type '" "void *""'");
- }
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setDTMFCallback(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sayPhrase", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2" " of type '" "char const *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->sayPhrase((char const *) arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_speak",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->speak(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[5];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_set_tts_parms",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->set_tts_parms(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
+ " sayPhrase(CoreSession *,char const *,char const *)\n" " sayPhrase(CoreSession *,char const *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_collectDigits",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- result = (int)(arg1)->collectDigits(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int arg5;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int val5;
+ int ecode5 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3, &obj4))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ ecode5 = SWIG_AsVal_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_recordFile" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4, arg5);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- char *arg3 = (char *) 0 ;
- int arg4 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_getDigits",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int arg4;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_recordFile", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_recordFile" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (int) (arg1)->recordFile(arg2, arg3, arg4);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- char *arg4 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_transfer",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4"" of type '" "char *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- result = (int)(arg1)->transfer(arg2,arg3,arg4);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- char *arg4 = (char *) 0 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int res4 ;
- char *buf4 = 0 ;
- int alloc4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- PyObject * obj5 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4"" of type '" "char const *""'");
- }
- arg4 = reinterpret_cast< char * >(buf4);
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- return resultobj;
-fail:
- if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int arg2 ;
- int arg3 ;
- int arg4 ;
- int arg5 ;
- char *arg6 = (char *) 0 ;
- char *arg7 = (char *) 0 ;
- char *arg8 = (char *) 0 ;
- char *arg9 = (char *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int val2 ;
- int ecode2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- int val4 ;
- int ecode4 = 0 ;
- int val5 ;
- int ecode5 = 0 ;
- int res6 ;
- char *buf6 = 0 ;
- int alloc6 = 0 ;
- int res7 ;
- char *buf7 = 0 ;
- int alloc7 = 0 ;
- int res8 ;
- char *buf8 = 0 ;
- int alloc8 = 0 ;
- int res9 ;
- char *buf9 = 0 ;
- int alloc9 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
- PyObject * obj5 = 0 ;
- PyObject * obj6 = 0 ;
- PyObject * obj7 = 0 ;
- PyObject * obj8 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_int(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2"" of type '" "int""'");
- }
- arg2 = static_cast< int >(val2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- ecode4 = SWIG_AsVal_int(obj3, &val4);
- if (!SWIG_IsOK(ecode4)) {
- SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4"" of type '" "int""'");
- }
- arg4 = static_cast< int >(val4);
- ecode5 = SWIG_AsVal_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5"" of type '" "int""'");
- }
- arg5 = static_cast< int >(val5);
- res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
- if (!SWIG_IsOK(res6)) {
- SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6"" of type '" "char *""'");
- }
- arg6 = reinterpret_cast< char * >(buf6);
- res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
- if (!SWIG_IsOK(res7)) {
- SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7"" of type '" "char *""'");
- }
- arg7 = reinterpret_cast< char * >(buf7);
- res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
- if (!SWIG_IsOK(res8)) {
- SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8"" of type '" "char *""'");
- }
- arg8 = reinterpret_cast< char * >(buf8);
- res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
- if (!SWIG_IsOK(res9)) {
- SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9"" of type '" "char *""'");
- }
- arg9 = reinterpret_cast< char * >(buf9);
- result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
- resultobj = SWIG_FromCharPtr((const char *)result);
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
- return resultobj;
-fail:
- if (alloc6 == SWIG_NEWOBJ) delete[] buf6;
- if (alloc7 == SWIG_NEWOBJ) delete[] buf7;
- if (alloc8 == SWIG_NEWOBJ) delete[] buf8;
- if (alloc9 == SWIG_NEWOBJ) delete[] buf9;
- return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int arg3 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int val3 ;
- int ecode3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_streamFile",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- ecode3 = SWIG_AsVal_int(obj2, &val3);
- if (!SWIG_IsOK(ecode3)) {
- SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3"" of type '" "int""'");
- }
- arg3 = static_cast< int >(val3);
- result = (int)(arg1)->streamFile(arg2,arg3);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_recordFile", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_recordFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ result = (int) (arg1)->recordFile(arg2, arg3);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_streamFile",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- result = (int)(arg1)->streamFile(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_3(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_recordFile", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_recordFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_recordFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->recordFile(arg2);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[4];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 3); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_streamFile__SWIG_1(self, args);
- }
- }
- }
- if (argc == 3) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- {
- int res = SWIG_AsVal_int(argv[2], NULL);
- _v = SWIG_CheckState(res);
- }
- if (_v) {
- return _wrap_CoreSession_streamFile__SWIG_0(self, args);
- }
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
- " Possible C/C++ prototypes are:\n"
- " streamFile(CoreSession *,char *,int)\n"
- " streamFile(CoreSession *,char *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_recordFile(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[6];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 5); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_3(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[2], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_2(self, args);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[2], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[3], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_1(self, args);
+ }
+ }
+ }
+ }
+ }
+ if (argc == 5) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[2], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[3], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[4], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_recordFile__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+ }
+ }
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_recordFile'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " recordFile(CoreSession *,char *,int,int,int)\n"
+ " recordFile(CoreSession *,char *,int,int)\n"
+ " recordFile(CoreSession *,char *,int)\n" " recordFile(CoreSession *,char *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushEvents",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->flushEvents();
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_setCallerData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setCallerData", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setCallerData" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setCallerData" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setCallerData" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setCallerData(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_flushDigits",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (int)(arg1)->flushDigits();
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int arg4;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int val4;
+ int ecode4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_originate", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_originate" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (int) (arg1)->originate(arg2, arg3, arg4);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool arg2 ;
- int result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- bool val2 ;
- int ecode2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setAutoHangup",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- ecode2 = SWIG_AsVal_bool(obj1, &val2);
- if (!SWIG_IsOK(ecode2)) {
- SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2"" of type '" "bool""'");
- }
- arg2 = static_cast< bool >(val2);
- result = (int)(arg1)->setAutoHangup(arg2);
- resultobj = SWIG_From_int(static_cast< int >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_originate__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ CoreSession *arg2 = (CoreSession *) 0;
+ char *arg3 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_originate", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_originate" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_originate" "', argument " "2" " of type '" "CoreSession *" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_originate" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ result = (int) (arg1)->originate(arg2, arg3);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setHangupHook",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2"" of type '" "void *""'");
- }
- (arg1)->setHangupHook(arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_originate(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[5];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_originate__SWIG_1(self, args);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[3], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_originate__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_ready",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->ready();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_originate'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " originate(CoreSession *,CoreSession *,char *,int)\n" " originate(CoreSession *,CoreSession *,char *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_execute",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->execute(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_setDTMFCallback", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setDTMFCallback" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setDTMFCallback" "', argument " "2" " of type '" "void *" "'");
+ }
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setDTMFCallback(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_execute",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->execute(arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_speak(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_speak", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_speak" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_speak" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->speak(arg2);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[4];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 3); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 2) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_execute__SWIG_1(self, args);
- }
- }
- }
- if (argc == 3) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_CoreSession_execute__SWIG_0(self, args);
- }
- }
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
- " Possible C/C++ prototypes are:\n"
- " execute(CoreSession *,char *,char *)\n"
- " execute(CoreSession *,char *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_set_tts_parms(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_set_tts_parms", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_set_tts_parms" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_set_tts_parms" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_set_tts_parms" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->set_tts_parms(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sendEvent",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2"" of type '" "Event *""'");
- }
- arg2 = reinterpret_cast< Event * >(argp2);
- (arg1)->sendEvent(arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_collectDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_collectDigits", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_collectDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_collectDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ result = (int) (arg1)->collectDigits(arg2);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_getDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ char *arg3 = (char *) 0;
+ int arg4;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int val4;
+ int ecode4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_getDigits", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_getDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_getDigits" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_getDigits" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ result = (char *) (arg1)->getDigits(arg2, arg3, arg4);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_transfer(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ char *arg4 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOO:CoreSession_transfer", &obj0, &obj1, &obj2, &obj3))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_transfer" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_transfer" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_transfer" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_transfer" "', argument " "4" " of type '" "char *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ result = (int) (arg1)->transfer(arg2, arg3, arg4);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ char *arg4 = (char *) 0;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int res4;
+ char *buf4 = 0;
+ int alloc4 = 0;
+ int val5;
+ int ecode5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+ PyObject *obj5 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOOOO:CoreSession_read", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_read" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_read" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_read" "', argument " "4" " of type '" "char const *" "'");
+ }
+ arg4 = reinterpret_cast < char *>(buf4);
+ ecode5 = SWIG_AsVal_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_read" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6" " of type '" "char const *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ result = (char *) (arg1)->read(arg2, arg3, (char const *) arg4, arg5, (char const *) arg6);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ return resultobj;
+ fail:
+ if (alloc4 == SWIG_NEWOBJ)
+ delete[]buf4;
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int arg2;
+ int arg3;
+ int arg4;
+ int arg5;
+ char *arg6 = (char *) 0;
+ char *arg7 = (char *) 0;
+ char *arg8 = (char *) 0;
+ char *arg9 = (char *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int val2;
+ int ecode2 = 0;
+ int val3;
+ int ecode3 = 0;
+ int val4;
+ int ecode4 = 0;
+ int val5;
+ int ecode5 = 0;
+ int res6;
+ char *buf6 = 0;
+ int alloc6 = 0;
+ int res7;
+ char *buf7 = 0;
+ int alloc7 = 0;
+ int res8;
+ char *buf8 = 0;
+ int alloc8 = 0;
+ int res9;
+ char *buf9 = 0;
+ int alloc9 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+ PyObject *obj5 = 0;
+ PyObject *obj6 = 0;
+ PyObject *obj7 = 0;
+ PyObject *obj8 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOOOOOOO:CoreSession_playAndGetDigits", &obj0, &obj1, &obj2, &obj3, &obj4, &obj5, &obj6, &obj7, &obj8))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_int(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_playAndGetDigits" "', argument " "2" " of type '" "int" "'");
+ }
+ arg2 = static_cast < int >(val2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_playAndGetDigits" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ ecode4 = SWIG_AsVal_int(obj3, &val4);
+ if (!SWIG_IsOK(ecode4)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_playAndGetDigits" "', argument " "4" " of type '" "int" "'");
+ }
+ arg4 = static_cast < int >(val4);
+ ecode5 = SWIG_AsVal_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "CoreSession_playAndGetDigits" "', argument " "5" " of type '" "int" "'");
+ }
+ arg5 = static_cast < int >(val5);
+ res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
+ if (!SWIG_IsOK(res6)) {
+ SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_playAndGetDigits" "', argument " "6" " of type '" "char *" "'");
+ }
+ arg6 = reinterpret_cast < char *>(buf6);
+ res7 = SWIG_AsCharPtrAndSize(obj6, &buf7, NULL, &alloc7);
+ if (!SWIG_IsOK(res7)) {
+ SWIG_exception_fail(SWIG_ArgError(res7), "in method '" "CoreSession_playAndGetDigits" "', argument " "7" " of type '" "char *" "'");
+ }
+ arg7 = reinterpret_cast < char *>(buf7);
+ res8 = SWIG_AsCharPtrAndSize(obj7, &buf8, NULL, &alloc8);
+ if (!SWIG_IsOK(res8)) {
+ SWIG_exception_fail(SWIG_ArgError(res8), "in method '" "CoreSession_playAndGetDigits" "', argument " "8" " of type '" "char *" "'");
+ }
+ arg8 = reinterpret_cast < char *>(buf8);
+ res9 = SWIG_AsCharPtrAndSize(obj8, &buf9, NULL, &alloc9);
+ if (!SWIG_IsOK(res9)) {
+ SWIG_exception_fail(SWIG_ArgError(res9), "in method '" "CoreSession_playAndGetDigits" "', argument " "9" " of type '" "char *" "'");
+ }
+ arg9 = reinterpret_cast < char *>(buf9);
+ result = (char *) (arg1)->playAndGetDigits(arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ if (alloc9 == SWIG_NEWOBJ)
+ delete[]buf9;
+ return resultobj;
+ fail:
+ if (alloc6 == SWIG_NEWOBJ)
+ delete[]buf6;
+ if (alloc7 == SWIG_NEWOBJ)
+ delete[]buf7;
+ if (alloc8 == SWIG_NEWOBJ)
+ delete[]buf8;
+ if (alloc9 == SWIG_NEWOBJ)
+ delete[]buf9;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int arg3;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int val3;
+ int ecode3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_streamFile", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ ecode3 = SWIG_AsVal_int(obj2, &val3);
+ if (!SWIG_IsOK(ecode3)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "CoreSession_streamFile" "', argument " "3" " of type '" "int" "'");
+ }
+ arg3 = static_cast < int >(val3);
+ result = (int) (arg1)->streamFile(arg2, arg3);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_streamFile__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_streamFile", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_streamFile" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_streamFile" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ result = (int) (arg1)->streamFile(arg2);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_streamFile(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[4];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_streamFile__SWIG_1(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ {
+ int res = SWIG_AsVal_int(argv[2], NULL);
+ _v = SWIG_CheckState(res);
+ }
+ if (_v) {
+ return _wrap_CoreSession_streamFile__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_streamFile'.\n"
+ " Possible C/C++ prototypes are:\n" " streamFile(CoreSession *,char *,int)\n" " streamFile(CoreSession *,char *)\n");
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_flushEvents(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushEvents", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushEvents" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->flushEvents();
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_flushDigits(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_flushDigits", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_flushDigits" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (int) (arg1)->flushDigits();
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_setAutoHangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool arg2;
+ int result;
+ void *argp1 = 0;
+ int res1 = 0;
+ bool val2;
+ int ecode2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setAutoHangup", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setAutoHangup" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ ecode2 = SWIG_AsVal_bool(obj1, &val2);
+ if (!SWIG_IsOK(ecode2)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "CoreSession_setAutoHangup" "', argument " "2" " of type '" "bool" "'");
+ }
+ arg2 = static_cast < bool > (val2);
+ result = (int) (arg1)->setAutoHangup(arg2);
+ resultobj = SWIG_From_int(static_cast < int >(result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setHangupHook", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setHangupHook" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setHangupHook" "', argument " "2" " of type '" "void *" "'");
+ }
+ (arg1)->setHangupHook(arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_ready(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_ready", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_ready" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->ready();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_execute", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_execute" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->execute(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_execute", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->execute(arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[4];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_1(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
+ " Possible C/C++ prototypes are:\n" " execute(CoreSession *,char *,char *)\n" " execute(CoreSession *,char *)\n");
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_sendEvent", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sendEvent" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sendEvent" "', argument " "2" " of type '" "Event *" "'");
+ }
+ arg2 = reinterpret_cast < Event * >(argp2);
+ (arg1)->sendEvent(arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ Event *arg2 = (Event *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:CoreSession_setEventData", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_Event, 0 | 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2" " of type '" "Event *" "'");
+ }
+ arg2 = reinterpret_cast < Event * >(argp2);
+ (arg1)->setEventData(arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_getXMLCDR", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (char *) (arg1)->getXMLCDR();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
+
+
+ SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_begin_allow_threads", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->begin_allow_threads();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_setEventData(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- Event *arg2 = (Event *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_setEventData",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_setEventData" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_Event, 0 | 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_setEventData" "', argument " "2"" of type '" "Event *""'");
- }
- arg2 = reinterpret_cast< Event * >(argp2);
- (arg1)->setEventData(arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_end_allow_threads", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (bool) (arg1)->end_allow_threads();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_getXMLCDR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_getXMLCDR",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_getXMLCDR" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (char *)(arg1)->getXMLCDR();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ char *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_uuid", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1" " of type '" "CoreSession const *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ result = (char *) ((CoreSession const *) arg1)->get_uuid();
+ resultobj = SWIG_FromCharPtr((const char *) result);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_begin_allow_threads",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_begin_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->begin_allow_threads();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ switch_input_args_t *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_get_cb_args", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1" " of type '" "CoreSession const *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ {
+ switch_input_args_t const &_result_ref = ((CoreSession const *) arg1)->get_cb_args();
+ result = (switch_input_args_t *) &_result_ref;
+ }
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_end_allow_threads",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_end_allow_threads" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (bool)(arg1)->end_allow_threads();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:CoreSession_check_hangup_hook", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ (arg1)->check_hangup_hook();
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_get_uuid(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- char *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_uuid",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_uuid" "', argument " "1"" of type '" "CoreSession const *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- result = (char *)((CoreSession const *)arg1)->get_uuid();
- resultobj = SWIG_FromCharPtr((const char *)result);
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:CoreSession_run_dtmf_callback", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1" " of type '" "CoreSession *" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3),
+ "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3" " of type '"
+ "switch_input_type_t" "'");
+ } else {
+ switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+ arg3 = *temp;
+ if (SWIG_IsNewObj(res3))
+ delete temp;
+ }
+ }
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ resultobj =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_get_cb_args(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- switch_input_args_t *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_get_cb_args",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_get_cb_args" "', argument " "1"" of type '" "CoreSession const *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- {
- switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
- result = (switch_input_args_t *) &_result_ref;
- }
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_switch_input_args_t, 0 | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *CoreSession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
+ SWIGINTERN PyObject *_wrap_console_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ char *arg2 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:console_log", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ console_log(arg1, arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:CoreSession_check_hangup_hook",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_check_hangup_hook" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- (arg1)->check_hangup_hook();
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_console_clean_log(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:console_clean_log", &obj0))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ console_clean_log(arg1);
+ resultobj = SWIG_Py_Void();
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_CoreSession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = (CoreSession *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_run_dtmf_callback" "', argument " "1"" of type '" "CoreSession *""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "CoreSession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
- arg3 = *temp;
- if (SWIG_IsNewObj(res3)) delete temp;
- }
- }
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_bridge(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = 0;
+ CoreSession *arg2 = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ void *argp2 = 0;
+ int res2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:bridge", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+ }
+ if (!argp1) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1" " of type '" "CoreSession &" "'");
+ }
+ arg1 = reinterpret_cast < CoreSession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+ }
+ if (!argp2) {
+ SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2" " of type '" "CoreSession &" "'");
+ }
+ arg2 = reinterpret_cast < CoreSession * >(argp2);
+ bridge(*arg1, *arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *CoreSession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_CoreSession, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *_wrap_console_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- char *arg2 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:console_log",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_log" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "console_log" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- console_log(arg1,arg2);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_hanguphook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:hanguphook", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ result = hanguphook(arg1);
+ resultobj =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_console_clean_log(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:console_clean_log",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "console_clean_log" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- console_clean_log(arg1);
- resultobj = SWIG_Py_Void();
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ void *arg4 = (void *) 0;
+ unsigned int arg5;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ int res4;
+ unsigned int val5;
+ int ecode5 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+ PyObject *obj3 = 0;
+ PyObject *obj4 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOOOO:dtmf_callback", &obj0, &obj1, &obj2, &obj3, &obj4))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ } else {
+ switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+ arg3 = *temp;
+ if (SWIG_IsNewObj(res3))
+ delete temp;
+ }
+ }
+ res4 = SWIG_ConvertPtr(obj3, SWIG_as_voidptrptr(&arg4), 0, 0);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4" " of type '" "void *" "'");
+ }
+ ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
+ if (!SWIG_IsOK(ecode5)) {
+ SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5" " of type '" "unsigned int" "'");
+ }
+ arg5 = static_cast < unsigned int >(val5);
+ result = dtmf_callback(arg1, arg2, arg3, arg4, arg5);
+ resultobj =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_bridge(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- CoreSession *arg1 = 0 ;
- CoreSession *arg2 = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- void *argp2 = 0 ;
- int res2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:bridge",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_CoreSession, 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
- }
- if (!argp1) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "1"" of type '" "CoreSession &""'");
- }
- arg1 = reinterpret_cast< CoreSession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_CoreSession, 0 );
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
- }
- if (!argp2) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "bridge" "', argument " "2"" of type '" "CoreSession &""'");
- }
- arg2 = reinterpret_cast< CoreSession * >(argp2);
- bridge(*arg1,*arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *result = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) ":new_PySession"))
+ SWIG_fail;
+ result = (PySession *) new PySession();
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_hanguphook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:hanguphook",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "hanguphook" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = hanguphook(arg1);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ char *arg1 = (char *) 0;
+ PySession *result = 0;
+ int res1;
+ char *buf1 = 0;
+ int alloc1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
+ SWIG_fail;
+ res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "char *" "'");
+ }
+ arg1 = reinterpret_cast < char *>(buf1);
+ result = (PySession *) new PySession(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return resultobj;
+ fail:
+ if (alloc1 == SWIG_NEWOBJ)
+ delete[]buf1;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- void *arg4 = (void *) 0 ;
- unsigned int arg5 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- int res4 ;
- unsigned int val5 ;
- int ecode5 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
- PyObject * obj3 = 0 ;
- PyObject * obj4 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOOOO:dtmf_callback",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "dtmf_callback" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
- arg3 = *temp;
- if (SWIG_IsNewObj(res3)) delete temp;
- }
- }
- res4 = SWIG_ConvertPtr(obj3,SWIG_as_voidptrptr(&arg4), 0, 0);
- if (!SWIG_IsOK(res4)) {
- SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "dtmf_callback" "', argument " "4"" of type '" "void *""'");
- }
- ecode5 = SWIG_AsVal_unsigned_SS_int(obj4, &val5);
- if (!SWIG_IsOK(ecode5)) {
- SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "dtmf_callback" "', argument " "5"" of type '" "unsigned int""'");
- }
- arg5 = static_cast< unsigned int >(val5);
- result = dtmf_callback(arg1,arg2,arg3,arg4,arg5);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ switch_core_session_t *arg1 = (switch_core_session_t *) 0;
+ PySession *result = 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:new_PySession", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_switch_core_session_t, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1" " of type '" "switch_core_session_t *" "'");
+ }
+ arg1 = reinterpret_cast < switch_core_session_t *>(argp1);
+ result = (PySession *) new PySession(arg1);
+ resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *result = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)":new_PySession")) SWIG_fail;
- result = (PySession *)new PySession();
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_new_PySession(PyObject * self, PyObject * args) {
+ int argc;
+ PyObject *argv[2];
+ int ii;
+
+ if (!PyTuple_Check(args))
+ SWIG_fail;
+ argc = (int) PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 1); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args, ii);
+ }
+ if (argc == 0) {
+ return _wrap_new_PySession__SWIG_0(self, args);
+ }
+ if (argc == 1) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_PySession__SWIG_2(self, args);
+ }
+ }
+ if (argc == 1) {
+ int _v;
+ int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_new_PySession__SWIG_1(self, args);
+ }
+ }
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- char *arg1 = (char *) 0 ;
- PySession *result = 0 ;
- int res1 ;
- char *buf1 = 0 ;
- int alloc1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
- res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "char *""'");
- }
- arg1 = reinterpret_cast< char * >(buf1);
- result = (PySession *)new PySession(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0 );
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return resultobj;
-fail:
- if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
- return NULL;
-}
+ fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError, "Wrong number of arguments for overloaded function 'new_PySession'.\n"
+ " Possible C/C++ prototypes are:\n" " PySession()\n" " PySession(char *)\n" " PySession(switch_core_session_t *)\n");
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_PySession__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
- PySession *result = 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:new_PySession",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_switch_core_session_t, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_PySession" "', argument " "1"" of type '" "switch_core_session_t *""'");
- }
- arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
- result = (PySession *)new PySession(arg1);
- resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PySession, SWIG_POINTER_NEW | 0 );
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_delete_PySession(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:delete_PySession", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ delete arg1;
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_new_PySession(PyObject *self, PyObject *args) {
- int argc;
- PyObject *argv[2];
- int ii;
-
- if (!PyTuple_Check(args)) SWIG_fail;
- argc = (int)PyObject_Length(args);
- for (ii = 0; (ii < argc) && (ii < 1); ii++) {
- argv[ii] = PyTuple_GET_ITEM(args,ii);
- }
- if (argc == 0) {
- return _wrap_new_PySession__SWIG_0(self, args);
- }
- if (argc == 1) {
- int _v;
- void *vptr = 0;
- int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_switch_core_session_t, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_PySession__SWIG_2(self, args);
- }
- }
- if (argc == 1) {
- int _v;
- int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
- _v = SWIG_CheckState(res);
- if (_v) {
- return _wrap_new_PySession__SWIG_1(self, args);
- }
- }
-
-fail:
- SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_PySession'.\n"
- " Possible C/C++ prototypes are:\n"
- " PySession()\n"
- " PySession(char *)\n"
- " PySession(switch_core_session_t *)\n");
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ PyObject *arg2 = (PyObject *) 0;
+ char *arg3 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res3;
+ char *buf3 = 0;
+ int alloc3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_setDTMFCallback", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ arg2 = obj1;
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3" " of type '" "char *" "'");
+ }
+ arg3 = reinterpret_cast < char *>(buf3);
+ (arg1)->setDTMFCallback(arg2, arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return resultobj;
+ fail:
+ if (alloc3 == SWIG_NEWOBJ)
+ delete[]buf3;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_delete_PySession(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:delete_PySession",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, SWIG_POINTER_DISOWN | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_PySession" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- delete arg1;
-
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ PyObject *arg2 = (PyObject *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:PySession_setHangupHook", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setHangupHook" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ arg2 = obj1;
+ (arg1)->setHangupHook(arg2);
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_setDTMFCallback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- PyObject *arg2 = (PyObject *) 0 ;
- char *arg3 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res3 ;
- char *buf3 = 0 ;
- int alloc3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_setDTMFCallback",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setDTMFCallback" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- arg2 = obj1;
- res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_setDTMFCallback" "', argument " "3"" of type '" "char *""'");
- }
- arg3 = reinterpret_cast< char * >(buf3);
- (arg1)->setDTMFCallback(arg2,arg3);
- resultobj = SWIG_Py_Void();
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return resultobj;
-fail:
- if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:PySession_check_hangup_hook", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_check_hangup_hook" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ (arg1)->check_hangup_hook();
+ resultobj = SWIG_Py_Void();
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_setHangupHook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- PyObject *arg2 = (PyObject *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:PySession_setHangupHook",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_setHangupHook" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- arg2 = obj1;
- (arg1)->setHangupHook(arg2);
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ char *arg2 = (char *) 0;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ char *buf2 = 0;
+ int alloc2 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OO:PySession_hangup", &obj0, &obj1))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_hangup" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2" " of type '" "char *" "'");
+ }
+ arg2 = reinterpret_cast < char *>(buf2);
+ (arg1)->hangup(arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return resultobj;
+ fail:
+ if (alloc2 == SWIG_NEWOBJ)
+ delete[]buf2;
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_check_hangup_hook(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:PySession_check_hangup_hook",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_check_hangup_hook" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- (arg1)->check_hangup_hook();
- resultobj = SWIG_Py_Void();
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:PySession_begin_allow_threads", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_begin_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ result = (bool) (arg1)->begin_allow_threads();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_hangup(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- char *arg2 = (char *) 0 ;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- char *buf2 = 0 ;
- int alloc2 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OO:PySession_hangup",&obj0,&obj1)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_hangup" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_hangup" "', argument " "2"" of type '" "char *""'");
- }
- arg2 = reinterpret_cast< char * >(buf2);
- (arg1)->hangup(arg2);
- resultobj = SWIG_Py_Void();
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return resultobj;
-fail:
- if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ bool result;
+ void *argp1 = 0;
+ int res1 = 0;
+ PyObject *obj0 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "O:PySession_end_allow_threads", &obj0))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_end_allow_threads" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ result = (bool) (arg1)->end_allow_threads();
+ resultobj = SWIG_From_bool(static_cast < bool > (result));
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_begin_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:PySession_begin_allow_threads",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_begin_allow_threads" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- result = (bool)(arg1)->begin_allow_threads();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *resultobj = 0;
+ PySession *arg1 = (PySession *) 0;
+ void *arg2 = (void *) 0;
+ switch_input_type_t arg3;
+ switch_status_t result;
+ void *argp1 = 0;
+ int res1 = 0;
+ int res2;
+ void *argp3;
+ int res3 = 0;
+ PyObject *obj0 = 0;
+ PyObject *obj1 = 0;
+ PyObject *obj2 = 0;
+
+ if (!PyArg_ParseTuple(args, (char *) "OOO:PySession_run_dtmf_callback", &obj0, &obj1, &obj2))
+ SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1, SWIGTYPE_p_PySession, 0 | 0);
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_run_dtmf_callback" "', argument " "1" " of type '" "PySession *" "'");
+ }
+ arg1 = reinterpret_cast < PySession * >(argp1);
+ res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&arg2), 0, 0);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2" " of type '" "void *" "'");
+ }
+ {
+ res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3),
+ "in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '" "switch_input_type_t" "'");
+ }
+ if (!argp3) {
+ SWIG_exception_fail(SWIG_ValueError,
+ "invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3" " of type '"
+ "switch_input_type_t" "'");
+ } else {
+ switch_input_type_t *temp = reinterpret_cast < switch_input_type_t *>(argp3);
+ arg3 = *temp;
+ if (SWIG_IsNewObj(res3))
+ delete temp;
+ }
+ }
+ result = (arg1)->run_dtmf_callback(arg2, arg3);
+ resultobj =
+ SWIG_NewPointerObj((new switch_status_t (static_cast < const switch_status_t &>(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0);
+ return resultobj;
+ fail:
+ return NULL;
+ }
-SWIGINTERN PyObject *_wrap_PySession_end_allow_threads(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- bool result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- PyObject * obj0 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"O:PySession_end_allow_threads",&obj0)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_end_allow_threads" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- result = (bool)(arg1)->end_allow_threads();
- resultobj = SWIG_From_bool(static_cast< bool >(result));
- return resultobj;
-fail:
- return NULL;
-}
+ SWIGINTERN PyObject *PySession_swigregister(PyObject * SWIGUNUSEDPARM(self), PyObject * args) {
+ PyObject *obj;
+ if (!PyArg_ParseTuple(args, (char *) "O:swigregister", &obj))
+ return NULL;
+ SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
+ return SWIG_Py_Void();
+ }
-SWIGINTERN PyObject *_wrap_PySession_run_dtmf_callback(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *resultobj = 0;
- PySession *arg1 = (PySession *) 0 ;
- void *arg2 = (void *) 0 ;
- switch_input_type_t arg3 ;
- switch_status_t result;
- void *argp1 = 0 ;
- int res1 = 0 ;
- int res2 ;
- void *argp3 ;
- int res3 = 0 ;
- PyObject * obj0 = 0 ;
- PyObject * obj1 = 0 ;
- PyObject * obj2 = 0 ;
-
- if (!PyArg_ParseTuple(args,(char *)"OOO:PySession_run_dtmf_callback",&obj0,&obj1,&obj2)) SWIG_fail;
- res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_PySession, 0 | 0 );
- if (!SWIG_IsOK(res1)) {
- SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "PySession_run_dtmf_callback" "', argument " "1"" of type '" "PySession *""'");
- }
- arg1 = reinterpret_cast< PySession * >(argp1);
- res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2), 0, 0);
- if (!SWIG_IsOK(res2)) {
- SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "PySession_run_dtmf_callback" "', argument " "2"" of type '" "void *""'");
- }
- {
- res3 = SWIG_ConvertPtr(obj2, &argp3, SWIGTYPE_p_switch_input_type_t, 0 | 0);
- if (!SWIG_IsOK(res3)) {
- SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- }
- if (!argp3) {
- SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "PySession_run_dtmf_callback" "', argument " "3"" of type '" "switch_input_type_t""'");
- } else {
- switch_input_type_t * temp = reinterpret_cast< switch_input_type_t * >(argp3);
- arg3 = *temp;
- if (SWIG_IsNewObj(res3)) delete temp;
- }
- }
- result = (arg1)->run_dtmf_callback(arg2,arg3);
- resultobj = SWIG_NewPointerObj((new switch_status_t(static_cast< const switch_status_t& >(result))), SWIGTYPE_p_switch_status_t, SWIG_POINTER_OWN | 0 );
- return resultobj;
-fail:
- return NULL;
-}
-
-
-SWIGINTERN PyObject *PySession_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
- PyObject *obj;
- if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
- SWIG_TypeNewClientData(SWIGTYPE_p_PySession, SWIG_NewClientData(obj));
- return SWIG_Py_Void();
-}
-
-static PyMethodDef SwigMethods[] = {
- { (char *)"consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
- { (char *)"consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
- { (char *)"new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
- { (char *)"delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
- { (char *)"IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
- { (char *)"IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
- { (char *)"IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
- { (char *)"new_API", _wrap_new_API, METH_VARARGS, NULL},
- { (char *)"delete_API", _wrap_delete_API, METH_VARARGS, NULL},
- { (char *)"API_execute", _wrap_API_execute, METH_VARARGS, NULL},
- { (char *)"API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
- { (char *)"API_swigregister", API_swigregister, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
- { (char *)"new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
- { (char *)"delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
- { (char *)"input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
- { (char *)"new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
- { (char *)"delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
- { (char *)"Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
- { (char *)"Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
- { (char *)"Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
- { (char *)"Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
- { (char *)"Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
- { (char *)"Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
- { (char *)"Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
- { (char *)"Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
- { (char *)"Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
- { (char *)"new_Event", _wrap_new_Event, METH_VARARGS, NULL},
- { (char *)"delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
- { (char *)"Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
- { (char *)"Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
- { (char *)"Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
- { (char *)"Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
- { (char *)"Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
- { (char *)"Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
- { (char *)"Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
- { (char *)"Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
- { (char *)"Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
- { (char *)"Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
- { (char *)"delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
- { (char *)"CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
- { (char *)"CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
- { (char *)"CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
- { (char *)"CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
- { (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
- { (char *)"CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
- { (char *)"CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
- { (char *)"CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
- { (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
- { (char *)"CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
- { (char *)"CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
- { (char *)"CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
- { (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
- { (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
- { (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
- { (char *)"CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
- { (char *)"CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
- { (char *)"CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
- { (char *)"CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
- { (char *)"CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
- { (char *)"CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
- { (char *)"CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
- { (char *)"CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
- { (char *)"CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
- { (char *)"CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
- { (char *)"CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
- { (char *)"CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
- { (char *)"CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
- { (char *)"CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
- { (char *)"CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
- { (char *)"CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
- { (char *)"CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
- { (char *)"CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
- { (char *)"CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
- { (char *)"CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
- { (char *)"CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
- { (char *)"CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
- { (char *)"CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
- { (char *)"CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
- { (char *)"CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
- { (char *)"console_log", _wrap_console_log, METH_VARARGS, NULL},
- { (char *)"console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
- { (char *)"bridge", _wrap_bridge, METH_VARARGS, NULL},
- { (char *)"hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
- { (char *)"dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
- { (char *)"new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
- { (char *)"delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
- { (char *)"PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
- { (char *)"PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
- { (char *)"PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
- { (char *)"PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
- { (char *)"PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
- { (char *)"PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
- { (char *)"PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
- { (char *)"PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
- { NULL, NULL, 0, NULL }
-};
+ static PyMethodDef SwigMethods[] = {
+ {(char *) "consoleLog", _wrap_consoleLog, METH_VARARGS, NULL},
+ {(char *) "consoleCleanLog", _wrap_consoleCleanLog, METH_VARARGS, NULL},
+ {(char *) "new_IVRMenu", _wrap_new_IVRMenu, METH_VARARGS, NULL},
+ {(char *) "delete_IVRMenu", _wrap_delete_IVRMenu, METH_VARARGS, NULL},
+ {(char *) "IVRMenu_bindAction", _wrap_IVRMenu_bindAction, METH_VARARGS, NULL},
+ {(char *) "IVRMenu_execute", _wrap_IVRMenu_execute, METH_VARARGS, NULL},
+ {(char *) "IVRMenu_swigregister", IVRMenu_swigregister, METH_VARARGS, NULL},
+ {(char *) "new_API", _wrap_new_API, METH_VARARGS, NULL},
+ {(char *) "delete_API", _wrap_delete_API, METH_VARARGS, NULL},
+ {(char *) "API_execute", _wrap_API_execute, METH_VARARGS, NULL},
+ {(char *) "API_executeString", _wrap_API_executeString, METH_VARARGS, NULL},
+ {(char *) "API_swigregister", API_swigregister, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get, METH_VARARGS, NULL},
+ {(char *) "new_input_callback_state_t", _wrap_new_input_callback_state_t, METH_VARARGS, NULL},
+ {(char *) "delete_input_callback_state_t", _wrap_delete_input_callback_state_t, METH_VARARGS, NULL},
+ {(char *) "input_callback_state_t_swigregister", input_callback_state_t_swigregister, METH_VARARGS, NULL},
+ {(char *) "new_Stream", _wrap_new_Stream, METH_VARARGS, NULL},
+ {(char *) "delete_Stream", _wrap_delete_Stream, METH_VARARGS, NULL},
+ {(char *) "Stream_write", _wrap_Stream_write, METH_VARARGS, NULL},
+ {(char *) "Stream_get_data", _wrap_Stream_get_data, METH_VARARGS, NULL},
+ {(char *) "Stream_swigregister", Stream_swigregister, METH_VARARGS, NULL},
+ {(char *) "Event_event_set", _wrap_Event_event_set, METH_VARARGS, NULL},
+ {(char *) "Event_event_get", _wrap_Event_event_get, METH_VARARGS, NULL},
+ {(char *) "Event_serialized_string_set", _wrap_Event_serialized_string_set, METH_VARARGS, NULL},
+ {(char *) "Event_serialized_string_get", _wrap_Event_serialized_string_get, METH_VARARGS, NULL},
+ {(char *) "Event_mine_set", _wrap_Event_mine_set, METH_VARARGS, NULL},
+ {(char *) "Event_mine_get", _wrap_Event_mine_get, METH_VARARGS, NULL},
+ {(char *) "new_Event", _wrap_new_Event, METH_VARARGS, NULL},
+ {(char *) "delete_Event", _wrap_delete_Event, METH_VARARGS, NULL},
+ {(char *) "Event_serialize", _wrap_Event_serialize, METH_VARARGS, NULL},
+ {(char *) "Event_setPriority", _wrap_Event_setPriority, METH_VARARGS, NULL},
+ {(char *) "Event_getHeader", _wrap_Event_getHeader, METH_VARARGS, NULL},
+ {(char *) "Event_getBody", _wrap_Event_getBody, METH_VARARGS, NULL},
+ {(char *) "Event_getType", _wrap_Event_getType, METH_VARARGS, NULL},
+ {(char *) "Event_addBody", _wrap_Event_addBody, METH_VARARGS, NULL},
+ {(char *) "Event_addHeader", _wrap_Event_addHeader, METH_VARARGS, NULL},
+ {(char *) "Event_delHeader", _wrap_Event_delHeader, METH_VARARGS, NULL},
+ {(char *) "Event_fire", _wrap_Event_fire, METH_VARARGS, NULL},
+ {(char *) "Event_swigregister", Event_swigregister, METH_VARARGS, NULL},
+ {(char *) "delete_CoreSession", _wrap_delete_CoreSession, METH_VARARGS, NULL},
+ {(char *) "CoreSession_session_set", _wrap_CoreSession_session_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_session_get", _wrap_CoreSession_session_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_channel_set", _wrap_CoreSession_channel_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_channel_get", _wrap_CoreSession_channel_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_flags_set", _wrap_CoreSession_flags_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_flags_get", _wrap_CoreSession_flags_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_allocated_set", _wrap_CoreSession_allocated_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_allocated_get", _wrap_CoreSession_allocated_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set, METH_VARARGS, NULL},
+ {(char *) "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get, METH_VARARGS, NULL},
+ {(char *) "CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL},
+ {(char *) "CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL},
+ {(char *) "CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setVariable", _wrap_CoreSession_setVariable, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setPrivate", _wrap_CoreSession_setPrivate, METH_VARARGS, NULL},
+ {(char *) "CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
+ {(char *) "CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
+ {(char *) "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
+ {(char *) "CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
+ {(char *) "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
+ {(char *) "CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
+ {(char *) "CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback, METH_VARARGS, NULL},
+ {(char *) "CoreSession_speak", _wrap_CoreSession_speak, METH_VARARGS, NULL},
+ {(char *) "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms, METH_VARARGS, NULL},
+ {(char *) "CoreSession_collectDigits", _wrap_CoreSession_collectDigits, METH_VARARGS, NULL},
+ {(char *) "CoreSession_getDigits", _wrap_CoreSession_getDigits, METH_VARARGS, NULL},
+ {(char *) "CoreSession_transfer", _wrap_CoreSession_transfer, METH_VARARGS, NULL},
+ {(char *) "CoreSession_read", _wrap_CoreSession_read, METH_VARARGS, NULL},
+ {(char *) "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits, METH_VARARGS, NULL},
+ {(char *) "CoreSession_streamFile", _wrap_CoreSession_streamFile, METH_VARARGS, NULL},
+ {(char *) "CoreSession_flushEvents", _wrap_CoreSession_flushEvents, METH_VARARGS, NULL},
+ {(char *) "CoreSession_flushDigits", _wrap_CoreSession_flushDigits, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook, METH_VARARGS, NULL},
+ {(char *) "CoreSession_ready", _wrap_CoreSession_ready, METH_VARARGS, NULL},
+ {(char *) "CoreSession_execute", _wrap_CoreSession_execute, METH_VARARGS, NULL},
+ {(char *) "CoreSession_sendEvent", _wrap_CoreSession_sendEvent, METH_VARARGS, NULL},
+ {(char *) "CoreSession_setEventData", _wrap_CoreSession_setEventData, METH_VARARGS, NULL},
+ {(char *) "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR, METH_VARARGS, NULL},
+ {(char *) "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads, METH_VARARGS, NULL},
+ {(char *) "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads, METH_VARARGS, NULL},
+ {(char *) "CoreSession_get_uuid", _wrap_CoreSession_get_uuid, METH_VARARGS, NULL},
+ {(char *) "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args, METH_VARARGS, NULL},
+ {(char *) "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook, METH_VARARGS, NULL},
+ {(char *) "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback, METH_VARARGS, NULL},
+ {(char *) "CoreSession_swigregister", CoreSession_swigregister, METH_VARARGS, NULL},
+ {(char *) "console_log", _wrap_console_log, METH_VARARGS, NULL},
+ {(char *) "console_clean_log", _wrap_console_clean_log, METH_VARARGS, NULL},
+ {(char *) "bridge", _wrap_bridge, METH_VARARGS, NULL},
+ {(char *) "hanguphook", _wrap_hanguphook, METH_VARARGS, NULL},
+ {(char *) "dtmf_callback", _wrap_dtmf_callback, METH_VARARGS, NULL},
+ {(char *) "new_PySession", _wrap_new_PySession, METH_VARARGS, NULL},
+ {(char *) "delete_PySession", _wrap_delete_PySession, METH_VARARGS, NULL},
+ {(char *) "PySession_setDTMFCallback", _wrap_PySession_setDTMFCallback, METH_VARARGS, NULL},
+ {(char *) "PySession_setHangupHook", _wrap_PySession_setHangupHook, METH_VARARGS, NULL},
+ {(char *) "PySession_check_hangup_hook", _wrap_PySession_check_hangup_hook, METH_VARARGS, NULL},
+ {(char *) "PySession_hangup", _wrap_PySession_hangup, METH_VARARGS, NULL},
+ {(char *) "PySession_begin_allow_threads", _wrap_PySession_begin_allow_threads, METH_VARARGS, NULL},
+ {(char *) "PySession_end_allow_threads", _wrap_PySession_end_allow_threads, METH_VARARGS, NULL},
+ {(char *) "PySession_run_dtmf_callback", _wrap_PySession_run_dtmf_callback, METH_VARARGS, NULL},
+ {(char *) "PySession_swigregister", PySession_swigregister, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL}
+ };
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
- return (void *)((CoreSession *) ((PySession *) x));
-}
-static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_PySession = {"_p_PySession", "PySession *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_swap_state_t = {"_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_state_t = {"_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_channel_t = {"_p_switch_channel_t", "switch_channel_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_core_session_t = {"_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_event_t = {"_p_switch_event_t", "switch_event_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_args_t = {"_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_input_type_t = {"_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_priority_t = {"_p_switch_priority_t", "switch_priority_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch_status_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
- &_swigt__p_API,
- &_swigt__p_CoreSession,
- &_swigt__p_Event,
- &_swigt__p_IVRMenu,
- &_swigt__p_PySession,
- &_swigt__p_Stream,
- &_swigt__p_char,
- &_swigt__p_input_callback_state,
- &_swigt__p_session_flag_t,
- &_swigt__p_swap_state_t,
- &_swigt__p_switch_channel_state_t,
- &_swigt__p_switch_channel_t,
- &_swigt__p_switch_core_session_t,
- &_swigt__p_switch_event_t,
- &_swigt__p_switch_input_args_t,
- &_swigt__p_switch_input_type_t,
- &_swigt__p_switch_priority_t,
- &_swigt__p_switch_status_t,
- &_swigt__p_switch_stream_handle_t,
- &_swigt__p_void,
-};
-
-static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_swap_state_t[] = { {&_swigt__p_swap_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
- _swigc__p_API,
- _swigc__p_CoreSession,
- _swigc__p_Event,
- _swigc__p_IVRMenu,
- _swigc__p_PySession,
- _swigc__p_Stream,
- _swigc__p_char,
- _swigc__p_input_callback_state,
- _swigc__p_session_flag_t,
- _swigc__p_swap_state_t,
- _swigc__p_switch_channel_state_t,
- _swigc__p_switch_channel_t,
- _swigc__p_switch_core_session_t,
- _swigc__p_switch_event_t,
- _swigc__p_switch_input_args_t,
- _swigc__p_switch_input_type_t,
- _swigc__p_switch_priority_t,
- _swigc__p_switch_status_t,
- _swigc__p_switch_stream_handle_t,
- _swigc__p_void,
-};
+ static void *_p_PySessionTo_p_CoreSession(void *x, int *newmemory) {
+ return (void *) ((CoreSession *) ((PySession *) x));
+ }
+ static swig_type_info _swigt__p_API = { "_p_API", "API *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_CoreSession = { "_p_CoreSession", "CoreSession *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_Event = { "_p_Event", "Event *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_IVRMenu = { "_p_IVRMenu", "IVRMenu *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_PySession = { "_p_PySession", "PySession *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_Stream = { "_p_Stream", "Stream *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_char = { "_p_char", "char *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_input_callback_state =
+ { "_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_session_flag_t = { "_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_swap_state_t = { "_p_swap_state_t", "enum swap_state_t *|swap_state_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_channel_state_t = { "_p_switch_channel_state_t", "switch_channel_state_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_channel_t = { "_p_switch_channel_t", "switch_channel_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_core_session_t = { "_p_switch_core_session_t", "switch_core_session_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_event_t = { "_p_switch_event_t", "switch_event_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_input_args_t = { "_p_switch_input_args_t", "switch_input_args_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_input_type_t = { "_p_switch_input_type_t", "switch_input_type_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_priority_t = { "_p_switch_priority_t", "switch_priority_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_status_t = { "_p_switch_status_t", "switch_status_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_switch_stream_handle_t = { "_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void *) 0, 0 };
+ static swig_type_info _swigt__p_void = { "_p_void", "void *", 0, 0, (void *) 0, 0 };
+
+ static swig_type_info *swig_type_initial[] = {
+ &_swigt__p_API,
+ &_swigt__p_CoreSession,
+ &_swigt__p_Event,
+ &_swigt__p_IVRMenu,
+ &_swigt__p_PySession,
+ &_swigt__p_Stream,
+ &_swigt__p_char,
+ &_swigt__p_input_callback_state,
+ &_swigt__p_session_flag_t,
+ &_swigt__p_swap_state_t,
+ &_swigt__p_switch_channel_state_t,
+ &_swigt__p_switch_channel_t,
+ &_swigt__p_switch_core_session_t,
+ &_swigt__p_switch_event_t,
+ &_swigt__p_switch_input_args_t,
+ &_swigt__p_switch_input_type_t,
+ &_swigt__p_switch_priority_t,
+ &_swigt__p_switch_status_t,
+ &_swigt__p_switch_stream_handle_t,
+ &_swigt__p_void,
+ };
+
+ static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_CoreSession[] =
+ { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_PySession, _p_PySessionTo_p_CoreSession, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_PySession[] = { {&_swigt__p_PySession, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_session_flag_t[] = { {&_swigt__p_session_flag_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_swap_state_t[] = { {&_swigt__p_swap_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_channel_state_t[] = { {&_swigt__p_switch_channel_state_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_channel_t[] = { {&_swigt__p_switch_channel_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_core_session_t[] = { {&_swigt__p_switch_core_session_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_event_t[] = { {&_swigt__p_switch_event_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_input_args_t[] = { {&_swigt__p_switch_input_args_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_input_type_t[] = { {&_swigt__p_switch_input_type_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_priority_t[] = { {&_swigt__p_switch_priority_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0}, {0, 0, 0, 0} };
+ static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0}, {0, 0, 0, 0} };
+
+ static swig_cast_info *swig_cast_initial[] = {
+ _swigc__p_API,
+ _swigc__p_CoreSession,
+ _swigc__p_Event,
+ _swigc__p_IVRMenu,
+ _swigc__p_PySession,
+ _swigc__p_Stream,
+ _swigc__p_char,
+ _swigc__p_input_callback_state,
+ _swigc__p_session_flag_t,
+ _swigc__p_swap_state_t,
+ _swigc__p_switch_channel_state_t,
+ _swigc__p_switch_channel_t,
+ _swigc__p_switch_core_session_t,
+ _swigc__p_switch_event_t,
+ _swigc__p_switch_input_args_t,
+ _swigc__p_switch_input_type_t,
+ _swigc__p_switch_priority_t,
+ _swigc__p_switch_status_t,
+ _swigc__p_switch_stream_handle_t,
+ _swigc__p_void,
+ };
/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-static swig_const_info swig_const_table[] = {
-{0, 0, 0, 0.0, 0, 0}};
+ static swig_const_info swig_const_table[] = {
+ {0, 0, 0, 0.0, 0, 0}
+ };
#ifdef __cplusplus
}
@@ -7912,160 +8198,162 @@
#ifdef __cplusplus
extern "C" {
#if 0
-} /* c-mode */
+} /* c-mode */
#endif
#endif
-
#if 0
#define SWIGRUNTIME_DEBUG
#endif
+SWIGRUNTIME void SWIG_InitializeModule(void *clientdata)
+{
+ size_t i;
+ swig_module_info *module_head, *iter;
+ int found, init;
+
+ clientdata = clientdata;
+
+ /* check to see if the circular list has been setup, if not, set it up */
+ if (swig_module.next == 0) {
+ /* Initialize the swig_module */
+ swig_module.type_initial = swig_type_initial;
+ swig_module.cast_initial = swig_cast_initial;
+ swig_module.next = &swig_module;
+ init = 1;
+ } else {
+ init = 0;
+ }
+ /* Try and load any already created modules */
+ module_head = SWIG_GetModule(clientdata);
+ if (!module_head) {
+ /* This is the first module loaded for this interpreter */
+ /* so set the swig module into the interpreter */
+ SWIG_SetModule(clientdata, &swig_module);
+ module_head = &swig_module;
+ } else {
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+ found = 0;
+ iter = module_head;
+ do {
+ if (iter == &swig_module) {
+ found = 1;
+ break;
+ }
+ iter = iter->next;
+ } while (iter != module_head);
+
+ /* if the is found in the list, then all is done and we may leave */
+ if (found)
+ return;
+ /* otherwise we must add out module into the list */
+ swig_module.next = module_head->next;
+ module_head->next = &swig_module;
+ }
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
- size_t i;
- swig_module_info *module_head, *iter;
- int found, init;
-
- clientdata = clientdata;
-
- /* check to see if the circular list has been setup, if not, set it up */
- if (swig_module.next==0) {
- /* Initialize the swig_module */
- swig_module.type_initial = swig_type_initial;
- swig_module.cast_initial = swig_cast_initial;
- swig_module.next = &swig_module;
- init = 1;
- } else {
- init = 0;
- }
-
- /* Try and load any already created modules */
- module_head = SWIG_GetModule(clientdata);
- if (!module_head) {
- /* This is the first module loaded for this interpreter */
- /* so set the swig module into the interpreter */
- SWIG_SetModule(clientdata, &swig_module);
- module_head = &swig_module;
- } else {
- /* the interpreter has loaded a SWIG module, but has it loaded this one? */
- found=0;
- iter=module_head;
- do {
- if (iter==&swig_module) {
- found=1;
- break;
- }
- iter=iter->next;
- } while (iter!= module_head);
-
- /* if the is found in the list, then all is done and we may leave */
- if (found) return;
- /* otherwise we must add out module into the list */
- swig_module.next = module_head->next;
- module_head->next = &swig_module;
- }
-
- /* When multiple interpeters are used, a module could have already been initialized in
- a different interpreter, but not yet have a pointer in this interpreter.
- In this case, we do not want to continue adding types... everything should be
- set up already */
- if (init == 0) return;
-
- /* Now work on filling in swig_module.types */
+ /* When multiple interpeters are used, a module could have already been initialized in
+ a different interpreter, but not yet have a pointer in this interpreter.
+ In this case, we do not want to continue adding types... everything should be
+ set up already */
+ if (init == 0)
+ return;
+
+ /* Now work on filling in swig_module.types */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
#endif
- for (i = 0; i < swig_module.size; ++i) {
- swig_type_info *type = 0;
- swig_type_info *ret;
- swig_cast_info *cast;
-
+ for (i = 0; i < swig_module.size; ++i) {
+ swig_type_info *type = 0;
+ swig_type_info *ret;
+ swig_cast_info *cast;
+
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
#endif
-
- /* if there is another module already loaded */
- if (swig_module.next != &swig_module) {
- type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
- }
- if (type) {
- /* Overwrite clientdata field */
+
+ /* if there is another module already loaded */
+ if (swig_module.next != &swig_module) {
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+ }
+ if (type) {
+ /* Overwrite clientdata field */
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found type %s\n", type->name);
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
#endif
- if (swig_module.type_initial[i]->clientdata) {
- type->clientdata = swig_module.type_initial[i]->clientdata;
+ if (swig_module.type_initial[i]->clientdata) {
+ type->clientdata = swig_module.type_initial[i]->clientdata;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
#endif
- }
- } else {
- type = swig_module.type_initial[i];
- }
-
- /* Insert casting types */
- cast = swig_module.cast_initial[i];
- while (cast->type) {
- /* Don't need to add information already in the list */
- ret = 0;
+ }
+ } else {
+ type = swig_module.type_initial[i];
+ }
+
+ /* Insert casting types */
+ cast = swig_module.cast_initial[i];
+ while (cast->type) {
+ /* Don't need to add information already in the list */
+ ret = 0;
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
#endif
- if (swig_module.next != &swig_module) {
- ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+ if (swig_module.next != &swig_module) {
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
#ifdef SWIGRUNTIME_DEBUG
- if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+ if (ret)
+ printf("SWIG_InitializeModule: found cast %s\n", ret->name);
#endif
- }
- if (ret) {
- if (type == swig_module.type_initial[i]) {
+ }
+ if (ret) {
+ if (type == swig_module.type_initial[i]) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
#endif
- cast->type = ret;
- ret = 0;
- } else {
- /* Check for casting already in the list */
- swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+ cast->type = ret;
+ ret = 0;
+ } else {
+ /* Check for casting already in the list */
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
#ifdef SWIGRUNTIME_DEBUG
- if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+ if (ocast)
+ printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
#endif
- if (!ocast) ret = 0;
- }
- }
-
- if (!ret) {
+ if (!ocast)
+ ret = 0;
+ }
+ }
+
+ if (!ret) {
#ifdef SWIGRUNTIME_DEBUG
- printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
#endif
- if (type->cast) {
- type->cast->prev = cast;
- cast->next = type->cast;
- }
- type->cast = cast;
- }
- cast++;
- }
- /* Set entry in modules->types array equal to the type */
- swig_module.types[i] = type;
- }
- swig_module.types[i] = 0;
-
+ if (type->cast) {
+ type->cast->prev = cast;
+ cast->next = type->cast;
+ }
+ type->cast = cast;
+ }
+ cast++;
+ }
+ /* Set entry in modules->types array equal to the type */
+ swig_module.types[i] = type;
+ }
+ swig_module.types[i] = 0;
+
#ifdef SWIGRUNTIME_DEBUG
- printf("**** SWIG_InitializeModule: Cast List ******\n");
- for (i = 0; i < swig_module.size; ++i) {
- int j = 0;
- swig_cast_info *cast = swig_module.cast_initial[i];
- printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
- while (cast->type) {
- printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
- cast++;
- ++j;
- }
- printf("---- Total casts: %d\n",j);
- }
- printf("**** SWIG_InitializeModule: Cast List ******\n");
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
+ for (i = 0; i < swig_module.size; ++i) {
+ int j = 0;
+ swig_cast_info *cast = swig_module.cast_initial[i];
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+ while (cast->type) {
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+ cast++;
+ ++j;
+ }
+ printf("---- Total casts: %d\n", j);
+ }
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
#endif
}
@@ -8074,33 +8362,34 @@
* of equivalent types. It is like calling
* SWIG_TypeClientData(type, clientdata) a second time.
*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
- size_t i;
- swig_cast_info *equiv;
- static int init_run = 0;
-
- if (init_run) return;
- init_run = 1;
-
- for (i = 0; i < swig_module.size; i++) {
- if (swig_module.types[i]->clientdata) {
- equiv = swig_module.types[i]->cast;
- while (equiv) {
- if (!equiv->converter) {
- if (equiv->type && !equiv->type->clientdata)
- SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
- }
- equiv = equiv->next;
- }
- }
- }
+SWIGRUNTIME void SWIG_PropagateClientData(void)
+{
+ size_t i;
+ swig_cast_info *equiv;
+ static int init_run = 0;
+
+ if (init_run)
+ return;
+ init_run = 1;
+
+ for (i = 0; i < swig_module.size; i++) {
+ if (swig_module.types[i]->clientdata) {
+ equiv = swig_module.types[i]->cast;
+ while (equiv) {
+ if (!equiv->converter) {
+ if (equiv->type && !equiv->type->clientdata)
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+ }
+ equiv = equiv->next;
+ }
+ }
+ }
}
#ifdef __cplusplus
#if 0
{
- /* c-mode */
+ /* c-mode */
#endif
}
#endif
@@ -8110,258 +8399,240 @@
#ifdef __cplusplus
extern "C" {
#endif
-
- /* Python-specific SWIG API */
+
+ /* Python-specific SWIG API */
#define SWIG_newvarlink() SWIG_Python_newvarlink()
#define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
#define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
-
- /* -----------------------------------------------------------------------------
- * global variable support code.
- * ----------------------------------------------------------------------------- */
-
- typedef struct swig_globalvar {
- char *name; /* Name of global variable */
- PyObject *(*get_attr)(void); /* Return the current value */
- int (*set_attr)(PyObject *); /* Set the value */
- struct swig_globalvar *next;
- } swig_globalvar;
-
- typedef struct swig_varlinkobject {
- PyObject_HEAD
- swig_globalvar *vars;
- } swig_varlinkobject;
-
- SWIGINTERN PyObject *
- swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
- return PyString_FromString("<Swig global variables>");
- }
-
- SWIGINTERN PyObject *
- swig_varlink_str(swig_varlinkobject *v) {
- PyObject *str = PyString_FromString("(");
- swig_globalvar *var;
- for (var = v->vars; var; var=var->next) {
- PyString_ConcatAndDel(&str,PyString_FromString(var->name));
- if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
- }
- PyString_ConcatAndDel(&str,PyString_FromString(")"));
- return str;
- }
-
- SWIGINTERN int
- swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
- PyObject *str = swig_varlink_str(v);
- fprintf(fp,"Swig global variables ");
- fprintf(fp,"%s\n", PyString_AsString(str));
- Py_DECREF(str);
- return 0;
- }
-
- SWIGINTERN void
- swig_varlink_dealloc(swig_varlinkobject *v) {
- swig_globalvar *var = v->vars;
- while (var) {
- swig_globalvar *n = var->next;
- free(var->name);
- free(var);
- var = n;
- }
- }
-
- SWIGINTERN PyObject *
- swig_varlink_getattr(swig_varlinkobject *v, char *n) {
- PyObject *res = NULL;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->get_attr)();
- break;
- }
- var = var->next;
- }
- if (res == NULL && !PyErr_Occurred()) {
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- }
- return res;
- }
-
- SWIGINTERN int
- swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
- int res = 1;
- swig_globalvar *var = v->vars;
- while (var) {
- if (strcmp(var->name,n) == 0) {
- res = (*var->set_attr)(p);
- break;
- }
- var = var->next;
- }
- if (res == 1 && !PyErr_Occurred()) {
- PyErr_SetString(PyExc_NameError,"Unknown C global variable");
- }
- return res;
- }
-
- SWIGINTERN PyTypeObject*
- swig_varlink_type(void) {
- static char varlink__doc__[] = "Swig var link object";
- static PyTypeObject varlink_type;
- static int type_init = 0;
- if (!type_init) {
- const PyTypeObject tmp
- = {
- PyObject_HEAD_INIT(NULL)
- 0, /* Number of items in variable part (ob_size) */
- (char *)"swigvarlink", /* Type name (tp_name) */
- sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
- 0, /* Itemsize (tp_itemsize) */
- (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
- (printfunc) swig_varlink_print, /* Print (tp_print) */
- (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
- (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
- 0, /* tp_compare */
- (reprfunc) swig_varlink_repr, /* tp_repr */
- 0, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- (reprfunc)swig_varlink_str, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
- 0, /* tp_flags */
- varlink__doc__, /* tp_doc */
- 0, /* tp_traverse */
- 0, /* tp_clear */
- 0, /* tp_richcompare */
- 0, /* tp_weaklistoffset */
+
+ /* -----------------------------------------------------------------------------
+ * global variable support code.
+ * ----------------------------------------------------------------------------- */
+
+ typedef struct swig_globalvar {
+ char *name; /* Name of global variable */
+ PyObject *(*get_attr) (void); /* Return the current value */
+ int (*set_attr) (PyObject *); /* Set the value */
+ struct swig_globalvar *next;
+ } swig_globalvar;
+
+ typedef struct swig_varlinkobject {
+ PyObject_HEAD swig_globalvar * vars;
+ } swig_varlinkobject;
+
+ SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM(v)) {
+ return PyString_FromString("<Swig global variables>");
+ } SWIGINTERN PyObject *swig_varlink_str(swig_varlinkobject * v) {
+ PyObject *str = PyString_FromString("(");
+ swig_globalvar *var;
+ for (var = v->vars; var; var = var->next) {
+ PyString_ConcatAndDel(&str, PyString_FromString(var->name));
+ if (var->next)
+ PyString_ConcatAndDel(&str, PyString_FromString(", "));
+ }
+ PyString_ConcatAndDel(&str, PyString_FromString(")"));
+ return str;
+ }
+
+ SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int SWIGUNUSEDPARM(flags)) {
+ PyObject *str = swig_varlink_str(v);
+ fprintf(fp, "Swig global variables ");
+ fprintf(fp, "%s\n", PyString_AsString(str));
+ Py_DECREF(str);
+ return 0;
+ }
+
+ SWIGINTERN void swig_varlink_dealloc(swig_varlinkobject * v) {
+ swig_globalvar *var = v->vars;
+ while (var) {
+ swig_globalvar *n = var->next;
+ free(var->name);
+ free(var);
+ var = n;
+ }
+ }
+
+ SWIGINTERN PyObject *swig_varlink_getattr(swig_varlinkobject * v, char *n) {
+ PyObject *res = NULL;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name, n) == 0) {
+ res = (*var->get_attr) ();
+ break;
+ }
+ var = var->next;
+ }
+ if (res == NULL && !PyErr_Occurred()) {
+ PyErr_SetString(PyExc_NameError, "Unknown C global variable");
+ }
+ return res;
+ }
+
+ SWIGINTERN int swig_varlink_setattr(swig_varlinkobject * v, char *n, PyObject * p) {
+ int res = 1;
+ swig_globalvar *var = v->vars;
+ while (var) {
+ if (strcmp(var->name, n) == 0) {
+ res = (*var->set_attr) (p);
+ break;
+ }
+ var = var->next;
+ }
+ if (res == 1 && !PyErr_Occurred()) {
+ PyErr_SetString(PyExc_NameError, "Unknown C global variable");
+ }
+ return res;
+ }
+
+ SWIGINTERN PyTypeObject *swig_varlink_type(void) {
+ static char varlink__doc__[] = "Swig var link object";
+ static PyTypeObject varlink_type;
+ static int type_init = 0;
+ if (!type_init) {
+ const PyTypeObject tmp = {
+ PyObject_HEAD_INIT(NULL)
+ 0, /* Number of items in variable part (ob_size) */
+ (char *) "swigvarlink", /* Type name (tp_name) */
+ sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
+ 0, /* Itemsize (tp_itemsize) */
+ (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
+ (printfunc) swig_varlink_print, /* Print (tp_print) */
+ (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
+ (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
+ 0, /* tp_compare */
+ (reprfunc) swig_varlink_repr, /* tp_repr */
+ 0, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ (reprfunc) swig_varlink_str, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
+ 0, /* tp_flags */
+ varlink__doc__, /* tp_doc */
+ 0, /* tp_traverse */
+ 0, /* tp_clear */
+ 0, /* tp_richcompare */
+ 0, /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* tp_iter -> tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
- 0, /* tp_del */
+ 0, /* tp_del */
#endif
#ifdef COUNT_ALLOCS
- 0,0,0,0 /* tp_alloc -> tp_next */
+ 0, 0, 0, 0 /* tp_alloc -> tp_next */
#endif
- };
- varlink_type = tmp;
- varlink_type.ob_type = &PyType_Type;
- type_init = 1;
- }
- return &varlink_type;
- }
-
- /* Create a variable linking object for use later */
- SWIGINTERN PyObject *
- SWIG_Python_newvarlink(void) {
- swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
- if (result) {
- result->vars = 0;
- }
- return ((PyObject*) result);
- }
-
- SWIGINTERN void
- SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
- swig_varlinkobject *v = (swig_varlinkobject *) p;
- swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
- if (gv) {
- size_t size = strlen(name)+1;
- gv->name = (char *)malloc(size);
- if (gv->name) {
- strncpy(gv->name,name,size);
- gv->get_attr = get_attr;
- gv->set_attr = set_attr;
- gv->next = v->vars;
- }
- }
- v->vars = gv;
- }
-
- SWIGINTERN PyObject *
- SWIG_globals(void) {
- static PyObject *_SWIG_globals = 0;
- if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
- return _SWIG_globals;
- }
-
- /* -----------------------------------------------------------------------------
- * constants/methods manipulation
- * ----------------------------------------------------------------------------- */
-
- /* Install Constants */
- SWIGINTERN void
- SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
- PyObject *obj = 0;
- size_t i;
- for (i = 0; constants[i].type; ++i) {
- switch(constants[i].type) {
- case SWIG_PY_POINTER:
- obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
- break;
- case SWIG_PY_BINARY:
- obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
- break;
- default:
- obj = 0;
- break;
- }
- if (obj) {
- PyDict_SetItemString(d, constants[i].name, obj);
- Py_DECREF(obj);
- }
- }
- }
-
- /* -----------------------------------------------------------------------------*/
- /* Fix SwigMethods to carry the callback ptrs when needed */
- /* -----------------------------------------------------------------------------*/
-
- SWIGINTERN void
- SWIG_Python_FixMethods(PyMethodDef *methods,
- swig_const_info *const_table,
- swig_type_info **types,
- swig_type_info **types_initial) {
- size_t i;
- for (i = 0; methods[i].ml_name; ++i) {
- const char *c = methods[i].ml_doc;
- if (c && (c = strstr(c, "swig_ptr: "))) {
- int j;
- swig_const_info *ci = 0;
- const char *name = c + 10;
- for (j = 0; const_table[j].type; ++j) {
- if (strncmp(const_table[j].name, name,
- strlen(const_table[j].name)) == 0) {
- ci = &(const_table[j]);
- break;
- }
- }
- if (ci) {
- size_t shift = (ci->ptype) - types;
- swig_type_info *ty = types_initial[shift];
- size_t ldoc = (c - methods[i].ml_doc);
- size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
- char *ndoc = (char*)malloc(ldoc + lptr + 10);
- if (ndoc) {
- char *buff = ndoc;
- void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
- if (ptr) {
- strncpy(buff, methods[i].ml_doc, ldoc);
- buff += ldoc;
- strncpy(buff, "swig_ptr: ", 10);
- buff += 10;
- SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
- methods[i].ml_doc = ndoc;
- }
- }
- }
- }
- }
- }
-
+ };
+ varlink_type = tmp;
+ varlink_type.ob_type = &PyType_Type;
+ type_init = 1;
+ }
+ return &varlink_type;
+ }
+
+ /* Create a variable linking object for use later */
+ SWIGINTERN PyObject *SWIG_Python_newvarlink(void) {
+ swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
+ if (result) {
+ result->vars = 0;
+ }
+ return ((PyObject *) result);
+ }
+
+ SWIGINTERN void SWIG_Python_addvarlink(PyObject * p, char *name, PyObject * (*get_attr) (void), int (*set_attr) (PyObject * p)) {
+ swig_varlinkobject *v = (swig_varlinkobject *) p;
+ swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
+ if (gv) {
+ size_t size = strlen(name) + 1;
+ gv->name = (char *) malloc(size);
+ if (gv->name) {
+ strncpy(gv->name, name, size);
+ gv->get_attr = get_attr;
+ gv->set_attr = set_attr;
+ gv->next = v->vars;
+ }
+ }
+ v->vars = gv;
+ }
+
+ SWIGINTERN PyObject *SWIG_globals(void) {
+ static PyObject *_SWIG_globals = 0;
+ if (!_SWIG_globals)
+ _SWIG_globals = SWIG_newvarlink();
+ return _SWIG_globals;
+ }
+
+ /* -----------------------------------------------------------------------------
+ * constants/methods manipulation
+ * ----------------------------------------------------------------------------- */
+
+ /* Install Constants */
+ SWIGINTERN void SWIG_Python_InstallConstants(PyObject * d, swig_const_info constants[]) {
+ PyObject *obj = 0;
+ size_t i;
+ for (i = 0; constants[i].type; ++i) {
+ switch (constants[i].type) {
+ case SWIG_PY_POINTER:
+ obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype, 0);
+ break;
+ case SWIG_PY_BINARY:
+ obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+ break;
+ default:
+ obj = 0;
+ break;
+ }
+ if (obj) {
+ PyDict_SetItemString(d, constants[i].name, obj);
+ Py_DECREF(obj);
+ }
+ }
+ }
+
+ /* ----------------------------------------------------------------------------- */
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ /* ----------------------------------------------------------------------------- */
+
+ SWIGINTERN void SWIG_Python_FixMethods(PyMethodDef * methods, swig_const_info * const_table, swig_type_info ** types, swig_type_info ** types_initial) {
+ size_t i;
+ for (i = 0; methods[i].ml_name; ++i) {
+ const char *c = methods[i].ml_doc;
+ if (c && (c = strstr(c, "swig_ptr: "))) {
+ int j;
+ swig_const_info *ci = 0;
+ const char *name = c + 10;
+ for (j = 0; const_table[j].type; ++j) {
+ if (strncmp(const_table[j].name, name, strlen(const_table[j].name)) == 0) {
+ ci = &(const_table[j]);
+ break;
+ }
+ }
+ if (ci) {
+ size_t shift = (ci->ptype) - types;
+ swig_type_info *ty = types_initial[shift];
+ size_t ldoc = (c - methods[i].ml_doc);
+ size_t lptr = strlen(ty->name) + 2 * sizeof(void *) + 2;
+ char *ndoc = (char *) malloc(ldoc + lptr + 10);
+ if (ndoc) {
+ char *buff = ndoc;
+ void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
+ if (ptr) {
+ strncpy(buff, methods[i].ml_doc, ldoc);
+ buff += ldoc;
+ strncpy(buff, "swig_ptr: ", 10);
+ buff += 10;
+ SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
+ methods[i].ml_doc = ndoc;
+ }
+ }
+ }
+ }
+ }
+ }
+
#ifdef __cplusplus
}
#endif
@@ -8373,23 +8644,23 @@
#ifdef __cplusplus
extern "C"
#endif
-SWIGEXPORT void SWIG_init(void) {
- PyObject *m, *d;
-
- /* Fix SwigMethods to carry the callback ptrs when needed */
- SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
-
- m = Py_InitModule((char *) SWIG_name, SwigMethods);
- d = PyModule_GetDict(m);
-
- SWIG_InitializeModule(0);
- SWIG_InstallConstants(d,swig_const_table);
-
-
- SWIG_Python_SetConstant(d, "S_HUP",SWIG_From_int(static_cast< int >(S_HUP)));
- SWIG_Python_SetConstant(d, "S_FREE",SWIG_From_int(static_cast< int >(S_FREE)));
- SWIG_Python_SetConstant(d, "S_RDLOCK",SWIG_From_int(static_cast< int >(S_RDLOCK)));
- SWIG_Python_SetConstant(d, "S_SWAPPED_IN",SWIG_From_int(static_cast< int >(S_SWAPPED_IN)));
- SWIG_Python_SetConstant(d, "S_SWAPPED_OUT",SWIG_From_int(static_cast< int >(S_SWAPPED_OUT)));
-}
+ SWIGEXPORT void SWIG_init(void)
+{
+ PyObject *m, *d;
+
+ /* Fix SwigMethods to carry the callback ptrs when needed */
+ SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
+ m = Py_InitModule((char *) SWIG_name, SwigMethods);
+ d = PyModule_GetDict(m);
+
+ SWIG_InitializeModule(0);
+ SWIG_InstallConstants(d, swig_const_table);
+
+
+ SWIG_Python_SetConstant(d, "S_HUP", SWIG_From_int(static_cast < int >(S_HUP)));
+ SWIG_Python_SetConstant(d, "S_FREE", SWIG_From_int(static_cast < int >(S_FREE)));
+ SWIG_Python_SetConstant(d, "S_RDLOCK", SWIG_From_int(static_cast < int >(S_RDLOCK)));
+ SWIG_Python_SetConstant(d, "S_SWAPPED_IN", SWIG_From_int(static_cast < int >(S_SWAPPED_IN)));
+ SWIG_Python_SetConstant(d, "S_SWAPPED_OUT", SWIG_From_int(static_cast < int >(S_SWAPPED_OUT)));
+}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/switch_swig_wrap.c Tue May 27 07:24:06 2008
@@ -571,7 +571,7 @@
* type checking.
*
* Author : David Beazley (beazley(a)cs.uchicago.edu)
- ************************************************************************//* Common SWIG API */
+ ************************************************************************//* Common SWIG API */
#define SWIG_ConvertPtr(obj, pp, type, flags) SWIG_Python_ConvertPtr(obj, pp, type, flags)
#define SWIG_NewPointerObj(p, type, flags) SWIG_Python_NewPointerObj(p, type, flags)
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
@@ -583,11 +583,11 @@
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
/* -----------------------------------------------------------------------------
* Pointer declarations
- * ----------------------------------------------------------------------------- *//*
- Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
- C/C++ pointers in the python side. Very useful for debugging, but
- not always safe.
- */
+ * ----------------------------------------------------------------------------- *//*
+ Use SWIG_NO_COBJECT_TYPES to force the use of strings to represent
+ C/C++ pointers in the python side. Very useful for debugging, but
+ not always safe.
+ */
#if !defined(SWIG_NO_COBJECT_TYPES) && !defined(SWIG_COBJECT_TYPES)
# define SWIG_COBJECT_TYPES
#endif
@@ -1538,8 +1538,7 @@
resultobj = Py_None;
return resultobj;
fail:return NULL;
- }
- static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
+ } static PyObject *_wrap_fs_core_init(PyObject * self, PyObject * args) {
PyObject *resultobj = NULL;
char *arg1 = (char *) 0;
int result;
@@ -2683,8 +2682,7 @@
SWIGINTERN PyObject *swig_varlink_repr(swig_varlinkobject * v) {
v = v;
return PyString_FromString("<Swig global variables>");
- }
- SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
+ } SWIGINTERN int swig_varlink_print(swig_varlinkobject * v, FILE * fp, int flags) {
swig_globalvar *var;
flags = flags;
fprintf(fp, "Swig global variables { ");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Tue May 27 07:24:06 2008
@@ -184,7 +184,7 @@
return JS_TRUE;
}
-static JSBool request_add_header(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool request_add_header(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct request_obj *ro = JS_GetPrivate(cx, obj);
@@ -226,7 +226,7 @@
return JS_TRUE;
}
-static JSBool request_dump_env(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool request_dump_env(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct request_obj *ro = JS_GetPrivate(cx, obj);
char *how = "text";
@@ -244,10 +244,10 @@
switch_xml_t xml;
char *xmlstr;
if ((xml = switch_event_xmlize(ro->stream->param_event, SWITCH_VA_NONE))) {
- xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
+ xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
return JS_TRUE;
- }
+ }
} else {
char *buf;
switch_event_serialize(ro->stream->param_event, &buf, SWITCH_TRUE);
@@ -264,7 +264,7 @@
static void request_destroy(JSContext * cx, JSObject * obj)
{
-
+
}
enum request_tinyid {
@@ -284,7 +284,7 @@
{0}
};
-static JSBool request_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
+static JSBool request_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
JSBool res = JS_TRUE;
struct request_obj *ro = JS_GetPrivate(cx, obj);
@@ -320,12 +320,11 @@
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, request_destroy, NULL, NULL, NULL, NULL
};
-static JSObject *new_request(JSContext *cx, JSObject *obj, struct request_obj *ro)
+static JSObject *new_request(JSContext * cx, JSObject * obj, struct request_obj *ro)
{
JSObject *Request;
if ((Request = JS_DefineObject(cx, obj, "request", &request_class, NULL, 0))) {
- if ((JS_SetPrivate(cx, Request, ro) &&
- JS_DefineProperties(cx, Request, request_props) && JS_DefineFunctions(cx, Request, request_methods))) {
+ if ((JS_SetPrivate(cx, Request, ro) && JS_DefineProperties(cx, Request, request_props) && JS_DefineFunctions(cx, Request, request_methods))) {
return Request;
}
}
@@ -375,12 +374,12 @@
char *string, *regex_string;
if (argc > 1) {
- string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- regex_string = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+ string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+ regex_string = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
switch_regex_safe_free(pcre_obj->re);
switch_safe_free(pcre_obj->string);
pcre_obj->string = strdup(string);
- pcre_obj->proceed = switch_regex_perform(pcre_obj->string, regex_string, &pcre_obj->re, pcre_obj->ovector,
+ pcre_obj->proceed = switch_regex_perform(pcre_obj->string, regex_string, &pcre_obj->re, pcre_obj->ovector,
sizeof(pcre_obj->ovector) / sizeof(pcre_obj->ovector[0]));
*rval = BOOLEAN_TO_JSVAL(pcre_obj->proceed ? JS_TRUE : JS_FALSE);
} else {
@@ -401,10 +400,10 @@
eval_some_js("~throw new Error(\"REGEX is not compiled or has no matches\");", cx, obj, rval);
return JS_FALSE;
}
-
+
if (argc > 0) {
uint32_t len;
- subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+ subst_string = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
len = (uint32_t) (strlen(pcre_obj->string) + strlen(subst_string) + 10);
substituted = malloc(len);
switch_assert(substituted != NULL);
@@ -841,7 +840,7 @@
case DTMF_DURATION:
{
- *vp = INT_TO_JSVAL((int)dtmf->duration);
+ *vp = INT_TO_JSVAL((int) dtmf->duration);
}
break;
}
@@ -1097,10 +1096,10 @@
uintN argc = 0;
jsval argv[4];
JSObject *Event = NULL;
- jsval nval , *rval = &nval;
+ jsval nval, *rval = &nval;
JSContext *cx = cb_state->cx;
JSObject *obj = cb_state->obj;
-
+
METHOD_SANITY_CHECK();
jss->stack_depth++;
@@ -1126,10 +1125,10 @@
return SWITCH_STATUS_FALSE;
}
break;
- case SWITCH_INPUT_TYPE_DTMF:
+ case SWITCH_INPUT_TYPE_DTMF:
{
switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-
+
if (dtmf) {
if ((Event = new_js_dtmf(dtmf, "_XX_DTMF_XX_", cb_state->cx, cb_state->obj))) {
argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
@@ -1624,7 +1623,7 @@
switch_input_args_t args = { 0 };
const char *prebuf;
char posbuf[35] = "";
-
+
METHOD_SANITY_CHECK();
channel = switch_core_session_get_channel(jss->session);
CHANNEL_SANITY_CHECK();
@@ -1660,13 +1659,13 @@
JS_ValueToInt32(cx, argv[3], &samps);
fh.samples = samps;
}
-
- if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
- int maybe = atoi(prebuf);
- if (maybe > 0) {
- fh.prebuf = maybe;
- }
- }
+
+ if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) {
+ int maybe = atoi(prebuf);
+ if (maybe > 0) {
+ fh.prebuf = maybe;
+ }
+ }
cb_state.extra = &fh;
cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE);
@@ -1825,7 +1824,7 @@
if (jss->speech && strcasecmp(jss->speech->sh.name, tts_name)) {
destroy_speech_engine(jss);
}
-
+
if (jss->speech) {
switch_core_speech_text_param_tts(&jss->speech->sh, "voice", voice_name);
} else {
@@ -1861,7 +1860,7 @@
args.input_callback = dtmf_func;
args.buf = bp;
args.buflen = len;
-
+
switch_core_speech_flush_tts(&jss->speech->sh);
switch_ivr_speak_text_handle(jss->session, &jss->speech->sh, &jss->speech->codec, NULL, text, &args);
JS_ResumeRequest(cx, cb_state.saveDepth);
@@ -2174,12 +2173,11 @@
CHANNEL_SANITY_CHECK();
if (argc > 1) {
- if(JSVAL_IS_INT(argv[0])) {
+ if (JSVAL_IS_INT(argv[0])) {
int32 i = 0;
JS_ValueToInt32(cx, argv[0], &i);
cause = i;
- }
- else {
+ } else {
cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
cause = switch_channel_str2cause(cause_name);
}
@@ -2204,7 +2202,7 @@
JSObject *obj;
switch_size_t buffer_size;
switch_size_t data_len;
- char* buffer;
+ char *buffer;
};
static size_t hash_callback(void *ptr, size_t size, size_t nmemb, void *data)
@@ -2257,7 +2255,7 @@
register unsigned int realsize = (unsigned int) (size * nmemb);
struct config_data *config_data = data;
- if ((write(config_data->fd, ptr, realsize) != (int)realsize)) {
+ if ((write(config_data->fd, ptr, realsize) != (int) realsize)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to write all bytes!\n");
}
return realsize;
@@ -2412,7 +2410,7 @@
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, config_data.buffer));
} else {
char errmsg[256];
- switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned)code);
+ switch_snprintf(errmsg, 256, "~throw new Error(\"Curl returned error %u.\");", (unsigned) code);
eval_some_js(errmsg, cx, obj, rval);
}
@@ -2593,7 +2591,7 @@
*jss = malloc(sizeof(**jss));
switch_assert(*jss);
memset(*jss, 0, sizeof(**jss));
-
+
(*jss)->session = session;
(*jss)->flags = flags;
(*jss)->cx = cx;
@@ -2628,7 +2626,7 @@
jss->cx = cx;
jss->obj = obj;
JS_SetPrivate(cx, obj, jss);
-
+
if (argc > 0) {
char *uuid = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
if (uuid) {
@@ -2649,7 +2647,7 @@
char *var, *val, **toset = NULL;
var = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
-
+
if (!strcasecmp(var, "dialplan")) {
toset = &jss->dialplan;
} else if (!strcasecmp(var, "username")) {
@@ -2670,15 +2668,15 @@
toset = &jss->destination_number;
} else if (!strcasecmp(var, "context")) {
toset = &jss->context;
- }
-
+ }
+
if (toset) {
switch_safe_free(*toset);
*toset = strdup(val);
}
}
-
+
return JS_TRUE;
}
@@ -2727,14 +2725,22 @@
}
}
- if (!switch_strlen_zero(jss->dialplan)) dialplan = jss->dialplan;
- if (!switch_strlen_zero(jss->caller_id_name)) cid_name = jss->caller_id_name;
- if (!switch_strlen_zero(jss->caller_id_number)) cid_num = jss->caller_id_number;
- if (!switch_strlen_zero(jss->ani)) ani = jss->ani;
- if (!switch_strlen_zero(jss->aniii)) aniii = jss->aniii;
- if (!switch_strlen_zero(jss->rdnis)) rdnis = jss->rdnis;
- if (!switch_strlen_zero(jss->context)) context = jss->context;
- if (!switch_strlen_zero(jss->username)) username = jss->username;
+ if (!switch_strlen_zero(jss->dialplan))
+ dialplan = jss->dialplan;
+ if (!switch_strlen_zero(jss->caller_id_name))
+ cid_name = jss->caller_id_name;
+ if (!switch_strlen_zero(jss->caller_id_number))
+ cid_num = jss->caller_id_number;
+ if (!switch_strlen_zero(jss->ani))
+ ani = jss->ani;
+ if (!switch_strlen_zero(jss->aniii))
+ aniii = jss->aniii;
+ if (!switch_strlen_zero(jss->rdnis))
+ rdnis = jss->rdnis;
+ if (!switch_strlen_zero(jss->context))
+ context = jss->context;
+ if (!switch_strlen_zero(jss->username))
+ username = jss->username;
dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
@@ -2747,16 +2753,15 @@
tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
if (!switch_strlen_zero(tmp)) {
to = tmp;
- }
+ }
}
-
+
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
return JS_FALSE;
}
- caller_profile = switch_caller_profile_new(pool,username, dialplan, cid_name, cid_num, network_addr,
- ani, aniii, rdnis, modname, context, dest);
+ caller_profile = switch_caller_profile_new(pool, username, dialplan, cid_name, cid_num, network_addr, ani, aniii, rdnis, modname, context, dest);
saveDepth = JS_SuspendRequest(cx);
status = switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, SOF_NONE);
@@ -2766,7 +2771,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot Create Outgoing Channel! [%s]\n", dest);
goto done;
}
-
+
jss->session = peer_session;
switch_set_flag(jss, S_HUP);
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
@@ -2783,21 +2788,21 @@
static void session_destroy(JSContext * cx, JSObject * obj)
{
struct js_session *jss;
-
+
if (cx && obj) {
if ((jss = JS_GetPrivate(cx, obj))) {
JS_SetPrivate(cx, obj, NULL);
if (jss->speech && *jss->speech->sh.name) {
destroy_speech_engine(jss);
}
-
+
if (jss->session) {
switch_core_session_t *session = jss->session;
switch_channel_t *channel = switch_core_session_get_channel(session);
-
+
switch_channel_set_private(channel, "jss", NULL);
switch_core_event_hook_remove_state_change(session, hanguphook);
-
+
if (switch_test_flag(jss, S_HUP)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
@@ -2816,7 +2821,7 @@
}
free(jss);
-
+
}
}
@@ -3025,7 +3030,7 @@
static JSBool js_exit(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
char *supplied_error, code_buf[256] = "";
-
+
if (argc > 0 && (supplied_error = JS_GetStringBytes(JS_ValueToString(cx, argv[0])))) {
switch_snprintf(code_buf, sizeof(code_buf), "~throw new Error(\"%s\");", supplied_error);
eval_some_js(code_buf, cx, obj, rval);
@@ -3078,7 +3083,7 @@
char *var_name = NULL, *val = NULL;
if (argc > 1) {
var_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+ val = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
switch_core_set_variable(var_name, val);
return JS_TRUE;
}
@@ -3153,7 +3158,7 @@
if (argc > 1) {
arg = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
}
-
+
if (argc > 2) {
JSObject *session_obj;
struct js_session *jss;
@@ -3384,7 +3389,7 @@
js_parse_and_execute(session, data, NULL);
}
-static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC js_thread_run(switch_thread_t *thread, void *obj)
{
char *input_code = obj;
@@ -3419,17 +3424,17 @@
SWITCH_STANDARD_API(jsapi_function)
{
- struct request_obj ro = {0};
+ struct request_obj ro = { 0 };
char *path_info = NULL;
- if (stream->param_event) {
+ if (stream->param_event) {
path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
if (switch_strlen_zero(cmd) && path_info) {
cmd = path_info;
}
-
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "USAGE: %s\n", jsapi_interface.syntax);
return SWITCH_STATUS_SUCCESS;
@@ -3456,14 +3461,14 @@
return SWITCH_STATUS_SUCCESS;
}
-static void message_query_handler(switch_event_t *event)
+static void message_query_handler(switch_event_t *event)
{
char *account = switch_event_get_header(event, "message-account");
if (account) {
char *path, *cmd;
- path = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
+ path = switch_mprintf("%s%smwi.js", SWITCH_GLOBAL_dirs.script_dir, SWITCH_PATH_SEPARATOR);
switch_assert(path != NULL);
if (switch_file_exists(path, NULL) == SWITCH_STATUS_SUCCESS) {
@@ -3497,7 +3502,8 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_API(api_interface, "jsrun", "run a script", launch_async, "jsrun <script> [additional_vars [...]]");
SWITCH_ADD_API(api_interface, "jsapi", "execute an api call", jsapi_function, "jsapi <script> [additional_vars [...]]");
- SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "<script> [additional_vars [...]]",
+ SAF_SUPPORT_NOMEDIA);
curl_global_init(CURL_GLOBAL_ALL);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_core_db/mod_spidermonkey_core_db.c Tue May 27 07:24:06 2008
@@ -73,10 +73,10 @@
return JS_FALSE;
}
-static JSBool db_close(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool db_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct db_obj *dbo = JS_GetPrivate(cx, obj);
-
+
if (dbo) {
if (dbo->stmt) {
switch_core_db_finalize(dbo->stmt);
@@ -91,7 +91,7 @@
return JS_TRUE;
}
-static void db_destroy(JSContext *cx, JSObject *obj)
+static void db_destroy(JSContext * cx, JSObject * obj)
{
struct db_obj *dbo = JS_GetPrivate(cx, obj);
@@ -215,7 +215,7 @@
}
for (x = 0; x < colcount; x++) {
switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"",
- (char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
+ (char *) switch_core_db_column_name(dbo->stmt, x), (char *) switch_core_db_column_text(dbo->stmt, x));
eval_some_js(code, dbo->cx, dbo->obj, rval);
if (*rval == JS_FALSE) {
@@ -275,7 +275,7 @@
};
-static JSBool db_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool db_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
@@ -332,7 +332,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
*module_interface = &DB_module_interface;
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c Tue May 27 07:24:06 2008
@@ -41,7 +41,7 @@
JSFunction *function;
JSObject *user_data;
jsrefcount saveDepth;
- jsval ret;
+ jsval ret;
};
@@ -51,21 +51,21 @@
struct curl_obj *co = data;
uintN argc = 0;
jsval argv[4];
-
+
if (!co) {
return 0;
}
if (co->function) {
char *ret;
- argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *)ptr));
+ argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *) ptr));
if (co->user_data) {
argv[argc++] = OBJECT_TO_JSVAL(co->user_data);
}
JS_ResumeRequest(co->cx, co->saveDepth);
JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
co->saveDepth = JS_SuspendRequest(co->cx);
-
+
if ((ret = JS_GetStringBytes(JS_ValueToString(co->cx, co->ret)))) {
if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
return realsize;
@@ -81,7 +81,7 @@
/* Curl Object */
/*********************************************************************************/
-static JSBool curl_construct(JSContext *cx, JSObject *obj, uintN argc, jsval * argv, jsval * rval)
+static JSBool curl_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct curl_obj *co = NULL;
@@ -98,14 +98,14 @@
return JS_TRUE;
}
-static void curl_destroy(JSContext *cx, JSObject *obj)
+static void curl_destroy(JSContext * cx, JSObject * obj)
{
struct curl_obj *co = JS_GetPrivate(cx, obj);
switch_safe_free(co);
JS_SetPrivate(cx, obj, NULL);
}
-static JSBool curl_run(JSContext *cx, JSObject *obj, uintN argc, jsval * argv, jsval * rval)
+static JSBool curl_run(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
struct curl_obj *co = JS_GetPrivate(cx, obj);
char *method = NULL, *url, *cred = NULL;
@@ -127,11 +127,11 @@
curl_easy_setopt(co->curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
}
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
-
+
if (argc > 2) {
data = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
}
-
+
if (argc > 3) {
co->function = JS_ValueToFunction(cx, argv[3]);
}
@@ -148,7 +148,7 @@
}
}
-
+
curl_easy_setopt(co->curl_handle, CURLOPT_HTTPHEADER, headers);
url_p = url;
@@ -164,7 +164,7 @@
url_p = durl;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Running: method: [%s] url: [%s] data: [%s] cred=[%s] cb: [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Running: method: [%s] url: [%s] data: [%s] cred=[%s] cb: [%s]\n",
method, url_p, data, switch_str_nil(cred), co->function ? "yes" : "no");
curl_easy_setopt(co->curl_handle, CURLOPT_URL, url_p);
@@ -172,7 +172,7 @@
curl_easy_setopt(co->curl_handle, CURLOPT_WRITEDATA, (void *) co);
curl_easy_setopt(co->curl_handle, CURLOPT_USERAGENT, "freeswitch-spidermonkey-curl/1.0");
-
+
co->saveDepth = JS_SuspendRequest(cx);
curl_easy_perform(co->curl_handle);
@@ -183,7 +183,7 @@
co->function = NULL;
JS_ResumeRequest(cx, co->saveDepth);
switch_safe_free(durl);
-
+
return JS_TRUE;
}
@@ -198,7 +198,7 @@
{0}
};
-static JSBool curl_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval * vp)
+static JSBool curl_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
JSBool res = JS_TRUE;
return res;
@@ -212,7 +212,7 @@
};
-switch_status_t curl_load(JSContext *cx, JSObject *obj)
+switch_status_t curl_load(JSContext * cx, JSObject * obj)
{
JS_InitClass(cx, obj, NULL, &curl_class, curl_construct, 3, curl_props, curl_methods, curl_props, curl_methods);
return SWITCH_STATUS_SUCCESS;
@@ -225,7 +225,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
curl_global_init(CURL_GLOBAL_ALL);
*module_interface = &curl_module_interface;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_odbc/mod_spidermonkey_odbc.c Tue May 27 07:24:06 2008
@@ -42,7 +42,7 @@
SQLCHAR *code;
int32 codelen;
};
-typedef struct odbc_obj odbc_obj_t;
+typedef struct odbc_obj odbc_obj_t;
static odbc_obj_t *new_odbc_obj(char *dsn, char *username, char *password)
{
@@ -56,7 +56,7 @@
if (!(new_obj->handle = switch_odbc_handle_new(dsn, username, password))) {
goto err;
}
-
+
return new_obj;
err:
@@ -72,29 +72,30 @@
switch_odbc_status_t odbc_obj_connect(odbc_obj_t *obj)
{
-
+
return switch_odbc_handle_connect(obj->handle);
}
-static void destroy_odbc_obj(odbc_obj_t ** objp)
+static void destroy_odbc_obj(odbc_obj_t **objp)
{
odbc_obj_t *obj = *objp;
- if (obj == NULL) return;
+ if (obj == NULL)
+ return;
if (obj->stmt) {
SQLFreeHandle(SQL_HANDLE_STMT, obj->stmt);
}
- if (obj->handle) {
- switch_odbc_handle_destroy(&obj->handle);
- }
- switch_safe_free(obj->colbuf);
- switch_safe_free(obj->code);
+ if (obj->handle) {
+ switch_odbc_handle_destroy(&obj->handle);
+ }
+ switch_safe_free(obj->colbuf);
+ switch_safe_free(obj->code);
switch_safe_free(obj);
}
/* ODBC Object */
/*********************************************************************************/
-static JSBool odbc_construct(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = NULL;
char *dsn, *username, *password;
@@ -156,16 +157,17 @@
static void odbc_destroy(JSContext * cx, JSObject * obj)
{
- odbc_obj_t *odbc_obj;
- if (obj == NULL) return;
+ odbc_obj_t *odbc_obj;
+ if (obj == NULL)
+ return;
odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
if (odbc_obj) {
destroy_odbc_obj(&odbc_obj);
- JS_SetPrivate(cx, obj, NULL);
- }
+ JS_SetPrivate(cx, obj, NULL);
+ }
}
-static JSBool odbc_connect(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
JSBool tf = JS_TRUE;
@@ -183,7 +185,7 @@
return JS_TRUE;
}
-static JSBool odbc_execute(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
char *sql;
@@ -217,7 +219,7 @@
return JS_TRUE;
}
-static JSBool odbc_exec(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
char *sql;
@@ -253,7 +255,7 @@
return JS_TRUE;
}
-static JSBool odbc_num_rows(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_num_rows(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
@@ -277,7 +279,7 @@
}
-static JSBool odbc_next_row(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_next_row(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
int result = 0;
@@ -285,8 +287,8 @@
if (switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
- goto done;
- }
+ goto done;
+ }
if (odbc_obj->stmt) {
@@ -345,7 +347,7 @@
}
-static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
@@ -353,8 +355,8 @@
if (switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
- goto done;
- }
+ goto done;
+ }
if (odbc_obj->stmt) {
SQLSMALLINT c = 0, x = 0;
@@ -374,7 +376,7 @@
SQLCHAR name[1024] = "";
SQLCHAR *data = odbc_obj->colbuf;
SQLCHAR *esc = NULL;
-
+
SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
@@ -407,10 +409,10 @@
}
-static JSBool odbc_close(JSContext * cx, JSObject * obj, uintN argc, jsval *argv, jsval *rval)
+static JSBool odbc_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
- odbc_destroy(cx, obj);
- return JS_TRUE;
+ odbc_destroy(cx, obj);
+ return JS_TRUE;
}
enum odbc_tinyid {
@@ -425,17 +427,17 @@
{"numRows", odbc_num_rows, 1},
{"nextRow", odbc_next_row, 1},
{"getData", odbc_get_data, 1},
- {"close", odbc_close, 1},
+ {"close", odbc_close, 1},
{0}
};
static JSPropertySpec odbc_props[] = {
- {"name", odbc_NAME, JSPROP_READONLY|JSPROP_PERMANENT},
+ {"name", odbc_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
{0}
};
-static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
@@ -446,11 +448,11 @@
return JS_TRUE;
}
-static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval *vp)
+static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
int param;
char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
-
+
/* numbers are our props anything else is a method */
if (name[0] >= 48 && name[0] <= 57) {
param = atoi(name);
@@ -483,7 +485,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
*module_interface = &odbc_module_interface;
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_skel/mod_spidermonkey_skel.c Tue May 27 07:24:06 2008
@@ -93,7 +93,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
*module_interface = &skel_module_interface;
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_socket/mod_spidermonkey_socket.c Tue May 27 07:24:06 2008
@@ -34,7 +34,7 @@
struct js_socket_obj {
switch_socket_t *socket;
switch_memory_pool_t *pool;
- char* read_buffer;
+ char *read_buffer;
switch_size_t buffer_size;
int state;
};
@@ -44,20 +44,18 @@
/*********************************************************************************/
static JSBool socket_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
- js_socket_obj_t* js_socket_obj = 0;
+ js_socket_obj_t *js_socket_obj = 0;
switch_memory_pool_t *pool;
switch_socket_t *socket;
switch_status_t ret;
switch_core_new_memory_pool(&pool);
ret = switch_socket_create(&socket, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, pool);
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_core_destroy_memory_pool(&pool);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Failed to create socket, reason: %d.\n", ret);
return JS_FALSE;
}
-
// allocate information needed by JS to be able to write to the log.
// (needed since multitple js sessions can write to the same log)
js_socket_obj = switch_core_alloc(pool, sizeof(js_socket_obj_t));
@@ -73,8 +71,7 @@
if (socket == NULL)
return;
- if (socket->socket != 0)
- {
+ if (socket->socket != 0) {
switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
switch_socket_close(socket->socket);
switch_core_destroy_memory_pool(&socket->pool);
@@ -84,14 +81,12 @@
static JSBool socket_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
- if (socket == NULL)
- {
+ if (socket == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
return JS_FALSE;
}
- if (argc == 2)
- {
+ if (argc == 2) {
char *host = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
int32 port;
switch_sockaddr_t *addr;
@@ -99,21 +94,18 @@
JS_ValueToInt32(cx, argv[1], &port);
- ret = switch_sockaddr_info_get(&addr, host, AF_INET, (switch_port_t)port, 0, socket->pool);
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ ret = switch_sockaddr_info_get(&addr, host, AF_INET, (switch_port_t) port, 0, socket->pool);
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_sockaddr_info_get failed: %d.\n", ret);
return JS_FALSE;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Connecting to: %s:%d.\n", host, port);
ret = switch_socket_connect(socket->socket, addr);
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_connect failed: %d.\n", ret);
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
- }
- else
+ } else
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
}
@@ -124,23 +116,19 @@
static JSBool socket_send(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
- if (socket == NULL)
- {
+ if (socket == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
return JS_FALSE;
}
- if (argc == 1)
- {
+ if (argc == 1) {
char *buffer = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
switch_size_t len = strlen(buffer);
switch_status_t ret = switch_socket_send(socket->socket, buffer, &len);
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
- }
- else
+ } else
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
}
@@ -150,35 +138,29 @@
static JSBool socket_read_bytes(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
- if (socket == NULL)
- {
+ if (socket == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
return JS_FALSE;
}
- if (argc == 1)
- {
+ if (argc == 1) {
int32 bytes_to_read;
switch_status_t ret;
switch_size_t len;
JS_ValueToInt32(cx, argv[0], &bytes_to_read);
- len = (switch_size_t)bytes_to_read;
+ len = (switch_size_t) bytes_to_read;
- if (socket->buffer_size < len)
- {
- socket->read_buffer = switch_core_alloc(socket->pool, len+1);
+ if (socket->buffer_size < len) {
+ socket->read_buffer = switch_core_alloc(socket->pool, len + 1);
socket->buffer_size = bytes_to_read + 1;
}
ret = switch_socket_recv(socket->socket, socket->read_buffer, &len);
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
- }
- else
- {
+ } else {
socket->read_buffer[len] = 0;
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
}
@@ -190,15 +172,13 @@
static JSBool socket_read(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
- if (socket == NULL)
- {
+ if (socket == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
return JS_FALSE;
}
- if (argc >= 0)
- {
- char* delimiter = "\n";
+ if (argc >= 0) {
+ char *delimiter = "\n";
switch_status_t ret = SWITCH_STATUS_FALSE;
switch_size_t len = 1;
switch_size_t total_length = 0;
@@ -212,8 +192,7 @@
if (socket->read_buffer == 0)
socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
- while (can_run == TRUE)
- {
+ while (can_run == TRUE) {
ret = switch_socket_recv(socket->socket, tempbuf, &len);
if (ret != SWITCH_STATUS_SUCCESS)
break;
@@ -223,13 +202,11 @@
break;
else if (tempbuf[0] == '\r' && delimiter[0] == '\n')
continue;
- else
- {
+ else {
// Buffer is full, let's increase it.
- if (total_length == socket->buffer_size - 1)
- {
+ if (total_length == socket->buffer_size - 1) {
switch_size_t new_size = socket->buffer_size + 4196;
- char* new_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
+ char *new_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
memcpy(new_buffer, socket->read_buffer, total_length);
socket->buffer_size = new_size;
socket->read_buffer = new_buffer;
@@ -238,13 +215,10 @@
++total_length;
}
}
- if (ret != SWITCH_STATUS_SUCCESS)
- {
+ if (ret != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret);
*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
- }
- else
- {
+ } else {
socket->read_buffer[total_length] = 0;
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
}
@@ -256,8 +230,7 @@
static JSBool socket_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
{
js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
- if (socket == NULL)
- {
+ if (socket == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
return JS_FALSE;
}
@@ -290,7 +263,7 @@
static JSBool socket_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
{
JSBool res = JS_TRUE;
-// js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+// js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
char *name;
int param = 0;
@@ -335,7 +308,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
*module_interface = &socket_module_interface;
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c Tue May 27 07:24:06 2008
@@ -56,7 +56,7 @@
};
-static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
struct teletone_obj *tto = ts->user_data;
int wrote;
@@ -249,7 +249,7 @@
if (switch_test_flag(tto, TTF_DTMF)) {
char dtmf[128];
char *ret;
-
+
if (switch_channel_has_dtmf(channel)) {
uintN aargc = 0;
jsval aargv[4];
@@ -345,7 +345,7 @@
/*.next */ NULL
};
-SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t **module_interface)
{
*module_interface = &teletone_module_interface;
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_console/mod_console.c Tue May 27 07:24:06 2008
@@ -84,14 +84,14 @@
} else {
m = switch_log_str2mask(val);
}
-
+
if (!strcasecmp(var, "all")) {
all_level |= m;
return;
}
del_mapping(var);
- switch_core_hash_insert(log_hash, var, (void *)(intptr_t) m);
+ switch_core_hash_insert(log_hash, var, (void *) (intptr_t) m);
}
static switch_status_t config_logger(void)
@@ -149,7 +149,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static int can_write(FILE *handle, int ms)
+static int can_write(FILE * handle, int ms)
{
#ifndef WIN32
int aok = 1;
@@ -166,14 +166,14 @@
FD_SET(fd, &can_write);
to.tv_sec = sec;
to.tv_usec = usec;
- if (select(fd+1, NULL, &can_write, NULL, &to) > 0) {
+ if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
aok = FD_ISSET(fd, &can_write);
} else {
aok = 0;
}
-
+
return aok;
-#else
+#else
return 1;
#endif
}
@@ -182,11 +182,10 @@
static switch_status_t switch_console_logger(const switch_log_node_t *node, switch_log_level_t level)
{
FILE *handle;
-
+
if (!RUNNING) {
return SWITCH_STATUS_SUCCESS;
}
-
#if 0
if (failed_write) {
if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
@@ -197,7 +196,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
#else
if (COLORIZE) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s", COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s%s%s", COLORS[1], msg, SWITCH_SEQ_DEFAULT_COLOR);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", msg);
}
@@ -213,11 +212,11 @@
}
if ((handle = switch_core_data_channel(SWITCH_CHANNEL_ID_LOG))) {
- size_t mask = 0;
- size_t ok = 0;
-
- ok = switch_log_check_mask(all_level, level);
-
+ size_t mask = 0;
+ size_t ok = 0;
+
+ ok = switch_log_check_mask(all_level, level);
+
if (log_hash) {
if (!ok) {
mask = (size_t) switch_core_hash_find(log_hash, node->file);
@@ -233,7 +232,7 @@
if (ok) {
#ifndef WIN32
int aok = can_write(handle, 10000);
-
+
if (!aok) {
//hard_log_level = 0;
//failed_write++;
@@ -261,18 +260,18 @@
SWITCH_STANDARD_API(console_api_function)
{
int argc;
- char *mydata = NULL, *argv[3];
+ char *mydata = NULL, *argv[3];
const char *err = NULL;
if (!cmd) {
err = "bad args";
- goto end;
- }
+ goto end;
+ }
+
+ mydata = strdup(cmd);
+ assert(mydata);
- mydata = strdup(cmd);
- assert(mydata);
-
- argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc > 0) {
@@ -283,7 +282,7 @@
if (!strcasecmp(argv[0], "loglevel")) {
int level = hard_log_level;
-
+
if (argc > 1) {
if (*argv[1] > 47 && *argv[1] < 58) {
level = atoi(argv[1]);
@@ -296,26 +295,26 @@
stream->write_function(stream, "-ERR syntax error, console log level not set!\n");
} else {
hard_log_level = level;
- stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
+ stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
}
goto end;
} else if (!strcasecmp(argv[0], "colorize")) {
if (argc > 1) {
COLORIZE = switch_true(argv[1]);
}
- stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
+ stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
goto end;
}
-
+
err = "invalid command";
}
- end:
-
+ end:
+
if (err) {
- stream->write_function(stream, "-Error %s\n", err);
+ stream->write_function(stream, "-Error %s\n", err);
}
@@ -328,10 +327,10 @@
SWITCH_MODULE_LOAD_FUNCTION(mod_console_load)
{
switch_api_interface_t *api_interface;
-
+
module_pool = pool;
-
+
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_logfile/mod_logfile.c Tue May 27 07:24:06 2008
@@ -36,9 +36,9 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_logfile_shutdown);
SWITCH_MODULE_DEFINITION(mod_logfile, mod_logfile_load, mod_logfile_shutdown, NULL);
-#define DEFAULT_LIMIT 0xA00000 /* About 10 MB */
+#define DEFAULT_LIMIT 0xA00000 /* About 10 MB */
#define WARM_FUZZY_OFFSET 256
-#define MAX_ROT 4096 /* why not */
+#define MAX_ROT 4096 /* why not */
static switch_memory_pool_t *module_pool = NULL;
static switch_hash_t *profile_hash = NULL;
@@ -50,12 +50,12 @@
struct logfile_profile {
char *name;
- switch_size_t log_size; /* keep the log size in check for rotation */
- switch_size_t roll_size; /* the size that we want to rotate the file at */
+ switch_size_t log_size; /* keep the log size in check for rotation */
+ switch_size_t roll_size; /* the size that we want to rotate the file at */
char *logfile;
switch_file_t *log_afd;
- switch_hash_t *log_hash;
- uint32_t all_level;
+ switch_hash_t *log_hash;
+ uint32_t all_level;
};
typedef struct logfile_profile logfile_profile_t;
@@ -76,7 +76,7 @@
return;
}
- switch_core_hash_insert(profile->log_hash, var, (void *)(intptr_t) switch_log_str2mask(val));
+ switch_core_hash_insert(profile->log_hash, var, (void *) (intptr_t) switch_log_str2mask(val));
}
static switch_status_t mod_logfile_rotate(logfile_profile_t *profile);
@@ -92,7 +92,7 @@
flags |= SWITCH_FOPEN_WRITE;
flags |= SWITCH_FOPEN_APPEND;
- stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD|SWITCH_FPROT_UWRITE, module_pool);
+ stat = switch_file_open(&afd, profile->logfile, flags, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, module_pool);
if (stat != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
}
@@ -136,15 +136,15 @@
}
- p = malloc(strlen(profile->logfile)+WARM_FUZZY_OFFSET);
+ p = malloc(strlen(profile->logfile) + WARM_FUZZY_OFFSET);
switch_assert(p);
- memset(p, '\0', strlen(profile->logfile)+WARM_FUZZY_OFFSET);
+ memset(p, '\0', strlen(profile->logfile) + WARM_FUZZY_OFFSET);
switch_core_new_memory_pool(&pool);
- for (i=1; i < MAX_ROT; i++) {
- sprintf((char *)p, "%s.%s.%i", profile->logfile, date, i);
+ for (i = 1; i < MAX_ROT; i++) {
+ sprintf((char *) p, "%s.%s.%i", profile->logfile, date, i);
if (switch_file_exists(p, pool) == SWITCH_STATUS_SUCCESS) {
continue;
}
@@ -152,9 +152,9 @@
switch_file_close(profile->log_afd);
switch_file_rename(profile->logfile, p, pool);
if ((status = mod_logfile_openlogfile(profile, SWITCH_FALSE)) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
- goto end;
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Rotating Log!\n");
+ goto end;
+ }
break;
}
@@ -164,7 +164,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New log started.\n");
-end:
+ end:
switch_mutex_unlock(globals.mutex);
@@ -175,7 +175,7 @@
static switch_status_t mod_logfile_raw_write(logfile_profile_t *profile, char *log_data)
{
switch_size_t len;
- switch_status_t status = SWITCH_STATUS_SUCCESS;
+ switch_status_t status = SWITCH_STATUS_SUCCESS;
len = strlen(log_data);
if (len <= 0 || !profile->log_afd) {
@@ -187,96 +187,96 @@
if (switch_file_write(profile->log_afd, log_data, &len) != SWITCH_STATUS_SUCCESS) {
switch_file_close(profile->log_afd);
if ((status = mod_logfile_openlogfile(profile, SWITCH_TRUE)) == SWITCH_STATUS_SUCCESS) {
- len = strlen(log_data);
- switch_file_write(profile->log_afd, log_data, &len);
- }
+ len = strlen(log_data);
+ switch_file_write(profile->log_afd, log_data, &len);
+ }
}
switch_mutex_unlock(globals.mutex);
- if (status == SWITCH_STATUS_SUCCESS) {
- profile->log_size += len;
+ if (status == SWITCH_STATUS_SUCCESS) {
+ profile->log_size += len;
- if (profile->roll_size && profile->log_size >= profile->roll_size) {
- mod_logfile_rotate(profile);
- }
- }
+ if (profile->roll_size && profile->log_size >= profile->roll_size) {
+ mod_logfile_rotate(profile);
+ }
+ }
return status;
}
static switch_status_t process_node(const switch_log_node_t *node, switch_log_level_t level)
{
- switch_hash_index_t *hi;
+ switch_hash_index_t *hi;
void *val;
const void *var;
logfile_profile_t *profile;
-
- for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
- size_t mask = 0;
- size_t ok = 0;
-
- switch_hash_this(hi, &var, NULL, &val);
- profile = val;
-
- ok = switch_log_check_mask(profile->all_level, level);
-
- if (!ok) {
- mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
- ok = switch_log_check_mask(mask, level);
- }
-
- if (!ok) {
- mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
- ok = switch_log_check_mask(mask, level);
- }
-
- if (ok) {
- mod_logfile_raw_write(profile, node->data);
- }
- }
+ for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+ size_t mask = 0;
+ size_t ok = 0;
+
+ switch_hash_this(hi, &var, NULL, &val);
+ profile = val;
+
+ ok = switch_log_check_mask(profile->all_level, level);
+
+ if (!ok) {
+ mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);
+ ok = switch_log_check_mask(mask, level);
+ }
+
+ if (!ok) {
+ mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);
+ ok = switch_log_check_mask(mask, level);
+ }
+
+ if (ok) {
+ mod_logfile_raw_write(profile, node->data);
+ }
+
+ }
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t mod_logfile_logger(const switch_log_node_t *node, switch_log_level_t level)
{
- return process_node(node, level);
+ return process_node(node, level);
}
static switch_status_t load_profile(switch_xml_t xml)
{
switch_xml_t param, settings;
- char *name = (char *) switch_xml_attr_soft(xml, "name");
- logfile_profile_t *new_profile;
+ char *name = (char *) switch_xml_attr_soft(xml, "name");
+ logfile_profile_t *new_profile;
+
+ new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
+ memset(new_profile, 0, sizeof(*new_profile));
+ switch_core_hash_init(&(new_profile->log_hash), module_pool);
+ new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
+
- new_profile = switch_core_alloc(module_pool, sizeof(*new_profile));
- memset(new_profile, 0, sizeof(*new_profile));
- switch_core_hash_init(&(new_profile->log_hash), module_pool);
- new_profile->name = switch_core_strdup(module_pool, switch_str_nil(name));
-
-
if ((settings = switch_xml_child(xml, "settings"))) {
- for (param = switch_xml_child(settings, "param"); param; param = param->next) {
- char *var = (char *) switch_xml_attr_soft(param, "name");
- char *val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcmp(var, "logfile")) {
- new_profile->logfile = strdup(val);
- } else if (!strcmp(var, "rollover")) {
- new_profile->roll_size = atoi(val);
- if (new_profile->roll_size < 0) {
- new_profile->roll_size = 0;
- }
- }
- }
- }
+ for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+ char *var = (char *) switch_xml_attr_soft(param, "name");
+ char *val = (char *) switch_xml_attr_soft(param, "value");
+ if (!strcmp(var, "logfile")) {
+ new_profile->logfile = strdup(val);
+ } else if (!strcmp(var, "rollover")) {
+ new_profile->roll_size = atoi(val);
+ if (new_profile->roll_size < 0) {
+ new_profile->roll_size = 0;
+ }
+ }
+ }
+ }
if ((settings = switch_xml_child(xml, "mappings"))) {
for (param = switch_xml_child(settings, "map"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
-
+
add_mapping(new_profile, var, val);
}
}
@@ -286,40 +286,40 @@
switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
new_profile->logfile = strdup(logfile);
}
-
- if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
- return SWITCH_STATUS_GENERR;
- }
- switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
- return SWITCH_STATUS_SUCCESS;
+ if (mod_logfile_openlogfile(new_profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
+ return SWITCH_STATUS_GENERR;
+ }
+
+ switch_core_hash_insert(profile_hash, new_profile->name, (void *) new_profile);
+ return SWITCH_STATUS_SUCCESS;
}
static void event_handler(switch_event_t *event)
{
const char *sig = switch_event_get_header(event, "Trapped-Signal");
- switch_hash_index_t *hi;
+ switch_hash_index_t *hi;
void *val;
const void *var;
logfile_profile_t *profile;
if (sig && !strcmp(sig, "HUP")) {
if (globals.rotate) {
- for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, &var, NULL, &val);
+ for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
profile = val;
mod_logfile_rotate(profile);
}
} else {
switch_mutex_lock(globals.mutex);
- for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, &var, NULL, &val);
+ for (hi = switch_hash_first(NULL, profile_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &var, NULL, &val);
profile = val;
switch_file_close(profile->log_afd);
if (mod_logfile_openlogfile(profile, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Re-opening Log!\n");
+ }
}
switch_mutex_unlock(globals.mutex);
}
@@ -364,11 +364,11 @@
if ((profiles = switch_xml_child(cfg, "profiles"))) {
for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
- if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
- }
- }
- }
+ if (load_profile(xprofile) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error loading profile.");
+ }
+ }
+ }
switch_xml_free(xml);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/loggers/mod_syslog/mod_syslog.c Tue May 27 07:24:06 2008
@@ -54,16 +54,16 @@
SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_format, globals.format);
static switch_loadable_module_interface_t console_module_interface = {
- /*.module_name */ modname,
- /*.endpoint_interface */ NULL,
- /*.timer_interface */ NULL,
- /*.dialplan_interface */ NULL,
- /*.codec_interface */ NULL,
- /*.application_interface */ NULL,
- /*.api_interface */ NULL,
- /*.file_interface */ NULL,
- /*.speech_interface */ NULL,
- /*.directory_interface */ NULL
+ /*.module_name */ modname,
+ /*.endpoint_interface */ NULL,
+ /*.timer_interface */ NULL,
+ /*.dialplan_interface */ NULL,
+ /*.codec_interface */ NULL,
+ /*.application_interface */ NULL,
+ /*.api_interface */ NULL,
+ /*.file_interface */ NULL,
+ /*.speech_interface */ NULL,
+ /*.directory_interface */ NULL
};
static switch_status_t mod_syslog_logger(const switch_log_node_t *node, switch_log_level_t level)
@@ -72,30 +72,30 @@
int syslog_level;
switch (level) {
- case SWITCH_LOG_DEBUG:
- syslog_level = LOG_DEBUG;
- break;
- case SWITCH_LOG_INFO:
- syslog_level = LOG_INFO;
- break;
- case SWITCH_LOG_NOTICE:
- syslog_level = LOG_NOTICE;
- break;
- case SWITCH_LOG_WARNING:
- syslog_level = LOG_WARNING;
- break;
- case SWITCH_LOG_ERROR:
- syslog_level = LOG_ERR;
- break;
- case SWITCH_LOG_CRIT:
- syslog_level = LOG_CRIT;
- break;
- case SWITCH_LOG_ALERT:
- syslog_level = LOG_ALERT;
- break;
- default:
- syslog_level = LOG_NOTICE;
- break;
+ case SWITCH_LOG_DEBUG:
+ syslog_level = LOG_DEBUG;
+ break;
+ case SWITCH_LOG_INFO:
+ syslog_level = LOG_INFO;
+ break;
+ case SWITCH_LOG_NOTICE:
+ syslog_level = LOG_NOTICE;
+ break;
+ case SWITCH_LOG_WARNING:
+ syslog_level = LOG_WARNING;
+ break;
+ case SWITCH_LOG_ERROR:
+ syslog_level = LOG_ERR;
+ break;
+ case SWITCH_LOG_CRIT:
+ syslog_level = LOG_CRIT;
+ break;
+ case SWITCH_LOG_ALERT:
+ syslog_level = LOG_ALERT;
+ break;
+ default:
+ syslog_level = LOG_NOTICE;
+ break;
}
if (!switch_strlen_zero(message)) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_de/mod_say_de.c Tue May 27 07:24:06 2008
@@ -39,6 +39,7 @@
*
* Anthony Minessale II <anthmct(a)yahoo.com>
* Michael B. Murdock <mike(a)mmurdock.org>
+ * Daniel Swarbrick <daniel.swarbrick(a)gmail.com>
*
* mod_say_de.c -- Say for German
*
@@ -101,11 +102,21 @@
if (b) {
if (b > 1) {
- say_file("digits/%d0.wav", b);
+ say_file("digits/%d.wav", c);
+ say_file("currency/and.wav");
+ if (method == SSM_COUNTED) {
+ say_file("digits/h-%d0.wav", b);
+ } else {
+ say_file("digits/%d0.wav", b);
+ }
} else {
- say_file("digits/%d%d.wav", b, c);
- c = 0;
+ if (method == SSM_COUNTED) {
+ say_file("digits/h-%d%d.wav", b, c);
+ } else {
+ say_file("digits/%d%d.wav", b, c);
+ }
}
+ c = 0;
}
if (c) {
@@ -185,8 +196,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
@@ -395,14 +406,13 @@
}
say_num(hour, SSM_PRONOUNCED);
+ say_file("time/oclock.wav");
if (tm.tm_min > 9) {
say_num(tm.tm_min, SSM_PRONOUNCED);
} else if (tm.tm_min) {
say_file("time/oh.wav");
say_num(tm.tm_min, SSM_PRONOUNCED);
- } else {
- say_file("time/oclock.wav");
}
say_file("time/%s.wav", pm ? "p-m" : "a-m");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_en/mod_say_en.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_es/mod_say_es.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_fr/mod_say_fr.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_it/mod_say_it.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_nl/mod_say_nl.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/say/mod_say_zh/mod_say_zh.c Tue May 27 07:24:06 2008
@@ -185,8 +185,8 @@
if (in != 0) {
for (x = 8; x >= 0; x--) {
int num = (int) pow(10, x);
- if ((places[(uint32_t)x] = in / num)) {
- in -= places[(uint32_t)x] * num;
+ if ((places[(uint32_t) x] = in / num)) {
+ in -= places[(uint32_t) x] * num;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Tue May 27 07:24:06 2008
@@ -99,10 +99,7 @@
}
if (!switch_strlen_zero(logdir)) {
- if ((path = switch_mprintf("%s%s%s.cdr.xml",
- logdir,
- SWITCH_PATH_SEPARATOR,
- switch_core_session_get_uuid(session)))) {
+ if ((path = switch_mprintf("%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -124,7 +121,7 @@
/* try to post it to the web server */
if (!switch_strlen_zero(globals.url)) {
curl_handle = curl_easy_init();
-
+
if (globals.encode) {
switch_size_t need_bytes = strlen(xml_text) * 3;
@@ -136,14 +133,14 @@
switch_url_encode(xml_text, xml_text_escaped, need_bytes);
} else {
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
- switch_b64_encode((unsigned char *)xml_text, need_bytes / 3, (unsigned char *)xml_text_escaped, need_bytes);
+ switch_b64_encode((unsigned char *) xml_text, need_bytes / 3, (unsigned char *) xml_text_escaped, need_bytes);
}
switch_safe_free(xml_text);
xml_text = xml_text_escaped;
} else {
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
}
-
+
if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
goto error;
@@ -165,15 +162,15 @@
slist = curl_slist_append(slist, "Expect:");
curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
}
-
+
if (globals.ignore_cacert_check) {
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, FALSE);
}
/* these were used for testing, optionally they may be enabled if someone desires
- curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
- curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
- */
+ curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
+ curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
+ */
for (cur_try = 0; cur_try < globals.retries; cur_try++) {
if (cur_try > 0) {
@@ -184,7 +181,7 @@
if (httpRes == 200) {
goto success;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n", httpRes, globals.url);
}
}
curl_easy_cleanup(curl_handle);
@@ -197,10 +194,7 @@
/* if we are here the web post failed for some reason */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");
- if ((path = switch_mprintf("%s%s%s.cdr.xml",
- globals.err_log_dir,
- SWITCH_PATH_SEPARATOR,
- switch_core_session_get_uuid(session)))) {
+ if ((path = switch_mprintf("%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -218,11 +212,11 @@
}
}
-success:
+ success:
status = SWITCH_STATUS_SUCCESS;
-error:
- if (curl_handle) {
+ error:
+ if (curl_handle) {
curl_easy_cleanup(curl_handle);
}
if (headers) {
@@ -259,7 +253,7 @@
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
- memset(&globals,0,sizeof(globals));
+ memset(&globals, 0, sizeof(globals));
globals.log_b = 1;
globals.disable100continue = 0;
@@ -294,32 +288,22 @@
globals.retries = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-dir")) {
if (switch_strlen_zero(val)) {
- globals.log_dir = switch_mprintf("%s%sxml_cdr",
- SWITCH_GLOBAL_dirs.log_dir,
- SWITCH_PATH_SEPARATOR);
+ globals.log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
globals.log_dir = strdup(val);
} else {
- globals.log_dir = switch_mprintf("%s%s%s",
- SWITCH_GLOBAL_dirs.log_dir,
- SWITCH_PATH_SEPARATOR,
- val);
+ globals.log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
}
}
} else if (!strcasecmp(var, "err-log-dir")) {
if (switch_strlen_zero(val)) {
- globals.err_log_dir = switch_mprintf("%s%sxml_cdr",
- SWITCH_GLOBAL_dirs.log_dir,
- SWITCH_PATH_SEPARATOR);
+ globals.err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
globals.err_log_dir = strdup(val);
} else {
- globals.err_log_dir = switch_mprintf("%s%s%s",
- SWITCH_GLOBAL_dirs.log_dir,
- SWITCH_PATH_SEPARATOR,
- val);
+ globals.err_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
}
}
} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
@@ -330,9 +314,7 @@
if (!switch_strlen_zero(globals.log_dir)) {
globals.err_log_dir = strdup(globals.log_dir);
} else {
- globals.err_log_dir = switch_mprintf("%s%sxml_cdr",
- SWITCH_GLOBAL_dirs.log_dir,
- SWITCH_PATH_SEPARATOR);
+ globals.err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
}
}
}
@@ -342,7 +324,7 @@
globals.retries = 0;
}
- if (globals.retries && globals.delay<=0) {
+ if (globals.retries && globals.delay <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "retries set but delay 0 setting to 5000ms\n");
globals.delay = 5000;
}
@@ -355,9 +337,9 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_cdr_shutdown)
{
-
- globals.shutdown=1;
- return SWITCH_STATUS_SUCCESS;
+
+ globals.shutdown = 1;
+ return SWITCH_STATUS_SUCCESS;
}
/* For Emacs:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Tue May 27 07:24:06 2008
@@ -43,8 +43,8 @@
char *cred;
int disable100continue;
uint32_t ignore_cacert_check;
- switch_hash_t* vars_map;
- switch_memory_pool_t* vars_map_pool;
+ switch_hash_t *vars_map;
+ switch_memory_pool_t *vars_map_pool;
};
static int keep_files_around = 0;
@@ -78,7 +78,7 @@
stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS;
-usage:
+ usage:
stream->write_function(stream, "USAGE: %s\n", XML_CURL_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -89,7 +89,7 @@
struct config_data *config_data = data;
int x;
x = write(config_data->fd, ptr, realsize);
- if ( x != (int)realsize) {
+ if (x != (int) realsize) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write! %d out of %d\n", x, realsize);
}
return x;
@@ -130,13 +130,9 @@
}
switch_snprintf(basic_data, sizeof(basic_data), "hostname=%s§ion=%s&tag_name=%s&key_name=%s&key_value=%s",
- hostname,
- section,
- switch_str_nil(tag_name),
- switch_str_nil(key_name),
- switch_str_nil(key_value));
+ hostname, section, switch_str_nil(tag_name), switch_str_nil(key_name), switch_str_nil(key_value));
- data = switch_event_build_param_string(params, basic_data,binding->vars_map);
+ data = switch_event_build_param_string(params, basic_data, binding->vars_map);
switch_assert(data);
switch_uuid_get(&uuid);
@@ -166,8 +162,8 @@
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
if (binding->disable100continue) {
- slist = curl_slist_append(slist, "Expect:");
- curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
+ slist = curl_slist_append(slist, "Expect:");
+ curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
}
if (binding->ignore_cacert_check) {
@@ -206,6 +202,7 @@
return xml;
}
+
#define ENABLE_PARAM_VALUE "enabled"
static switch_status_t do_config(void)
{
@@ -214,9 +211,9 @@
xml_binding_t *binding = NULL;
int x = 0;
int need_vars_map = 0;
- switch_hash_t* vars_map = NULL;
- switch_memory_pool_t* vars_map_pool = NULL;
-
+ switch_hash_t *vars_map = NULL;
+ switch_memory_pool_t *vars_map_pool = NULL;
+
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
@@ -249,29 +246,29 @@
disable100continue = 1;
} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
ignore_cacert_check = 1;
- } else if(!strcasecmp(var, "enable-post-var")) {
+ } else if (!strcasecmp(var, "enable-post-var")) {
if (!vars_map && need_vars_map == 0) {
- if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
- need_vars_map = -1;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
- continue;
- }
-
- if (switch_core_hash_init(&vars_map,vars_map_pool) != SWITCH_STATUS_SUCCESS) {
- need_vars_map = -1;
- switch_core_destroy_memory_pool(&vars_map_pool);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
- continue;
- }
- need_vars_map = 1;
+ if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+ need_vars_map = -1;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
+ continue;
+ }
+
+ if (switch_core_hash_init(&vars_map, vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+ need_vars_map = -1;
+ switch_core_destroy_memory_pool(&vars_map_pool);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
+ continue;
+ }
+ need_vars_map = 1;
}
-
+
if (vars_map && val)
- if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n",val);
- }
-
- }
+ if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n", val);
+ }
+
+ }
}
if (!url) {
@@ -296,7 +293,7 @@
binding->disable100continue = disable100continue;
binding->ignore_cacert_check = ignore_cacert_check;
-
+
binding->vars_map = vars_map;
binding->vars_map_pool = vars_map_pool;
@@ -307,7 +304,7 @@
binding = NULL;
}
- done:
+ done:
switch_xml_free(xml);
return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c Tue May 27 07:24:06 2008
@@ -96,17 +96,15 @@
}
if (!strcasecmp(cmd, "debug_on")) {
- }
- else if (!strcasecmp(cmd, "debug_off")) {
- }
- else {
+ } else if (!strcasecmp(cmd, "debug_off")) {
+ } else {
goto usage;
}
stream->write_function(stream, "OK\n");
return SWITCH_STATUS_SUCCESS;
-usage:
+ usage:
stream->write_function(stream, "USAGE: %s\n", XML_LDAP_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -144,11 +142,10 @@
ldap->val = ldap_first_attribute(ldap->ld, ldap->entry, &ldap->berval);
do {
if (strstr(ldap->val, "value")) {
- if (strstr(ldap->val, ldap->key) && strcmp(ldap->val, ldap->key) ) {
+ if (strstr(ldap->val, ldap->key) && strcmp(ldap->val, ldap->key)) {
if (!strcmp(ldap->key, "param")) {
params = switch_xml_add_child_d(asdf, "params", loff++);
- }
- else if (!strcmp(ldap->key, "variable")) {
+ } else if (!strcmp(ldap->key, "variable")) {
variables = switch_xml_add_child_d(asdf, "variables", loff++);
}
@@ -162,8 +159,7 @@
param = switch_xml_add_child_d(params, "param", loff++);
switch_xml_set_attr_d(param, "name", ldap->keyvals[i]);
switch_xml_set_attr_d(param, "value", ldap->valvals[i]);
- }
- else if (!strcmp(ldap->key, "variable")) {
+ } else if (!strcmp(ldap->key, "variable")) {
variable = switch_xml_add_child_d(variables, "variable", loff++);
switch_xml_set_attr_d(variable, "name", ldap->keyvals[i]);
switch_xml_set_attr_d(variable, "value", ldap->valvals[i]);
@@ -177,9 +173,9 @@
if (ldap->valvals) {
ldap_value_free(ldap->valvals);
}
- }
- else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "seems the values %d and %d are not the same??\n",ldap_count_values(ldap->valvals), ldap_count_values(ldap->keyvals));
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "seems the values %d and %d are not the same??\n",
+ ldap_count_values(ldap->valvals), ldap_count_values(ldap->keyvals));
}
}
}
@@ -200,7 +196,7 @@
ber_free(ldap->berval, 0);
}
- ldap->key = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berkey );
+ ldap->key = ldap_next_attribute(ldap->ld, ldap->entry, ldap->berkey);
} while (ldap->key != NULL);
@@ -212,9 +208,10 @@
}
-static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
+static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+ void *user_data)
{
- xml_binding_t *binding = (xml_binding_t *)user_data;
+ xml_binding_t *binding = (xml_binding_t *) user_data;
switch_event_header_t *hi;
switch_xml_t xml = NULL, sub = NULL;
@@ -222,7 +219,7 @@
struct ldap_c ldap_connection;
struct ldap_c *ldap = &ldap_connection;
- int auth_method = LDAP_AUTH_SIMPLE;
+ int auth_method = LDAP_AUTH_SIMPLE;
int desired_version = LDAP_VERSION3;
xml_ldap_query_type_t query_type;
char *dir_exten = NULL, *dir_domain = NULL;
@@ -237,16 +234,13 @@
return NULL;
}
- if (!strcmp(section,"configuration")) {
+ if (!strcmp(section, "configuration")) {
query_type = XML_LDAP_CONFIG;
- }
- else if (!strcmp(section,"directory")) {
+ } else if (!strcmp(section, "directory")) {
query_type = XML_LDAP_DIRECTORY;
- }
- else if (!strcmp(section,"dialplan")) {
+ } else if (!strcmp(section, "dialplan")) {
query_type = XML_LDAP_DIALPLAN;
- }
- else if (!strcmp(section,"phrases")) {
+ } else if (!strcmp(section, "phrases")) {
query_type = XML_LDAP_PHRASE;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid section\n");
@@ -256,15 +250,14 @@
if (params) {
if ((hi = params->headers)) {
for (; hi; hi = hi->next) {
- switch(query_type) {
+ switch (query_type) {
case XML_LDAP_CONFIG:
break;
case XML_LDAP_DIRECTORY:
- if (!strcmp(hi->name,"user")) {
+ if (!strcmp(hi->name, "user")) {
dir_exten = strdup(hi->value);
- }
- else if (!strcmp(hi->name,"domain")) {
+ } else if (!strcmp(hi->name, "domain")) {
dir_domain = strdup(hi->value);
}
break;
@@ -274,7 +267,7 @@
break;
}
}
- switch(query_type) {
+ switch (query_type) {
case XML_LDAP_CONFIG:
break;
@@ -282,7 +275,7 @@
if (dir_exten && dir_domain) {
if ((xml = switch_xml_new("directory"))) {
switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
-
+
if ((sub = switch_xml_add_child_d(xml, "section", off++))) {
switch_xml_set_attr_d(sub, "name", "directory");
}
@@ -290,21 +283,23 @@
if ((sub = switch_xml_add_child_d(sub, "domain", off++))) {
switch_xml_set_attr_d(sub, "name", dir_domain);
}
-
+
if ((sub = switch_xml_add_child_d(sub, "user", off++))) {
switch_xml_set_attr_d(sub, "id", dir_exten);
}
}
search_base = switch_mprintf(binding->queryfmt, dir_exten, dir_domain, binding->ldap_base);
-
+
free(dir_exten);
dir_exten = NULL;
free(dir_domain);
dir_domain = NULL;
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten, dir_domain);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ "something bad happened during the query construction phase likely exten(%s) or domain(%s) is null\n", dir_exten,
+ dir_domain);
goto cleanup;
}
break;
@@ -325,8 +320,7 @@
case XML_LDAP_PHRASE:
break;
}
- }
- else {
+ } else {
goto cleanup;
}
}
@@ -359,7 +353,7 @@
goto cleanup;
}
-cleanup:
+ cleanup:
if (ldap->msg) {
ldap_msgfree(ldap->msg);
}
@@ -409,28 +403,25 @@
if (val) {
binding->queryfmt = strdup(val);
}
- }
- else if (!strcasecmp(var, "base")) {
+ } else if (!strcasecmp(var, "base")) {
binding->ldap_base = strdup(val);
- }
- else if (!strcasecmp(var, "binddn")) {
+ } else if (!strcasecmp(var, "binddn")) {
binding->binddn = strdup(val);
- }
- else if (!strcasecmp(var, "bindpass")) {
+ } else if (!strcasecmp(var, "bindpass")) {
binding->bindpass = strdup(val);
- }
- else if (!strcasecmp(var, "host")) {
+ } else if (!strcasecmp(var, "host")) {
binding->host = strdup(val);
}
}
if (!binding->ldap_base || !binding->binddn || !binding->bindpass || !binding->queryfmt) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must define \"base\", \"binddn\", \"bindpass\", and \"queryfmt\" in mod_xml_ldap.conf.xml\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ "You must define \"base\", \"binddn\", \"bindpass\", and \"queryfmt\" in mod_xml_ldap.conf.xml\n");
continue;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->ldap_base, binding->bindings ? binding->bindings : "all");
+ switch_strlen_zero(bname) ? "N/A" : bname, binding->ldap_base, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
@@ -438,7 +429,7 @@
binding = NULL;
}
-done:
+ done:
switch_xml_free(xml);
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Tue May 27 07:24:06 2008
@@ -50,7 +50,7 @@
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime);
SWITCH_MODULE_DEFINITION(mod_xml_rpc, mod_xml_rpc_load, mod_xml_rpc_shutdown, mod_xml_rpc_runtime);
-static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len);
+static abyss_bool HTTPWrite(TSession * s, char *buffer, uint32_t len);
static struct {
uint16_t port;
@@ -124,8 +124,8 @@
{
TSession *r = handle->data;
- return HTTPWrite(r, (char *)data, (uint32_t) datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
-
+ return HTTPWrite(r, (char *) data, (uint32_t) datalen) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+
}
static switch_status_t http_stream_write(switch_stream_handle_t *handle, const char *fmt, ...)
@@ -148,11 +148,11 @@
return ret ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
}
-static abyss_bool http_directory_auth(TSession *r, char *domain_name)
+static abyss_bool http_directory_auth(TSession * r, char *domain_name)
{
- char *p;
+ char *p;
char *x;
- char z[256], t[80];
+ char z[256], t[80];
char user[512];
char *pass;
const char *mypass1 = NULL, *mypass2 = NULL;
@@ -161,27 +161,27 @@
int at = 0;
switch_event_t *params = NULL;
- p = RequestHeaderValue(r, "authorization");
+ p = RequestHeaderValue(r, "authorization");
- if (p) {
- NextToken((const char ** const)&p);
- x = GetToken(&p);
- if (x) {
- if (!strcasecmp(x, "basic")) {
+ if (p) {
+ NextToken((const char **const) &p);
+ x = GetToken(&p);
+ if (x) {
+ if (!strcasecmp(x, "basic")) {
- NextToken((const char ** const)&p);
+ NextToken((const char **const) &p);
switch_b64_decode(p, user, sizeof(user));
if ((pass = strchr(user, ':'))) {
*pass++ = '\0';
}
-
+
if (!domain_name) {
if ((domain_name = strchr(user, '@'))) {
*domain_name++ = '\0';
at++;
} else {
- domain_name = (char *)r->requestInfo.host;
+ domain_name = (char *) r->requestInfo.host;
if (!strncasecmp(domain_name, "www.", 3)) {
domain_name += 4;
}
@@ -191,15 +191,15 @@
if (!domain_name) {
goto fail;
}
-
+
switch_snprintf(z, sizeof(z), "%s:%s", globals.user, globals.pass);
Base64Encode(z, t);
-
+
if (!strcmp(p, t)) {
- r->requestInfo.user=strdup(user);
+ r->requestInfo.user = strdup(user);
goto authed;
}
-
+
switch_event_create(¶ms, SWITCH_EVENT_MESSAGE);
switch_assert(params);
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", "check");
@@ -209,41 +209,41 @@
goto fail;
}
- switch_event_destroy(¶ms);
+ switch_event_destroy(¶ms);
box = switch_xml_attr_soft(x_user, "mailbox");
-
- for (x_param = switch_xml_child(x_domain, "param"); x_param; x_param = x_param->next) {
- const char *var = switch_xml_attr_soft(x_param, "name");
- const char *val = switch_xml_attr_soft(x_param, "value");
-
- if (!strcasecmp(var, "password")) {
- mypass1 = val;
- } else if (!strcasecmp(var, "vm-password")) {
- mypass2 = val;
- } else if (!strncasecmp(var, "http-", 5)) {
- ResponseAddField(r, (char *)var, (char *)val);
- }
+
+ for (x_param = switch_xml_child(x_domain, "param"); x_param; x_param = x_param->next) {
+ const char *var = switch_xml_attr_soft(x_param, "name");
+ const char *val = switch_xml_attr_soft(x_param, "value");
+
+ if (!strcasecmp(var, "password")) {
+ mypass1 = val;
+ } else if (!strcasecmp(var, "vm-password")) {
+ mypass2 = val;
+ } else if (!strncasecmp(var, "http-", 5)) {
+ ResponseAddField(r, (char *) var, (char *) val);
+ }
}
if (!(x_params = switch_xml_child(x_user, "params"))) {
goto authed;
- }
-
- for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
- const char *var = switch_xml_attr_soft(x_param, "name");
- const char *val = switch_xml_attr_soft(x_param, "value");
-
- if (!strcasecmp(var, "password")) {
- mypass1 = val;
- } else if (!strcasecmp(var, "vm-password")) {
- mypass2 = val;
- } else if (!strncasecmp(var, "http-", 5)) {
- ResponseAddField(r, (char *)var, (char *)val);
- }
}
-
+
+ for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+ const char *var = switch_xml_attr_soft(x_param, "name");
+ const char *val = switch_xml_attr_soft(x_param, "value");
+
+ if (!strcasecmp(var, "password")) {
+ mypass1 = val;
+ } else if (!strcasecmp(var, "vm-password")) {
+ mypass2 = val;
+ } else if (!strncasecmp(var, "http-", 5)) {
+ ResponseAddField(r, (char *) var, (char *) val);
+ }
+ }
+
if (!(mypass1 && mypass2)) {
- r->requestInfo.user=strdup(user);
+ r->requestInfo.user = strdup(user);
goto authed;
} else {
if (mypass1) {
@@ -253,9 +253,9 @@
switch_snprintf(z, sizeof(z), "%s:%s", user, mypass1);
}
Base64Encode(z, t);
-
+
if (!strcmp(p, t)) {
- r->requestInfo.user=strdup(box ? box : user);
+ r->requestInfo.user = strdup(box ? box : user);
goto authed;
}
}
@@ -267,9 +267,9 @@
switch_snprintf(z, sizeof(z), "%s:%s", user, mypass2);
}
Base64Encode(z, t);
-
+
if (!strcmp(p, t)) {
- r->requestInfo.user=strdup(box ? box : user);
+ r->requestInfo.user = strdup(box ? box : user);
goto authed;
}
}
@@ -282,13 +282,13 @@
switch_snprintf(z, sizeof(z), "%s:%s", box, mypass1);
}
Base64Encode(z, t);
-
+
if (!strcmp(p, t)) {
- r->requestInfo.user=strdup(box);
+ r->requestInfo.user = strdup(box);
goto authed;
}
}
-
+
if (mypass2) {
if (at) {
switch_snprintf(z, sizeof(z), "%s@%s:%s", box, domain_name, mypass2);
@@ -297,9 +297,9 @@
}
Base64Encode(z, t);
-
+
if (!strcmp(p, t)) {
- r->requestInfo.user=strdup(box);
+ r->requestInfo.user = strdup(box);
goto authed;
}
}
@@ -307,30 +307,30 @@
}
goto fail;
- authed:
-
+ authed:
+
ResponseAddField(r, "freeswitch-user", r->requestInfo.user);
ResponseAddField(r, "freeswitch-domain", domain_name);
-
+
if (x_domain_root) {
switch_xml_free(x_domain_root);
}
-
+
return TRUE;
- }
- }
- }
+ }
+ }
+ }
- fail:
+ fail:
if (x_domain_root) {
switch_xml_free(x_domain_root);
}
- switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
- ResponseAddField(r, "WWW-Authenticate", z);
- ResponseStatus(r, 401);
- return FALSE;
+ switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
+ ResponseAddField(r, "WWW-Authenticate", z);
+ ResponseStatus(r, 401);
+ return FALSE;
}
abyss_bool auth_hook(TSession * r)
@@ -341,7 +341,7 @@
if (!strncmp(r->requestInfo.uri, "/domains/", 9)) {
domain_name = strdup(r->requestInfo.uri + 9);
switch_assert(domain_name);
-
+
if ((e = strchr(domain_name, '/'))) {
*e++ = '\0';
}
@@ -356,36 +356,27 @@
free(domain_name);
} else {
char tmp[512];
- const char *list[2] = {"index.html", "index.txt"};
+ const char *list[2] = { "index.html", "index.txt" };
int x;
if (!strncmp(r->requestInfo.uri, "/pub", 4)) {
- char *p = (char *)r->requestInfo.uri;
+ char *p = (char *) r->requestInfo.uri;
char *new_uri = p + 4;
if (!new_uri) {
new_uri = "/";
}
- switch_snprintf(tmp, sizeof(tmp), "%s%s",
- SWITCH_GLOBAL_dirs.htdocs_dir,
- new_uri
- );
+ switch_snprintf(tmp, sizeof(tmp), "%s%s", SWITCH_GLOBAL_dirs.htdocs_dir, new_uri);
if (switch_directory_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
for (x = 0; x < 2; x++) {
- switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s",
- SWITCH_GLOBAL_dirs.htdocs_dir,
- new_uri,
- end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR,
- list[x]
- );
-
+ switch_snprintf(tmp, sizeof(tmp), "%s%s%s%s",
+ SWITCH_GLOBAL_dirs.htdocs_dir, new_uri, end_of(new_uri) == *SWITCH_PATH_SEPARATOR ? "" : SWITCH_PATH_SEPARATOR, list[x]
+ );
+
if (switch_file_exists(tmp, NULL) == SWITCH_STATUS_SUCCESS) {
- switch_snprintf(tmp, sizeof(tmp), "%s%s%s",
- new_uri,
- end_of(new_uri) == '/' ? "" : "/",
- list[x]
- );
+ switch_snprintf(tmp, sizeof(tmp), "%s%s%s", new_uri, end_of(new_uri) == '/' ? "" : "/", list[x]
+ );
new_uri = tmp;
break;
}
@@ -405,36 +396,34 @@
}
-static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len)
+static abyss_bool HTTPWrite(TSession * s, char *buffer, uint32_t len)
{
- if (s->chunkedwrite && s->chunkedwritemode)
- {
- char t[16];
+ if (s->chunkedwrite && s->chunkedwritemode) {
+ char t[16];
- if (ConnWrite(s->conn,t,sprintf(t,"%x"CRLF,len)))
- if (ConnWrite(s->conn,buffer,len))
- return ConnWrite(s->conn,CRLF,2);
+ if (ConnWrite(s->conn, t, sprintf(t, "%x" CRLF, len)))
+ if (ConnWrite(s->conn, buffer, len))
+ return ConnWrite(s->conn, CRLF, 2);
- return FALSE;
- }
+ return FALSE;
+ }
- return ConnWrite(s->conn,buffer,len);
+ return ConnWrite(s->conn, buffer, len);
}
-static abyss_bool HTTPWriteEnd(TSession *s)
+static abyss_bool HTTPWriteEnd(TSession * s)
{
- if (!s->chunkedwritemode)
- return TRUE;
+ if (!s->chunkedwritemode)
+ return TRUE;
- if (s->chunkedwrite)
- {
- /* May be one day trailer dumping will be added */
- s->chunkedwritemode=FALSE;
- return ConnWrite(s->conn,"0"CRLF CRLF,5);
- }
+ if (s->chunkedwrite) {
+ /* May be one day trailer dumping will be added */
+ s->chunkedwritemode = FALSE;
+ return ConnWrite(s->conn, "0" CRLF CRLF, 5);
+ }
- s->requestInfo.keepalive=FALSE;
- return TRUE;
+ s->requestInfo.keepalive = FALSE;
+ return TRUE;
}
abyss_bool handler_hook(TSession * r)
@@ -473,8 +462,8 @@
*path_info++ = '\0';
}
- for (i=0;i<r->response_headers.size;i++) {
- ti=&r->response_headers.item[i];
+ for (i = 0; i < r->response_headers.size; i++) {
+ ti = &r->response_headers.item[i];
if (!strcasecmp(ti->name, "freeswitch-user")) {
fs_user = ti->value;
} else if (!strcasecmp(ti->name, "freeswitch-domain")) {
@@ -483,14 +472,14 @@
int argc, x;
char *argv[256] = { 0 };
j++;
-
+
if (!strcasecmp(ti->value, "any")) {
auth++;
}
dup = strdup(ti->value);
argc = switch_separate_string(dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-
+
for (x = 0; x < argc; x++) {
if (!strcasecmp(command, argv[x])) {
auth++;
@@ -504,13 +493,12 @@
} else {
if (!j) {
auth = 0;
- }
+ }
}
-
+
if (auth) {
goto auth;
}
-
//unauth:
ResponseStatus(r, 403);
ResponseError(r);
@@ -519,11 +507,11 @@
ret = TRUE;
goto end;
- auth:
+ auth:
if (switch_event_create(&stream.param_event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
- const char * const content_length = RequestHeaderValue(r, "content-length");
-
+ const char *const content_length = RequestHeaderValue(r, "content-length");
+
if (fs_user)
switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
if (fs_domain)
@@ -550,14 +538,14 @@
if (r->requestInfo.query || content_length) {
char *q, *qd;
char *next;
- char *query = (char *)r->requestInfo.query;
+ char *query = (char *) r->requestInfo.query;
char *name, *val;
char qbuf[8192] = "";
-
+
if (r->requestInfo.method == m_post && content_length) {
int len = atoi(content_length);
int qlen = 0;
-
+
if (len > 0) {
int succeeded;
char *qp = qbuf;
@@ -569,11 +557,11 @@
}
qlen += blen;
-
- if ( qlen > sizeof(qbuf) ) {
+
+ if (qlen > sizeof(qbuf)) {
break;
}
-
+
memcpy(qp, r->conn->buffer + r->conn->bufferpos, blen);
qp += blen;
@@ -581,7 +569,7 @@
break;
}
} while ((succeeded = ConnRead(r->conn, 2000)));
-
+
query = qbuf;
}
}
@@ -616,14 +604,13 @@
}
q = next;
} while (q != NULL);
-
+
free(qd);
}
}
}
-
//ResponseChunked(r);
-
+
//ResponseContentType(r, mime);
//ResponseWrite(r);
@@ -633,7 +620,7 @@
/* generation of the date field */
{
- const char * dateValue;
+ const char *dateValue;
DateToString(r->date, &dateValue);
@@ -642,25 +629,25 @@
}
}
-
+
/* Generation of the server field */
- ResponseAddField(r,"Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
+ ResponseAddField(r, "Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
if (html) {
ResponseAddField(r, "Content-Type", "text/html");
}
- for (i=0;i<r->response_headers.size;i++) {
- ti=&r->response_headers.item[i];
- ConnWrite(r->conn, ti->name, (uint32_t)strlen(ti->name));
- ConnWrite(r->conn,": ",2);
- ConnWrite(r->conn, ti->value, (uint32_t)strlen(ti->value));
- ConnWrite(r->conn,CRLF,2);
+ for (i = 0; i < r->response_headers.size; i++) {
+ ti = &r->response_headers.item[i];
+ ConnWrite(r->conn, ti->name, (uint32_t) strlen(ti->name));
+ ConnWrite(r->conn, ": ", 2);
+ ConnWrite(r->conn, ti->value, (uint32_t) strlen(ti->value));
+ ConnWrite(r->conn, CRLF, 2);
}
-
+
switch_snprintf(buf, sizeof(buf), "Connection: close\r\n");
ConnWrite(r->conn, buf, (uint32_t) strlen(buf));
-
+
if (html) {
ConnWrite(r->conn, "\r\n", 2);
}
@@ -673,10 +660,10 @@
} else {
ResponseStatus(r, 404);
ResponseError(r);
- }
-
+ }
+
//SocketClose(&(r->conn->socket));
-
+
HTTPWriteEnd(r);
//if(r->conn->channelP)
//ConnKill(r->conn);
@@ -685,7 +672,7 @@
//ChannelDestroy(r->conn->channelP);
r->requestInfo.keepalive = 0;
- end:
+ end:
return ret;
}
@@ -712,7 +699,7 @@
val = xmlrpc_build_value(envP, "s", "ERROR!");
}
- done:
+ done:
/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
switch_safe_free(command);
switch_safe_free(arg);
@@ -767,7 +754,7 @@
/* Return our result. */
val = xmlrpc_build_value(envP, "s", buf);
- done:
+ done:
/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
switch_safe_free(oid);
switch_safe_free(s_action);
@@ -797,7 +784,7 @@
MIMETypeInit();
MIMETypeAdd("text/html", "html");
- for(hi = switch_core_mime_index(); hi; hi = switch_hash_next(hi)) {
+ for (hi = switch_core_mime_index(); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
if (var && val) {
MIMETypeAdd((char *) val, (char *) var);
@@ -833,10 +820,10 @@
//globals.abyssServer.running = 0;
//shutdown(globals.abyssServer.listensock, 2);
ServerTerminate(&globals.abyssServer);
- while(globals.running) {
+ while (globals.running) {
switch_yield(100000);
}
-
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c Tue May 27 07:24:06 2008
@@ -213,10 +213,10 @@
char *usageDesc;
int alt_dirs = 0;
int known_opt;
- int high_prio = 0;
+ int high_prio = 0;
switch_core_flag_t flags = SCF_USE_SQL;
int ret;
- switch_file_t *fd;
+ switch_file_t *fd;
switch_memory_pool_t *pool = NULL;
usageDesc = "these are the optional arguments you can pass to freeswitch\n"
@@ -505,7 +505,7 @@
}
switch_core_setrlimits();
-
+
#ifndef WIN32
if (runas_user || runas_group) {
if (change_user_group(runas_user, runas_group) < 0) {
@@ -526,12 +526,12 @@
apr_pool_create(&pool, NULL);
if (switch_file_open(&fd,
- pid_path,
- SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE,
- SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE,
- pool) != SWITCH_STATUS_SUCCESS) {
- fprintf(stderr, "Cannot open pid file %s.\n", pid_path);
- return 255;
+ pid_path,
+ SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE,
+ SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE,
+ pool) != SWITCH_STATUS_SUCCESS) {
+ fprintf(stderr, "Cannot open pid file %s.\n", pid_path);
+ return 255;
}
if (switch_file_lock(fd, SWITCH_FLOCK_EXCLUSIVE | SWITCH_FLOCK_NONBLOCK) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_apr.c Tue May 27 07:24:06 2008
@@ -80,29 +80,29 @@
/* DSO functions */
-SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx)
+SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx)
{
return apr_dso_load(res_handle, path, ctx);
}
-SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t * handle)
+SWITCH_DECLARE(switch_status_t) switch_dso_unload(switch_dso_handle_t *handle)
{
return apr_dso_unload(handle);
}
-SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t * ressym, switch_dso_handle_t * handle, const char *symname)
+SWITCH_DECLARE(switch_status_t) switch_dso_sym(switch_dso_handle_sym_t *ressym, switch_dso_handle_t *handle, const char *symname)
{
return apr_dso_sym(ressym, handle, symname);
}
-SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t * dso, char *buf, size_t bufsize)
+SWITCH_DECLARE(const char *) switch_dso_error(switch_dso_handle_t *dso, char *buf, size_t bufsize)
{
return apr_dso_error(dso, buf, bufsize);
}
/* string functions */
-SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t * tm)
+SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
{
return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
}
@@ -124,7 +124,8 @@
SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
{
- if (!dst) return NULL;
+ if (!dst)
+ return NULL;
if (!src) {
*dst = '\0';
return dst;
@@ -134,69 +135,69 @@
/* thread read write lock functions */
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool)
{
return apr_thread_rwlock_create(rwlock, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_destroy(rwlock);
}
-SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_pool_get(rwlock);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_rdlock(rwlock);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_tryrdlock(rwlock);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_wrlock(rwlock);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_trywrlock(rwlock);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t * rwlock)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
{
return apr_thread_rwlock_unlock(rwlock);
}
/* thread mutex functions */
-SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
{
return apr_thread_mutex_create(lock, flags, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t * lock)
+SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock)
{
return apr_thread_mutex_destroy(lock);
}
-SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t * lock)
+SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock)
{
return apr_thread_mutex_lock(lock);
}
-SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t * lock)
+SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock)
{
return apr_thread_mutex_unlock(lock);
}
-SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t * lock)
+SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock)
{
return apr_thread_mutex_trylock(lock);
}
@@ -207,29 +208,29 @@
{
#if defined(HAVE_CLOCK_GETTIME) && defined(SWITCH_USE_CLOCK_FUNCS)
struct timespec ts;
- clock_gettime(CLOCK_REALTIME,&ts);
- return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec/1000);
+ clock_gettime(CLOCK_REALTIME, &ts);
+ return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000);
#else
return (switch_time_t) apr_time_now();
#endif
}
-SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t * result, switch_time_exp_t * input)
+SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
{
return apr_time_exp_gmt_get(result, (apr_time_exp_t *) input);
}
-SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t * result, switch_time_exp_t * input)
+SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
{
return apr_time_exp_get(result, (apr_time_exp_t *) input);
}
-SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t * result, switch_time_t input)
+SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
{
return apr_time_exp_lt((apr_time_exp_t *) result, input);
}
-SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t * result, switch_time_t input)
+SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
{
return apr_time_exp_gmt((apr_time_exp_t *) result, input);
}
@@ -246,45 +247,45 @@
/* Thread condition locks */
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
{
return apr_thread_cond_create(cond, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t * cond, switch_mutex_t * mutex)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
{
return apr_thread_cond_wait(cond, mutex);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t * cond, switch_mutex_t * mutex, switch_interval_time_t timeout)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout)
{
return apr_thread_cond_timedwait(cond, mutex, timeout);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t * cond)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond)
{
return apr_thread_cond_signal(cond);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t * cond)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond)
{
return apr_thread_cond_broadcast(cond);
}
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t * cond)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond)
{
return apr_thread_cond_destroy(cond);
}
/* file i/o stubs */
-SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
+SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm,
switch_memory_pool_t *pool)
{
return apr_file_open(newf, fname, flag, perm, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t * thefile, switch_seek_where_t where, int64_t *offset)
+SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset)
{
apr_status_t rv;
apr_off_t off = (apr_off_t) (*offset);
@@ -293,12 +294,12 @@
return rv;
}
-SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t * thefile)
+SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile)
{
return apr_file_close(thefile);
}
-SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t * thefile, int type)
+SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type)
{
return apr_file_lock(thefile, type);
}
@@ -313,12 +314,12 @@
return apr_file_remove(path, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t * thefile, void *buf, switch_size_t *nbytes)
+SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes)
{
return apr_file_read(thefile, buf, nbytes);
}
-SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t * thefile, const void *buf, switch_size_t *nbytes)
+SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes)
{
return apr_file_write(thefile, buf, nbytes);
}
@@ -341,7 +342,7 @@
SWITCH_DECLARE(switch_size_t) switch_file_get_size(switch_file_t *thefile)
{
struct apr_finfo_t finfo;
- return apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t)finfo.size : 0;
+ return apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t) finfo.size : 0;
}
SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool)
@@ -380,7 +381,7 @@
if (filename) {
apr_stat(&info, filename, wanted, pool ? pool : our_pool);
if (info.filetype != APR_NOFILE) {
- status = SWITCH_STATUS_SUCCESS;
+ status = SWITCH_STATUS_SUCCESS;
}
}
@@ -391,15 +392,12 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm,
- switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
{
return apr_dir_make(path, perm, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path,
- switch_fileperms_t perm,
- switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
{
return apr_dir_make_recursive(path, perm, pool);
}
@@ -427,7 +425,7 @@
*new_dir = NULL;
}
- return status;
+ return status;
}
SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir)
@@ -438,7 +436,7 @@
return status;
}
-SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
+SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
{
const char *fname = NULL;
apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
@@ -471,25 +469,25 @@
/* thread stubs */
-SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
{
return apr_threadattr_create(new_attr, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t * attr, int32_t on)
+SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
{
return apr_threadattr_detach_set(attr, on);
}
-SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t * attr, switch_size_t stacksize)
+SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
{
return apr_threadattr_stacksize_set(attr, stacksize);
}
#ifndef WIN32
struct apr_threadattr_t {
- apr_pool_t *pool;
- pthread_attr_t attr;
+ apr_pool_t *pool;
+ pthread_attr_t attr;
};
#endif
@@ -497,23 +495,22 @@
{
int stat = 0;
#ifndef WIN32
- struct sched_param param;
+ struct sched_param param;
struct apr_threadattr_t *myattr = attr;
pthread_attr_getschedparam(&myattr->attr, ¶m);
param.sched_priority = 50;
stat = pthread_attr_setschedparam(&myattr->attr, ¶m);
- if (stat == 0) {
- return SWITCH_STATUS_SUCCESS;
- }
-
+ if (stat == 0) {
+ return SWITCH_STATUS_SUCCESS;
+ }
#endif
- return stat;
+ return stat;
}
-SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t * attr,
+SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr,
switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
{
return apr_thread_create(new_thread, attr, func, data, cont);
@@ -526,42 +523,42 @@
return apr_socket_addr_get(sa, remote, sock);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
{
return apr_socket_create(new_sock, family, type, protocol, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t * sock, switch_shutdown_how_e how)
+SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
{
- return apr_socket_shutdown(sock, (apr_shutdown_how_e)how);
+ return apr_socket_shutdown(sock, (apr_shutdown_how_e) how);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t * sock)
+SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock)
{
return apr_socket_close(sock);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t * sock, switch_sockaddr_t * sa)
+SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
{
return apr_socket_bind(sock, sa);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t * sock, int32_t backlog)
+SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog)
{
return apr_socket_listen(sock, backlog);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t * sock, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
{
return apr_socket_accept(new_sock, sock, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t * sock, switch_sockaddr_t * sa)
+SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa)
{
return apr_socket_connect(sock, sa);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t * sock, const char *buf, switch_size_t *len)
+SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len)
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_size_t req = *len, wrote = 0, need = *len;
@@ -585,7 +582,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t * sock, switch_sockaddr_t * where, int32_t flags, const char *buf, switch_size_t *len)
+SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len)
{
if (!where || !buf || !len || !*len) {
return SWITCH_STATUS_GENERR;
@@ -593,33 +590,33 @@
return apr_socket_sendto(sock, where, flags, buf, len);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t * sock, char *buf, switch_size_t *len)
+SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
{
return apr_socket_recv(sock, buf, len);
}
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family,
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family,
switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
{
return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t * sock, int32_t opt, int32_t on)
+SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int32_t opt, int32_t on)
{
return apr_socket_opt_set(sock, opt, on);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t * sock, switch_interval_time_t t)
+SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t)
{
return apr_socket_timeout_set(sock, t);
}
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t * sa)
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa)
{
return apr_sockaddr_ip_get(addr, sa);
}
-SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t * sock, switch_sockaddr_t * join, switch_sockaddr_t * iface, switch_sockaddr_t * source)
+SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source)
{
return apr_mcast_join(sock, join, iface, source);
}
@@ -627,7 +624,7 @@
/* socket functions */
-SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t * in)
+SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switch_sockaddr_t *in)
{
if (!in) {
return "";
@@ -635,52 +632,52 @@
return get_addr(buf, len, &in->sa.sin.sin_addr);
}
-SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t * sa)
+SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
{
return sa->port;
}
-SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t * sa)
+SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa)
{
return sa->family;
}
-SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t * from, switch_socket_t * sock, int32_t flags, char *buf, size_t *len)
+SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
{
apr_status_t r;
if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
from->port = ntohs(from->sa.sin.sin_port);
/* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
- * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
- */
+ * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
+ */
+ }
+
+ if (r == 35) {
+ r = SWITCH_STATUS_BREAK;
}
-
- if (r == 35 ) {
- r = SWITCH_STATUS_BREAK;
- }
return r;
}
/* poll stubs */
-SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags)
+SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags)
{
return apr_pollset_create(pollset, size, p, flags);
}
-SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t * pollset, const switch_pollfd_t * descriptor)
+SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
{
return apr_pollset_add(pollset, descriptor);
}
-SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t * aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
+SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
{
return apr_poll(aprset, numsock, nsds, timeout);
}
-SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t * sock, int16_t flags, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)
{
switch_pollset_t *pollset;
@@ -713,39 +710,39 @@
/* UUID Handling (apr-util) */
-SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t * uuid)
+SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
{
apr_uuid_format(buffer, (const apr_uuid_t *) uuid);
}
-SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t * uuid)
+SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
{
apr_uuid_get((apr_uuid_t *) uuid);
}
-SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t * uuid, const char *uuid_str)
+SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str)
{
return apr_uuid_parse((apr_uuid_t *) uuid, uuid_str);
}
/* FIFO queues (apr-util) */
-SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
{
return apr_queue_create(queue, queue_capacity, pool);
}
-SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t * queue)
+SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue)
{
return apr_queue_size(queue);
}
-SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t * queue, void **data)
+SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data)
{
return apr_queue_pop(queue, data);
}
-SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t * queue, void *data)
+SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data)
{
apr_status_t s;
@@ -756,12 +753,12 @@
return s;
}
-SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t * queue, void **data)
+SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data)
{
return apr_queue_trypop(queue, data);
}
-SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t * queue, void *data)
+SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data)
{
apr_status_t s;
@@ -810,9 +807,9 @@
SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p)
{
- return apr_match_glob(pattern, (apr_array_header_t **)result, p);
+ return apr_match_glob(pattern, (apr_array_header_t **) result, p);
}
-
+
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_buffer.c Tue May 27 07:24:06 2008
@@ -280,7 +280,7 @@
SWITCH_DECLARE(void) switch_buffer_destroy(switch_buffer_t **buffer)
{
- if (buffer && *buffer) {
+ if (buffer && *buffer) {
if ((switch_test_flag((*buffer), SWITCH_BUFFER_FLAG_DYNAMIC))) {
switch_safe_free((*buffer)->data);
free(*buffer);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_caller.c Tue May 27 07:24:06 2008
@@ -44,16 +44,14 @@
const char *network_addr,
const char *ani,
const char *aniii,
- const char *rdnis,
- const char *source,
- const char *context,
- const char *destination_number)
+ const char *rdnis,
+ const char *source, const char *context, const char *destination_number)
{
switch_caller_profile_t *profile = NULL;
profile = switch_core_alloc(pool, sizeof(*profile));
switch_assert(profile != NULL);
-
+
if (!context) {
context = "default";
}
@@ -276,7 +274,8 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
}
-SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name, const char *extension_number)
+SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name,
+ const char *extension_number)
{
switch_caller_extension_t *caller_extension = NULL;
@@ -290,7 +289,8 @@
}
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session,
- switch_caller_extension_t *caller_extension, const char *application_name, const char *application_data)
+ switch_caller_extension_t *caller_extension, const char *application_name,
+ const char *application_data)
{
switch_caller_application_t *caller_application = NULL;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c Tue May 27 07:24:06 2008
@@ -130,7 +130,7 @@
uint8_t x;
const char *str = "UNKNOWN";
- for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) -1 ; x++) {
+ for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) - 1; x++) {
if (CAUSE_CHART[x].cause == cause) {
str = CAUSE_CHART[x].name;
break;
@@ -214,12 +214,12 @@
switch_status_t status;
void *pop;
switch_dtmf_t new_dtmf;
-
+
switch_assert(dtmf);
- switch_mutex_lock(channel->dtmf_mutex);
+ switch_mutex_lock(channel->dtmf_mutex);
new_dtmf = *dtmf;
-
+
if ((status = switch_core_session_recv_dtmf(channel->session, dtmf) != SWITCH_STATUS_SUCCESS)) {
goto done;
}
@@ -229,13 +229,13 @@
int x = 0;
if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(channel), new_dtmf.digit, new_dtmf.duration);
new_dtmf.duration = switch_core_max_dtmf_duration(0);
} else if (!new_dtmf.duration) {
new_dtmf.duration = switch_core_default_dtmf_duration(0);
}
-
+
switch_zmalloc(dt, sizeof(*dt));
*dt = new_dtmf;
@@ -251,7 +251,7 @@
status = SWITCH_STATUS_SUCCESS;
-done:
+ done:
switch_mutex_unlock(channel->dtmf_mutex);
@@ -261,7 +261,7 @@
SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_t *channel, const char *dtmf_string)
{
char *p;
- switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
+ switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
int sent = 0, dur;
char *string;
int i, argc;
@@ -274,7 +274,7 @@
string = switch_core_session_strdup(channel->session, dtmf_string);
argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0])));
- for(i = 0; i < argc; i++) {
+ for (i = 0; i < argc; i++) {
dtmf.duration = switch_core_default_dtmf_duration(0);
dur = switch_core_default_dtmf_duration(0) / 8;
if ((p = strchr(argv[i], '@'))) {
@@ -297,7 +297,7 @@
dtmf.digit = *p;
if (switch_channel_queue_dtmf(channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Queue dtmf\ndigit=%c ms=%u samples=%u\n",
- switch_channel_get_name(channel), dtmf.digit, dur, dtmf.duration);
+ switch_channel_get_name(channel), dtmf.digit, dur, dtmf.duration);
sent++;
}
}
@@ -323,7 +323,7 @@
free(dt);
if (dtmf->duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(channel), dtmf->digit, dtmf->duration);
dtmf->duration = switch_core_max_dtmf_duration(0);
} else if (!dtmf->duration) {
@@ -347,11 +347,11 @@
SWITCH_DECLARE(switch_size_t) switch_channel_dequeue_dtmf_string(switch_channel_t *channel, char *dtmf_str, switch_size_t len)
{
switch_size_t x = 0;
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
memset(dtmf_str, 0, len);
- while(x < len - 1 && switch_channel_dequeue_dtmf(channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
+ while (x < len - 1 && switch_channel_dequeue_dtmf(channel, &dtmf) == SWITCH_STATUS_SUCCESS) {
dtmf_str[x++] = dtmf.digit;
}
@@ -363,7 +363,7 @@
{
void *pop;
switch_mutex_lock(channel->dtmf_mutex);
- while(switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+ while (switch_queue_trypop(channel->dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_safe_free(pop);
}
switch_mutex_unlock(channel->dtmf_mutex);
@@ -426,7 +426,7 @@
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- if (!channel->variables || !(v = switch_event_get_header(channel->variables, (char*)varname))) {
+ if (!channel->variables || !(v = switch_event_get_header(channel->variables, (char *) varname))) {
switch_caller_profile_t *cp = channel->caller_profile;
if (cp) {
@@ -551,7 +551,7 @@
switch_event_del_header(channel->variables, varname);
if (!switch_strlen_zero(value)) {
switch_event_add_header(channel->variables, SWITCH_STACK_BOTTOM, varname, "%s", value);
- }
+ }
switch_mutex_unlock(channel->profile_mutex);
return SWITCH_STATUS_SUCCESS;
}
@@ -634,7 +634,7 @@
switch_channel_state_t state, mystate, ostate;
ostate = switch_channel_get_state(channel);
- for(;;) {
+ for (;;) {
state = switch_channel_get_running_state(other_channel);
mystate = switch_channel_get_running_state(channel);
@@ -652,7 +652,7 @@
to++;
}
- for(;;) {
+ for (;;) {
if (pres) {
if (switch_test_flag(channel, want_flag)) {
break;
@@ -723,9 +723,9 @@
switch_assert(channel != NULL);
- if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
+ if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
!switch_test_flag(channel, CF_TRANSFER)) {
- ret++;
+ ret++;
}
return ret;
@@ -769,8 +769,7 @@
const char *file, const char *func, int line)
{
switch_mutex_lock(channel->flag_mutex);
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s Running State Change %s\n",
- channel->name, state_names[state]);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s Running State Change %s\n", channel->name, state_names[state]);
channel->running_state = state;
if (channel->state_flags) {
@@ -797,7 +796,8 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%s", (char *) state_num);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Name", "%s", channel->name);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Unique-ID", "%s", switch_core_session_get_uuid(channel->session));
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s", switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Call-Direction", "%s",
+ switch_channel_test_flag(channel, CF_OUTBOUND) ? "outbound" : "inbound");
if (switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered");
} else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
@@ -837,172 +837,172 @@
}
/* STUB for more dev
- case CS_INIT:
- switch(state) {
+ case CS_INIT:
+ switch(state) {
+ case CS_NEW:
+ case CS_INIT:
+ case CS_EXCHANGE_MEDIA:
+ case CS_SOFT_EXECUTE:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_HANGUP:
+ case CS_DONE:
+
+ default:
+ break;
+ }
+ break;
+ */
+
+ switch (last_state) {
case CS_NEW:
+ case CS_RESET:
+ switch (state) {
+ default:
+ ok++;
+ break;
+ }
+ break;
+
case CS_INIT:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_SOFT_EXECUTE:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_EXCHANGE_MEDIA:
+ switch (state) {
+ case CS_SOFT_EXECUTE:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_SOFT_EXECUTE:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
+ case CS_PARK:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_SOFT_EXECUTE:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ case CS_CONSUME_MEDIA:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
+ case CS_CONSUME_MEDIA:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_SOFT_EXECUTE:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ case CS_PARK:
+ ok++;
+ default:
+ break;
+ }
+ break;
+ case CS_HIBERNATE:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_INIT:
+ case CS_ROUTING:
+ case CS_EXECUTE:
+ case CS_SOFT_EXECUTE:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_ROUTING:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_EXECUTE:
+ case CS_SOFT_EXECUTE:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_EXECUTE:
+ switch (state) {
+ case CS_EXCHANGE_MEDIA:
+ case CS_SOFT_EXECUTE:
+ case CS_ROUTING:
+ case CS_PARK:
+ case CS_CONSUME_MEDIA:
+ case CS_HIBERNATE:
+ case CS_RESET:
+ ok++;
+ default:
+ break;
+ }
+ break;
+
case CS_HANGUP:
- case CS_DONE:
+ switch (state) {
+ case CS_DONE:
+ ok++;
+ default:
+ break;
+ }
+ break;
default:
- break;
- }
- break;
- */
-
- switch (last_state) {
-case CS_NEW:
-case CS_RESET:
- switch (state) {
-default:
- ok++;
- break;
- }
- break;
-
-case CS_INIT:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_SOFT_EXECUTE:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_HIBERNATE:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_EXCHANGE_MEDIA:
- switch (state) {
-case CS_SOFT_EXECUTE:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_HIBERNATE:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_SOFT_EXECUTE:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_HIBERNATE:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_PARK:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_SOFT_EXECUTE:
-case CS_HIBERNATE:
-case CS_RESET:
-case CS_CONSUME_MEDIA:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_CONSUME_MEDIA:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_SOFT_EXECUTE:
-case CS_HIBERNATE:
-case CS_RESET:
-case CS_PARK:
- ok++;
-default:
- break;
- }
- break;
-case CS_HIBERNATE:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_INIT:
-case CS_ROUTING:
-case CS_EXECUTE:
-case CS_SOFT_EXECUTE:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_ROUTING:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_EXECUTE:
-case CS_SOFT_EXECUTE:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_HIBERNATE:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_EXECUTE:
- switch (state) {
-case CS_EXCHANGE_MEDIA:
-case CS_SOFT_EXECUTE:
-case CS_ROUTING:
-case CS_PARK:
-case CS_CONSUME_MEDIA:
-case CS_HIBERNATE:
-case CS_RESET:
- ok++;
-default:
- break;
- }
- break;
-
-case CS_HANGUP:
- switch (state) {
-case CS_DONE:
- ok++;
-default:
- break;
- }
- break;
-
-default:
- break;
+ break;
}
if (ok) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, "%s State Change %s -> %s\n",
- channel->name, state_names[last_state], state_names[state]);
+ channel->name, state_names[last_state], state_names[state]);
switch_mutex_lock(channel->flag_mutex);
channel->state = state;
switch_mutex_unlock(channel->flag_mutex);
@@ -1016,12 +1016,12 @@
}
} else {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING,
- "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]);
+ "%s Invalid State Change %s -> %s\n", channel->name, state_names[last_state], state_names[state]);
/* we won't tolerate an invalid state change so we can make sure we are as robust as a nice cup of dark coffee! */
/* not cool lets crash this bad boy and figure out wtf is going on */
switch_assert(channel->state >= CS_HANGUP);
}
-done:
+ done:
switch_mutex_unlock(channel->flag_mutex);
return channel->state;
@@ -1081,7 +1081,7 @@
/* Index Originator's Profile */
if (originator_caller_profile) {
switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event);
- } else if (originatee_caller_profile) { /* Index Originatee's Profile */
+ } else if (originatee_caller_profile) { /* Index Originatee's Profile */
switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
}
}
@@ -1152,7 +1152,7 @@
caller_profile->next = channel->caller_profile;
channel->caller_profile = caller_profile;
caller_profile->profile_index = switch_core_sprintf(caller_profile->pool, "%d", ++channel->profile_index);
-
+
switch_mutex_unlock(channel->profile_mutex);
}
@@ -1190,7 +1190,7 @@
channel->caller_profile->originatee_caller_profile = caller_profile;
}
switch_assert(channel->caller_profile->originatee_caller_profile->next != channel->caller_profile->originatee_caller_profile);
- switch_mutex_unlock(channel->profile_mutex);
+ switch_mutex_unlock(channel->profile_mutex);
}
SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_profile(switch_channel_t *channel)
@@ -1249,7 +1249,7 @@
channel->state_handlers[index] = state_handler;
-end:
+ end:
switch_mutex_unlock(channel->flag_mutex);
return index;
}
@@ -1347,7 +1347,7 @@
channel->state = CS_HANGUP;
channel->hangup_cause = hangup_cause;
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
- channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
+ channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", "%s", switch_channel_cause2str(channel->hangup_cause));
switch_channel_event_set_data(channel, event);
@@ -1408,12 +1408,12 @@
}
/* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
- a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
- */
+ a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
+ */
if ((uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
- switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
- switch_core_session_rwunlock(other_session);
+ switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
+ switch_core_session_rwunlock(other_session);
}
return SWITCH_STATUS_SUCCESS;
}
@@ -1443,7 +1443,7 @@
msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
msg.from = channel->name;
status = switch_core_session_receive_message(channel->session, &msg);
-
+
if (status == SWITCH_STATUS_SUCCESS) {
switch_channel_perform_mark_pre_answered(channel, file, func, line);
} else {
@@ -1515,12 +1515,12 @@
}
/* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
- a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
- */
+ a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
+ */
if ((uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATOR_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
- switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
- switch_core_session_rwunlock(other_session);
+ switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
+ switch_core_session_rwunlock(other_session);
}
switch_channel_set_variable(channel, "endpoint_disposition", "ANSWER");
@@ -1588,16 +1588,16 @@
int nv = 0;
if (switch_strlen_zero(in)) {
- return (char *)in;
+ return (char *) in;
}
q = in;
- while(q && *q) {
+ while (q && *q) {
if (!(p = strchr(q, '$'))) {
break;
}
- if (*(p+1) != '{') {
+ if (*(p + 1) != '{') {
q = p + 1;
continue;
}
@@ -1607,10 +1607,10 @@
}
if (!nv) {
- return (char *)in;
+ return (char *) in;
}
-
+
nv = 0;
olen = strlen(in) + 1;
indup = strdup(in);
@@ -1633,8 +1633,8 @@
}
if (*p == '$' && !nv) {
- if (*(p+1)) {
- if (*(p+1) == '{') {
+ if (*(p + 1)) {
+ if (*(p + 1) == '{') {
vtype = 1;
} else {
nv = 1;
@@ -1686,12 +1686,12 @@
if ((vval = strchr(vname, '('))) {
e = vval - 1;
*vval++ = '\0';
- while(*e == ' ') {
+ while (*e == ' ') {
*e-- = '\0';
}
e = vval;
br = 1;
- while(e && *e) {
+ while (e && *e) {
if (*e == '(') {
br++;
} else if (br > 1 && *e == ')') {
@@ -1712,7 +1712,7 @@
int ooffset = 0;
char *ptr;
- if ((expanded = switch_channel_expand_variables(channel, (char *)vname)) == vname) {
+ if ((expanded = switch_channel_expand_variables(channel, (char *) vname)) == vname) {
expanded = NULL;
} else {
vname = expanded;
@@ -1735,12 +1735,12 @@
if (offset >= 0) {
sub_val += offset;
- } else if ((size_t)abs(offset) <= strlen(sub_val)) {
+ } else if ((size_t) abs(offset) <= strlen(sub_val)) {
sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
}
- if (ooffset > 0 && (size_t)ooffset < strlen(sub_val)) {
- if ((ptr = (char *)sub_val + ooffset)) {
+ if (ooffset > 0 && (size_t) ooffset < strlen(sub_val)) {
+ if ((ptr = (char *) sub_val + ooffset)) {
*ptr = '\0';
}
}
@@ -1756,7 +1756,7 @@
if (stream.data) {
char *expanded_vname = NULL;
- if ((expanded_vname = switch_channel_expand_variables(channel, (char *)vname)) == vname) {
+ if ((expanded_vname = switch_channel_expand_variables(channel, (char *) vname)) == vname) {
expanded_vname = NULL;
} else {
vname = expanded_vname;
@@ -1782,7 +1782,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
free(data);
free(indup);
- return (char *)in;
+ return (char *) in;
}
}
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
@@ -1830,7 +1830,8 @@
switch_stream_handle_t stream = { 0 };
switch_size_t encode_len = 1024, new_len = 0;
char *encode_buf = NULL;
- const char *prof[12] = { 0 }, *prof_names[12] = {0};
+ const char *prof[12] = { 0 }, *prof_names[12] = {
+ 0};
char *e = NULL;
switch_event_header_t *hi;
uint32_t x = 0;
@@ -1938,7 +1939,8 @@
char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
- time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0 , mtt_progress_media = 0;
+ time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup =
+ 0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
return SWITCH_STATUS_FALSE;
@@ -1949,13 +1951,13 @@
last_app = ap->app;
last_arg = ap->arg;
}
-
+
if (!(ocp = switch_channel_get_originatee_caller_profile(channel))) {
ocp = switch_channel_get_originator_caller_profile(channel);
}
if (!switch_strlen_zero(caller_profile->caller_id_name)) {
- cid_buf = switch_core_session_sprintf(channel->session, "\"%s\" <%s>", caller_profile->caller_id_name,
+ cid_buf = switch_core_session_sprintf(channel->session, "\"%s\" <%s>", caller_profile->caller_id_name,
switch_str_nil(caller_profile->caller_id_number));
} else {
cid_buf = caller_profile->caller_id_number;
@@ -2016,21 +2018,21 @@
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_answered);
switch_channel_set_variable(channel, "answer_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
- switch_channel_set_variable(channel, "answer_uepoch", tmp);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
tt_progress = (time_t) (caller_profile->times->progress / 1000000);
mtt_progress = (time_t) (caller_profile->times->progress / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
switch_channel_set_variable(channel, "answer_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
- switch_channel_set_variable(channel, "answer_uepoch", tmp);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
tt_progress_media = (time_t) (caller_profile->times->progress_media / 1000000);
mtt_progress_media = (time_t) (caller_profile->times->progress_media / 1000);
switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress_media);
switch_channel_set_variable(channel, "answer_epoch", tmp);
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
- switch_channel_set_variable(channel, "answer_uepoch", tmp);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
@@ -2041,28 +2043,28 @@
switch_channel_set_variable(channel, "end_uepoch", tmp);
uduration = caller_profile->times->hungup - caller_profile->times->created;
- duration = (int32_t)(tt_hungup - tt_created);
- mduration = (int32_t)(mtt_hungup - mtt_created);
+ duration = (int32_t) (tt_hungup - tt_created);
+ mduration = (int32_t) (mtt_hungup - mtt_created);
if (caller_profile->times->answered) {
- billsec = (int32_t)(tt_hungup - tt_answered);
- billmsec = (int32_t)(mtt_hungup - mtt_answered);
+ billsec = (int32_t) (tt_hungup - tt_answered);
+ billmsec = (int32_t) (mtt_hungup - mtt_answered);
billusec = caller_profile->times->hungup - caller_profile->times->answered;
- legbillsec = (int32_t)(tt_hungup - tt_prof_created);
- legbillmsec = (int32_t)(mtt_hungup - mtt_prof_created);
+ legbillsec = (int32_t) (tt_hungup - tt_prof_created);
+ legbillmsec = (int32_t) (mtt_hungup - mtt_prof_created);
legbillusec = caller_profile->times->hungup - caller_profile->times->profile_created;
}
if (caller_profile->times->progress) {
- progresssec = (int32_t)(tt_progress - tt_created);
- progressmsec = (int32_t)(mtt_progress - mtt_created);
+ progresssec = (int32_t) (tt_progress - tt_created);
+ progressmsec = (int32_t) (mtt_progress - mtt_created);
progressusec = caller_profile->times->progress - caller_profile->times->created;
}
if (caller_profile->times->progress_media) {
- progress_mediasec = (int32_t)(tt_progress - tt_created);
- progress_mediamsec = (int32_t)(mtt_progress - mtt_created);
+ progress_mediasec = (int32_t) (tt_progress - tt_created);
+ progress_mediamsec = (int32_t) (mtt_progress - mtt_created);
progress_mediausec = caller_profile->times->progress - caller_profile->times->created;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c Tue May 27 07:24:06 2008
@@ -33,7 +33,7 @@
#include <switch.h>
#include <switch_config.h>
-SWITCH_DECLARE(int) switch_config_open_file(switch_config_t * cfg, char *file_path)
+SWITCH_DECLARE(int) switch_config_open_file(switch_config_t *cfg, char *file_path)
{
FILE *f;
char *path = NULL;
@@ -88,7 +88,7 @@
}
}
-SWITCH_DECLARE(void) switch_config_close_file(switch_config_t * cfg)
+SWITCH_DECLARE(void) switch_config_close_file(switch_config_t *cfg)
{
if (cfg->file) {
@@ -98,7 +98,7 @@
memset(cfg, 0, sizeof(*cfg));
}
-SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t * cfg, char **var, char **val)
+SWITCH_DECLARE(int) switch_config_next_pair(switch_config_t *cfg, char **var, char **val)
{
int ret = 0;
char *p, *end;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c Tue May 27 07:24:06 2008
@@ -53,12 +53,12 @@
char *cf = "switch.conf";
switch_xml_t cfg, xml, settings, param;
- /* clear the keybind array */
- int i;
+ /* clear the keybind array */
+ int i;
- for (i = 0; i < 12; i++) {
- console_fnkeys[i] = NULL;
- }
+ for (i = 0; i < 12; i++) {
+ console_fnkeys[i] = NULL;
+ }
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
@@ -69,13 +69,13 @@
for (param = switch_xml_child(settings, "key"); param; param = param->next) {
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
- int i = atoi(var);
- if ((i < 1) || (i > 12)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "keybind %s is invalid, range is from 1 to 12\n", var);
- } else {
- // Add the command to the fnkey array
- console_fnkeys[i - 1] = switch_core_permanent_strdup(val);
- }
+ int i = atoi(var);
+ if ((i < 1) || (i > 12)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "keybind %s is invalid, range is from 1 to 12\n", var);
+ } else {
+ // Add the command to the fnkey array
+ console_fnkeys[i - 1] = switch_core_permanent_strdup(val);
+ }
}
}
@@ -169,7 +169,7 @@
char *exp = NULL;
switch_core_db_t *db = switch_core_db_handle();
int full = 0;
-
+
sql = switch_mprintf("select command from aliases where alias='%q'", cmd);
switch_core_db_exec(db, sql, alias_callback, &r, &errmsg);
@@ -181,9 +181,9 @@
if (!r) {
sql = switch_mprintf("select command from aliases where alias='%q %q'", cmd, arg);
-
+
switch_core_db_exec(db, sql, alias_callback, &r, &errmsg);
-
+
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", sql, errmsg);
free(errmsg);
@@ -270,7 +270,7 @@
if (ret == -1) {
fprintf(stderr, "Memory Error\n");
goto done;
- }
+ }
if (channel == SWITCH_CHANNEL_ID_LOG_CLEAN) {
fprintf(handle, "%s", data);
@@ -283,11 +283,10 @@
if (channel == SWITCH_CHANNEL_ID_LOG) {
fprintf(handle, "[%d] %s %s:%d %s() %s", (int) getpid(), date, filep, line, func, data);
goto done;
- }
+ }
if (channel == SWITCH_CHANNEL_ID_EVENT &&
- switch_event_running() == SWITCH_STATUS_SUCCESS &&
- switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
+ switch_event_running() == SWITCH_STATUS_SUCCESS && switch_event_create(&event, SWITCH_EVENT_LOG) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Data", "%s", data);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-File", "%s", filep);
@@ -296,7 +295,7 @@
switch_event_fire(&event);
}
-done:
+ done:
if (data) {
free(data);
}
@@ -313,71 +312,85 @@
/*
* If a fnkey is configured then process the command
*/
-static unsigned char console_fnkey_pressed(int i) {
+static unsigned char console_fnkey_pressed(int i)
+{
char *c, *cmd;
- assert((i > 0) && (i <= 12));
+ assert((i > 0) && (i <= 12));
- c = console_fnkeys[i-1];
+ c = console_fnkeys[i - 1];
- // This new line is necessary to avoid output to begin after the ">" of the CLI's prompt
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE,"\n");
+ // This new line is necessary to avoid output to begin after the ">" of the CLI's prompt
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\n");
+
+ if (c == NULL) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "FUNCTION KEY F%d IS NOT BOUND, please edit switch.conf XML file\n", i);
+ return CC_REDISPLAY;
+ }
- if (c == NULL) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "FUNCTION KEY F%d IS NOT BOUND, please edit switch.conf XML file\n", i);
- return CC_REDISPLAY;
- }
-
cmd = strdup(c);
switch_console_process(cmd, 0);
free(cmd);
- return CC_REDISPLAY;
+ return CC_REDISPLAY;
}
-static unsigned char console_f1key(EditLine *el, int ch) {
- return console_fnkey_pressed(1);
+static unsigned char console_f1key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(1);
}
-static unsigned char console_f2key(EditLine *el, int ch) {
- return console_fnkey_pressed(2);
+static unsigned char console_f2key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(2);
}
-static unsigned char console_f3key(EditLine *el, int ch) {
- return console_fnkey_pressed(3);
+static unsigned char console_f3key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(3);
}
-static unsigned char console_f4key(EditLine *el, int ch) {
- return console_fnkey_pressed(4);
+static unsigned char console_f4key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(4);
}
-static unsigned char console_f5key(EditLine *el, int ch) {
- return console_fnkey_pressed(5);
+static unsigned char console_f5key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(5);
}
-static unsigned char console_f6key(EditLine *el, int ch) {
- return console_fnkey_pressed(6);
+static unsigned char console_f6key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(6);
}
-static unsigned char console_f7key(EditLine *el, int ch) {
- return console_fnkey_pressed(7);
+static unsigned char console_f7key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(7);
}
-static unsigned char console_f8key(EditLine *el, int ch) {
- return console_fnkey_pressed(8);
+static unsigned char console_f8key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(8);
}
-static unsigned char console_f9key(EditLine *el, int ch) {
- return console_fnkey_pressed(9);
+static unsigned char console_f9key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(9);
}
-static unsigned char console_f10key(EditLine *el, int ch) {
- return console_fnkey_pressed(10);
+static unsigned char console_f10key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(10);
}
-static unsigned char console_f11key(EditLine *el, int ch) {
- return console_fnkey_pressed(11);
+static unsigned char console_f11key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(11);
}
-static unsigned char console_f12key(EditLine *el, int ch) {
- return console_fnkey_pressed(12);
+static unsigned char console_f12key(EditLine * el, int ch)
+{
+ return console_fnkey_pressed(12);
}
-char * prompt(EditLine *e) {
+char *prompt(EditLine * e)
+{
if (*prompt_str == '\0') {
gethostname(hostname, sizeof(hostname));
switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
- }
+ }
return prompt_str;
}
@@ -408,22 +421,22 @@
char *cmd = strdup(line);
char *p;
const LineInfo *lf = el_line(el);
- char *foo = (char *)lf->buffer;
+ char *foo = (char *) lf->buffer;
if ((p = strrchr(cmd, '\r')) || (p = strrchr(cmd, '\n'))) {
*p = '\0';
}
assert(cmd != NULL);
history(myhistory, &ev, H_ENTER, line);
running = switch_console_process(cmd, 0);
- el_deletestr(el, strlen(foo)+1);
+ el_deletestr(el, strlen(foo) + 1);
memset(foo, 0, strlen(foo));
free(cmd);
}
}
switch_yield(1000);
}
-
- switch_core_destroy_memory_pool(&pool);
+
+ switch_core_destroy_memory_pool(&pool);
return NULL;
}
@@ -441,7 +454,7 @@
{
struct helper *h = (struct helper *) pArg;
char *target = NULL;
-
+
target = argv[0];
if (!target) {
@@ -449,17 +462,17 @@
}
fprintf(h->out, "%20s\t", target);
-
+
switch_copy_string(h->last, target, sizeof(h->last));
if ((++h->hits % 4) == 0) {
fprintf(h->out, "\n");
}
-
+
return 0;
}
-static unsigned char complete(EditLine *el, int ch)
+static unsigned char complete(EditLine * el, int ch)
{
switch_core_db_t *db = switch_core_db_handle();
char *sql;
@@ -475,13 +488,13 @@
if ((p = strchr(buf, '\r')) || (p = strchr(buf, '\n'))) {
*p = '\0';
- }
-
- while(*buf == ' ') {
+ }
+
+ while (*buf == ' ') {
buf++;
}
- for(p = buf; p && *p; p++) {
+ for (p = buf; p && *p; p++) {
if (*p == ' ') {
lp = p;
h.words++;
@@ -491,9 +504,9 @@
if (lp) {
buf = lp + 1;
}
-
+
h.len = strlen(buf);
-
+
fprintf(h.out, "\n\n");
if (h.words == 0) {
@@ -503,7 +516,7 @@
}
switch_core_db_exec(db, sql, comp_callback, &h, &errmsg);
-
+
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", sql, errmsg);
free(errmsg);
@@ -515,28 +528,25 @@
char *dupdup = strdup(dup);
switch_assert(dupdup);
int x, argc = 0;
- char *argv[10] = {0};
+ char *argv[10] = { 0 };
switch_stream_handle_t stream = { 0 };
SWITCH_STANDARD_STREAM(stream);
-
+
argc = switch_separate_string(dupdup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (h.words == 0) {
- stream.write_function(&stream,
- "select distinct a1 from complete where "
- "a1 not in (select name from interfaces) %s ", argc ? "and" : "");
+ stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces) %s ", argc ? "and" : "");
} else {
- stream.write_function(&stream,
- "select distinct a%d from complete where ", h.words + 1);
-
+ stream.write_function(&stream, "select distinct a%d from complete where ", h.words + 1);
+
}
- for(x = 0; x < argc; x++) {
- stream.write_function(&stream, "(a%d = '' or a%d like '%s%%')%s", x+1, x+1, switch_str_nil(argv[x]), x == argc -1 ? "" : " and ");
+ for (x = 0; x < argc; x++) {
+ stream.write_function(&stream, "(a%d = '' or a%d like '%s%%')%s", x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
}
-
- switch_core_db_exec(db, stream.data, comp_callback, &h, &errmsg);
+
+ switch_core_db_exec(db, stream.data, comp_callback, &h, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", (char *) stream.data, errmsg);
@@ -546,20 +556,20 @@
switch_safe_free(dupdup);
switch_safe_free(stream.data);
-
+
if (ret == CC_ERROR) {
goto end;
}
}
fprintf(h.out, "\n\n");
-
+
if (h.hits == 1) {
el_deletestr(el, h.len);
el_insertstr(el, h.last);
}
- end:
+ end:
fflush(h.out);
@@ -567,14 +577,14 @@
switch_safe_free(dup);
switch_core_db_close(db);
-
+
return (ret);
}
SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
{
- char *mydata = NULL, *argv[11] = {0};
+ char *mydata = NULL, *argv[11] = { 0 };
int argc, x;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -587,26 +597,26 @@
if (!strcasecmp(argv[0], "stickyadd")) {
mystream.write_function(&mystream, "insert into complete values (1,");
- for(x = 0; x < 10; x++) {
- mystream.write_function(&mystream, "'%s'%s", switch_str_nil(argv[x+1]), x == 9 ? ")" : ", ");
+ for (x = 0; x < 10; x++) {
+ mystream.write_function(&mystream, "'%s'%s", switch_str_nil(argv[x + 1]), x == 9 ? ")" : ", ");
}
switch_core_db_persistant_execute(db, mystream.data, 5);
status = SWITCH_STATUS_SUCCESS;
} else if (!strcasecmp(argv[0], "add")) {
mystream.write_function(&mystream, "insert into complete values (0,");
- for(x = 0; x < 10; x++) {
- mystream.write_function(&mystream, "'%s'%s", switch_str_nil(argv[x+1]), x == 9 ? ")" : ", ");
+ for (x = 0; x < 10; x++) {
+ mystream.write_function(&mystream, "'%s'%s", switch_str_nil(argv[x + 1]), x == 9 ? ")" : ", ");
}
switch_core_db_persistant_execute(db, mystream.data, 5);
status = SWITCH_STATUS_SUCCESS;
} else if (!strcasecmp(argv[0], "del")) {
char *what = argv[1];
- if (!strcasecmp(what, "*")) {
+ if (!strcasecmp(what, "*")) {
switch_core_db_persistant_execute(db, "delete from complete", 1);
} else {
mystream.write_function(&mystream, "delete from complete where ");
- for(x = 0; x < argc - 1; x++) {
- mystream.write_function(&mystream, "a%d = '%s'%s", x+1, switch_str_nil(argv[x+1]), x == argc - 2 ? "" : " and ");
+ for (x = 0; x < argc - 1; x++) {
+ mystream.write_function(&mystream, "a%d = '%s'%s", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and ");
}
switch_core_db_persistant_execute(db, mystream.data, 1);
}
@@ -626,10 +636,10 @@
SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
{
- char *mydata = NULL, *argv[3] = {0};
+ char *mydata = NULL, *argv[3] = { 0 };
int argc;
switch_status_t status = SWITCH_STATUS_FALSE;
-
+
if (string && (mydata = strdup(string))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
switch_core_db_t *db = switch_core_db_handle();
@@ -652,7 +662,7 @@
status = SWITCH_STATUS_SUCCESS;
} else if (!strcasecmp(argv[0], "del") && argc == 2) {
char *what = argv[1];
- if (!strcasecmp(what, "*")) {
+ if (!strcasecmp(what, "*")) {
switch_core_db_persistant_execute(db, "delete from aliases", 1);
} else {
sql = switch_mprintf("delete from aliases where alias='%q'", argv[1]);
@@ -664,7 +674,7 @@
switch_core_db_close(db);
}
}
-
+
switch_safe_free(mydata);
return status;
@@ -686,44 +696,44 @@
el = el_init(__FILE__, switch_core_get_console(), switch_core_get_console(), switch_core_get_console());
el_set(el, EL_PROMPT, &prompt);
el_set(el, EL_EDITOR, "emacs");
- /* AGX: Bind Keyboard function keys. This has been tested with:
- * - linux console keyabord
- * - putty.exe connected via ssh to linux
- */
- /* Load/Init the config first */
- console_xml_config();
- /* Bind the functions to the key */
- el_set(el, EL_ADDFN, "f1-key", "F1 KEY PRESS", console_f1key );
- el_set(el, EL_ADDFN, "f2-key", "F2 KEY PRESS", console_f2key );
- el_set(el, EL_ADDFN, "f3-key", "F3 KEY PRESS", console_f3key );
- el_set(el, EL_ADDFN, "f4-key", "F4 KEY PRESS", console_f4key );
- el_set(el, EL_ADDFN, "f5-key", "F5 KEY PRESS", console_f5key );
- el_set(el, EL_ADDFN, "f6-key", "F6 KEY PRESS", console_f6key );
- el_set(el, EL_ADDFN, "f7-key", "F7 KEY PRESS", console_f7key );
- el_set(el, EL_ADDFN, "f8-key", "F8 KEY PRESS", console_f8key );
- el_set(el, EL_ADDFN, "f9-key", "F9 KEY PRESS", console_f9key );
- el_set(el, EL_ADDFN, "f10-key", "F10 KEY PRESS", console_f10key );
- el_set(el, EL_ADDFN, "f11-key", "F11 KEY PRESS", console_f11key );
- el_set(el, EL_ADDFN, "f12-key", "F12 KEY PRESS", console_f12key );
-
- el_set(el, EL_BIND, "\033OP", "f1-key", NULL);
- el_set(el, EL_BIND, "\033OQ", "f2-key", NULL);
- el_set(el, EL_BIND, "\033OR", "f3-key", NULL);
- el_set(el, EL_BIND, "\033OS", "f4-key", NULL);
-
-
- el_set(el, EL_BIND, "\033[11~", "f1-key", NULL);
- el_set(el, EL_BIND, "\033[12~", "f2-key", NULL);
- el_set(el, EL_BIND, "\033[13~", "f3-key", NULL);
- el_set(el, EL_BIND, "\033[14~", "f4-key", NULL);
- el_set(el, EL_BIND, "\033[15~", "f5-key", NULL);
- el_set(el, EL_BIND, "\033[17~", "f6-key", NULL);
- el_set(el, EL_BIND, "\033[18~", "f7-key", NULL);
- el_set(el, EL_BIND, "\033[19~", "f8-key", NULL);
- el_set(el, EL_BIND, "\033[20~", "f9-key", NULL);
- el_set(el, EL_BIND, "\033[21~", "f10-key", NULL);
- el_set(el, EL_BIND, "\033[23~", "f11-key", NULL);
- el_set(el, EL_BIND, "\033[24~", "f12-key", NULL);
+ /* AGX: Bind Keyboard function keys. This has been tested with:
+ * - linux console keyabord
+ * - putty.exe connected via ssh to linux
+ */
+ /* Load/Init the config first */
+ console_xml_config();
+ /* Bind the functions to the key */
+ el_set(el, EL_ADDFN, "f1-key", "F1 KEY PRESS", console_f1key);
+ el_set(el, EL_ADDFN, "f2-key", "F2 KEY PRESS", console_f2key);
+ el_set(el, EL_ADDFN, "f3-key", "F3 KEY PRESS", console_f3key);
+ el_set(el, EL_ADDFN, "f4-key", "F4 KEY PRESS", console_f4key);
+ el_set(el, EL_ADDFN, "f5-key", "F5 KEY PRESS", console_f5key);
+ el_set(el, EL_ADDFN, "f6-key", "F6 KEY PRESS", console_f6key);
+ el_set(el, EL_ADDFN, "f7-key", "F7 KEY PRESS", console_f7key);
+ el_set(el, EL_ADDFN, "f8-key", "F8 KEY PRESS", console_f8key);
+ el_set(el, EL_ADDFN, "f9-key", "F9 KEY PRESS", console_f9key);
+ el_set(el, EL_ADDFN, "f10-key", "F10 KEY PRESS", console_f10key);
+ el_set(el, EL_ADDFN, "f11-key", "F11 KEY PRESS", console_f11key);
+ el_set(el, EL_ADDFN, "f12-key", "F12 KEY PRESS", console_f12key);
+
+ el_set(el, EL_BIND, "\033OP", "f1-key", NULL);
+ el_set(el, EL_BIND, "\033OQ", "f2-key", NULL);
+ el_set(el, EL_BIND, "\033OR", "f3-key", NULL);
+ el_set(el, EL_BIND, "\033OS", "f4-key", NULL);
+
+
+ el_set(el, EL_BIND, "\033[11~", "f1-key", NULL);
+ el_set(el, EL_BIND, "\033[12~", "f2-key", NULL);
+ el_set(el, EL_BIND, "\033[13~", "f3-key", NULL);
+ el_set(el, EL_BIND, "\033[14~", "f4-key", NULL);
+ el_set(el, EL_BIND, "\033[15~", "f5-key", NULL);
+ el_set(el, EL_BIND, "\033[17~", "f6-key", NULL);
+ el_set(el, EL_BIND, "\033[18~", "f7-key", NULL);
+ el_set(el, EL_BIND, "\033[19~", "f8-key", NULL);
+ el_set(el, EL_BIND, "\033[20~", "f9-key", NULL);
+ el_set(el, EL_BIND, "\033[21~", "f10-key", NULL);
+ el_set(el, EL_BIND, "\033[23~", "f11-key", NULL);
+ el_set(el, EL_BIND, "\033[24~", "f12-key", NULL);
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
@@ -746,7 +756,7 @@
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&thread, thd_attr, console_thread, pool, pool);
-
+
while (running) {
int32_t arg = 0;
switch_core_session_ctl(SCSC_CHECK_RUNNING, &arg);
@@ -758,7 +768,7 @@
history(myhistory, &ev, H_SAVE, hfile);
free(hfile);
-
+
/* Clean up our memory */
history_end(myhistory);
el_end(el);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c Tue May 27 07:24:06 2008
@@ -172,7 +172,7 @@
}
-static void *switch_core_service_thread(switch_thread_t * thread, void *obj)
+static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
{
switch_core_thread_session_t *data = obj;
switch_core_session_t *session = data->objs[0];
@@ -362,7 +362,7 @@
#endif
#endif
}
-
+
dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
switch_dir_make_recursive(dir_path,
SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE | SWITCH_FPROT_UEXECUTE | SWITCH_FPROT_GREAD | SWITCH_FPROT_GEXECUTE,
@@ -436,8 +436,7 @@
* So let's try to remove the mlock limit here...
*/
if (setrlimit(RLIMIT_MEMLOCK, &lim) < 0) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
- "Failed to disable memlock limit, application may crash if run as non-root user!\n");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to disable memlock limit, application may crash if run as non-root user!\n");
}
#endif
@@ -463,7 +462,7 @@
/*
* Lookup user information in the system's db
*/
- runas_pw = getpwnam( user );
+ runas_pw = getpwnam(user);
if (!runas_pw) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unknown user \"%s\"\n", user);
return -1;
@@ -477,7 +476,7 @@
/*
* Lookup group information in the system's db
*/
- gr = getgrnam( group );
+ gr = getgrnam(group);
if (!gr) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unknown group \"%s\"\n", group);
return -1;
@@ -514,7 +513,6 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to change gid!\n");
return -1;
}
-
#ifdef HAVE_INITGROUPS
/*
* Set all the other groups the user is a member of
@@ -573,7 +571,7 @@
return (const char *) switch_core_hash_find(runtime.mime_types, ext);
}
-
+
SWITCH_DECLARE(switch_hash_index_t *) switch_core_mime_index(void)
{
return switch_hash_first(NULL, runtime.mime_types);
@@ -605,17 +603,17 @@
switch_core_hash_insert(runtime.mime_types, argv[x], ptype);
}
}
-
+
status = SWITCH_STATUS_SUCCESS;
}
-
+
free(ext_list);
}
return status;
}
-static void load_mime_types(void)
+static void load_mime_types(void)
{
char *cf = "mime.types";
int fd = -1;
@@ -630,7 +628,7 @@
return;
}
- while((switch_fd_read_line(fd, line_buf, sizeof(line_buf)))) {
+ while ((switch_fd_read_line(fd, line_buf, sizeof(line_buf)))) {
char *p;
char *type = line_buf;
@@ -645,20 +643,20 @@
if ((p = strchr(type, '\t')) || (p = strchr(type, ' '))) {
*p++ = '\0';
- while(*p == ' ' || *p == '\t') {
+ while (*p == ' ' || *p == '\t') {
p++;
}
switch_core_mime_add_type(type, p);
}
-
+
}
if (fd > -1) {
close(fd);
fd = -1;
}
-}
+}
SWITCH_DECLARE(void) switch_core_setrlimits(void)
{
@@ -667,10 +665,10 @@
/*
Setting the stack size on FreeBSD results in an instant crash.
-
+
If anyone knows how to fix this,
feel free to submit a patch to http://jira.freeswitch.org
- */
+ */
#ifndef __FreeBSD__
memset(&rlp, 0, sizeof(rlp));
@@ -710,10 +708,10 @@
switch_network_list_t *list;
uint32_t ip, net, mask, bits;
switch_bool_t ok = SWITCH_FALSE;
-
+
switch_mutex_lock(runtime.global_mutex);
switch_inet_pton(AF_INET, ip_str, &ip);
-
+
if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) {
ok = switch_network_list_validate_ip(list, ip);
} else if (strchr(list_name, '/')) {
@@ -721,7 +719,7 @@
ok = switch_test_subnet(ip, net, mask);
}
switch_mutex_unlock(runtime.global_mutex);
-
+
return ok;
}
@@ -741,11 +739,11 @@
if (IP_LIST.pool) {
switch_core_destroy_memory_pool(&IP_LIST.pool);
}
-
+
memset(&IP_LIST, 0, sizeof(IP_LIST));
switch_core_new_memory_pool(&IP_LIST.pool);
switch_core_hash_init(&IP_LIST.hash, IP_LIST.pool);
-
+
if ((xml = switch_xml_open_cfg("acl.conf", &cfg, NULL))) {
if ((x_lists = switch_xml_child(cfg, "network-lists"))) {
for (x_list = switch_xml_child(x_lists, "list"); x_list; x_list = x_list->next) {
@@ -760,7 +758,7 @@
if (dft) {
default_type = switch_true(dft);
}
-
+
if (switch_network_list_create(&list, default_type, IP_LIST.pool) != SWITCH_STATUS_SUCCESS) {
abort();
}
@@ -779,35 +777,36 @@
if (type) {
ok = switch_true(type);
- }
+ }
cidr = switch_xml_attr(x_node, "cidr");
host = switch_xml_attr(x_node, "host");
mask = switch_xml_attr(x_node, "mask");
-
+
if (cidr) {
if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {
if (reload) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny",
+ name);
}
} else {
if (reload) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Error Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
"Error Adding %s (%s) to list %s\n", cidr, ok ? "allow" : "deny", name);
}
}
} else if (host && mask) {
if (switch_network_list_add_host_mask(list, host, mask, ok) == SWITCH_STATUS_SUCCESS) {
if (reload) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
"Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
"Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
}
}
@@ -855,8 +854,8 @@
memset(&runtime, 0, sizeof(runtime));
runtime.dummy_cng_frame.data = runtime.dummy_data;
- runtime.dummy_cng_frame.datalen= sizeof(runtime.dummy_data);
- runtime.dummy_cng_frame.buflen= sizeof(runtime.dummy_data);
+ runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
+ runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
runtime.dummy_cng_frame.flags = SFF_CNG;
switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
@@ -914,17 +913,16 @@
switch_set_flag((&runtime), SCF_CRASH_PROT);
}
} else if (!strcasecmp(var, "loglevel")) {
- int level;
- if (*val > 47 && *val < 58) {
- level = atoi(val);
- } else {
- level = switch_log_str2level(val);
- }
+ int level;
+ if (*val > 47 && *val < 58) {
+ level = atoi(val);
+ } else {
+ level = switch_log_str2level(val);
+ }
if (level != SWITCH_LOG_INVALID) {
- switch_core_session_ctl(SCSC_LOGLEVEL, &level);
+ switch_core_session_ctl(SCSC_LOGLEVEL, &level);
}
-
#ifdef HAVE_SETRLIMIT
} else if (!strcasecmp(var, "dump-cores")) {
struct rlimit rlp;
@@ -942,23 +940,21 @@
} else if (!strcasecmp(var, "max_dtmf_duration")) {
int tmp = atoi(val);
if (tmp > 0) {
- switch_core_max_dtmf_duration((uint32_t)tmp);
+ switch_core_max_dtmf_duration((uint32_t) tmp);
}
} else if (!strcasecmp(var, "default_dtmf_duration")) {
int tmp = atoi(val);
if (tmp > 0) {
- switch_core_default_dtmf_duration((uint32_t)tmp);
+ switch_core_default_dtmf_duration((uint32_t) tmp);
}
} else if (!strcasecmp(var, "disable-monotonic-timing")) {
switch_time_set_monotonic(SWITCH_FALSE);
} else if (!strcasecmp(var, "max-sessions")) {
switch_core_session_limit(atoi(val));
- }
- else if (!strcasecmp(var, "rtp-start-port")) {
- switch_rtp_set_start_port((switch_port_t)atoi(val));
- }
- else if (!strcasecmp(var, "rtp-end-port")) {
- switch_rtp_set_end_port((switch_port_t)atoi(val));
+ } else if (!strcasecmp(var, "rtp-start-port")) {
+ switch_rtp_set_start_port((switch_port_t) atoi(val));
+ } else if (!strcasecmp(var, "rtp-end-port")) {
+ switch_rtp_set_end_port((switch_port_t) atoi(val));
}
}
}
@@ -1059,7 +1055,7 @@
{
if (sig) {
switch_event_t *event;
-
+
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Trapped-Signal", "HUP");
switch_event_fire(&event);
@@ -1094,7 +1090,7 @@
#endif
signal(SIGHUP, handle_SIGHUP);
- switch_load_network_lists(SWITCH_FALSE);
+ switch_load_network_lists(SWITCH_FALSE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n");
@@ -1110,12 +1106,10 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
- "\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
+ "\nFreeSWITCH Version %s Started.\nCrash Protection [%s]\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
switch_test_flag((&runtime), SCF_CRASH_PROT) ? "Enabled" : "Disabled",
switch_core_session_limit(0),
- switch_core_sessions_per_second(0),
- switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled"
- );
+ switch_core_sessions_per_second(0), switch_test_flag((&runtime), SCF_USE_SQL) ? "Enabled" : "Disabled");
switch_clear_flag((&runtime), SCF_NO_NEW_SESSIONS);
@@ -1145,7 +1139,7 @@
return switch_timestamp_now() - runtime.initiated;
}
-SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t * val)
+SWITCH_DECLARE(int32_t) switch_core_session_ctl(switch_session_ctl_t cmd, int32_t *val)
{
if (switch_test_flag((&runtime), SCF_SHUTTING_DOWN)) {
return -1;
@@ -1292,7 +1286,7 @@
SWITCH_DECLARE(void) switch_core_memory_reclaim_all(void)
{
- switch_core_memory_reclaim_logger();
+ switch_core_memory_reclaim_logger();
switch_core_memory_reclaim_events();
switch_core_memory_reclaim();
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_asr.c Tue May 27 07:24:06 2008
@@ -37,11 +37,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah,
const char *module_name,
- const char *codec,
- int rate,
- const char *dest,
- switch_asr_flag_t *flags,
- switch_memory_pool_t *pool)
+ const char *codec, int rate, const char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool)
{
switch_status_t status;
char buf[256] = "";
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_codec.c Tue May 27 07:24:06 2008
@@ -50,7 +50,7 @@
char tmp[30];
switch_assert(codec->implementation);
-
+
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame);
@@ -92,7 +92,8 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d",
+ codec->implementation->actual_samples_per_second);
}
switch_event_fire(&event);
}
@@ -185,14 +186,14 @@
new_codec->codec_interface = codec->codec_interface;
new_codec->implementation = codec->implementation;
new_codec->flags = codec->flags;
-
+
if (codec->fmtp_in) {
new_codec->fmtp_in = switch_core_strdup(new_codec->memory_pool, codec->fmtp_in);
}
-
+
new_codec->implementation->init(new_codec, new_codec->flags, NULL);
-
- return SWITCH_STATUS_SUCCESS;
+
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, char *codec_name, char *fmtp,
@@ -286,7 +287,7 @@
void *decoded_data,
uint32_t decoded_data_len,
uint32_t decoded_rate,
- void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate, unsigned int *flag)
+ void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
{
switch_assert(codec != NULL);
switch_assert(encoded_data != NULL);
@@ -311,7 +312,7 @@
void *encoded_data,
uint32_t encoded_data_len,
uint32_t encoded_rate,
- void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate, unsigned int *flag)
+ void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
{
switch_assert(codec != NULL);
switch_assert(encoded_data != NULL);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c Tue May 27 07:24:06 2008
@@ -81,7 +81,7 @@
int sane = 100;
char *err = NULL;
- while(--sane > 0) {
+ while (--sane > 0) {
ret = sqlite3_exec(db, sql, callback, data, &err);
if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
if (sane > 1) {
@@ -165,8 +165,9 @@
sqlite3_free(z);
}
-SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db) {
- return sqlite3_changes(db);
+SWITCH_DECLARE(int) switch_core_db_changes(switch_core_db_t *db)
+{
+ return sqlite3_changes(db);
}
SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
@@ -212,7 +213,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\n", errmsg, reactive_sql);
switch_core_db_free(errmsg);
errmsg = NULL;
- }
+ }
switch_core_db_exec(db, reactive_sql, NULL, NULL, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\n", errmsg, reactive_sql);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_event_hook.c Tue May 27 07:24:06 2008
@@ -32,17 +32,17 @@
#include "private/switch_core_pvt.h"
NEW_HOOK_DECL(outgoing_channel)
-NEW_HOOK_DECL(receive_message)
-NEW_HOOK_DECL(receive_event)
-NEW_HOOK_DECL(state_change)
-NEW_HOOK_DECL(read_frame)
-NEW_HOOK_DECL(write_frame)
-NEW_HOOK_DECL(video_read_frame)
-NEW_HOOK_DECL(video_write_frame)
-NEW_HOOK_DECL(kill_channel)
-NEW_HOOK_DECL(send_dtmf)
-NEW_HOOK_DECL(recv_dtmf)
-NEW_HOOK_DECL(resurrect_session)
+ NEW_HOOK_DECL(receive_message)
+ NEW_HOOK_DECL(receive_event)
+ NEW_HOOK_DECL(state_change)
+ NEW_HOOK_DECL(read_frame)
+ NEW_HOOK_DECL(write_frame)
+ NEW_HOOK_DECL(video_read_frame)
+ NEW_HOOK_DECL(video_write_frame)
+ NEW_HOOK_DECL(kill_channel)
+ NEW_HOOK_DECL(send_dtmf)
+ NEW_HOOK_DECL(recv_dtmf)
+ NEW_HOOK_DECL(resurrect_session)
/* For Emacs:
* Local Variables:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_file.c Tue May 27 07:24:06 2008
@@ -37,11 +37,8 @@
SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, const char *func, int line,
switch_file_handle_t *fh,
- const char *file_path,
- uint8_t channels,
- uint32_t rate,
- unsigned int flags,
- switch_memory_pool_t *pool)
+ const char *file_path,
+ uint8_t channels, uint32_t rate, unsigned int flags, switch_memory_pool_t *pool)
{
char *ext;
switch_status_t status;
@@ -69,7 +66,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid file format [%s] for [%s]!\n", ext, file_path);
return SWITCH_STATUS_GENERR;
}
-
+
fh->file = file;
fh->func = func;
fh->line = line;
@@ -109,8 +106,8 @@
} else {
fh->native_rate = rate;
}
-
- if (fh->samplerate && rate && fh->samplerate != rate) {
+
+ if (fh->samplerate && rate && fh->samplerate != rate) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Sample rate doesn't match\n");
if ((flags & SWITCH_FILE_FLAG_READ)) {
fh->samplerate = rate;
@@ -126,7 +123,7 @@
{
switch_status_t status;
switch_size_t orig_len = *len;
-
+
switch_assert(fh != NULL);
switch_assert(fh->file_interface != NULL);
@@ -142,20 +139,16 @@
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
if (!fh->resampler) {
if (switch_resample_create(&fh->resampler,
- fh->native_rate,
- orig_len,
- fh->samplerate,
- (uint32_t)orig_len,
- fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ fh->native_rate, orig_len, fh->samplerate, (uint32_t) orig_len, fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
return SWITCH_STATUS_GENERR;
}
}
-
+
fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
- fh->resampler->to_len =
+ fh->resampler->to_len =
switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
-
+
if (fh->resampler->to_len > orig_len) {
if (!fh->buffer) {
switch_buffer_create_dynamic(&fh->buffer, fh->resampler->to_len * 2, fh->resampler->to_len * 4, fh->resampler->to_len * 8);
@@ -166,7 +159,7 @@
fh->dbuf = switch_core_alloc(fh->memory_pool, fh->dbuflen);
}
switch_assert(fh->resampler->to_len <= fh->dbuflen);
-
+
switch_float_to_short(fh->resampler->to, (int16_t *) fh->dbuf, fh->resampler->to_len);
switch_buffer_write(fh->buffer, fh->dbuf, fh->resampler->to_len * 2);
*len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
@@ -174,10 +167,10 @@
switch_float_to_short(fh->resampler->to, data, fh->resampler->to_len);
*len = fh->resampler->to_len;
}
-
+
}
- done:
+ done:
return status;
}
@@ -192,22 +185,18 @@
if (!fh->file_interface->file_write) {
return SWITCH_STATUS_FALSE;
}
-
+
if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
if (!fh->resampler) {
if (switch_resample_create(&fh->resampler,
- fh->native_rate,
- orig_len,
- fh->samplerate,
- (uint32_t)orig_len,
- fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ fh->native_rate, orig_len, fh->samplerate, (uint32_t) orig_len, fh->memory_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
return SWITCH_STATUS_GENERR;
}
}
-
+
fh->resampler->from_len = switch_short_to_float(data, fh->resampler->from, (int) *len);
- fh->resampler->to_len =
+ fh->resampler->to_len =
switch_resample_process(fh->resampler, fh->resampler->from, fh->resampler->from_len, fh->resampler->to, fh->resampler->to_size, 0);
if (fh->resampler->to_len > orig_len) {
if (!fh->dbuf) {
@@ -222,7 +211,7 @@
}
*len = fh->resampler->to_len;
-
+
}
if (!*len) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_hash.c Tue May 27 07:24:06 2008
@@ -41,16 +41,16 @@
Hash table;
};
-SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t ** hash, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_init(switch_hash_t **hash, switch_memory_pool_t *pool)
{
switch_hash_t *newhash;
-
+
newhash = switch_core_alloc(pool, sizeof(*newhash));
switch_assert(newhash);
sqlite3HashInit(&newhash->table, SQLITE_HASH_STRING, 1);
*hash = newhash;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -62,54 +62,54 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t * hash, const char *key, const void *data)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert(switch_hash_t *hash, const char *key, const void *data)
{
- sqlite3HashInsert(&hash->table, key, (int)strlen(key)+1, (void *)data);
+ sqlite3HashInsert(&hash->table, key, (int) strlen(key) + 1, (void *) data);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t * hash, const char *key, const void *data, switch_mutex_t *mutex)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_insert_locked(switch_hash_t *hash, const char *key, const void *data, switch_mutex_t *mutex)
{
if (mutex) {
- switch_mutex_lock(mutex);
- }
+ switch_mutex_lock(mutex);
+ }
- sqlite3HashInsert(&hash->table, key, (int)strlen(key)+1, (void *)data);
+ sqlite3HashInsert(&hash->table, key, (int) strlen(key) + 1, (void *) data);
if (mutex) {
- switch_mutex_unlock(mutex);
- }
+ switch_mutex_unlock(mutex);
+ }
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t * hash, const char *key)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete(switch_hash_t *hash, const char *key)
{
- sqlite3HashInsert(&hash->table, key, (int)strlen(key)+1, NULL);
+ sqlite3HashInsert(&hash->table, key, (int) strlen(key) + 1, NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t * hash, const char *key, switch_mutex_t *mutex)
+SWITCH_DECLARE(switch_status_t) switch_core_hash_delete_locked(switch_hash_t *hash, const char *key, switch_mutex_t *mutex)
{
if (mutex) {
- switch_mutex_lock(mutex);
- }
-
- sqlite3HashInsert(&hash->table, key, (int)strlen(key)+1, NULL);
-
+ switch_mutex_lock(mutex);
+ }
+
+ sqlite3HashInsert(&hash->table, key, (int) strlen(key) + 1, NULL);
+
if (mutex) {
- switch_mutex_unlock(mutex);
- }
+ switch_mutex_unlock(mutex);
+ }
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t * hash, const char *key)
+SWITCH_DECLARE(void *) switch_core_hash_find(switch_hash_t *hash, const char *key)
{
- return sqlite3HashFind(&hash->table, key, (int)strlen(key)+1);
+ return sqlite3HashFind(&hash->table, key, (int) strlen(key) + 1);
}
-SWITCH_DECLARE(void *) switch_core_hash_find_locked(switch_hash_t * hash, const char *key, switch_mutex_t *mutex)
+SWITCH_DECLARE(void *) switch_core_hash_find_locked(switch_hash_t *hash, const char *key, switch_mutex_t *mutex)
{
void *val;
@@ -117,8 +117,8 @@
switch_mutex_lock(mutex);
}
- val = sqlite3HashFind(&hash->table, key, (int)strlen(key)+1);
-
+ val = sqlite3HashFind(&hash->table, key, (int) strlen(key) + 1);
+
if (mutex) {
switch_mutex_unlock(mutex);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c Tue May 27 07:24:06 2008
@@ -35,7 +35,8 @@
#include <switch.h>
#include "private/switch_core_pvt.h"
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
+ int stream_id)
{
switch_io_event_hook_video_write_frame_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -56,7 +57,8 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
+ int stream_id)
{
switch_status_t status = SWITCH_STATUS_FALSE;
switch_io_event_hook_video_read_frame_t *ptr;
@@ -68,8 +70,7 @@
}
if (session->endpoint_interface->io_routines->read_video_frame) {
- if ((status =
- session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
+ if ((status = session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
for (ptr = session->event_hooks.video_read_frame; ptr; ptr = ptr->next) {
if ((status = ptr->video_read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
break;
@@ -93,12 +94,13 @@
goto done;
}
- done:
+ done:
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags,
+ int stream_id)
{
switch_io_event_hook_read_frame_t *ptr;
switch_status_t status;
@@ -107,7 +109,7 @@
switch_assert(session != NULL);
-top:
+ top:
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
*frame = NULL;
@@ -126,8 +128,7 @@
}
if (session->endpoint_interface->io_routines->read_frame) {
- if ((status =
- session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
+ if ((status = session->endpoint_interface->io_routines->read_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) {
for (ptr = session->event_hooks.read_frame; ptr; ptr = ptr->next) {
if ((status = ptr->read_frame(session, frame, flags, stream_id)) != SWITCH_STATUS_SUCCESS) {
break;
@@ -150,7 +151,7 @@
/* Fast PASS! */
status = SWITCH_STATUS_SUCCESS;
goto done;
- }
+ }
if (switch_test_flag(*frame, SFF_CNG)) {
status = SWITCH_STATUS_SUCCESS;
@@ -158,7 +159,7 @@
goto done;
}
is_cng = 1;
- }
+ }
switch_assert((*frame)->codec != NULL);
@@ -195,15 +196,15 @@
if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
switch_core_session_message_t msg = { 0 };
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
switch_core_session_receive_message(session, &msg);
switch_set_flag(session, SSF_WARN_TRANSCODE);
}
-
+
if (read_frame->codec || is_cng) {
session->raw_read_frame.datalen = session->raw_read_frame.buflen;
-
+
if (is_cng) {
memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
@@ -241,7 +242,7 @@
session->read_codec->implementation->actual_samples_per_second,
session->read_codec->implementation->bytes_per_frame, session->pool);
switch_mutex_unlock(session->resample_mutex);
-
+
if (status != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate resampler\n");
status = SWITCH_STATUS_FALSE;
@@ -263,7 +264,7 @@
switch_mutex_lock(session->resample_mutex);
switch_resample_destroy(&session->read_resampler);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deactivating read resampler\n");
- switch_mutex_unlock(session->resample_mutex);
+ switch_mutex_unlock(session->resample_mutex);
}
status = SWITCH_STATUS_SUCCESS;
@@ -296,12 +297,13 @@
switch_mutex_lock(bp->read_mutex);
switch_buffer_write(bp->raw_read_buffer, read_frame->data, read_frame->datalen);
if (bp->callback) {
- if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ) == SWITCH_FALSE
+ || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
ok = SWITCH_FALSE;
}
}
switch_mutex_unlock(bp->read_mutex);
- }
+ }
if (switch_test_flag(bp, SMBF_READ_REPLACE)) {
do_bugs = 0;
@@ -339,21 +341,21 @@
}
if (session->read_codec) {
- if (session->read_resampler) {
- short *data = read_frame->data;
- switch_mutex_lock(session->resample_mutex);
-
- session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2);
- session->read_resampler->to_len =
- switch_resample_process(session->read_resampler, session->read_resampler->from,
- session->read_resampler->from_len, session->read_resampler->to, session->read_resampler->to_size, 0);
- switch_float_to_short(session->read_resampler->to, data, read_frame->datalen);
- read_frame->samples = session->read_resampler->to_len;
- read_frame->datalen = session->read_resampler->to_len * 2;
- read_frame->rate = session->read_resampler->to_rate;
- switch_mutex_unlock(session->resample_mutex);
-
- }
+ if (session->read_resampler) {
+ short *data = read_frame->data;
+ switch_mutex_lock(session->resample_mutex);
+
+ session->read_resampler->from_len = switch_short_to_float(data, session->read_resampler->from, (int) read_frame->datalen / 2);
+ session->read_resampler->to_len =
+ switch_resample_process(session->read_resampler, session->read_resampler->from,
+ session->read_resampler->from_len, session->read_resampler->to, session->read_resampler->to_size, 0);
+ switch_float_to_short(session->read_resampler->to, data, read_frame->datalen);
+ read_frame->samples = session->read_resampler->to_len;
+ read_frame->datalen = session->read_resampler->to_len * 2;
+ read_frame->rate = session->read_resampler->to_rate;
+ switch_mutex_unlock(session->resample_mutex);
+
+ }
if ((*frame)->datalen == session->read_codec->implementation->bytes_per_frame) {
perfect = TRUE;
@@ -368,7 +370,7 @@
goto done;
}
}
-
+
if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_codec->implementation->bytes_per_frame) {
if (perfect) {
@@ -448,7 +450,8 @@
if (bp->ready && switch_test_flag(bp, SMBF_READ_PING)) {
switch_mutex_lock(bp->read_mutex);
if (bp->callback) {
- if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
+ if (bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_READ_PING) == SWITCH_FALSE
+ || (bp->stop_time && bp->stop_time <= switch_timestamp(NULL))) {
ok = SWITCH_FALSE;
}
}
@@ -476,7 +479,7 @@
}
}
- even_more_done:
+ even_more_done:
if (!*frame) {
*frame = &runtime.dummy_cng_frame;
@@ -504,7 +507,8 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags,
+ int stream_id)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -569,7 +573,7 @@
if (need_codec) {
if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
switch_core_session_message_t msg = { 0 };
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
switch_core_session_receive_message(session, &msg);
switch_set_flag(session, SSF_WARN_TRANSCODE);
@@ -637,7 +641,7 @@
if (session->write_resampler) {
short *data = write_frame->data;
-
+
switch_mutex_lock(session->resample_mutex);
session->write_resampler->from_len = write_frame->datalen / 2;
@@ -665,14 +669,14 @@
continue;
}
if (switch_test_flag(bp, SMBF_WRITE_STREAM)) {
-
+
switch_mutex_lock(bp->write_mutex);
switch_buffer_write(bp->raw_write_buffer, write_frame->data, write_frame->datalen);
switch_mutex_unlock(bp->write_mutex);
if (bp->callback) {
ok = bp->callback(bp, bp->user_data, SWITCH_ABC_TYPE_WRITE);
}
- }
+ }
if (switch_test_flag(bp, SMBF_WRITE_REPLACE)) {
do_bugs = 0;
@@ -807,8 +811,8 @@
rate = frame->codec->implementation->actual_samples_per_second;
} else {
rate = session->write_codec->implementation->actual_samples_per_second;
- }
-
+ }
+
status = switch_core_codec_encode(session->write_codec,
frame->codec,
enc_frame->data,
@@ -832,7 +836,7 @@
session->write_codec->implementation->actual_samples_per_second,
session->write_codec->implementation->bytes_per_frame, session->pool);
switch_mutex_unlock(session->resample_mutex);
-
+
if (status != SWITCH_STATUS_SUCCESS) {
goto done;
}
@@ -871,7 +875,7 @@
if (session->read_resampler) {
short *data = write_frame->data;
switch_mutex_lock(session->resample_mutex);
-
+
session->read_resampler->from_len =
switch_short_to_float(data, session->read_resampler->from, (int) write_frame->datalen / 2);
session->read_resampler->to_len = (uint32_t)
@@ -883,7 +887,7 @@
write_frame->datalen = session->read_resampler->to_len * 2;
write_frame->rate = session->read_resampler->to_rate;
switch_mutex_unlock(session->resample_mutex);
-
+
}
if (flag & SFF_CNG) {
switch_set_flag(write_frame, SFF_CNG);
@@ -941,10 +945,10 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
- switch_io_event_hook_recv_dtmf_t *ptr;
+ switch_io_event_hook_recv_dtmf_t *ptr;
switch_status_t status;
switch_dtmf_t new_dtmf;
-
+
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -954,7 +958,7 @@
new_dtmf = *dtmf;
if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
new_dtmf.duration = switch_core_max_dtmf_duration(0);
} else if (!new_dtmf.duration) {
@@ -974,7 +978,7 @@
switch_io_event_hook_send_dtmf_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_dtmf_t new_dtmf;
-
+
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -984,7 +988,7 @@
new_dtmf = *dtmf;
if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration);
new_dtmf.duration = switch_core_max_dtmf_duration(0);
} else if (!new_dtmf.duration) {
@@ -997,7 +1001,7 @@
return SWITCH_STATUS_SUCCESS;
}
}
-
+
if (session->endpoint_interface->io_routines->send_dtmf) {
if (dtmf->digit == 'w') {
switch_yield(500000);
@@ -1013,19 +1017,19 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf_string(switch_core_session_t *session, const char *dtmf_string)
{
char *p;
- switch_dtmf_t dtmf = {0, switch_core_default_dtmf_duration(0)};
+ switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
int sent = 0, dur;
char *string;
int i, argc;
char *argv[256];
-
+
switch_assert(session != NULL);
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
-
+
if (switch_strlen_zero(dtmf_string)) {
return SWITCH_STATUS_FALSE;
}
@@ -1037,12 +1041,12 @@
string = switch_core_session_strdup(session, dtmf_string);
argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0])));
-
+
if (argc) {
switch_channel_pre_answer(session->channel);
}
- for(i = 0; i < argc; i++) {
+ for (i = 0; i < argc; i++) {
dtmf.duration = switch_core_default_dtmf_duration(0);
dur = switch_core_default_dtmf_duration(0) / 8;
if ((p = strchr(argv[i], '@'))) {
@@ -1054,7 +1058,7 @@
if (dtmf.duration > switch_core_max_dtmf_duration(0)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s EXECSSIVE DTMF DIGIT [%c] LEN [%d]\n",
switch_channel_get_name(session->channel), dtmf.digit, dtmf.duration);
dtmf.duration = switch_core_max_dtmf_duration(0);
} else if (!dtmf.duration) {
@@ -1071,7 +1075,7 @@
}
}
}
-
+
}
return sent ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_media_bug.c Tue May 27 07:24:06 2008
@@ -100,7 +100,7 @@
if ((bug->raw_read_buffer && bug->raw_write_buffer) && (!rlen && !wlen)) {
return SWITCH_STATUS_FALSE;
}
-
+
maxlen = SWITCH_RECOMMENDED_BUFFER_SIZE > frame->buflen ? frame->buflen : SWITCH_RECOMMENDED_BUFFER_SIZE;
if ((rdlen = rlen > wlen ? wlen : rlen) > maxlen) {
@@ -128,11 +128,11 @@
bytes = (datalen > frame->datalen) ? datalen : frame->datalen;
- switch_assert( bytes <= maxlen );
-
+ switch_assert(bytes <= maxlen);
+
if (bytes) {
int16_t *tp = bug->tmp;
-
+
dp = (int16_t *) bug->data;
fp = (int16_t *) frame->data;
rlen = frame->datalen / 2;
@@ -171,10 +171,10 @@
frame->datalen = bytes;
frame->samples = bytes / sizeof(int16_t);
frame->rate = read_codec->implementation->actual_samples_per_second;
-
+
return SWITCH_STATUS_SUCCESS;
}
-
+
return SWITCH_STATUS_FALSE;
}
@@ -183,7 +183,7 @@
switch_media_bug_callback_t callback,
void *user_data, time_t stop_time, switch_media_bug_flag_t flags, switch_media_bug_t **new_bug)
{
- switch_media_bug_t *bug;//, *bp;
+ switch_media_bug_t *bug; //, *bp;
switch_size_t bytes;
if (flags & SMBF_WRITE_REPLACE) {
@@ -287,7 +287,7 @@
switch_thread_rwlock_unlock(session->bug_rwlock);
return SWITCH_STATUS_SUCCESS;
}
-
+
if (session->bug_codec.implementation) {
switch_core_codec_destroy(&session->bug_codec);
}
@@ -313,7 +313,7 @@
*bug = NULL;
return SWITCH_STATUS_SUCCESS;
}
-
+
return SWITCH_STATUS_FALSE;
}
@@ -350,7 +350,7 @@
if (!session->bugs && session->bug_codec.implementation) {
switch_core_codec_destroy(&session->bug_codec);
}
-
+
return status;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_memory.c Tue May 27 07:24:06 2008
@@ -43,7 +43,7 @@
static struct {
switch_mutex_t *mem_lock;
- switch_queue_t *pool_queue; /* 8 ball break */
+ switch_queue_t *pool_queue; /* 8 ball break */
switch_queue_t *pool_recycle_queue;
switch_memory_pool_t *memory_pool;
int pool_thread_running;
@@ -58,7 +58,8 @@
/* **ONLY** alloc things with this function that **WILL NOT** outlive
the session itself or expect an earth shattering KABOOM!*/
-SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *session, switch_size_t memory, const char *file, const char *func, int line)
+SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *session, switch_size_t memory, const char *file, const char *func,
+ int line)
{
void *ptr = NULL;
switch_assert(session != NULL);
@@ -70,14 +71,14 @@
#ifdef DEBUG_ALLOC
if (memory > 500)
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Session Allocate %d\n", (int)memory);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Session Allocate %d\n", (int) memory);
#endif
ptr = apr_palloc(session->pool, memory);
switch_assert(ptr != NULL);
memset(ptr, 0, memory);
-
+
#ifdef LOCK_MORE
switch_mutex_unlock(memory_manager.mem_lock);
#endif
@@ -98,7 +99,7 @@
#endif
#ifdef DEBUG_ALLOC
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %d\n", (int)memory);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %d\n", (int) memory);
#endif
ptr = apr_palloc(memory_manager.memory_pool, memory);
@@ -131,7 +132,7 @@
switch_assert(duped != NULL);
#ifdef DEBUG_ALLOC
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %d\n", (int)len);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Perm Allocate %d\n", (int) len);
#endif
#ifdef LOCK_MORE
@@ -153,7 +154,7 @@
switch_assert(session != NULL);
switch_assert(session->pool != NULL);
va_start(ap, fmt);
-
+
result = apr_pvsprintf(session->pool, fmt, ap);
switch_assert(result != NULL);
va_end(ap);
@@ -199,7 +200,6 @@
if (!todup) {
return NULL;
}
-
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
#endif
@@ -208,7 +208,7 @@
#ifdef DEBUG_ALLOC
if (len > 500)
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %d\n", (int)len);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %d\n", (int) len);
#endif
duped = apr_pstrmemdup(session->pool, todup, len);
@@ -231,7 +231,6 @@
if (!todup) {
return NULL;
}
-
#ifdef LOCK_MORE
switch_mutex_lock(memory_manager.mem_lock);
#endif
@@ -240,7 +239,7 @@
#ifdef DEBUG_ALLOC
if (len > 500)
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "core strdup Allocate %d\n", (int)len);
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "core strdup Allocate %d\n", (int) len);
#endif
duped = apr_pstrmemdup(pool, todup, len);
@@ -262,10 +261,10 @@
{
char *tmp;
#ifdef PER_POOL_LOCK
- apr_allocator_t *my_allocator = NULL;
- apr_thread_mutex_t *my_mutex;
+ apr_allocator_t *my_allocator = NULL;
+ apr_thread_mutex_t *my_mutex;
#else
- void *pop = NULL;
+ void *pop = NULL;
#endif
switch_mutex_lock(memory_manager.mem_lock);
@@ -322,7 +321,7 @@
apr_pool_destroy(*pool);
}
*pool = NULL;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -338,8 +337,8 @@
#ifdef DEBUG_ALLOC
if (memory > 500)
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Core Allocate %d\n", (int)memory);
- /*switch_assert(memory < 20000);*/
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Core Allocate %d\n", (int) memory);
+ /*switch_assert(memory < 20000); */
#endif
ptr = apr_palloc(pool, memory);
@@ -357,9 +356,9 @@
{
switch_memory_pool_t *pool;
void *pop = NULL;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled memory pool(s)\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled memory pool(s)\n",
switch_queue_size(memory_manager.pool_recycle_queue) + switch_queue_size(memory_manager.pool_queue));
-
+
while (switch_queue_trypop(memory_manager.pool_recycle_queue, &pop) == SWITCH_STATUS_SUCCESS) {
pool = (switch_memory_pool_t *) pop;
if (!pool) {
@@ -369,7 +368,7 @@
}
}
-static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
{
memory_manager.pool_thread_running = 1;
@@ -388,7 +387,6 @@
break;
}
-
#if defined(PER_POOL_LOCK) || defined(DESTROY_POOLS)
apr_pool_destroy(pop);
#else
@@ -408,7 +406,7 @@
}
}
- done:
+ done:
switch_core_memory_reclaim();
{
@@ -428,7 +426,7 @@
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping memory pool queue.\n");
memory_manager.pool_thread_running = -1;
- while(memory_manager.pool_thread_running) {
+ while (memory_manager.pool_thread_running) {
switch_yield(1000);
}
}
@@ -436,7 +434,7 @@
switch_memory_pool_t *switch_core_memory_init(void)
{
switch_thread_t *thread;
- switch_threadattr_t *thd_attr;
+ switch_threadattr_t *thd_attr;
#ifdef PER_POOL_LOCK
apr_allocator_t *my_allocator = NULL;
apr_thread_mutex_t *my_mutex;
@@ -445,22 +443,22 @@
memset(&memory_manager, 0, sizeof(memory_manager));
#ifdef PER_POOL_LOCK
- if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) {
- abort();
- }
+ if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) {
+ abort();
+ }
- if ((apr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
- apr_allocator_destroy(my_allocator);
- my_allocator = NULL;
- abort();
- }
+ if ((apr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
+ apr_allocator_destroy(my_allocator);
+ my_allocator = NULL;
+ abort();
+ }
- if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, memory_manager.memory_pool)) != APR_SUCCESS) {
- abort();
- }
+ if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_DEFAULT, memory_manager.memory_pool)) != APR_SUCCESS) {
+ abort();
+ }
- apr_allocator_mutex_set(my_allocator, my_mutex);
- apr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
+ apr_allocator_mutex_set(my_allocator, my_mutex);
+ apr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
#else
apr_pool_create(&memory_manager.memory_pool, NULL);
switch_assert(memory_manager.memory_pool != NULL);
@@ -475,7 +473,7 @@
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
switch_thread_create(&thread, thd_attr, pool_thread, NULL, memory_manager.memory_pool);
-
+
while (!memory_manager.pool_thread_running) {
switch_yield(1000);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_port_allocator.c Tue May 27 07:24:06 2008
@@ -54,7 +54,7 @@
switch_memory_pool_t *pool;
switch_core_port_allocator_t *alloc;
int even, odd;
-
+
if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
return status;
}
@@ -63,7 +63,7 @@
switch_core_destroy_memory_pool(&pool);
return SWITCH_STATUS_MEMERR;
}
-
+
alloc->flags = flags;
even = switch_test_flag(alloc, SPF_EVEN);
odd = switch_test_flag(alloc, SPF_ODD);
@@ -90,14 +90,14 @@
}
}
- alloc->track_len = (end - start) + 2;
+ alloc->track_len = (end - start) + 2;
if (!(even && odd)) {
alloc->track_len /= 2;
}
-
+
alloc->track = switch_core_alloc(pool, (alloc->track_len + 2) * sizeof(switch_byte_t));
-
+
alloc->start = start;
alloc->next = start;
alloc->end = end;
@@ -118,20 +118,20 @@
int odd = switch_test_flag(alloc, SPF_ODD);
switch_mutex_lock(alloc->mutex);
- srand(getpid() + (unsigned)switch_timestamp(NULL));
-
- while(alloc->track_used < alloc->track_len) {
+ srand(getpid() + (unsigned) switch_timestamp(NULL));
+
+ while (alloc->track_used < alloc->track_len) {
double r;
uint32_t index;
int tries = 0;
do {
- r = ((double)rand() / ((double)(RAND_MAX)+(double)(1)));
+ r = ((double) rand() / ((double) (RAND_MAX) + (double) (1)));
index = (int) (r * alloc->track_len);
tries++;
- } while((alloc->track[index] || index >= alloc->track_len) && tries < 10000);
-
- while(alloc->track[index]) {
+ } while ((alloc->track[index] || index >= alloc->track_len) && tries < 10000);
+
+ while (alloc->track[index]) {
if (++index >= alloc->track_len) {
index = 0;
}
@@ -143,29 +143,29 @@
status = SWITCH_STATUS_SUCCESS;
if ((even && odd)) {
- port = (switch_port_t)(index + alloc->start);
+ port = (switch_port_t) (index + alloc->start);
} else {
- port = (switch_port_t)(index + (alloc->start / 2));
+ port = (switch_port_t) (index + (alloc->start / 2));
port *= 2;
- }
+ }
goto end;
}
}
-
-
- end:
+
+
+ end:
switch_mutex_unlock(alloc->mutex);
-
+
if (status == SWITCH_STATUS_SUCCESS) {
*port_ptr = port;
} else {
*port_ptr = 0;
}
-
+
return status;
-
+
}
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(switch_core_port_allocator_t *alloc, switch_port_t port)
@@ -174,7 +174,7 @@
int even = switch_test_flag(alloc, SPF_EVEN);
int odd = switch_test_flag(alloc, SPF_ODD);
int index = port - alloc->start;
-
+
if (!(even && odd)) {
index /= 2;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_rwlock.c Tue May 27 07:24:06 2008
@@ -57,7 +57,8 @@
if (switch_test_flag(session, SSF_DESTROYED)) {
status = SWITCH_STATUS_FALSE;
#ifdef SWITCH_DEBUG_RWLOCKS
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n", switch_channel_get_name(session->channel));
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
+ switch_channel_get_name(session->channel));
#endif
} else {
status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock);
@@ -75,7 +76,8 @@
SWITCH_DECLARE(void) switch_core_session_perform_write_lock(switch_core_session_t *session, const char *file, const char *func, int line)
{
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n", switch_channel_get_name(session->channel));
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "%s Write lock AQUIRED\n",
+ switch_channel_get_name(session->channel));
#else
SWITCH_DECLARE(void) switch_core_session_write_lock(switch_core_session_t *session)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c Tue May 27 07:24:06 2008
@@ -174,9 +174,7 @@
}
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(const char *endpoint_name,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- void *data)
+ switch_core_session_t **new_session, switch_memory_pool_t **pool, void *data)
{
const switch_endpoint_interface_t *endpoint_interface;
@@ -188,12 +186,11 @@
return endpoint_interface->io_routines->resurrect_session(new_session, pool, data);
}
- SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
- const char *endpoint_name,
- switch_caller_profile_t *caller_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags)
+SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
+ const char *endpoint_name,
+ switch_caller_profile_t *caller_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
switch_io_event_hook_outgoing_channel_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -218,10 +215,10 @@
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
-
+
forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
if (!switch_strlen_zero(forwardvar)) {
- forwardval = atoi(forwardvar) - 1;
+ forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
return SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR;
@@ -249,7 +246,8 @@
}
}
- if ((cause = endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
+ if ((cause =
+ endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
return cause;
}
@@ -262,16 +260,16 @@
}
if (!*new_session) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n",
endpoint_name, switch_channel_cause2str(cause));
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
} else {
switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
switch_event_t *event;
switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session);
-
+
switch_assert(peer_channel);
-
+
peer_profile = switch_channel_get_caller_profile(peer_channel);
if (channel) {
@@ -339,7 +337,7 @@
switch_channel_set_originator_caller_profile(peer_channel, cloned_profile);
}
}
-
+
if (peer_profile) {
if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
@@ -370,9 +368,9 @@
if ((status = switch_core_session_read_lock(session)) != SWITCH_STATUS_SUCCESS) {
return status;
}
-
+
switch_core_session_signal_lock(session);
-
+
if (session->endpoint_interface->io_routines->receive_message) {
status = session->endpoint_interface->io_routines->receive_message(session, message);
}
@@ -396,7 +394,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_pass_indication(switch_core_session_t *session, switch_core_session_message_types_t indication)
{
- switch_core_session_message_t msg = {0};
+ switch_core_session_message_t msg = { 0 };
switch_core_session_t *other_session;
const char *uuid;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -410,7 +408,7 @@
} else {
status = SWITCH_STATUS_FALSE;
}
-
+
return status;
}
@@ -426,7 +424,7 @@
switch_core_session_queue_message(session, msg);
return SWITCH_STATUS_SUCCESS;
}
-
+
return SWITCH_STATUS_FALSE;
}
@@ -441,7 +439,7 @@
status = SWITCH_STATUS_SUCCESS;
}
}
-
+
return status;
}
@@ -581,7 +579,7 @@
if (!switch_channel_test_flag(channel, CF_EVENT_LOCK) && session->private_event_queue) {
return switch_queue_size(session->private_event_queue);
}
-
+
return 0;
}
@@ -615,7 +613,7 @@
x++;
}
}
-
+
return x;
}
@@ -624,7 +622,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_size_t has;
- /* clear resamplers*/
+ /* clear resamplers */
switch_resample_destroy(&session->read_resampler);
switch_resample_destroy(&session->write_resampler);
@@ -634,7 +632,7 @@
/* wipe theese, they will be recreated if need be */
switch_buffer_destroy(&session->raw_read_buffer);
switch_buffer_destroy(&session->raw_write_buffer);
-
+
if (flush_dtmf) {
while ((has = switch_channel_has_dtmf(channel))) {
switch_channel_flush_dtmf(channel);
@@ -657,7 +655,7 @@
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_io_event_hook_state_change_t *ptr;
-
+
/* If trylock fails the signal is already awake so we needn't bother */
if (switch_mutex_trylock(session->mutex) == SWITCH_STATUS_SUCCESS) {
switch_thread_cond_signal(session->cond);
@@ -689,13 +687,12 @@
switch_memory_pool_t *pool;
switch_event_t *event;
- switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
- switch_channel_get_name((*session)->channel),
- switch_channel_state_name(switch_channel_get_state((*session)->channel)));
+ switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Close Channel %s [%s]\n",
+ switch_channel_get_name((*session)->channel), switch_channel_state_name(switch_channel_get_state((*session)->channel)));
- switch_core_media_bug_remove_all(*session);
+ switch_core_media_bug_remove_all(*session);
switch_ivr_deactivate_unicast(*session);
-
+
switch_scheduler_del_task_group((*session)->uuid_str);
switch_mutex_lock(runtime.throttle_mutex);
@@ -722,10 +719,10 @@
//#endif
*session = NULL;
switch_core_destroy_memory_pool(&pool);
-
+
}
-static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
{
switch_core_session_t *session = obj;
switch_event_t *event;
@@ -735,7 +732,7 @@
session->thread = thread;
switch_core_session_run(session);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %"SWITCH_SIZE_T_FMT" (%s) Locked, Waiting on external entities\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session %" SWITCH_SIZE_T_FMT " (%s) Locked, Waiting on external entities\n",
session->id, switch_channel_get_name(session->channel));
switch_core_session_write_lock(session);
switch_set_flag(session, SSF_DESTROYED);
@@ -753,7 +750,7 @@
switch_core_session_rwunlock(session);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Session %"SWITCH_SIZE_T_FMT" (%s) Ended\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Session %" SWITCH_SIZE_T_FMT " (%s) Ended\n",
session->id, switch_channel_get_name(session->channel));
switch_core_session_destroy(&session);
return NULL;
@@ -769,7 +766,7 @@
switch_threadattr_detach_set(thd_attr, 1);
switch_mutex_lock(session->mutex);
-
+
if (!session->thread_running) {
session->thread_running = 1;
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -818,7 +815,7 @@
count = session_manager.session_count;
sps = --runtime.sps;
switch_mutex_unlock(runtime.throttle_mutex);
-
+
if (sps <= 0) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error!\n");
return NULL;
@@ -838,7 +835,7 @@
session = switch_core_alloc(usepool, sizeof(*session));
session->pool = usepool;
-
+
if (switch_channel_alloc(&session->channel, session->pool) != SWITCH_STATUS_SUCCESS) {
abort();
}
@@ -968,13 +965,13 @@
switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE;
}
-
+
if (!application_interface->application_function) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Function for %s\n", app);
switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE;
}
-
+
if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
switch_ivr_media(session->uuid_str, SMF_NONE);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Application %s Requires media on channel %s!\n",
@@ -1004,7 +1001,7 @@
}
switch_core_session_exec(session, application_interface, expanded);
-
+
if (expanded != arg) {
switch_safe_free(expanded);
}
@@ -1013,7 +1010,8 @@
}
SWITCH_DECLARE(switch_status_t) switch_core_session_exec(switch_core_session_t *session,
- const switch_application_interface_t *application_interface, const char *arg) {
+ const switch_application_interface_t *application_interface, const char *arg)
+{
switch_app_log_t *log, *lp;
switch_event_t *event;
const char *var;
@@ -1028,7 +1026,7 @@
log->app = switch_core_session_strdup(session, application_interface->interface_name);
log->arg = switch_core_session_strdup(session, arg);
- for(lp = session->app_log; lp && lp->next; lp = lp->next);
+ for (lp = session->app_log; lp && lp->next; lp = lp->next);
if (lp) {
lp->next = log;
@@ -1036,7 +1034,7 @@
session->app_log = log;
}
}
-
+
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name);
@@ -1049,7 +1047,7 @@
switch_assert(application_interface->application_function);
application_interface->application_function(session, arg);
-
+
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Application", "%s", application_interface->interface_name);
@@ -1060,7 +1058,8 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_session_t *session, const char *exten, const char *dialplan, const char *context)
+SWITCH_DECLARE(switch_status_t) switch_core_session_execute_exten(switch_core_session_t *session, const char *exten, const char *dialplan,
+ const char *context)
{
char *dp[25];
char *dpstr;
@@ -1074,21 +1073,21 @@
if (!(profile = switch_channel_get_caller_profile(channel))) {
return SWITCH_STATUS_FALSE;
}
-
+
if (session->stack_count > SWITCH_MAX_STACKS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s too many stacked extensions\n", switch_channel_get_name(session->channel));
return SWITCH_STATUS_FALSE;
}
session->stack_count++;
-
+
new_profile = switch_caller_profile_clone(session, profile);
new_profile->destination_number = switch_core_session_strdup(session, exten);
-
+
if (!switch_strlen_zero(dialplan)) {
new_profile->dialplan = switch_core_session_strdup(session, dialplan);
}
-
+
if (!switch_strlen_zero(context)) {
new_profile->context = switch_core_session_strdup(session, context);
}
@@ -1101,7 +1100,7 @@
for (x = 0; x < argc; x++) {
char *dpname = dp[x];
char *dparg = NULL;
-
+
if (dpname) {
if ((dparg = strchr(dpname, ':'))) {
*dparg++ = '\0';
@@ -1113,14 +1112,14 @@
if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
continue;
}
-
+
count++;
-
+
if ((extension = dialplan_interface->hunt_function(session, dparg, new_profile)) != 0) {
break;
}
}
-
+
if (!extension) {
status = SWITCH_STATUS_FALSE;
goto done;
@@ -1129,8 +1128,8 @@
new_profile->caller_extension = extension;
if (profile->caller_extension) {
- for(pp = profile->caller_extension->children; pp && pp->next; pp = pp->next);
-
+ for (pp = profile->caller_extension->children; pp && pp->next; pp = pp->next);
+
if (pp) {
pp->next = new_profile;
} else {
@@ -1141,19 +1140,19 @@
while (switch_channel_ready(channel) && extension->current_application) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Execute %s(%s)\n",
extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
-
+
if (switch_core_session_execute_application(session,
extension->current_application->application_name,
extension->current_application->application_data) != SWITCH_STATUS_SUCCESS) {
goto done;
}
-
- extension->current_application = extension->current_application->next;
+
+ extension->current_application = extension->current_application->next;
}
- done:
+ done:
session->stack_count--;
- return status;
+ return status;
}
/* For Emacs:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_speech.c Tue May 27 07:24:06 2008
@@ -37,11 +37,8 @@
SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *sh,
const char *module_name,
- const char *voice_name,
- unsigned int rate,
- unsigned int interval,
- switch_speech_flag_t *flags,
- switch_memory_pool_t *pool)
+ const char *voice_name,
+ unsigned int rate, unsigned int interval, switch_speech_flag_t *flags, switch_memory_pool_t *pool)
{
switch_status_t status;
char buf[256] = "";
@@ -130,7 +127,7 @@
}
SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
- void *data, switch_size_t *datalen, uint32_t * rate, switch_speech_flag_t *flags)
+ void *data, switch_size_t *datalen, uint32_t *rate, switch_speech_flag_t *flags)
{
switch_assert(sh != NULL);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c Tue May 27 07:24:06 2008
@@ -56,7 +56,7 @@
retries = 1000;
}
- again:
+again:
while (begin_retries > 0) {
again = 0;
@@ -107,7 +107,7 @@
}
}
- done:
+done:
switch_core_db_exec(db, "end transaction", NULL, NULL, NULL);
@@ -293,7 +293,7 @@
if (!switch_strlen_zero(state)) {
state_i = atoi(state);
}
-
+
switch (state_i) {
case CS_HANGUP:
case CS_DONE:
@@ -474,7 +474,7 @@
}
switch_queue_create(&sql_manager.sql_queue, SWITCH_SQL_QUEUE_LEN, sql_manager.memory_pool);
-
+
switch_threadattr_create(&thd_attr, sql_manager.memory_pool);
switch_threadattr_detach_set(thd_attr, 1);
switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c Tue May 27 07:24:06 2008
@@ -50,8 +50,7 @@
static void switch_core_standard_on_reset(switch_core_session_t *session)
{
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n",
- switch_channel_get_name(session->channel));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard RESET %s\n", switch_channel_get_name(session->channel));
}
static void switch_core_standard_on_routing(switch_core_session_t *session)
@@ -71,7 +70,7 @@
} else {
char *dp[25];
int argc, x, count = 0;
-
+
if (!switch_strlen_zero(caller_profile->dialplan)) {
if ((dpstr = switch_core_session_strdup(session, caller_profile->dialplan))) {
expanded = switch_channel_expand_variables(session->channel, dpstr);
@@ -79,7 +78,7 @@
for (x = 0; x < argc; x++) {
char *dpname = dp[x];
char *dparg = NULL;
-
+
if (dpname) {
if ((dparg = strchr(dpname, ':'))) {
*dparg++ = '\0';
@@ -90,7 +89,7 @@
if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
continue;
}
-
+
count++;
if ((extension = dialplan_interface->hunt_function(session, dparg, NULL)) != 0) {
@@ -115,8 +114,8 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No Route, Aborting\n");
switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
}
-
- end:
+
+ end:
if (expanded && dpstr && expanded != dpstr) {
free(expanded);
@@ -129,7 +128,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard EXECUTE\n");
- top:
+ top:
switch_channel_clear_flag(session->channel, CF_RESET);
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
@@ -141,12 +140,12 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Execute %s(%s)\n", switch_channel_get_name(session->channel),
extension->current_application->application_name, switch_str_nil(extension->current_application->application_data));
- if (switch_core_session_execute_application(session,
+ if (switch_core_session_execute_application(session,
extension->current_application->application_name,
extension->current_application->application_data) != SWITCH_STATUS_SUCCESS) {
return;
}
-
+
if (switch_channel_test_flag(session->channel, CF_RESET)) {
goto top;
}
@@ -249,7 +248,7 @@
void switch_core_state_machine_init(switch_memory_pool_t *pool)
{
-
+
if (switch_test_flag((&runtime), SCF_CRASH_PROT)) {
sqlite3HashInit(&stack_table, SQLITE_HASH_BINARY, 0);
}
@@ -320,7 +319,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Thread has crashed for channel %s\n", switch_channel_get_name(session->channel));
switch_channel_hangup(session->channel, SWITCH_CAUSE_CRASH);
} else {
- sqlite3HashInsert(&stack_table, &thread_id, sizeof(thread_id), (void *)&env);
+ sqlite3HashInsert(&stack_table, &thread_id, sizeof(thread_id), (void *) &env);
//apr_hash_set(stack_table, &thread_id, sizeof(thread_id), &env);
}
}
@@ -361,7 +360,7 @@
if (state != switch_channel_get_running_state(session->channel) || state == CS_HANGUP || exception) {
int index = 0;
int proceed = 1;
- int do_extra_handlers = 1;
+ int do_extra_handlers = 1;
switch_channel_set_running_state(session->channel, state);
@@ -372,7 +371,7 @@
case CS_DONE:
goto done;
/* HANGUP INIT ROUTING and RESET are all short term so we signal lock during their callbacks */
- case CS_HANGUP: /* Deactivate and end the thread */
+ case CS_HANGUP: /* Deactivate and end the thread */
{
const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
const char *hook_var;
@@ -387,7 +386,7 @@
do_extra_handlers = 0;
}
} else if (!switch_true(var)) {
- do_extra_handlers = 0;
+ do_extra_handlers = 0;
}
}
switch_core_session_signal_lock(session);
@@ -405,50 +404,51 @@
}
SWITCH_STANDARD_STREAM(stream);
switch_api_execute(cmd, arg, NULL, &stream);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, arg,
+ switch_str_nil((char *) stream.data));
switch_safe_free(stream.data);
}
}
goto done;
- case CS_INIT: /* Basic setup tasks */
+ case CS_INIT: /* Basic setup tasks */
switch_core_session_signal_lock(session);
STATE_MACRO(init, "INIT");
switch_core_session_signal_unlock(session);
break;
- case CS_ROUTING: /* Look for a dialplan and find something to do */
+ case CS_ROUTING: /* Look for a dialplan and find something to do */
switch_core_session_signal_lock(session);
STATE_MACRO(routing, "ROUTING");
switch_core_session_signal_unlock(session);
break;
- case CS_RESET: /* Reset */
+ case CS_RESET: /* Reset */
switch_core_session_signal_lock(session);
STATE_MACRO(reset, "RESET");
switch_core_session_signal_unlock(session);
break;
/* These other states are intended for prolonged durations so we do not signal lock for them */
- case CS_EXECUTE: /* Execute an Operation */
+ case CS_EXECUTE: /* Execute an Operation */
STATE_MACRO(execute, "EXECUTE");
break;
- case CS_EXCHANGE_MEDIA: /* loop all data back to source */
+ case CS_EXCHANGE_MEDIA: /* loop all data back to source */
STATE_MACRO(exchange_media, "EXCHANGE_MEDIA");
break;
- case CS_SOFT_EXECUTE: /* send/recieve data to/from another channel */
+ case CS_SOFT_EXECUTE: /* send/recieve data to/from another channel */
STATE_MACRO(soft_execute, "SOFT_EXECUTE");
break;
- case CS_PARK: /* wait in limbo */
+ case CS_PARK: /* wait in limbo */
STATE_MACRO(park, "PARK");
break;
- case CS_CONSUME_MEDIA: /* wait in limbo */
+ case CS_CONSUME_MEDIA: /* wait in limbo */
STATE_MACRO(consume_media, "CONSUME_MEDIA");
break;
- case CS_HIBERNATE: /* sleep */
+ case CS_HIBERNATE: /* sleep */
STATE_MACRO(hibernate, "HIBERNATE");
break;
case CS_NONE:
abort();
break;
}
-
+
if (midstate == CS_DONE) {
break;
}
@@ -456,7 +456,7 @@
}
endstate = switch_channel_get_state(session->channel);
-
+
if (endstate == switch_channel_get_running_state(session->channel)) {
if (endstate == CS_NEW) {
switch_yield(1000);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_timer.c Tue May 27 07:24:06 2008
@@ -35,7 +35,8 @@
#include <switch.h>
#include "private/switch_core_pvt.h"
-SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
+ switch_memory_pool_t *pool)
{
switch_timer_interface_t *timer_interface;
switch_status_t status;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp Tue May 27 07:24:06 2008
@@ -104,7 +104,7 @@
}
-SWITCH_DECLARE(char *) API::execute(const char *cmd, const char *arg)
+SWITCH_DECLARE(const char *) API::execute(const char *cmd, const char *arg)
{
switch_stream_handle_t stream = { 0 };
this_check("");
@@ -114,7 +114,7 @@
return last_data;
}
-SWITCH_DECLARE(char *) API::executeString(const char *cmd)
+SWITCH_DECLARE(const char *) API::executeString(const char *cmd)
{
char *arg;
switch_stream_handle_t stream = { 0 };
@@ -238,7 +238,7 @@
return false;
}
-SWITCH_DECLARE(char *)Event::getHeader(char *header_name)
+SWITCH_DECLARE(const char *)Event::getHeader(char *header_name)
{
this_check("");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c Tue May 27 07:24:06 2008
@@ -59,13 +59,13 @@
static switch_queue_t *EVENT_HEADER_RECYCLE_QUEUE = NULL;
static void launch_dispatch_threads(int max, int len, switch_memory_pool_t *pool);
-static char *my_dup (const char *s)
+static char *my_dup(const char *s)
{
- size_t len = strlen (s) + 1;
- void *new = malloc (len);
+ size_t len = strlen(s) + 1;
+ void *new = malloc(len);
switch_assert(new);
- return (char *) memcpy (new, s, len);
+ return (char *) memcpy(new, s, len);
}
#ifndef ALLOC
@@ -172,7 +172,7 @@
return match;
}
-static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *thread, void *obj)
{
switch_queue_t *queue = (switch_queue_t *) obj;
int my_id = 0;
@@ -186,7 +186,7 @@
}
}
- for(;;) {
+ for (;;) {
void *pop = NULL;
switch_event_t *event = NULL;
@@ -197,7 +197,7 @@
if (!pop) {
break;
}
-
+
event = (switch_event_t *) pop;
switch_event_deliver(&event);
}
@@ -206,14 +206,14 @@
switch_mutex_lock(EVENT_QUEUE_MUTEX);
THREAD_COUNT--;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Dispatch Thread %d Ended.\n", my_id);
return NULL;
-
+
}
-static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, void *obj)
{
switch_queue_t *queue = (switch_queue_t *) obj;
int index = 0;
@@ -228,11 +228,11 @@
break;
}
}
-
- for(;;) {
+
+ for (;;) {
void *pop = NULL;
switch_event_t *event = NULL;
-
+
if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -243,18 +243,18 @@
event = (switch_event_t *) pop;
- while(event) {
+ while (event) {
for (index = 0; index < SOFT_MAX_DISPATCH; index++) {
if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) {
event = NULL;
break;
}
}
-
+
if (event) {
- if (SOFT_MAX_DISPATCH+1 < MAX_DISPATCH) {
- switch_mutex_lock(EVENT_QUEUE_MUTEX);
- launch_dispatch_threads(SOFT_MAX_DISPATCH+1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
+ if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) {
+ switch_mutex_lock(EVENT_QUEUE_MUTEX);
+ launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL);
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
}
}
@@ -264,10 +264,10 @@
switch_mutex_lock(EVENT_QUEUE_MUTEX);
THREAD_COUNT--;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Event Thread %d Ended.\n", my_id);
return NULL;
-
+
}
@@ -352,7 +352,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled event(s) %d bytes\n", size, (int) sizeof(switch_event_t) * size);
size = switch_queue_size(EVENT_HEADER_RECYCLE_QUEUE);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled event header(s) %d bytes\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled event header(s) %d bytes\n",
size, (int) sizeof(switch_event_header_t) * size);
while (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
@@ -371,16 +371,16 @@
SYSTEM_RUNNING = 0;
switch_mutex_unlock(EVENT_QUEUE_MUTEX);
- for(x = 0; x < 3; x++) {
+ for (x = 0; x < 3; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping event queue %d\n", x);
switch_queue_push(EVENT_QUEUE[x], NULL);
}
- for(x = 0; x < SOFT_MAX_DISPATCH; x++) {
+ for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch queue %d\n", x);
switch_queue_push(EVENT_DISPATCH_QUEUE[x], NULL);
}
-
+
while (x < 10000 && THREAD_COUNT) {
switch_yield(1000);
if (THREAD_COUNT == last) {
@@ -388,7 +388,7 @@
}
last = THREAD_COUNT;
}
-
+
switch_core_hash_destroy(&CUSTOM_HASH);
switch_core_memory_reclaim_events();
@@ -399,17 +399,17 @@
static void launch_dispatch_threads(int max, int len, switch_memory_pool_t *pool)
{
switch_thread_t *thread;
- switch_threadattr_t *thd_attr;
+ switch_threadattr_t *thd_attr;
int index = 0;
if (max > MAX_DISPATCH) {
return;
}
-
+
if (max < SOFT_MAX_DISPATCH) {
return;
}
-
+
for (index = SOFT_MAX_DISPATCH; index < max && index < MAX_DISPATCH; index++) {
if (EVENT_DISPATCH_QUEUE[index]) {
continue;
@@ -445,7 +445,7 @@
switch_queue_create(&EVENT_QUEUE[2], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
switch_queue_create(&EVENT_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
switch_queue_create(&EVENT_HEADER_RECYCLE_QUEUE, 250000, THRUNTIME_POOL);
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Eventing Engine.\n");
switch_mutex_init(&BLOCK, SWITCH_MUTEX_NESTED, RUNTIME_POOL);
@@ -459,7 +459,7 @@
switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[0], RUNTIME_POOL);
switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[1], RUNTIME_POOL);
switch_thread_create(&thread, thd_attr, switch_event_thread, EVENT_QUEUE[2], RUNTIME_POOL);
-
+
while (!THREAD_COUNT) {
switch_yield(1000);
}
@@ -475,11 +475,11 @@
SWITCH_DECLARE(switch_status_t) switch_event_create_subclass(switch_event_t **event, switch_event_types_t event_id, const char *subclass_name)
{
void *pop;
-
+
if (event_id != SWITCH_EVENT_CUSTOM && subclass_name) {
return SWITCH_STATUS_GENERR;
}
-
+
if (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
*event = (switch_event_t *) pop;
} else {
@@ -493,7 +493,7 @@
if (subclass_name) {
if (!((*event)->subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
- switch_event_reserve_subclass((char *)subclass_name);
+ switch_event_reserve_subclass((char *) subclass_name);
(*event)->subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
}
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
@@ -513,7 +513,8 @@
{
switch_event_header_t *hp;
switch_assert(event);
- if (!header_name) return NULL;
+ if (!header_name)
+ return NULL;
for (hp = event->headers; hp; hp = hp->next) {
if (!strcasecmp(hp->name, header_name)) {
@@ -556,7 +557,7 @@
}
lp = hp;
}
-
+
return status;
}
@@ -685,7 +686,7 @@
for (hp = todup->headers; hp; hp = hp->next) {
void *pop;
-
+
if (switch_queue_trypop(EVENT_HEADER_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
header = (switch_event_header_t *) pop;
} else {
@@ -844,7 +845,7 @@
return header;
}
-SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt,...)
+SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt, ...)
{
switch_event_header_t *hp;
char *data = NULL, *body = NULL;
@@ -863,7 +864,8 @@
ret = vasprintf(&data, fmt, ap);
#else
data = (char *) malloc(2048);
- if (!data) return NULL;
+ if (!data)
+ return NULL;
ret = vsnprintf(data, 2048, fmt, ap);
#endif
va_end(ap);
@@ -935,7 +937,7 @@
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-Local", date);
switch_rfc822_date(date, ts);
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Date-GMT", date);
- switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Date-timestamp", "%"SWITCH_UINT64_T_FMT, (uint64_t)ts);
+ switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Date-timestamp", "%" SWITCH_UINT64_T_FMT, (uint64_t) ts);
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-File", switch_cut_path(file));
switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Function", func);
switch_event_add_header(*event, SWITCH_STACK_BOTTOM, "Event-Calling-Line-Number", "%d", line);
@@ -948,7 +950,7 @@
if (user_data) {
(*event)->event_user_data = user_data;
}
-
+
switch_queue_push(EVENT_QUEUE[(*event)->priority], *event);
*event = NULL;
@@ -998,15 +1000,15 @@
return SWITCH_STATUS_MEMERR;
}
-SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(char *file, char *func, int line,
+SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(char *file, char *func, int line,
const char *proto, const char *login,
const char *from, const char *from_domain,
- const char *status, const char *event_type,
+ const char *status, const char *event_type,
const char *alt_event_type, int event_count,
const char *unique_id, const char *channel_state,
const char *answer_state, const char *call_direction)
{
- switch_event_t *pres_event;
+ switch_event_t *pres_event;
if (switch_event_create_subclass(&pres_event, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(pres_event, SWITCH_STACK_TOP, "proto", proto);
@@ -1047,22 +1049,22 @@
int nv = 0;
q = in;
- while(q && *q) {
+ while (q && *q) {
if (!(p = strchr(q, '$'))) {
break;
}
-
- if (*(p+1) != '{') {
+
+ if (*(p + 1) != '{') {
q = p + 1;
continue;
}
-
+
nv = 1;
break;
}
-
+
if (!nv) {
- return (char *)in;
+ return (char *) in;
}
nv = 0;
@@ -1074,7 +1076,7 @@
c = data;
for (p = indup; p && *p; p++) {
vtype = 0;
-
+
if (*p == '\\') {
if (*(p + 1) == '$') {
nv = 1;
@@ -1087,8 +1089,8 @@
}
if (*p == '$' && !nv) {
- if (*(p+1)) {
- if (*(p+1) == '{') {
+ if (*(p + 1)) {
+ if (*(p + 1) == '{') {
vtype = 1;
} else {
nv = 1;
@@ -1132,20 +1134,20 @@
br--;
}
}
-
+
e++;
}
p = e;
-
+
if ((vval = strchr(vname, '('))) {
e = vval - 1;
*vval++ = '\0';
- while(*e == ' ') {
+ while (*e == ' ') {
*e-- = '\0';
}
e = vval;
br = 1;
- while(e && *e) {
+ while (e && *e) {
if (*e == '(') {
br++;
} else if (br > 1 && *e == ')') {
@@ -1166,7 +1168,7 @@
int ooffset = 0;
char *ptr;
- if ((expanded = switch_event_expand_headers(event, (char *)vname)) == vname) {
+ if ((expanded = switch_event_expand_headers(event, (char *) vname)) == vname) {
expanded = NULL;
} else {
vname = expanded;
@@ -1179,25 +1181,25 @@
ooffset = atoi(ptr);
}
}
-
+
if (!(sub_val = switch_event_get_header(event, vname))) {
sub_val = switch_core_get_variable(vname);
}
if (offset || ooffset) {
cloned_sub_val = strdup(sub_val);
- switch_assert(cloned_sub_val);
+ switch_assert(cloned_sub_val);
sub_val = cloned_sub_val;
}
if (offset >= 0) {
sub_val += offset;
- } else if ((size_t)abs(offset) <= strlen(sub_val)) {
+ } else if ((size_t) abs(offset) <= strlen(sub_val)) {
sub_val = cloned_sub_val + (strlen(cloned_sub_val) + offset);
}
- if (ooffset > 0 && (size_t)ooffset < strlen(sub_val)) {
- if ((ptr = (char *)sub_val + ooffset)) {
+ if (ooffset > 0 && (size_t) ooffset < strlen(sub_val)) {
+ if ((ptr = (char *) sub_val + ooffset)) {
*ptr = '\0';
}
}
@@ -1212,7 +1214,7 @@
if (stream.data) {
char *expanded_vname = NULL;
- if ((expanded_vname = switch_event_expand_headers(event, (char *)vname)) == vname) {
+ if ((expanded_vname = switch_event_expand_headers(event, (char *) vname)) == vname) {
expanded_vname = NULL;
} else {
vname = expanded_vname;
@@ -1230,15 +1232,15 @@
} else {
free(stream.data);
}
-
+
switch_safe_free(expanded);
switch_safe_free(expanded_vname);
-
+
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
free(data);
free(indup);
- return (char *)in;
+ return (char *) in;
}
}
if ((nlen = sub_val ? strlen(sub_val) : 0)) {
@@ -1277,20 +1279,21 @@
}
}
free(indup);
-
+
return data;
}
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t* vars_map)
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map)
{
switch_stream_handle_t stream = { 0 };
switch_size_t encode_len = 1024, new_len = 0;
char *encode_buf = NULL;
- const char *prof[12] = { 0 }, *prof_names[12] = {0};
+ const char *prof[12] = { 0 }, *prof_names[12] = {
+ 0};
char *e = NULL;
switch_event_header_t *hi;
uint32_t x = 0;
- void* data = NULL;
+ void *data = NULL;
SWITCH_STANDARD_STREAM(stream);
@@ -1325,24 +1328,23 @@
if (event) {
if ((hi = event->headers)) {
-
+
for (; hi; hi = hi->next) {
char *var = hi->name;
char *val = hi->value;
-
- if (vars_map != NULL)
- {
- if ((data = switch_core_hash_find(vars_map,var)) == NULL || strcasecmp(((char*)data),"enabled"))
- continue;
-
+
+ if (vars_map != NULL) {
+ if ((data = switch_core_hash_find(vars_map, var)) == NULL || strcasecmp(((char *) data), "enabled"))
+ continue;
+
}
-
+
new_len = (strlen((char *) var) * 3) + 1;
if (encode_len < new_len) {
char *tmp;
-
+
encode_len = new_len;
-
+
tmp = realloc(encode_buf, encode_len);
switch_assert(tmp);
encode_buf = tmp;
@@ -1354,7 +1356,7 @@
}
}
}
-
+
e = (char *) stream.data + (strlen((char *) stream.data) - 1);
if (e && *e == '&') {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c Tue May 27 07:24:06 2008
@@ -90,17 +90,17 @@
}
channel = switch_core_session_get_channel(conninfo->session);
-
- while(switch_test_flag(conninfo, SUF_READY) && switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
+
+ while (switch_test_flag(conninfo, SUF_READY) && switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
len = conninfo->write_frame.buflen;
if (switch_socket_recv(conninfo->socket, conninfo->write_frame.data, &len) != SWITCH_STATUS_SUCCESS || len == 0) {
break;
}
- conninfo->write_frame.datalen = (uint32_t)len;
+ conninfo->write_frame.datalen = (uint32_t) len;
conninfo->write_frame.samples = conninfo->write_frame.datalen / 2;
switch_core_session_write_frame(conninfo->session, &conninfo->write_frame, SWITCH_IO_FLAG_NONE, conninfo->stream_id);
}
-
+
switch_clear_flag_locked(conninfo, SUF_READY);
switch_clear_flag_locked(conninfo, SUF_THREAD_RUNNING);
@@ -126,14 +126,14 @@
int sanity = 0;
if (!switch_channel_test_flag(channel, CF_UNICAST)) {
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
}
if ((conninfo = switch_channel_get_private(channel, "unicast"))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Shutting down unicast connection\n");
switch_clear_flag_locked(conninfo, SUF_READY);
switch_socket_shutdown(conninfo->socket, SWITCH_SHUTDOWN_READWRITE);
- while(switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
+ while (switch_test_flag(conninfo, SUF_THREAD_RUNNING)) {
switch_yield(10000);
if (++sanity >= 10000) {
break;
@@ -148,13 +148,10 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
+SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_t *session,
char *local_ip,
switch_port_t local_port,
- char *remote_ip,
- switch_port_t remote_port,
- char *transport,
- char *flags)
+ char *remote_ip, switch_port_t remote_port, char *transport, char *flags)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_unicast_conninfo_t *conninfo = switch_core_session_alloc(session, sizeof(*conninfo));
@@ -168,7 +165,7 @@
conninfo->remote_ip = switch_core_session_strdup(session, remote_ip);
conninfo->remote_port = remote_port;
conninfo->session = session;
-
+
if (!strcasecmp(transport, "udp")) {
conninfo->type = AF_INET;
conninfo->transport = SOCK_DGRAM;
@@ -187,9 +184,9 @@
}
switch_mutex_init(&conninfo->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-
+
read_codec = switch_core_session_get_read_codec(session);
-
+
if (!switch_test_flag(conninfo, SUF_NATIVE)) {
if (switch_core_codec_init(&conninfo->read_codec,
"L16",
@@ -216,17 +213,17 @@
conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
if (switch_sockaddr_info_get(&conninfo->local_addr,
- conninfo->local_ip, SWITCH_UNSPEC, conninfo->local_port, 0,
+ conninfo->local_ip, SWITCH_UNSPEC, conninfo->local_port, 0,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
goto fail;
}
-
- if (switch_sockaddr_info_get(&conninfo->remote_addr,
+
+ if (switch_sockaddr_info_get(&conninfo->remote_addr,
conninfo->remote_ip, SWITCH_UNSPEC, conninfo->remote_port, 0,
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
goto fail;
}
-
+
if (switch_socket_create(&conninfo->socket, AF_INET, SOCK_DGRAM, 0, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
if (switch_socket_bind(conninfo->socket, conninfo->local_addr) != SWITCH_STATUS_SUCCESS) {
goto fail;
@@ -242,11 +239,11 @@
switch_set_flag_locked(conninfo, SUF_READY);
return SWITCH_STATUS_SUCCESS;
- fail:
+ fail:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure creating unicast connection %s:%d->%s:%d\n",
conninfo->local_ip, conninfo->local_port, conninfo->remote_ip, conninfo->remote_port);
- return SWITCH_STATUS_FALSE;
+ return SWITCH_STATUS_FALSE;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *session, switch_event_t *event)
@@ -280,8 +277,8 @@
switch_frame_t *read_frame;
int frame_count = atoi(lead_frames);
int max_frames = frame_count * 2;
-
- while(frame_count > 0 && --max_frames > 0) {
+
+ while (frame_count > 0 && --max_frames > 0) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto done;
@@ -310,7 +307,7 @@
int x;
const char *b_uuid = NULL;
switch_core_session_t *b_session = NULL;
-
+
switch_channel_clear_flag(channel, CF_STOP_BROADCAST);
switch_channel_set_flag(channel, CF_BROADCAST);
if (hold_bleg && switch_true(hold_bleg)) {
@@ -336,8 +333,8 @@
}
for (x = 0; x < loops || loops < 0; x++) {
switch_time_t b4, aftr;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
switch_channel_get_name(channel), app_name, app_arg);
b4 = switch_timestamp_now();
switch_core_session_exec(session, application_interface, app_arg);
@@ -356,7 +353,7 @@
}
}
- switch_channel_clear_flag(channel, CF_BROADCAST);
+ switch_channel_clear_flag(channel, CF_BROADCAST);
}
}
}
@@ -384,7 +381,7 @@
transport = "udp";
}
- switch_ivr_activate_unicast(session, local_ip, (switch_port_t)atoi(local_port), remote_ip, (switch_port_t)atoi(remote_port), transport, flags);
+ switch_ivr_activate_unicast(session, local_ip, (switch_port_t) atoi(local_port), remote_ip, (switch_port_t) atoi(remote_port), transport, flags);
} else if (cmd_hash == CMD_HANGUP) {
char *cause_name = switch_event_get_header(event, "hangup-cause");
@@ -402,7 +399,7 @@
status = SWITCH_STATUS_SUCCESS;
- done:
+ done:
switch_channel_clear_flag(channel, CF_EVENT_PARSE);
switch_channel_clear_flag(channel, CF_EVENT_LOCK);
@@ -473,18 +470,18 @@
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
+
if (switch_channel_test_flag(channel, CF_UNICAST)) {
if (!conninfo) {
if (!(conninfo = switch_channel_get_private(channel, "unicast"))) {
switch_channel_clear_flag(channel, CF_UNICAST);
}
-
+
if (conninfo) {
unicast_thread_launch(conninfo);
}
}
-
+
if (conninfo) {
switch_size_t len = 0;
uint32_t flags = 0;
@@ -504,13 +501,11 @@
if (switch_test_flag(conninfo, SUF_NATIVE)) {
tstatus = SWITCH_STATUS_NOOP;
} else {
- tstatus = switch_core_codec_decode(
- read_codec,
- &conninfo->read_codec,
- read_frame->data,
- read_frame->datalen,
- read_codec->implementation->actual_samples_per_second,
- decoded, &dlen, &rate, &flags);
+ tstatus = switch_core_codec_decode(read_codec,
+ &conninfo->read_codec,
+ read_frame->data,
+ read_frame->datalen,
+ read_codec->implementation->actual_samples_per_second, decoded, &dlen, &rate, &flags);
}
switch (tstatus) {
case SWITCH_STATUS_NOOP:
@@ -533,19 +528,19 @@
if (tstatus == SWITCH_STATUS_SUCCESS) {
len = sendlen;
- if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *)sendbuf, &len) != SWITCH_STATUS_SUCCESS) {
+ if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *) sendbuf, &len) != SWITCH_STATUS_SUCCESS) {
switch_ivr_deactivate_unicast(session);
}
}
}
}
-
+
if (switch_core_session_private_event_count(session)) {
switch_ivr_parse_all_events(session);
}
if (switch_channel_has_dtmf(channel)) {
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_channel_dequeue_dtmf(channel, &dtmf);
if (args && args->input_callback) {
if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) {
@@ -600,7 +595,7 @@
while (switch_channel_ready(channel)) {
switch_frame_t *read_frame = NULL;
switch_event_t *event;
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
@@ -616,12 +611,12 @@
}
if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ switch_ivr_parse_all_events(session);
+ }
if (switch_channel_has_dtmf(channel)) {
switch_channel_dequeue_dtmf(channel, &dtmf);
- status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
}
if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
@@ -656,11 +651,9 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_session_t *session,
char *buf,
switch_size_t buflen,
- switch_size_t maxdigits,
- const char *terminators, char *terminator,
- uint32_t first_timeout,
- uint32_t digit_timeout,
- uint32_t abs_timeout)
+ switch_size_t maxdigits,
+ const char *terminators, char *terminator,
+ uint32_t first_timeout, uint32_t digit_timeout, uint32_t abs_timeout)
{
switch_size_t i = 0, x = strlen(buf);
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -693,7 +686,7 @@
} else if (first_timeout) {
digit_timeout = eff_timeout = first_timeout;
}
-
+
if (eff_timeout) {
digit_started = switch_timestamp_now();
@@ -701,7 +694,7 @@
while (switch_channel_ready(channel)) {
switch_frame_t *read_frame;
-
+
if (abs_timeout) {
abs_elapsed = (uint32_t) ((switch_timestamp_now() - started) / 1000);
if (abs_elapsed >= abs_timeout) {
@@ -709,9 +702,9 @@
}
}
- if (switch_core_session_private_event_count(session)) {
- switch_ivr_parse_all_events(session);
- }
+ if (switch_core_session_private_event_count(session)) {
+ switch_ivr_parse_all_events(session);
+ }
if (eff_timeout) {
@@ -722,9 +715,9 @@
}
if (switch_channel_has_dtmf(channel)) {
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_size_t y;
-
+
if (eff_timeout) {
eff_timeout = digit_timeout;
digit_started = switch_timestamp_now();
@@ -739,8 +732,8 @@
*terminator = dtmf.digit;
return SWITCH_STATUS_SUCCESS;
}
-
-
+
+
buf[x++] = dtmf.digit;
buf[x] = '\0';
if (x >= buflen || x >= maxdigits) {
@@ -777,13 +770,13 @@
switch_channel_set_flag(channel, CF_SUSPEND);
switch_core_session_receive_message(session, &msg);
-
+
if (moh && (stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_ivr_broadcast(other_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
}
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -848,7 +841,7 @@
switch_status_t status = SWITCH_STATUS_GENERR;
uint8_t swap = 0;
switch_frame_t *read_frame = NULL;
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA;
msg.from = __FILE__;
@@ -865,7 +858,7 @@
switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000);
switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if ((flags & SMF_REBRIDGE)
&& (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE))
&& (other_session = switch_core_session_locate(other_uuid))) {
@@ -881,7 +874,7 @@
switch_channel_clear_state_handler(channel, NULL);
}
}
-
+
switch_core_session_rwunlock(session);
if (other_channel) {
@@ -906,7 +899,7 @@
switch_core_session_message_t msg = { 0 };
switch_status_t status = SWITCH_STATUS_GENERR;
uint8_t swap = 0;
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_NOMEDIA;
msg.from = __FILE__;
@@ -920,7 +913,7 @@
if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_PROXY_MODE)) {
switch_core_session_receive_message(session, &msg);
-
+
if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
(other_session = switch_core_session_locate(other_uuid))) {
other_channel = switch_core_session_get_channel(other_session);
@@ -947,7 +940,8 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
+SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan,
+ const char *context)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_caller_profile_t *profile, *new_profile;
@@ -960,7 +954,7 @@
int forwardval = 70;
if (!switch_strlen_zero(forwardvar)) {
- forwardval = atoi(forwardvar) - 1;
+ forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
switch_channel_hangup(channel, SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR);
@@ -981,7 +975,7 @@
if (switch_strlen_zero(dialplan)) {
dialplan = profile->dialplan;
}
-
+
if (switch_strlen_zero(context)) {
context = profile->context;
}
@@ -989,7 +983,7 @@
if (switch_strlen_zero(dialplan)) {
dialplan = "XML";
}
-
+
if (switch_strlen_zero(context)) {
context = "default";
}
@@ -997,7 +991,7 @@
if (switch_strlen_zero(extension)) {
extension = "service";
}
-
+
new_profile = switch_caller_profile_clone(session, profile);
new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
@@ -1015,7 +1009,7 @@
if (!uuid) {
uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE);
}
-
+
if (uuid && (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
@@ -1028,7 +1022,7 @@
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
-
+
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
@@ -1045,7 +1039,7 @@
switch_channel_set_flag(channel, CF_TRANSFER);
switch_channel_set_state(channel, CS_ROUTING);
-
+
msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSFER;
msg.from = __FILE__;
switch_core_session_receive_message(session, &msg);
@@ -1108,7 +1102,7 @@
switch_time_t last_digit_time;
};
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1148,7 +1142,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t * parser)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_destroy(switch_ivr_digit_stream_parser_t *parser)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1166,7 +1160,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t ** stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1182,7 +1176,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t * stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t *stream)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1195,7 +1189,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t * parser, char *digits, void *data)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_event(switch_ivr_digit_stream_parser_t *parser, char *digits, void *data)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1231,7 +1225,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t * parser, char *digits)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_del_event(switch_ivr_digit_stream_parser_t *parser, char *digits)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1246,7 +1240,7 @@
return status;
}
-SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t * parser, switch_ivr_digit_stream_t * stream, char digit)
+SWITCH_DECLARE(void *) switch_ivr_digit_stream_parser_feed(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t *stream, char digit)
{
void *result = NULL;
@@ -1297,7 +1291,7 @@
return result;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t * stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_reset(switch_ivr_digit_stream_t *stream)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1311,7 +1305,7 @@
return status;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t * parser, char digit)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(switch_ivr_digit_stream_parser_t *parser, char digit)
{
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -1403,13 +1397,14 @@
switch_xml_t variable;
switch_event_header_t *hi = switch_channel_variable_first(channel);
- if (!hi) return off;
+ if (!hi)
+ return off;
for (; hi; hi = hi->next) {
if (!switch_strlen_zero(hi->name) && !switch_strlen_zero(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
char *data;
switch_size_t dlen = strlen(hi->value) * 3;
-
+
if ((data = malloc(dlen))) {
memset(data, 0, dlen);
switch_url_encode(hi->value, data, dlen);
@@ -1423,11 +1418,11 @@
return off;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t * xml_cdr)
+SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_t *session, switch_xml_t *xml_cdr)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_caller_profile_t *caller_profile;
- switch_xml_t variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
+ switch_xml_t variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
x_application, x_callflow, x_inner_extension, x_apps, x_o;
switch_app_log_t *app_log;
char tmp[512];
@@ -1444,23 +1439,23 @@
if ((app_log = switch_core_session_get_app_log(session))) {
int app_off = 0;
switch_app_log_t *ap;
-
+
if (!(x_apps = switch_xml_add_child_d(cdr, "app_log", cdr_off++))) {
goto error;
}
- for(ap = app_log; ap; ap = ap->next) {
+ for (ap = app_log; ap; ap = ap->next) {
if (!(x_application = switch_xml_add_child_d(x_apps, "application", app_off++))) {
goto error;
}
-
+
switch_xml_set_attr_d(x_application, "app_name", ap->app);
switch_xml_set_attr_d(x_application, "app_data", ap->arg);
}
}
switch_ivr_set_xml_chan_vars(variables, channel, v_off);
-
+
caller_profile = switch_channel_get_caller_profile(channel);
while (caller_profile) {
@@ -1486,7 +1481,7 @@
if (!(x_caller_extension = switch_xml_add_child_d(x_callflow, "extension", cf_off++))) {
goto error;
}
-
+
switch_xml_set_attr_d(x_caller_extension, "name", caller_profile->caller_extension->extension_name);
switch_xml_set_attr_d(x_caller_extension, "number", caller_profile->caller_extension->extension_number);
if (caller_profile->caller_extension->current_application) {
@@ -1509,13 +1504,13 @@
int i_off = 0;
for (cp = caller_profile->caller_extension->children; cp; cp = cp->next) {
app_off = 0;
-
+
if (!cp->caller_extension) {
continue;
}
if (!(x_inner_extension = switch_xml_add_child_d(x_caller_extension, "sub_extensions", i_off++))) {
goto error;
- }
+ }
if (!(x_caller_extension = switch_xml_add_child_d(x_inner_extension, "extension", cf_off++))) {
goto error;
@@ -1526,7 +1521,7 @@
if (cp->caller_extension->current_application) {
switch_xml_set_attr_d(x_caller_extension, "current_app", cp->caller_extension->current_application->application_name);
}
-
+
for (ap = cp->caller_extension->applications; ap; ap = ap->next) {
if (!(x_application = switch_xml_add_child_d(x_caller_extension, "application", app_off++))) {
goto error;
@@ -1675,7 +1670,7 @@
write_frame.codec = read_codec;
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
@@ -1686,7 +1681,7 @@
if ((jb_frame = stfu_n_read_a_frame(jb))) {
write_frame.data = jb_frame->data;
- write_frame.datalen = (uint32_t)jb_frame->dlen;
+ write_frame.datalen = (uint32_t) jb_frame->dlen;
status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
@@ -1697,14 +1692,15 @@
stfu_n_destroy(&jb);
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args)
+SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type,
+ const char *say_method, switch_input_args_t *args)
{
switch_say_interface_t *si;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if ((si = switch_loadable_module_get_say_interface(module_name))) {
// should go back and proto all the say mods to const....
- status = si->say_function(session, (char *)tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
+ status = si->say_function(session, (char *) tosay, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
status = SWITCH_STATUS_FALSE;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c Tue May 27 07:24:06 2008
@@ -47,20 +47,20 @@
switch_status_t status;
switch_frame_t *read_frame;
- eh->up = 1;
- while(switch_channel_ready(channel)) {
+ eh->up = 1;
+ while (switch_channel_ready(channel)) {
status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
+
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
}
eh->up = 0;
return NULL;
@@ -73,13 +73,13 @@
switch_frame_t *read_frame;
switch_channel_t *channel = switch_core_session_get_channel(session);
#ifdef SWITCH_VIDEO_IN_THREADS
- struct echo_helper eh = {0};
+ struct echo_helper eh = { 0 };
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
#endif
switch_channel_pre_answer(channel);
-
+
#ifdef SWITCH_VIDEO_IN_THREADS
if (switch_channel_test_flag(channel, CF_VIDEO)) {
eh.session = session;
@@ -90,7 +90,7 @@
}
#endif
- while(switch_channel_ready(channel)) {
+ while (switch_channel_ready(channel)) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
@@ -99,11 +99,11 @@
#ifndef SWITCH_VIDEO_IN_THREADS
status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
+
if (switch_test_flag(read_frame, SFF_CNG)) {
continue;
}
@@ -115,7 +115,7 @@
#ifdef SWITCH_VIDEO_IN_THREADS
if (eh.up) {
- while(eh.up) {
+ while (eh.up) {
switch_yield(1000);
}
}
@@ -165,8 +165,8 @@
uint32_t x;
st = switch_core_file_read(&dh->fh, buf, &len);
-
- for(x = 0; x < (uint32_t) len; x++) {
+
+ for (x = 0; x < (uint32_t) len; x++) {
int32_t mixed = fp[x] + buf[x];
switch_normalize_to_16bit(mixed);
fp[x] = (int16_t) mixed;
@@ -232,8 +232,8 @@
uint32_t x;
st = switch_core_file_read(&dh->fh, buf, &len);
-
- for(x = 0; x < (uint32_t) len; x++) {
+
+ for (x = 0; x < (uint32_t) len; x++) {
int32_t mixed = fp[x] + buf[x];
switch_normalize_to_16bit(mixed);
fp[x] = (int16_t) mixed;
@@ -296,19 +296,18 @@
return SWITCH_STATUS_MEMERR;
}
-
+
read_codec = switch_core_session_get_read_codec(session);
switch_assert(read_codec != NULL);
dh->fh.channels = read_codec->implementation->number_of_channels;
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
-
+
if (switch_core_file_open(&dh->fh,
file,
read_codec->implementation->number_of_channels,
read_codec->implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
@@ -327,13 +326,13 @@
if (flags && strchr(flags, 'l')) {
dh->loop++;
}
-
+
if (flags && strchr(flags, 'r')) {
status = switch_core_media_bug_add(session, read_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug);
} else {
status = switch_core_media_bug_add(session, write_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug);
}
-
+
if (status != SWITCH_STATUS_SUCCESS) {
switch_core_file_close(&dh->fh);
return status;
@@ -416,7 +415,7 @@
struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) user_data;
uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
switch_frame_t frame = { 0 };
-
+
frame.data = data;
frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
@@ -430,13 +429,13 @@
case SWITCH_ABC_TYPE_READ_PING:
if (ep->buffer) {
if (switch_core_media_bug_read(bug, &frame) == SWITCH_STATUS_SUCCESS) {
- switch_buffer_lock(ep->buffer);
+ switch_buffer_lock(ep->buffer);
switch_buffer_zwrite(ep->buffer, frame.data, frame.datalen);
- switch_buffer_unlock(ep->buffer);
+ switch_buffer_unlock(ep->buffer);
}
} else {
- return SWITCH_FALSE;
- }
+ return SWITCH_FALSE;
+ }
break;
case SWITCH_ABC_TYPE_READ:
break;
@@ -446,15 +445,15 @@
if (switch_test_flag(ep, ED_MUX_READ)) {
switch_frame_t *rframe = switch_core_media_bug_get_read_replace_frame(bug);
-
+
if (switch_buffer_inuse(ep->r_buffer) >= rframe->datalen) {
uint32_t bytes;
switch_buffer_lock(ep->r_buffer);
bytes = (uint32_t) switch_buffer_read(ep->r_buffer, data, rframe->datalen);
-
- rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *)data, bytes / 2) * 2;
+
+ rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2) * 2;
rframe->samples = rframe->datalen / 2;
-
+
switch_buffer_unlock(ep->r_buffer);
switch_core_media_bug_set_read_replace_frame(bug, rframe);
}
@@ -466,15 +465,15 @@
{
if (switch_test_flag(ep, ED_MUX_WRITE)) {
switch_frame_t *rframe = switch_core_media_bug_get_write_replace_frame(bug);
-
+
if (switch_buffer_inuse(ep->w_buffer) >= rframe->datalen) {
uint32_t bytes;
switch_buffer_lock(ep->w_buffer);
bytes = (uint32_t) switch_buffer_read(ep->w_buffer, data, rframe->datalen);
-
- rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *)data, bytes / 2) * 2;
+
+ rframe->datalen = switch_merge_sln(rframe->data, rframe->samples, (int16_t *) data, bytes / 2) * 2;
rframe->samples = rframe->datalen / 2;
-
+
switch_buffer_unlock(ep->w_buffer);
switch_core_media_bug_set_write_replace_frame(bug, rframe);
}
@@ -489,10 +488,8 @@
return SWITCH_TRUE;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
- const char *uuid,
- const char *require_group,
- switch_eavesdrop_flag_t flags)
+SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
+ const char *uuid, const char *require_group, switch_eavesdrop_flag_t flags)
{
switch_core_session_t *tsession;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -504,8 +501,8 @@
switch_media_bug_t *bug = NULL;
switch_channel_t *tchannel = switch_core_session_get_channel(tsession);
switch_frame_t *read_frame, write_frame = { 0 };
- switch_codec_t codec = {0};
- int16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE/2];
+ switch_codec_t codec = { 0 };
+ int16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE / 2];
switch_codec_t *tread_codec = switch_core_session_get_read_codec(tsession);
uint32_t tlen;
const char *macro_name = "eavesdrop_announce";
@@ -530,39 +527,39 @@
if (!switch_strlen_zero(require_group)) {
- const char *group_name = switch_channel_get_variable(tchannel, "eavesdrop_group");
+ const char *group_name = switch_channel_get_variable(tchannel, "eavesdrop_group");
if (!group_name || strcmp(group_name, require_group)) {
status = SWITCH_STATUS_BREAK;
goto end;
}
}
-
+
ep = switch_core_session_alloc(session, sizeof(*ep));
tlen = tread_codec->implementation->bytes_per_frame;
switch_channel_pre_answer(channel);
-
+
if (switch_core_codec_init(&codec,
"L16",
- NULL,
+ NULL,
tread_codec->implementation->actual_samples_per_second,
tread_codec->implementation->microseconds_per_frame / 1000,
- tread_codec->implementation->number_of_channels,
- SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ tread_codec->implementation->number_of_channels,
+ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot init codec\n");
switch_core_session_rwunlock(tsession);
goto end;
}
-
+
switch_core_session_set_read_codec(session, &codec);
write_frame.codec = &codec;
write_frame.data = buf;
write_frame.buflen = sizeof(buf);
write_frame.rate = read_codec->implementation->actual_samples_per_second;
-
+
ep->flags = flags;
switch_mutex_init(&ep->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(tsession));
switch_buffer_create_dynamic(&ep->buffer, 2048, 2048, 8192);
@@ -576,22 +573,22 @@
switch_buffer_create_dynamic(&ep->r_buffer, 2048, 2048, 8192);
switch_buffer_add_mutex(ep->r_buffer, ep->r_mutex);
-
- if (switch_core_media_bug_add(tsession, eavesdrop_callback, ep, 0,
+
+ if (switch_core_media_bug_add(tsession, eavesdrop_callback, ep, 0,
SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_READ_PING | SMBF_THREAD_LOCK,
&bug) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot attach bug\n");
goto end;
}
-
- while(switch_channel_ready(tchannel) && switch_channel_ready(channel)) {
+
+ while (switch_channel_ready(tchannel) && switch_channel_ready(channel)) {
uint32_t len = sizeof(buf);
switch_event_t *event = NULL;
char *fcommand = NULL;
char db[2] = "";
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto end;
}
@@ -605,7 +602,7 @@
}
if ((flags & ED_DTMF) && switch_channel_has_dtmf(channel)) {
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_channel_dequeue_dtmf(channel, &dtmf);
db[0] = dtmf.digit;
fcommand = db;
@@ -613,9 +610,9 @@
if (fcommand) {
char *d;
- for(d = fcommand; *d; d++) {
+ for (d = fcommand; *d; d++) {
int z = 1;
-
+
switch (*d) {
case '1':
switch_set_flag(ep, ED_MUX_READ);
@@ -640,14 +637,14 @@
break;
}
-
+
if (z) {
if (ep->r_buffer) {
switch_buffer_lock(ep->r_buffer);
switch_buffer_zero(ep->r_buffer);
switch_buffer_unlock(ep->r_buffer);
}
-
+
if (ep->w_buffer) {
switch_buffer_lock(ep->w_buffer);
switch_buffer_zero(ep->w_buffer);
@@ -671,49 +668,49 @@
len = tlen;
}
- if (switch_buffer_inuse(ep->buffer) >= len) {
- switch_buffer_lock(ep->buffer);
+ if (switch_buffer_inuse(ep->buffer) >= len) {
+ switch_buffer_lock(ep->buffer);
while (switch_buffer_inuse(ep->buffer) >= len) {
- write_frame.datalen = (uint32_t)switch_buffer_read(ep->buffer, buf, len);
+ write_frame.datalen = (uint32_t) switch_buffer_read(ep->buffer, buf, len);
write_frame.samples = write_frame.datalen / 2;
if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
break;
}
}
- switch_buffer_unlock(ep->buffer);
- }
-
- }
+ switch_buffer_unlock(ep->buffer);
+ }
+
+ }
- end:
+ end:
switch_core_codec_destroy(&codec);
- if (bug) {
- switch_core_media_bug_remove(tsession, &bug);
- }
+ if (bug) {
+ switch_core_media_bug_remove(tsession, &bug);
+ }
if (ep) {
if (ep->buffer) {
switch_buffer_destroy(&ep->buffer);
}
-
+
if (ep->r_buffer) {
switch_buffer_destroy(&ep->r_buffer);
}
-
+
if (ep->w_buffer) {
switch_buffer_destroy(&ep->w_buffer);
}
}
- switch_core_session_rwunlock(tsession);
+ switch_core_session_rwunlock(tsession);
status = SWITCH_STATUS_SUCCESS;
switch_core_session_set_read_codec(session, read_codec);
switch_core_session_reset(session, SWITCH_TRUE);
- }
-
+ }
+
return status;
}
@@ -747,7 +744,7 @@
if ((p = switch_channel_get_variable(channel, "RECORD_ANSWER_REQ")) && switch_true(p)) {
flags |= SMBF_RECORD_ANSWER_REQ;
}
-
+
fh->channels = channels;
fh->samplerate = read_codec->implementation->actual_samples_per_second;
@@ -803,7 +800,7 @@
if (limit) {
to = switch_timestamp(NULL) + limit;
}
-
+
if ((status = switch_core_media_bug_add(session, record_callback, fh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file);
switch_core_file_close(fh);
@@ -842,7 +839,7 @@
teletone_dtmf_get(&pvt->dtmf_detect, digit_str, sizeof(digit_str));
if (digit_str[0]) {
char *p = digit_str;
- while(p && *p) {
+ while (p && *p) {
switch_dtmf_t dtmf;
dtmf.digit = *p;
dtmf.duration = switch_core_default_dtmf_duration(0);
@@ -907,37 +904,37 @@
switch_core_session_t *session;
teletone_generation_session_t ts;
switch_queue_t *digit_queue;
- switch_buffer_t *audio_buffer;
+ switch_buffer_t *audio_buffer;
switch_mutex_t *mutex;
int read;
int ready;
} switch_inband_dtmf_generate_t;
-static int teletone_dtmf_generate_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+static int teletone_dtmf_generate_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
- switch_buffer_t *audio_buffer = ts->user_data;
- int wrote;
+ switch_buffer_t *audio_buffer = ts->user_data;
+ int wrote;
- if (!audio_buffer) {
- return -1;
- }
+ if (!audio_buffer) {
+ return -1;
+ }
- wrote = teletone_mux_tones(ts, map);
- switch_buffer_write(audio_buffer, ts->buffer, wrote * 2);
+ wrote = teletone_mux_tones(ts, map);
+ switch_buffer_write(audio_buffer, ts->buffer, wrote * 2);
- return 0;
+ return 0;
}
static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
- switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_media_bug_t *bug = switch_channel_get_private(channel, "dtmf_generate");
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_media_bug_t *bug = switch_channel_get_private(channel, "dtmf_generate");
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (bug) {
- switch_inband_dtmf_generate_t *pvt = (switch_inband_dtmf_generate_t *) switch_core_media_bug_get_user_data(bug);
-
- if (pvt) {
+ if (bug) {
+ switch_inband_dtmf_generate_t *pvt = (switch_inband_dtmf_generate_t *) switch_core_media_bug_get_user_data(bug);
+
+ if (pvt) {
switch_mutex_lock(pvt->mutex);
if (pvt->ready) {
switch_dtmf_t *dt = NULL;
@@ -948,7 +945,7 @@
/*
SWITCH_STATUS_FALSE indicates pretend there never was a DTMF
since we will be generating it inband now.
- */
+ */
status = SWITCH_STATUS_FALSE;
} else {
free(dt);
@@ -1005,7 +1002,7 @@
if (!pvt->ready) {
switch_mutex_unlock(pvt->mutex);
- return SWITCH_FALSE;
+ return SWITCH_FALSE;
}
if (pvt->read) {
@@ -1013,7 +1010,7 @@
} else {
frame = switch_core_media_bug_get_write_replace_frame(bug);
}
-
+
while (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_dtmf_t *dtmf = (switch_dtmf_t *) pop;
char buf[2] = "";
@@ -1022,13 +1019,13 @@
buf[0] = dtmf->digit;
if (duration > 8000) {
duration = 4000;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8);
}
pvt->ts.duration = duration;
teletone_run(&pvt->ts, buf);
}
-
+
if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) {
if (bytes < frame->datalen) {
switch_byte_t *dp = frame->data;
@@ -1087,7 +1084,7 @@
pvt->session = session;
pvt->read = !!read_stream;
- if ((status = switch_core_media_bug_add(session, inband_dtmf_generate_callback, pvt, 0,
+ if ((status = switch_core_media_bug_add(session, inband_dtmf_generate_callback, pvt, 0,
pvt->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
return status;
}
@@ -1108,7 +1105,7 @@
} switch_tone_detect_t;
typedef struct {
- switch_tone_detect_t list[MAX_TONES+1];
+ switch_tone_detect_t list[MAX_TONES + 1];
int index;
switch_media_bug_t *bug;
switch_core_session_t *session;
@@ -1133,11 +1130,11 @@
if (!frame) {
frame = switch_core_media_bug_get_write_replace_frame(bug);
}
-
- for (i = 0 ; i < cont->index; i++) {
+
+ for (i = 0; i < cont->index; i++) {
if (cont->list[i].up && teletone_multi_tone_detect(&cont->list[i].mt, frame->data, frame->samples)) {
switch_event_t *event;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "TONE %s DETECTED\n", cont->list[i].key);
cont->list[i].up = 0;
@@ -1154,11 +1151,11 @@
if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {
switch_event_t *dup;
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Detected-Tone", "%s", cont->list[i].key);
-
+
if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
switch_event_fire(&dup);
}
-
+
if (switch_core_session_queue_event(cont->session, &event) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Event queue failed!\n");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
@@ -1180,7 +1177,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_");
-
+
if (cont) {
switch_channel_set_private(channel, "_tone_detect_", NULL);
switch_core_media_bug_remove(session, &cont->bug);
@@ -1189,110 +1186,110 @@
return SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
+SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
const char *key, const char *tone_spec,
- const char *flags, time_t timeout,
- const char *app, const char *data)
+ const char *flags, time_t timeout, const char *app, const char *data)
{
- switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
- switch_status_t status;
- switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_");
- char *p, *next;
- int i = 0, ok = 0;
- switch_media_bug_flag_t bflags = 0;
-
- switch_assert(read_codec != NULL);
-
- if (switch_strlen_zero(key)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
- return SWITCH_STATUS_FALSE;
- }
-
- if (cont) {
- if (cont->index >= MAX_TONES) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max Tones Reached!\n");
- return SWITCH_STATUS_FALSE;
- }
-
- for(i = 0; i < cont->index; i++) {
- if (!switch_strlen_zero(cont->list[cont->index].key) && !strcasecmp(key, cont->list[cont->index].key)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-enabling %s\n", key);
- cont->list[cont->index].up = 1;
- teletone_multi_tone_init(&cont->list[i].mt, &cont->list[i].map);
- return SWITCH_STATUS_SUCCESS;
- }
- }
- }
-
- if (switch_strlen_zero(tone_spec)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Spec Specified!\n");
- return SWITCH_STATUS_FALSE;
- }
-
- if (!cont && !(cont = switch_core_session_alloc(session, sizeof(*cont)))) {
- return SWITCH_STATUS_MEMERR;
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding tone spec %s index %d\n", tone_spec, cont->index);
-
- i = 0;
- p = (char *) tone_spec;
-
- do {
- teletone_process_t this;
- next = strchr(p, ',');
- while(*p == ' ') p++;
- if ((this = (teletone_process_t) atof(p))) {
- ok++;
- cont->list[cont->index].map.freqs[i++] = this;
- }
- if (next) {
- p = next + 1;
- }
- } while (next);
- cont->list[cont->index].map.freqs[i++] = 0;
-
- if (!ok) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid tone spec!\n");
- return SWITCH_STATUS_FALSE;
- }
-
- cont->list[cont->index].key = switch_core_session_strdup(session, key);
-
- if (app) {
- cont->list[cont->index].app = switch_core_session_strdup(session, app);
- }
-
- if (data) {
- cont->list[cont->index].data = switch_core_session_strdup(session, data);
- }
-
- cont->list[cont->index].up = 1;
- cont->list[cont->index].mt.sample_rate = read_codec->implementation->actual_samples_per_second;
- teletone_multi_tone_init(&cont->list[cont->index].mt, &cont->list[cont->index].map);
- cont->session = session;
-
- switch_channel_pre_answer(channel);
-
- if (switch_strlen_zero(flags)) {
- bflags = SMBF_READ_REPLACE;
- } else {
- if (strchr(flags, 'r')) {
- bflags |= SMBF_READ_REPLACE;
- } else if (strchr(flags, 'w')) {
- bflags |= SMBF_WRITE_REPLACE;
- }
- }
-
- if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
- return status;
- }
-
- switch_channel_set_private(channel, "_tone_detect_", cont);
- cont->index++;
-
- return SWITCH_STATUS_SUCCESS;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+ switch_status_t status;
+ switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_");
+ char *p, *next;
+ int i = 0, ok = 0;
+ switch_media_bug_flag_t bflags = 0;
+
+ switch_assert(read_codec != NULL);
+
+ if (switch_strlen_zero(key)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Key Specified!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (cont) {
+ if (cont->index >= MAX_TONES) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max Tones Reached!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ for (i = 0; i < cont->index; i++) {
+ if (!switch_strlen_zero(cont->list[cont->index].key) && !strcasecmp(key, cont->list[cont->index].key)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-enabling %s\n", key);
+ cont->list[cont->index].up = 1;
+ teletone_multi_tone_init(&cont->list[i].mt, &cont->list[i].map);
+ return SWITCH_STATUS_SUCCESS;
+ }
+ }
+ }
+
+ if (switch_strlen_zero(tone_spec)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Spec Specified!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (!cont && !(cont = switch_core_session_alloc(session, sizeof(*cont)))) {
+ return SWITCH_STATUS_MEMERR;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding tone spec %s index %d\n", tone_spec, cont->index);
+
+ i = 0;
+ p = (char *) tone_spec;
+
+ do {
+ teletone_process_t this;
+ next = strchr(p, ',');
+ while (*p == ' ')
+ p++;
+ if ((this = (teletone_process_t) atof(p))) {
+ ok++;
+ cont->list[cont->index].map.freqs[i++] = this;
+ }
+ if (next) {
+ p = next + 1;
+ }
+ } while (next);
+ cont->list[cont->index].map.freqs[i++] = 0;
+
+ if (!ok) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid tone spec!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ cont->list[cont->index].key = switch_core_session_strdup(session, key);
+
+ if (app) {
+ cont->list[cont->index].app = switch_core_session_strdup(session, app);
+ }
+
+ if (data) {
+ cont->list[cont->index].data = switch_core_session_strdup(session, data);
+ }
+
+ cont->list[cont->index].up = 1;
+ cont->list[cont->index].mt.sample_rate = read_codec->implementation->actual_samples_per_second;
+ teletone_multi_tone_init(&cont->list[cont->index].mt, &cont->list[cont->index].map);
+ cont->session = session;
+
+ switch_channel_pre_answer(channel);
+
+ if (switch_strlen_zero(flags)) {
+ bflags = SMBF_READ_REPLACE;
+ } else {
+ if (strchr(flags, 'r')) {
+ bflags |= SMBF_READ_REPLACE;
+ } else if (strchr(flags, 'w')) {
+ bflags |= SMBF_WRITE_REPLACE;
+ }
+ }
+
+ if ((status = switch_core_media_bug_add(session, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) {
+ return status;
+ }
+
+ switch_channel_set_private(channel, "_tone_detect_", cont);
+ cont->index++;
+
+ return SWITCH_STATUS_SUCCESS;
}
typedef struct {
@@ -1304,7 +1301,7 @@
typedef struct {
dtmf_meta_app_t map[10];
time_t last_digit;
- switch_bool_t meta_on;
+ switch_bool_t meta_on;
int up;
} dtmf_meta_settings_t;
@@ -1321,19 +1318,19 @@
time_t now = switch_timestamp(NULL);
char digit[2] = "";
int dval;
-
+
if (!md || switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
return SWITCH_STATUS_SUCCESS;
}
- if (direction == SWITCH_DTMF_RECV && !md->sr[SWITCH_DTMF_RECV].up) {
+ if (direction == SWITCH_DTMF_RECV && !md->sr[SWITCH_DTMF_RECV].up) {
return SWITCH_STATUS_SUCCESS;
}
- if (direction == SWITCH_DTMF_SEND && !md->sr[SWITCH_DTMF_SEND].up) {
+ if (direction == SWITCH_DTMF_SEND && !md->sr[SWITCH_DTMF_SEND].up) {
return SWITCH_STATUS_SUCCESS;
}
-
+
if (md->sr[direction].meta_on && now - md->sr[direction].last_digit > 5) {
md->sr[direction].meta_on = SWITCH_FALSE;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Meta digit timeout parsing %c\n", switch_channel_get_name(channel), dtmf->digit);
@@ -1358,9 +1355,9 @@
*digit = dtmf->digit;
dval = atoi(digit);
- if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
+ if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
ok = 1;
- } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
+ } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
ok = 1;
}
@@ -1387,41 +1384,41 @@
flags |= SMF_ECHO_ALEG;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app);
switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags);
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Ignoring meta digit '%c' not mapped\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Ignoring meta digit '%c' not mapped\n",
switch_channel_get_name(channel), dtmf->digit);
-
+
}
}
md->sr[direction].meta_on = SWITCH_FALSE;
return SWITCH_STATUS_FALSE;
}
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_channel_set_private(channel, SWITCH_META_VAR_KEY, NULL);
+ switch_channel_set_private(channel, SWITCH_META_VAR_KEY, NULL);
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
+SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
switch_bind_flag_t bind_flags, const char *app)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
-
+
if (key > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid key %u\n", key);
return SWITCH_STATUS_FALSE;
}
-
+
if (!md) {
md = switch_core_session_alloc(session, sizeof(*md));
switch_channel_set_private(channel, SWITCH_META_VAR_KEY, md);
@@ -1435,7 +1432,7 @@
md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound A-Leg: %d %s\n", key, app);
}
if ((bind_flags & SBF_DIAL_BLEG)) {
@@ -1445,7 +1442,7 @@
md->sr[SWITCH_DTMF_SEND].map[key].bind_flags = bind_flags;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound B-Leg: %d %s\n", key, app);
}
-
+
} else {
if ((bind_flags & SBF_DIAL_ALEG)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound A-Leg: %d\n", key);
@@ -1470,7 +1467,7 @@
switch_memory_pool_t *pool;
};
-static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj)
{
struct speech_thread_handle *sth = (struct speech_thread_handle *) obj;
switch_channel_t *channel = switch_core_session_get_channel(sth->session);
@@ -1659,10 +1656,7 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session,
const char *mod_name,
- const char *grammar,
- const char *path,
- const char *dest,
- switch_asr_handle_t *ah)
+ const char *grammar, const char *path, const char *dest, switch_asr_handle_t *ah)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
@@ -1816,7 +1810,7 @@
}
switch_zmalloc(cur, len);
- helper = (struct transfer_helper *)cur;
+ helper = (struct transfer_helper *) cur;
switch_copy_string(helper->uuid_str, uuid, sizeof(helper->uuid_str));
@@ -1864,12 +1858,12 @@
char *cur = NULL;
switch_zmalloc(cur, len);
- helper = (struct broadcast_helper *)cur;
-
+ helper = (struct broadcast_helper *) cur;
+
cur += sizeof(*helper);
switch_copy_string(helper->uuid_str, uuid, sizeof(helper->uuid_str));
helper->flags = flags;
-
+
switch_copy_string(cur, path, len - sizeof(helper));
helper->path = cur;
@@ -1898,7 +1892,7 @@
channel = switch_core_session_get_channel(session);
if ((switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s][%s] already broadcasting...broadcast aborted\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel [%s][%s] already broadcasting...broadcast aborted\n",
switch_channel_get_name(channel), path);
switch_core_session_rwunlock(session);
return SWITCH_STATUS_FALSE;
@@ -1914,8 +1908,8 @@
if ((nomedia = switch_channel_test_flag(channel, CF_PROXY_MODE))) {
switch_ivr_media(uuid, SMF_REBRIDGE);
}
-
- if ((p = strchr(mypath, ':')) && *(p+1) == ':') {
+
+ if ((p = strchr(mypath, ':')) && *(p + 1) == ':') {
app = mypath;
*p++ = '\0';
*p++ = '\0';
@@ -1946,7 +1940,7 @@
switch_core_session_queue_private_event(other_session, &event);
}
-
+
switch_core_session_rwunlock(other_session);
master = other_session;
other_session = NULL;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c Tue May 27 07:24:06 2008
@@ -50,16 +50,16 @@
switch_status_t status;
switch_frame_t *read_frame;
- vh->up = 1;
- while(switch_channel_ready(channel) && vh->up == 1) {
+ vh->up = 1;
+ while (switch_channel_ready(channel) && vh->up == 1) {
status = switch_core_session_read_video_frame(vh->session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
break;
}
-
+
switch_core_session_write_video_frame(vh->session_b, read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
}
vh->up = 0;
return NULL;
@@ -70,10 +70,10 @@
switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
- switch_threadattr_create(&thd_attr, switch_core_session_get_pool(vh->session_a));
- switch_threadattr_detach_set(thd_attr, 1);
- switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
- switch_thread_create(&thread, thd_attr, video_bridge_thread, vh, switch_core_session_get_pool(vh->session_a));
+ switch_threadattr_create(&thd_attr, switch_core_session_get_pool(vh->session_a));
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, video_bridge_thread, vh, switch_core_session_get_pool(vh->session_a));
}
#endif
@@ -86,7 +86,7 @@
};
typedef struct switch_ivr_bridge_data switch_ivr_bridge_data_t;
-static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
+static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
{
switch_ivr_bridge_data_t *data = obj;
int stream_id = 0, pre_b = 0, ans_a = 0, ans_b = 0, originator = 0;
@@ -99,9 +99,9 @@
uint32_t loop_count = 0;
const char *app_name = NULL, *app_arg = NULL;
const char *hook_var = NULL;
- int inner_bridge = 0;
+ int inner_bridge = 0;
#ifdef SWITCH_VIDEO_IN_THREADS
- struct vid_helper vh = { 0 };
+ struct vid_helper vh = { 0 };
uint32_t vid_launch = 0;
#endif
@@ -109,7 +109,7 @@
if (!(session_b = switch_core_session_locate(data->b_uuid))) {
return NULL;
}
-
+
input_callback = data->input_callback;
user_data = data->session_data;
stream_id = data->stream_id;
@@ -124,7 +124,7 @@
}
inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
-
+
switch_channel_set_flag(chan_a, CF_BRIDGED);
@@ -170,20 +170,19 @@
if (!inner_bridge && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto end_of_bridge_loop;
}
continue;
}
-
#ifdef SWITCH_VIDEO_IN_THREADS
- if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO) && !vid_launch) {
- vid_launch++;
- vh.session_a = session_a;
- vh.session_b = session_b;
- launch_video(&vh);
- }
+ if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO) && !vid_launch) {
+ vid_launch++;
+ vh.session_a = session_a;
+ vh.session_b = session_b;
+ launch_video(&vh);
+ }
#endif
/* if 1 channel has DTMF pass it to the other */
@@ -193,8 +192,8 @@
int send_dtmf = 1;
if (input_callback) {
- switch_status_t cb_status = input_callback(session_a, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0);
-
+ switch_status_t cb_status = input_callback(session_a, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, user_data, 0);
+
if (cb_status == SWITCH_STATUS_IGNORE) {
send_dtmf = 0;
} else if (cb_status != SWITCH_STATUS_SUCCESS) {
@@ -203,7 +202,7 @@
goto end_of_bridge_loop;
}
}
-
+
if (send_dtmf) {
switch_core_session_send_dtmf(session_b, &dtmf);
}
@@ -250,16 +249,15 @@
continue;
}
}
-
#ifndef SWITCH_VIDEO_IN_THREADS
if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO)) {
/* read video from 1 channel and write it to the other */
status = switch_core_session_read_video_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto end_of_bridge_loop;
}
-
+
switch_core_session_write_video_frame(session_b, read_frame, SWITCH_IO_FLAG_NONE, 0);
}
#endif
@@ -285,17 +283,17 @@
}
}
- end_of_bridge_loop:
+ end_of_bridge_loop:
#ifdef SWITCH_VIDEO_IN_THREADS
- if (vh.up) {
- vh.up = -1;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n");
- while(vh.up) {
- switch_yield(100000);
- }
- }
+ if (vh.up) {
+ vh.up = -1;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ending video thread.\n");
+ while (vh.up) {
+ switch_yield(100000);
+ }
+ }
#endif
if (!inner_bridge) {
@@ -314,9 +312,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nPost-Bridge Command %s(%s):\n%s\n", cmd, arg, switch_str_nil((char *) stream.data));
switch_safe_free(stream.data);
}
-
-
- if (switch_channel_get_state(chan_b) >= CS_HANGUP) {
+
+
+ if (switch_channel_get_state(chan_b) >= CS_HANGUP) {
if (originator && switch_channel_ready(chan_a) && !switch_channel_test_flag(chan_a, CF_ANSWERED)) {
switch_channel_hangup(chan_a, switch_channel_get_cause(chan_b));
}
@@ -326,7 +324,7 @@
msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg);
-
+
if (!inner_bridge && switch_channel_get_state(chan_a) < CS_HANGUP) {
if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
switch_caller_extension_t *extension = NULL;
@@ -347,7 +345,7 @@
}
}
- end:
+ end:
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
switch_core_session_reset(session_a, SWITCH_TRUE);
@@ -379,7 +377,7 @@
switch_channel_clear_state_handler(channel, &audio_bridge_peer_state_handlers);
state = switch_channel_get_state(channel);
-
+
if (!switch_channel_test_flag(channel, CF_TRANSFER) && state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
@@ -447,13 +445,12 @@
if (!switch_channel_test_flag(channel, CF_ORIGINATOR)) {
return SWITCH_STATUS_SUCCESS;
}
-
- if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) &&
- (other_session = switch_core_session_locate(other_uuid))) {
+
+ if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) && (other_session = switch_core_session_locate(other_uuid))) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_event_t *event;
uint8_t ready_a, ready_b;
-
+
switch_channel_set_variable(channel, SWITCH_UUID_BRIDGE, NULL);
switch_channel_wait_for_state(channel, other_channel, CS_RESET);
@@ -474,7 +471,7 @@
switch_channel_clear_flag(other_channel, CF_TRANSFER);
switch_core_session_reset(session, SWITCH_TRUE);
switch_core_session_reset(other_session, SWITCH_TRUE);
-
+
ready_a = switch_channel_ready(channel);
ready_b = switch_channel_ready(other_channel);
@@ -524,8 +521,8 @@
/*.on_exchange_media */ NULL,
/*.on_soft_execute */ uuid_bridge_on_soft_execute,
/*.on_consume_media */ NULL,
- /*.on_hibernate*/ NULL,
- /*.on_reset*/ uuid_bridge_on_reset
+ /*.on_hibernate */ NULL,
+ /*.on_reset */ uuid_bridge_on_reset
};
static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
@@ -548,7 +545,7 @@
switch_core_session_t *other_session;
switch_event_t *event;
- if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
+ if (switch_channel_test_flag(channel, CF_ORIGINATOR)) {
switch_channel_clear_flag(channel, CF_ORIGINATOR);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
@@ -636,7 +633,7 @@
switch_channel_set_state_flag(caller_channel, CF_TRANSFER);
switch_channel_set_state_flag(peer_channel, CF_TRANSFER);
-
+
switch_channel_set_state(caller_channel, CS_HIBERNATE);
switch_channel_set_state(peer_channel, CS_HIBERNATE);
@@ -659,7 +656,7 @@
switch_event_t *event;
int br = 0;
int inner_bridge = switch_channel_test_flag(caller_channel, CF_INNER_BRIDGE);
-
+
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
switch_channel_clear_flag(caller_channel, CF_TRANSFER);
switch_channel_clear_flag(peer_channel, CF_TRANSFER);
@@ -695,7 +692,7 @@
switch_event_fire(&event);
br = 1;
}
-
+
if (switch_core_session_read_lock(peer_session) == SWITCH_STATUS_SUCCESS) {
switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
@@ -748,14 +745,14 @@
switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_CHANNEL_VARIABLE, switch_channel_get_name(caller_channel));
switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_UUID_VARIABLE, switch_core_session_get_uuid(session));
switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session));
-
+
if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_app"))) {
data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_data");
if ((application_interface = switch_loadable_module_get_application_interface(app))) {
switch_core_session_exec(session, application_interface, data);
}
}
-
+
if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_app"))) {
data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_data");
if ((application_interface = switch_loadable_module_get_application_interface(app))) {
@@ -768,7 +765,7 @@
audio_bridge_thread(NULL, (void *) a_leg);
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
-
+
if (!switch_channel_test_flag(peer_channel, CF_TRANSFER) && switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
switch_channel_set_state(peer_channel, CS_RESET);
}
@@ -801,10 +798,10 @@
}
state = switch_channel_get_state(caller_channel);
-
+
if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !inner_bridge) {
- if ((state != CS_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
- (switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP &&
+ if ((state != CS_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
+ (switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP &&
switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE)))) {
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
}
@@ -837,7 +834,7 @@
swap_session = originator_session;
originator_session = originatee_session;
originatee_session = swap_session;
-
+
swap_channel = originator_channel;
originator_channel = originatee_channel;
originatee_channel = swap_channel;
@@ -856,7 +853,7 @@
* inturrupt anything they are already doing.
* originatee_session will fall asleep and originator_session will bridge to it
*/
-
+
switch_channel_clear_state_handler(originator_channel, NULL);
switch_channel_clear_state_handler(originatee_channel, NULL);
switch_channel_set_state_flag(originator_channel, CF_ORIGINATOR);
@@ -864,7 +861,7 @@
switch_channel_add_state_handler(originator_channel, &uuid_bridge_state_handlers);
switch_channel_add_state_handler(originatee_channel, &uuid_bridge_state_handlers);
switch_channel_set_variable(originator_channel, SWITCH_UUID_BRIDGE, switch_core_session_get_uuid(originatee_session));
-
+
switch_channel_set_variable(originator_channel, SWITCH_BRIDGE_CHANNEL_VARIABLE, switch_channel_get_name(originatee_channel));
switch_channel_set_variable(originator_channel, SWITCH_BRIDGE_UUID_VARIABLE, switch_core_session_get_uuid(originatee_session));
switch_channel_set_variable(originator_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(originatee_session));
@@ -872,10 +869,10 @@
switch_channel_set_variable(originatee_channel, SWITCH_BRIDGE_UUID_VARIABLE, switch_core_session_get_uuid(originator_session));
switch_channel_set_variable(originatee_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(originator_session));
-
+
originator_cp = switch_channel_get_caller_profile(originator_channel);
originatee_cp = switch_channel_get_caller_profile(originatee_channel);
-
+
switch_channel_set_variable(originatee_channel, "original_destination_number", originatee_cp->destination_number);
switch_channel_set_variable(originatee_channel, "original_caller_id_name", originatee_cp->caller_id_name);
@@ -891,7 +888,7 @@
cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
switch_channel_set_caller_profile(originatee_channel, cp);
switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
-
+
cp = switch_caller_profile_clone(originator_session, originator_cp);
cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
@@ -907,7 +904,7 @@
switch_channel_clear_flag(originator_channel, CF_ORIGINATING);
switch_channel_clear_flag(originatee_channel, CF_ORIGINATING);
-
+
/* change the states and let the chips fall where they may */
switch_channel_set_state(originator_channel, CS_RESET);
switch_channel_set_state(originatee_channel, CS_RESET);
@@ -935,7 +932,7 @@
switch_status_t status = SWITCH_STATUS_FALSE;
switch_assert(uuid);
-
+
if ((rsession = switch_core_session_locate(uuid))) {
switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
const char *brto;
@@ -946,7 +943,7 @@
}
switch_core_session_rwunlock(rsession);
}
-
+
return status;
}
@@ -972,7 +969,7 @@
return;
}
- channel = switch_core_session_get_channel(session);
+ channel = switch_core_session_get_channel(session);
rchannel = switch_core_session_get_channel(rsession);
switch_channel_pre_answer(channel);
@@ -983,7 +980,7 @@
if (!switch_channel_test_flag(rchannel, CF_ANSWERED)) {
switch_channel_answer(rchannel);
- }
+ }
//switch_ivr_park_session(rsession);
switch_channel_set_state_flag(rchannel, CF_TRANSFER);
switch_channel_set_state(rchannel, CS_RESET);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c Tue May 27 07:24:06 2008
@@ -164,7 +164,7 @@
menu->confirm_attempts = confirm_attempts;
menu->inlen = digit_len;
-
+
menu->max_failures = max_failures;
menu->timeout = timeout;
@@ -250,8 +250,8 @@
if (stack != NULL && stack->pool != NULL) {
if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_STACK)
&& switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FREEPOOL)) {
- switch_memory_pool_t *pool = stack->pool;
- status = switch_core_destroy_memory_pool(&pool);
+ switch_memory_pool_t *pool = stack->pool;
+ status = switch_core_destroy_memory_pool(&pool);
} else {
status = SWITCH_STATUS_SUCCESS;
}
@@ -313,7 +313,7 @@
if (menu->confirm_key) {
ap = &confirm_args;
}
-
+
switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
if (menu->confirm_key && *buf == '\0') {
@@ -398,17 +398,17 @@
int ok = 0;
char substituted[1024];
char *use_arg = ap->arg;
-
+
if (ap->re) {
switch_regex_t *re = NULL;
int ovector[30];
-
+
if ((ok = switch_regex_perform(menu->buf, ap->bind, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
switch_perform_substitution(re, ok, ap->arg, menu->buf, substituted, sizeof(substituted), ovector);
use_arg = substituted;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "action regex [%s] [%s] [%d]\n", menu->buf, ap->bind, ok);
-
+
switch_regex_safe_free(re);
} else {
ok = !strcmp(menu->buf, ap->bind);
@@ -696,7 +696,7 @@
const char *confirm_attempts = switch_xml_attr_soft(xml_menu, "confirm-attempts");
const char *digit_len = switch_xml_attr_soft(xml_menu, "digit-len");
const char *inter_timeout = switch_xml_attr_soft(xml_menu, "inter-digit-timeout");
-
+
switch_ivr_menu_t *menu = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "building menu '%s'\n", menu_name);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c Tue May 27 07:24:06 2008
@@ -37,13 +37,13 @@
static switch_status_t originate_on_consume_media_transmit(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
-
+
if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
- while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
+ while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
switch_ivr_sleep(session, 10);
}
}
-
+
switch_channel_clear_state_handler(channel, &originate_state_handlers);
return SWITCH_STATUS_FALSE;
@@ -81,7 +81,7 @@
switch_core_session_t *session;
};
-static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void *obj)
{
struct key_collect *collect = (struct key_collect *) obj;
switch_channel_t *channel = switch_core_session_get_channel(collect->session);
@@ -117,7 +117,7 @@
switch_channel_set_state(channel, CS_SOFT_EXECUTE);
switch_core_session_exec(collect->session, application_interface, app_data);
-
+
if (switch_channel_get_state(channel) < CS_HANGUP) {
switch_channel_set_flag(channel, CF_WINNER);
}
@@ -166,13 +166,14 @@
static uint8_t check_channel_status(switch_channel_t **peer_channels,
switch_core_session_t **peer_sessions,
- uint32_t len, int32_t *idx, uint32_t * hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready, uint8_t return_ring_ready)
+ uint32_t len, int32_t *idx, uint32_t *hups, char *file, char *key, uint8_t early_ok, uint8_t *ring_ready,
+ uint8_t return_ring_ready)
{
uint32_t i;
*hups = 0;
*idx = IDX_NADA;
-
+
for (i = 0; i < len; i++) {
switch_channel_state_t state;
if (!peer_channels[i]) {
@@ -183,17 +184,16 @@
}
state = switch_channel_get_state(peer_channels[i]);
- if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER) ||
- switch_channel_test_flag(peer_channels[i], CF_BRIDGED) ||
- !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
+ if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER) ||
+ switch_channel_test_flag(peer_channels[i], CF_BRIDGED) || !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
) {
(*hups)++;
} else if ((switch_channel_test_flag(peer_channels[i], CF_ANSWERED) ||
(early_ok && len == 1 && switch_channel_test_flag(peer_channels[i], CF_EARLY_MEDIA)) ||
(*ring_ready && return_ring_ready && len == 1 && switch_channel_test_flag(peer_channels[i], CF_RING_READY))
- )
+ )
&& !switch_channel_test_flag(peer_channels[i], CF_TAGGED)
- ) {
+ ) {
if (!switch_strlen_zero(key)) {
struct key_collect *collect;
@@ -236,7 +236,7 @@
typedef struct ringback ringback_t;
-static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
ringback_t *tto = ts->user_data;
int wrote;
@@ -255,7 +255,7 @@
{
switch_channel_t *caller_channel = switch_core_session_get_channel(session);
switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
- const char *ringback_data = NULL;
+ const char *ringback_data = NULL;
switch_frame_t write_frame = { 0 };
switch_codec_t write_codec = { 0 };
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
@@ -267,7 +267,7 @@
int timelimit = 60;
const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
switch_time_t start = 0;
-
+
if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
return SWITCH_STATUS_SUCCESS;
}
@@ -287,14 +287,14 @@
if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
- }
-
+ }
+
if (!ringback_data) {
ringback_data = switch_channel_get_variable(caller_channel, "ringback");
}
-
-
- if (read_codec && (ringback_data ||
+
+
+ if (read_codec && (ringback_data ||
(!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) {
if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
if (switch_core_codec_init(&write_codec,
@@ -302,14 +302,14 @@
NULL,
read_codec->implementation->actual_samples_per_second,
read_codec->implementation->microseconds_per_frame / 1000,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
-
+
write_frame.codec = &write_codec;
write_frame.datalen = read_codec->implementation->bytes_per_frame;
write_frame.samples = write_frame.datalen / 2;
@@ -317,13 +317,13 @@
if (ringback_data) {
char *tmp_data = NULL;
-
+
switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0);
switch_buffer_set_loops(ringback.audio_buffer, -1);
-
+
if (switch_is_file_path(ringback_data)) {
char *ext;
-
+
if (strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR)) {
switch_core_session_set_read_codec(session, &write_codec);
} else {
@@ -342,8 +342,7 @@
ringback_data,
read_codec->implementation->number_of_channels,
read_codec->implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
switch_safe_free(tmp_data);
goto done;
@@ -370,9 +369,10 @@
}
}
- while (switch_channel_ready(peer_channel) && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
- int diff = (int)(switch_timestamp_now() - start);
-
+ while (switch_channel_ready(peer_channel)
+ && !(switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+ int diff = (int) (switch_timestamp_now() - start);
+
if (diff > timelimit) {
status = SWITCH_STATUS_TIMEOUT;
goto done;
@@ -390,7 +390,7 @@
break;
}
-
+
if (read_frame && !pass) {
if (ringback.fh) {
switch_size_t mlen, olen;
@@ -431,8 +431,8 @@
}
}
- done:
-
+ done:
+
if (ringback.fh) {
switch_core_file_close(ringback.fh);
ringback.fh = NULL;
@@ -461,10 +461,9 @@
const char *bridgeto,
uint32_t timelimit_sec,
const switch_state_handler_table_t *table,
- const char *cid_name_override,
- const char *cid_num_override,
- switch_caller_profile_t *caller_profile_override,
- switch_originate_flag_t flags)
+ const char *cid_name_override,
+ const char *cid_num_override,
+ switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags)
{
switch_originate_flag_t myflags = SOF_NONE;
char *pipe_names[MAX_PEERS] = { 0 };
@@ -516,10 +515,10 @@
while (data && *data && *data == ' ') {
data++;
}
-
+
if (*data == '{') {
char *e = switch_find_end_paren(data, '{', '}');
-
+
if (e) {
vars = data + 1;
*e++ = '\0';
@@ -558,47 +557,47 @@
if ((hi = switch_channel_variable_first(caller_channel))) {
for (; hi; hi = hi->next) {
int ok = 0;
- if (!strcasecmp((char *)hi->name, "group_confirm_key")) {
+ if (!strcasecmp((char *) hi->name, "group_confirm_key")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "group_confirm_file")) {
+ } else if (!strcasecmp((char *) hi->name, "group_confirm_file")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "forked_dial")) {
+ } else if (!strcasecmp((char *) hi->name, "forked_dial")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "fail_on_single_reject")) {
+ } else if (!strcasecmp((char *) hi->name, "fail_on_single_reject")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "ignore_early_media")) {
+ } else if (!strcasecmp((char *) hi->name, "ignore_early_media")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "return_ring_ready")) {
+ } else if (!strcasecmp((char *) hi->name, "return_ring_ready")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "originate_retries")) {
+ } else if (!strcasecmp((char *) hi->name, "originate_retries")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "originate_timeout")) {
+ } else if (!strcasecmp((char *) hi->name, "originate_timeout")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "originate_retry_sleep_ms")) {
+ } else if (!strcasecmp((char *) hi->name, "originate_retry_sleep_ms")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "origination_caller_id_name")) {
+ } else if (!strcasecmp((char *) hi->name, "origination_caller_id_name")) {
ok = 1;
- } else if (!strcasecmp((char *)hi->name, "origination_caller_id_number")) {
+ } else if (!strcasecmp((char *) hi->name, "origination_caller_id_number")) {
ok = 1;
}
if (ok) {
- switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (char *)hi->name, "%s", (char *) hi->value);
+ switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (char *) hi->name, "%s", (char *) hi->value);
}
}
switch_channel_variable_last(caller_channel);
}
/*
- if ((hi = switch_channel_variable_first(caller_channel))) {
- for (; hi; hi = switch_hash_next(hi)) {
- switch_hash_this(hi, &vvar, NULL, &vval);
- if (vvar && vval) {
- switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, "%s", (char *) vval);
- }
- }
- switch_channel_variable_last(caller_channel);
- }
- */
+ if ((hi = switch_channel_variable_first(caller_channel))) {
+ for (; hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, &vvar, NULL, &vval);
+ if (vvar && vval) {
+ switch_event_add_header(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, "%s", (char *) vval);
+ }
+ }
+ switch_channel_variable_last(caller_channel);
+ }
+ */
}
if (vars) { /* Parse parameters specified from the dialstring */
@@ -609,7 +608,7 @@
for (x = 0; x < var_count; x++) {
char *inner_var_array[2] = { 0 };
int inner_var_count;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"variable string %d = [%s]\n", x, var_array[x]);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]);
if ((inner_var_count =
switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
@@ -624,12 +623,12 @@
if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
- }
-
+ }
+
if (!ringback_data) {
ringback_data = switch_channel_get_variable(caller_channel, "ringback");
}
-
+
switch_channel_set_variable(caller_channel, "originate_disposition", "failure");
}
@@ -736,7 +735,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Only calling the first element in the list in this mode.\n");
and_argc = 1;
}
-
+
for (i = 0; i < and_argc; i++) {
char *vdata;
char *e = NULL;
@@ -748,7 +747,7 @@
vdata = chan_type;
e = switch_find_end_paren(vdata, '[', ']');
-
+
if (e) {
vdata++;
*e++ = '\0';
@@ -756,7 +755,7 @@
} else {
vdata = NULL;
}
-
+
if ((chan_data = strchr(chan_type, '/')) != 0) {
*chan_data = '\0';
chan_data++;
@@ -801,18 +800,15 @@
new_profile = switch_caller_profile_new(pool,
NULL,
NULL,
- cid_name_override,
- cid_num_override,
- NULL, NULL, NULL, NULL, __FILE__, NULL,
- chan_data);
+ cid_name_override, cid_num_override, NULL, NULL, NULL, NULL, __FILE__, NULL, chan_data);
}
}
-
+
caller_profiles[i] = NULL;
peer_channels[i] = NULL;
peer_sessions[i] = NULL;
new_session = NULL;
-
+
if (and_argc > 1 || or_argc > 1) {
myflags |= SOF_FORKED_DIAL;
} else if (var_event) {
@@ -821,9 +817,11 @@
myflags |= SOF_FORKED_DIAL;
}
}
- if ((reason = switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
- chan_type, switch_channel_cause2str(reason));
+ if ((reason =
+ switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
+ myflags)) != SWITCH_CAUSE_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n", chan_type,
+ switch_channel_cause2str(reason));
if (pool) {
switch_core_destroy_memory_pool(&pool);
}
@@ -837,7 +835,7 @@
peer_sessions[i] = new_session;
peer_channels[i] = switch_core_session_get_channel(new_session);
switch_channel_set_flag(peer_channels[i], CF_ORIGINATING);
-
+
if (vdata) {
char *var_array[1024] = { 0 };
int var_count = 0;
@@ -847,15 +845,15 @@
char *inner_var_array[2] = { 0 };
int inner_var_count;
if ((inner_var_count =
- switch_separate_string(var_array[x], '=',
+ switch_separate_string(var_array[x], '=',
inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) {
-
+
switch_channel_set_variable(peer_channels[i], inner_var_array[0], inner_var_array[1]);
}
}
}
}
-
+
if (var_event) {
switch_event_t *event;
switch_event_header_t *header;
@@ -883,15 +881,15 @@
*cause = SWITCH_CAUSE_SUCCESS;
goto outer_for;
}
-
+
if (!switch_core_session_running(peer_sessions[i])) {
//if (!(flags & SOF_NOBLOCK)) {
- //switch_channel_set_state(peer_channels[i], CS_ROUTING);
+ //switch_channel_set_state(peer_channels[i], CS_ROUTING);
//}
- //} else {
+ //} else {
switch_core_session_thread_launch(peer_sessions[i]);
}
- }
+ }
switch_timestamp(&start);
@@ -928,7 +926,7 @@
switch_yield(10000);
}
-
+
if (valid_channels == 0) {
status = SWITCH_STATUS_GENERR;
goto done;
@@ -936,7 +934,7 @@
}
- endfor1:
+ endfor1:
if (ringback_data && !switch_channel_test_flag(caller_channel, CF_ANSWERED)
&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
@@ -947,7 +945,7 @@
}
if (session && (read_codec = switch_core_session_get_read_codec(session)) &&
- (ringback_data ||
+ (ringback_data ||
(!(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA))))) {
if (!(pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
@@ -956,13 +954,14 @@
NULL,
read_codec->implementation->actual_samples_per_second,
read_codec->implementation->microseconds_per_frame / 1000,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second,
+ read_codec->implementation->microseconds_per_frame / 1000);
write_frame.codec = &write_codec;
write_frame.datalen = read_codec->implementation->bytes_per_frame;
write_frame.samples = write_frame.datalen / 2;
@@ -973,10 +972,10 @@
switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0);
switch_buffer_set_loops(ringback.audio_buffer, -1);
-
+
if (switch_is_file_path(ringback_data)) {
char *ext;
-
+
if (strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR)) {
switch_core_session_set_read_codec(session, &write_codec);
} else {
@@ -995,8 +994,7 @@
ringback_data,
read_codec->implementation->number_of_channels,
read_codec->implementation->actual_samples_per_second,
- SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
- NULL) != SWITCH_STATUS_SUCCESS) {
+ SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
switch_safe_free(tmp_data);
goto notready;
@@ -1038,7 +1036,6 @@
switch_channel_ring_ready(caller_channel);
sent_ring = 1;
}
-
// When the AND operator is being used, and fail_on_single_reject is set, a hangup indicates that the call should fail.
if ((to = (uint8_t) ((switch_timestamp(NULL) - start) >= (time_t) timelimit_sec))
|| (fail_on_single_reject && hups)) {
@@ -1059,23 +1056,24 @@
}
}
- /* read from the channel while we wait if the audio is up on it */
- if (session &&
- !switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
- !switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
- (ringback_data || (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
-
+ /* read from the channel while we wait if the audio is up on it */
+ if (session &&
+ !switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
+ !switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
+ (ringback_data
+ || (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
+
switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}
-
+
if (ring_ready && read_frame && !pass) {
if (ringback.fh) {
switch_size_t mlen, olen;
unsigned int pos = 0;
-
+
if (ringback.asis) {
mlen = write_frame.codec->implementation->encoded_bytes_per_frame;
@@ -1103,7 +1101,7 @@
break;
}
}
-
+
if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -1121,19 +1119,18 @@
idx = IDX_CANCEL;
}
- if (session && (ringback_data || !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
+ if (session && (ringback_data || !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)))) {
switch_core_session_reset(session, SWITCH_FALSE);
}
-
+
for (i = 0; i < and_argc; i++) {
if (!peer_channels[i]) {
continue;
}
-
+
if (switch_channel_test_flag(peer_channels[i], CF_TRANSFER) || switch_channel_test_flag(peer_channels[i], CF_BRIDGED) ||
- switch_channel_get_state(peer_channels[i]) == CS_RESET ||
- !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
+ switch_channel_get_state(peer_channels[i]) == CS_RESET || !switch_channel_test_flag(peer_channels[i], CF_ORIGINATING)
) {
continue;
}
@@ -1194,8 +1191,8 @@
}
}
- if (switch_channel_test_flag(peer_channel, CF_ANSWERED) ||
- (early_ok && switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) ||
+ if (switch_channel_test_flag(peer_channel, CF_ANSWERED) ||
+ (early_ok && switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA)) ||
(return_ring_ready && switch_channel_test_flag(peer_channel, CF_RING_READY))
) {
*bleg = peer_session;
@@ -1275,7 +1272,7 @@
}
switch_core_codec_destroy(&write_codec);
}
-
+
for (i = 0; i < and_argc; i++) {
if (!peer_channels[i]) {
@@ -1287,7 +1284,7 @@
}
switch_core_session_rwunlock(peer_sessions[i]);
}
-
+
if (status == SWITCH_STATUS_SUCCESS) {
goto outer_for;
}
@@ -1301,7 +1298,7 @@
*bleg = NULL;
}
-
+
if (var_event) {
switch_event_destroy(&var_event);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c Tue May 27 07:24:06 2008
@@ -121,14 +121,14 @@
switch_event_create(&hint_data, SWITCH_EVENT_MESSAGE);
switch_assert(hint_data);
-
+
switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "macro_name", macro_name);
switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "lang", chan_lang);
if (data) {
switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "data", data);
} else {
- data = "";
- }
+ data = "";
+ }
switch_channel_event_set_data(channel, hint_data);
if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data) != SWITCH_STATUS_SUCCESS) {
@@ -170,7 +170,7 @@
if (!(tts_engine = (char *) switch_xml_attr(language, "tts-engine"))) {
tts_engine = (char *) switch_xml_attr(language, "tts_engine");
}
-
+
if (!(tts_voice = (char *) switch_xml_attr(language, "tts-voice"))) {
tts_voice = (char *) switch_xml_attr(language, "tts_voice");
}
@@ -210,7 +210,7 @@
while (input && !done) {
char *pattern = (char *) switch_xml_attr(input, "pattern");
const char *do_break = switch_xml_attr_soft(input, "break_on_match");
-
+
if (pattern) {
switch_regex_t *re = NULL;
int proceed = 0, ovector[30];
@@ -221,7 +221,7 @@
switch_xml_t match = NULL;
status = SWITCH_STATUS_SUCCESS;
-
+
if ((proceed = switch_regex_perform(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
match = switch_xml_child(input, "match");
} else {
@@ -233,7 +233,7 @@
for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) {
char *adata = (char *) switch_xml_attr_soft(action, "data");
char *func = (char *) switch_xml_attr_soft(action, "function");
-
+
if (strchr(pattern, '(') && strchr(adata, '$')) {
len = (uint32_t) (strlen(data) + strlen(adata) + 10);
if (!(substituted = malloc(len))) {
@@ -278,7 +278,7 @@
cmd_args = switch_separate_paren_args(cmd);
- if (!cmd_args ) {
+ if (!cmd_args) {
cmd_args = "";
}
@@ -293,14 +293,16 @@
char *say_type = (char *) switch_xml_attr_soft(action, "type");
char *say_method = (char *) switch_xml_attr_soft(action, "method");
- status = si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method), args);
+ status =
+ si->say_function(session, odata, switch_ivr_get_say_type_by_name(say_type), switch_ivr_get_say_method_by_name(say_method),
+ args);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name);
}
} else if (!strcasecmp(func, "speak-text")) {
const char *my_tts_engine = switch_xml_attr(action, "tts-engine");
const char *my_tts_voice = switch_xml_attr(action, "tts-voice");
-
+
if (!my_tts_engine) {
my_tts_engine = tts_engine;
}
@@ -321,11 +323,11 @@
switch_safe_free(expanded);
switch_safe_free(substituted);
-
+
if (match && do_break && switch_true(do_break)) {
break;
}
-
+
}
if (status != SWITCH_STATUS_SUCCESS) {
@@ -337,7 +339,7 @@
}
done:
-
+
if (hint_data) {
switch_event_destroy(&hint_data);
}
@@ -360,7 +362,7 @@
switch_file_handle_t *fh, const char *file, switch_input_args_t *args, uint32_t limit)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_file_handle_t lfh = { 0 };
switch_frame_t *read_frame;
switch_codec_t codec, *read_codec = switch_core_session_get_read_codec(session);
@@ -463,9 +465,9 @@
org_silence_hits = fh->silence_hits;
}
- for(;;) {
+ for (;;) {
switch_size_t len;
-
+
if (!switch_channel_ready(channel)) {
status = SWITCH_STATUS_FALSE;
break;
@@ -476,7 +478,7 @@
status = SWITCH_STATUS_BREAK;
break;
}
-
+
if (switch_core_session_private_event_count(session)) {
switch_ivr_parse_all_events(session);
}
@@ -497,9 +499,9 @@
}
switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- switch_copy_string((char *) args->buf, (void *)&dtmf, args->buflen);
+ switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen);
status = SWITCH_STATUS_BREAK;
}
}
@@ -535,7 +537,7 @@
uint32_t score, count = 0, j = 0;
double energy = 0;
int divisor = 0;
-
+
for (count = 0; count < samples; count++) {
energy += abs(fdata[j]);
j += read_codec->implementation->number_of_channels;
@@ -544,7 +546,7 @@
if (!(divisor = read_codec->implementation->actual_samples_per_second / 8000)) {
divisor = 1;
}
-
+
score = (uint32_t) (energy / (samples / divisor));
if (score < fh->thresh) {
if (!--fh->silence_hits) {
@@ -558,7 +560,7 @@
if (!switch_test_flag(fh, SWITCH_FILE_PAUSE) && !switch_test_flag(read_frame, SFF_CNG)) {
int16_t *data = read_frame->data;
len = (switch_size_t) read_frame->datalen / 2;
-
+
if (switch_core_file_write(fh, data, &len) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -571,7 +573,7 @@
return status;
}
-static int teletone_handler(teletone_generation_session_t * ts, teletone_tone_map_t * map)
+static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
{
switch_buffer_t *audio_buffer = ts->user_data;
int wrote;
@@ -589,7 +591,7 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args)
{
teletone_generation_session_t ts;
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
switch_buffer_t *audio_buffer;
switch_frame_t *read_frame = NULL;
switch_codec_t *read_codec = NULL, write_codec = { 0 };
@@ -599,13 +601,13 @@
switch_channel_pre_answer(channel);
read_codec = switch_core_session_get_read_codec(session);
-
+
if (switch_core_codec_init(&write_codec,
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
read_codec->implementation->microseconds_per_frame / 1000,
- 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+ 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
@@ -624,14 +626,14 @@
switch_buffer_set_loops(audio_buffer, loops);
}
- for(;;) {
+ for (;;) {
int done = 0;
switch_status_t status;
-
+
if (!switch_channel_ready(channel)) {
- status = SWITCH_STATUS_FALSE;
- break;
- }
+ status = SWITCH_STATUS_FALSE;
+ break;
+ }
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
@@ -658,9 +660,9 @@
}
switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- *((char *)args->buf) = dtmf.digit;
+ *((char *) args->buf) = dtmf.digit;
status = SWITCH_STATUS_BREAK;
}
}
@@ -680,13 +682,12 @@
}
}
- if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data,
- read_codec->implementation->bytes_per_frame)) <= 0) {
+ if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_codec->implementation->bytes_per_frame)) <= 0) {
break;
}
write_frame.samples = write_frame.datalen / 2;
-
+
if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -708,7 +709,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
int16_t *abuf = NULL;
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
uint32_t interval = 0, samples = 0, framelen, sample_start = 0;
uint32_t ilen = 0;
switch_size_t olen = 0, llen = 0;
@@ -750,7 +751,7 @@
const char *lang = switch_channel_get_variable(channel, "language");
alt = file + 7;
dup = switch_core_session_strdup(session, alt);
-
+
if (dup) {
if ((arg = strchr(dup, ':'))) {
*arg++ = '\0';
@@ -763,7 +764,7 @@
} else if (!strncasecmp(file, "say:", 4)) {
char *engine = NULL, *voice = NULL, *text = NULL;
alt = file + 4;
- dup = switch_core_session_strdup(session, alt);
+ dup = switch_core_session_strdup(session, alt);
engine = dup;
if (!switch_strlen_zero(engine)) {
@@ -779,8 +780,8 @@
return switch_ivr_speak_text(session, engine, voice, text, args);
} else if (!switch_strlen_zero(engine) && !(voice && text)) {
text = engine;
- engine = (char *)switch_channel_get_variable(channel, "tts_engine");
- voice = (char *)switch_channel_get_variable(channel, "tts_voice");
+ engine = (char *) switch_channel_get_variable(channel, "tts_engine");
+ voice = (char *) switch_channel_get_variable(channel, "tts_voice");
if (engine && text) {
return switch_ivr_speak_text(session, engine, voice, text, args);
}
@@ -789,7 +790,7 @@
return SWITCH_STATUS_FALSE;
}
}
-
+
}
if (!prefix) {
@@ -946,15 +947,15 @@
ilen = samples;
- for(;;) {
+ for (;;) {
int done = 0;
int do_speed = 1;
int last_speed = -1;
if (!switch_channel_ready(channel)) {
- status = SWITCH_STATUS_FALSE;
- break;
- }
+ status = SWITCH_STATUS_FALSE;
+ break;
+ }
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
@@ -979,9 +980,9 @@
}
switch_channel_dequeue_dtmf(channel, &dtmf);
if (args->input_callback) {
- status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
} else {
- *((char *)args->buf) = dtmf.digit;
+ *((char *) args->buf) = dtmf.digit;
status = SWITCH_STATUS_BREAK;
}
}
@@ -1062,7 +1063,7 @@
supplement = 1;
}
newlen = (fh->speed > 0) ? olen - supplement : olen + supplement;
-
+
step = (fh->speed > 0) ? (newlen / supplement) : (olen / supplement);
if (!fh->sp_audio_buffer) {
@@ -1099,10 +1100,10 @@
olen = llen;
}
- write_frame.samples = (uint32_t)olen;
+ write_frame.samples = (uint32_t) olen;
if (asis) {
- write_frame.datalen = (uint32_t)olen;
+ write_frame.datalen = (uint32_t) olen;
} else {
write_frame.datalen = write_frame.samples * 2;
}
@@ -1125,7 +1126,7 @@
fh->offset_pos += write_frame.samples / 2;
status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (status == SWITCH_STATUS_MORE_DATA) {
status = SWITCH_STATUS_SUCCESS;
continue;
@@ -1150,7 +1151,7 @@
}
tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-
+
if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}
@@ -1171,7 +1172,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "done playing file\n");
switch_core_file_seek(fh, &fh->last_pos, 0, SEEK_CUR);
-
+
switch_core_file_close(fh);
switch_buffer_destroy(&fh->audio_buffer);
switch_buffer_destroy(&fh->sp_audio_buffer);
@@ -1185,7 +1186,7 @@
}
- end:
+ end:
switch_safe_free(abuf);
switch_core_session_reset(session, SWITCH_TRUE);
@@ -1197,10 +1198,7 @@
uint32_t max_digits,
const char *prompt_audio_file,
const char *var_name,
- char *digit_buffer,
- switch_size_t digit_buffer_length,
- uint32_t timeout,
- const char *valid_terminators)
+ char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators)
{
switch_channel_t *channel;
switch_input_args_t args = { 0 };
@@ -1221,34 +1219,34 @@
memset(digit_buffer, 0, digit_buffer_length);
args.buf = digit_buffer;
- args.buflen = (uint32_t)digit_buffer_length;
+ args.buflen = (uint32_t) digit_buffer_length;
if (!switch_strlen_zero(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args);
}
-
+
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
goto end;
}
len = strlen(digit_buffer);
-
+
if (len < min_digits && len < max_digits) {
args.buf = digit_buffer + len;
- args.buflen = (uint32_t)(digit_buffer_length - len);
+ args.buflen = (uint32_t) (digit_buffer_length - len);
status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &terminator, timeout, 0, 0);
}
-
- end:
+
+ end:
if (var_name && !switch_strlen_zero(digit_buffer)) {
switch_channel_set_variable(channel, var_name, digit_buffer);
}
return status;
-
+
}
@@ -1357,7 +1355,7 @@
}
}
- done:
+ done:
//if we got here, we got no digits or lost the channel
digit_buffer = "\0";
return SWITCH_STATUS_FALSE;
@@ -1370,7 +1368,7 @@
{
switch_channel_t *channel = switch_core_session_get_channel(session);
short abuf[960];
- switch_dtmf_t dtmf = {0};
+ switch_dtmf_t dtmf = { 0 };
uint32_t len = 0;
switch_size_t ilen = 0;
switch_frame_t write_frame = { 0 };
@@ -1395,9 +1393,9 @@
write_frame.buflen = sizeof(abuf);
len = sh->samples * 2;
-
+
flags = 0;
-
+
if (!(star = switch_channel_get_variable(channel, "star_replace"))) {
star = "star";
}
@@ -1408,7 +1406,7 @@
poundlen = strlen(pound);
- for(p = text; p && *p; p++) {
+ for (p = text; p && *p; p++) {
if (*p == '*') {
extra += starlen;
} else if (*p == '#') {
@@ -1429,14 +1427,14 @@
if (*p == '*') {
strncat(tp, star, starlen);
tp += starlen;
- } else if (*p == '#') {
+ } else if (*p == '#') {
strncat(tp, pound, poundlen);
tp += poundlen;
} else {
*tp++ = *p;
}
}
-
+
text = tmp;
}
@@ -1466,13 +1464,13 @@
}
ilen = len;
- for(;;) {
+ for (;;) {
switch_event_t *event;
if (!switch_channel_ready(channel)) {
- status = SWITCH_STATUS_FALSE;
- break;
- }
+ status = SWITCH_STATUS_FALSE;
+ break;
+ }
if (switch_channel_test_flag(channel, CF_BREAK)) {
switch_channel_clear_flag(channel, CF_BREAK);
@@ -1628,7 +1626,7 @@
};
typedef struct cached_speech_handle cached_speech_handle_t;
-SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *session)
+SWITCH_DECLARE(void) switch_ivr_clear_speech_cache(switch_core_session_t *session)
{
cached_speech_handle_t *cache_obj = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -1698,13 +1696,13 @@
switch_core_session_reset(session, SWITCH_TRUE);
read_codec = switch_core_session_get_read_codec(session);
-
+
rate = read_codec->implementation->actual_samples_per_second;
interval = read_codec->implementation->microseconds_per_frame / 1000;
-
+
if (need_create) {
memset(sh, 0, sizeof(*sh));
- if (switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
+ if (switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
&flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid TTS module!\n");
switch_core_session_reset(session, SWITCH_TRUE);
@@ -1727,7 +1725,8 @@
if (need_create) {
if (switch_core_codec_init(codec,
codec_name,
- NULL, (int) rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
+ NULL, (int) rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+ pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval);
@@ -1740,7 +1739,7 @@
return SWITCH_STATUS_GENERR;
}
}
-
+
write_frame.codec = codec;
if (timer_name) {
@@ -1762,7 +1761,7 @@
switch_core_service_session(session, &thread_session, 0);
}
-
+
status = switch_ivr_speak_text_handle(session, sh, write_frame.codec, timer_name ? timer : NULL, text, args);
flags = 0;
@@ -1790,8 +1789,8 @@
switch (itype) {
case SWITCH_INPUT_TYPE_DTMF:
- {
- switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
if (dtmf->digit == *stop_key) {
return SWITCH_STATUS_BREAK;
}
@@ -1813,8 +1812,8 @@
switch_input_args_t args = { 0 };
args.input_callback = hold_on_dtmf;
args.buf = (void *) unhold_key;
- args.buflen = (uint32_t)strlen(unhold_key);
-
+ args.buflen = (uint32_t) strlen(unhold_key);
+
switch_assert(session != NULL);
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
@@ -1825,7 +1824,7 @@
other_channel = switch_core_session_get_channel(other_session);
if (moh_b) {
- moh = moh_b;
+ moh = moh_b;
} else {
moh = switch_channel_get_variable(other_channel, "hold_music");
}
@@ -1834,18 +1833,18 @@
switch_ivr_broadcast(other_uuid, moh, SMF_ECHO_ALEG | SMF_LOOP);
moh_br++;
}
-
+
if (moh_a) {
moh = moh_a;
} else {
moh = switch_channel_get_variable(channel, "hold_music");
}
-
+
if (!switch_strlen_zero(moh) && strcasecmp(moh, "silence")) {
switch_ivr_play_file(session, NULL, moh, &args);
} else {
switch_ivr_collect_digits_callback(session, &args, 0);
- }
+ }
if (moh_br) {
switch_channel_stop_broadcast(other_channel);
@@ -1856,9 +1855,9 @@
return SWITCH_STATUS_SUCCESS;
}
-
+
}
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Channel %s is not in a bridge\n", switch_channel_get_name(channel));
return SWITCH_STATUS_FALSE;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c Tue May 27 07:24:06 2008
@@ -75,7 +75,7 @@
static struct switch_loadable_module_container loadable_modules;
static void do_shutdown(switch_loadable_module_t *module);
-static void *switch_loadable_module_exec(switch_thread_t * thread, void *obj)
+static void *switch_loadable_module_exec(switch_thread_t *thread, void *obj)
{
@@ -126,7 +126,7 @@
switch_event_t *event;
new_module->key = switch_core_strdup(new_module->pool, key);
-
+
switch_mutex_lock(loadable_modules.mutex);
switch_core_hash_insert(loadable_modules.module_hash, key, new_module);
@@ -155,13 +155,15 @@
if (!impl->iananame) {
load_interface = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
- "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
+ "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name,
+ key);
break;
}
if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
load_interface = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
- "Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name, key);
+ "Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name,
+ key);
break;
}
}
@@ -590,7 +592,7 @@
const switch_chat_interface_t *ptr;
for (ptr = old_module->module_interface->chat_interface; ptr; ptr = ptr->next) {
- if (ptr->interface_name) {
+ if (ptr->interface_name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Chat interface '%s'\n", ptr->interface_name);
if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "type", "%s", "chat");
@@ -718,12 +720,12 @@
}
if (status == SWITCH_STATUS_NOUNLOAD) {
- module->perm++;
- }
-
+ module->perm++;
+ }
+
loading = 0;
}
-
+
if (err) {
if (pool) {
@@ -778,7 +780,7 @@
if (switch_is_file_path(file)) {
path = switch_core_strdup(loadable_modules.pool, file);
- file = (char *)switch_cut_path(file);
+ file = (char *) switch_cut_path(file);
if ((dot = strchr(file, '.'))) {
dot = '\0';
}
@@ -841,8 +843,7 @@
SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename,
switch_module_load_t switch_module_load,
switch_module_runtime_t switch_module_runtime,
- switch_module_shutdown_t switch_module_shutdown,
- switch_bool_t runtime)
+ switch_module_shutdown_t switch_module_shutdown, switch_bool_t runtime)
{
switch_loadable_module_t *module = NULL;
switch_module_load_t load_func_ptr = NULL;
@@ -851,7 +852,7 @@
switch_loadable_module_interface_t *module_interface = NULL;
switch_memory_pool_t *pool;
-
+
if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
abort();
@@ -1058,7 +1059,7 @@
}
apr_dir_close(module_dir_handle);
}
-
+
switch_loadable_module_runtime();
return SWITCH_STATUS_SUCCESS;
@@ -1093,7 +1094,7 @@
switch_hash_index_t *hi;
void *val;
switch_loadable_module_t *module;
-
+
for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, NULL, NULL, &val);
module = (switch_loadable_module_t *) val;
@@ -1227,7 +1228,7 @@
/* oh well we will use what we have */
array[i++] = codec_interface->implementations;
- found:
+ found:
if (i > arraylen) {
break;
@@ -1235,7 +1236,7 @@
}
switch_mutex_unlock(loadable_modules.mutex);
-
+
return i;
}
@@ -1247,7 +1248,7 @@
const switch_codec_implementation_t *imp;
switch_mutex_lock(loadable_modules.mutex);
-
+
for (x = 0; x < preflen; x++) {
char *cur, *last = NULL, *next = NULL, *name, *p, buf[256];
uint32_t interval = 0, rate = 8000;
@@ -1259,7 +1260,7 @@
if (!next) {
break;
}
-
+
if ((p = strchr(next, '@'))) {
*p++ = '\0';
}
@@ -1318,7 +1319,7 @@
}
}
- found:
+ found:
if (i > arraylen) {
break;
@@ -1327,7 +1328,7 @@
}
switch_mutex_unlock(loadable_modules.mutex);
-
+
return i;
}
@@ -1383,7 +1384,7 @@
mod->pool = pool;
mod->module_name = switch_core_strdup(mod->pool, name);
-
+
return mod;
}
@@ -1404,46 +1405,46 @@
SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_module_interface_t *mod, switch_module_interface_name_t iname)
{
- switch(iname) {
+ switch (iname) {
case SWITCH_ENDPOINT_INTERFACE:
ALLOC_INTERFACE(endpoint)
case SWITCH_TIMER_INTERFACE:
ALLOC_INTERFACE(timer)
-
+
case SWITCH_DIALPLAN_INTERFACE:
ALLOC_INTERFACE(dialplan)
-
+
case SWITCH_CODEC_INTERFACE:
ALLOC_INTERFACE(codec)
-
+
case SWITCH_APPLICATION_INTERFACE:
ALLOC_INTERFACE(application)
-
+
case SWITCH_API_INTERFACE:
ALLOC_INTERFACE(api)
-
+
case SWITCH_FILE_INTERFACE:
ALLOC_INTERFACE(file)
-
+
case SWITCH_SPEECH_INTERFACE:
ALLOC_INTERFACE(speech)
-
+
case SWITCH_DIRECTORY_INTERFACE:
ALLOC_INTERFACE(directory)
-
+
case SWITCH_CHAT_INTERFACE:
ALLOC_INTERFACE(chat)
-
+
case SWITCH_SAY_INTERFACE:
ALLOC_INTERFACE(say)
-
+
case SWITCH_ASR_INTERFACE:
ALLOC_INTERFACE(asr)
-
+
case SWITCH_MANAGEMENT_INTERFACE:
ALLOC_INTERFACE(management)
-
+
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Module Type!\n");
return NULL;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c Tue May 27 07:24:06 2008
@@ -145,7 +145,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC log_thread(switch_thread_t *thread, void *obj)
{
if (!obj) {
@@ -174,7 +174,7 @@
}
}
switch_mutex_unlock(BINDLOCK);
-
+
switch_safe_free(node->data);
if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
free(node);
@@ -263,13 +263,13 @@
fd_set can_write;
int fd;
struct timeval to;
-
+
fd = fileno(handle);
memset(&to, 0, sizeof(to));
FD_SET(fd, &can_write);
to.tv_sec = 0;
to.tv_usec = 100000;
- if (select(fd+1, NULL, &can_write, NULL, &to) > 0) {
+ if (select(fd + 1, NULL, &can_write, NULL, &to) > 0) {
aok = FD_ISSET(fd, &can_write);
} else {
aok = 0;
@@ -287,7 +287,7 @@
node = (switch_log_node_t *) pop;
} else {
node = malloc(sizeof(*node));
- switch_assert(node);
+ switch_assert(node);
}
node->data = data;
@@ -308,8 +308,8 @@
node = NULL;
}
}
-
- end:
+
+ end:
switch_safe_free(data);
switch_safe_free(new_fmt);
@@ -347,7 +347,8 @@
{
void *pop;
int size = switch_queue_size(LOG_RECYCLE_QUEUE);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size, (int)sizeof(switch_log_node_t) * size);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Returning %d recycled log node(s) %d bytes\n", size,
+ (int) sizeof(switch_log_node_t) * size);
while (switch_queue_trypop(LOG_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS) {
free(pop);
}
@@ -362,7 +363,7 @@
switch_yield(1000);
}
switch_core_memory_reclaim_logger();
-
+
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c Tue May 27 07:24:06 2008
@@ -50,7 +50,7 @@
if (!(new_handle = malloc(sizeof(*new_handle)))) {
goto err;
}
-
+
memset(new_handle, 0, sizeof(*new_handle));
if (!(new_handle->dsn = strdup(dsn))) {
@@ -96,7 +96,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Disconnectiong [%s]\n", handle->dsn);
}
- }
+ }
handle->state = SWITCH_ODBC_STATE_DOWN;
@@ -143,19 +143,21 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connecting %s\n", handle->dsn);
-
- if(!strstr(handle->dsn, "DRIVER")) {
- result = SQLConnect(handle->con, (SQLCHAR *) handle->dsn, SQL_NTS, (SQLCHAR *) handle->username, SQL_NTS, (SQLCHAR *) handle->password, SQL_NTS);
- } else {
- SQLCHAR outstr[1024] = {0};
- SQLSMALLINT outstrlen = 0;
- result = SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT)strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT);
- }
+
+ if (!strstr(handle->dsn, "DRIVER")) {
+ result = SQLConnect(handle->con, (SQLCHAR *) handle->dsn, SQL_NTS, (SQLCHAR *) handle->username, SQL_NTS, (SQLCHAR *) handle->password, SQL_NTS);
+ } else {
+ SQLCHAR outstr[1024] = { 0 };
+ SQLSMALLINT outstrlen = 0;
+ result =
+ SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT) strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen,
+ SQL_DRIVER_NOPROMPT);
+ }
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
char *err_str;
if ((err_str = switch_odbc_handle_get_error(handle, NULL))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n",err_str);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err_str);
free(err_str);
} else {
SQLGetDiagRec(SQL_HANDLE_DBC, handle->con, 1, stat, &err, msg, 100, &mlen);
@@ -165,10 +167,10 @@
return SWITCH_ODBC_FAIL;
}
- result = SQLGetInfo(handle->con, SQL_DRIVER_NAME, (SQLCHAR*)handle->odbc_driver, 255, &valueLength);
- if ( result == SQL_SUCCESS || result == SQL_SUCCESS_WITH_INFO) {
+ result = SQLGetInfo(handle->con, SQL_DRIVER_NAME, (SQLCHAR *) handle->odbc_driver, 255, &valueLength);
+ if (result == SQL_SUCCESS || result == SQL_SUCCESS_WITH_INFO) {
for (i = 0; i < valueLength; ++i)
- handle->odbc_driver[i] = (char)toupper(handle->odbc_driver[i]);
+ handle->odbc_driver[i] = (char) toupper(handle->odbc_driver[i]);
}
if (strstr(handle->odbc_driver, "FIREBIRD") != 0 || strstr(handle->odbc_driver, "FB32") != 0 || strstr(handle->odbc_driver, "FB64") != 0) {
@@ -194,28 +196,28 @@
SQLCHAR sql[255] = "";
int max_tries = 120;
- top:
-
+ top:
+
if (!handle) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No DB Handle\n");
goto done;
}
if (handle->is_firebird) {
- strcpy((char*)sql, "select first 1 * from RDB$RELATIONS");
+ strcpy((char *) sql, "select first 1 * from RDB$RELATIONS");
} else {
- strcpy((char*)sql, "select 1");
+ strcpy((char *) sql, "select 1");
}
- if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) {
- goto error;
- }
-
- if (SQLPrepare(stmt, sql, SQL_NTS) != SQL_SUCCESS) {
- goto error;
- }
-
- result = SQLExecute(stmt);
+ if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) {
+ goto error;
+ }
+
+ if (SQLPrepare(stmt, sql, SQL_NTS) != SQL_SUCCESS) {
+ goto error;
+ }
+
+ result = SQLExecute(stmt);
SQLRowCount(stmt, &m);
ret = (int) m;
@@ -226,14 +228,14 @@
goto done;
- error:
+ error:
err_str = switch_odbc_handle_get_error(handle, stmt);
recon = switch_odbc_handle_connect(handle);
max_tries--;
if (switch_event_create(&event, SWITCH_EVENT_TRAP) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Failure-Message", "The sql server is not responding for DSN %s [%s]",
+ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Failure-Message", "The sql server is not responding for DSN %s [%s]",
switch_str_nil(handle->dsn), switch_str_nil(err_str));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "The sql server is not responding for DSN %s [%s]\n",
switch_str_nil(handle->dsn), switch_str_nil(err_str));
@@ -260,8 +262,8 @@
switch_safe_free(err_str);
switch_yield(1000000);
goto top;
-
- done:
+
+ done:
switch_safe_free(err_str);
@@ -269,10 +271,10 @@
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
}
- return ret;
+ return ret;
}
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT *rstmt)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, char *sql, SQLHSTMT * rstmt)
{
SQLHSTMT stmt = NULL;
int result;
@@ -280,7 +282,7 @@
if (!db_is_up(handle)) {
goto error;
}
-
+
if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) {
goto error;
}
@@ -303,13 +305,13 @@
return SWITCH_ODBC_SUCCESS;
- error:
+ error:
if (rstmt) {
- *rstmt = stmt;
- } else if (stmt) {
+ *rstmt = stmt;
+ } else if (stmt) {
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
}
- return SWITCH_ODBC_FAIL;
+ return SWITCH_ODBC_FAIL;
}
SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec(switch_odbc_handle_t *handle,
@@ -349,14 +351,14 @@
char **names;
char **vals;
int y = 0;
-
+
if (!(result = SQLFetch(stmt)) == SQL_SUCCESS) {
goto error;
}
-
+
names = calloc(c, sizeof(*names));
vals = calloc(c, sizeof(*vals));
-
+
switch_assert(names && vals);
for (x = 1; x <= c; x++) {
@@ -365,7 +367,7 @@
names[y] = malloc(name_len);
memset(names[y], 0, name_len);
- SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT)name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+ SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
ColumnSize++;
vals[y] = malloc(ColumnSize);
@@ -373,7 +375,7 @@
SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL);
y++;
}
-
+
if (callback(pdata, y, vals, names)) {
break;
}
@@ -435,8 +437,8 @@
SQLSMALLINT length;
char *ret = NULL;
- if (SQLError(handle->env, handle->con, stmt, (SQLCHAR *)sqlstate, &sqlcode, (SQLCHAR *)buffer, sizeof(buffer), &length) == SQL_SUCCESS) {
- ret = switch_mprintf("STATE: %s CODE %ld ERROR: %s\n", sqlstate, sqlcode, buffer);
+ if (SQLError(handle->env, handle->con, stmt, (SQLCHAR *) sqlstate, &sqlcode, (SQLCHAR *) buffer, sizeof(buffer), &length) == SQL_SUCCESS) {
+ ret = switch_mprintf("STATE: %s CODE %ld ERROR: %s\n", sqlstate, sqlcode, buffer);
};
return ret;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c Tue May 27 07:24:06 2008
@@ -58,11 +58,10 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
- unsigned int *flag)
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
{
/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
- if (codec && other_codec && codec->implementation && other_codec->implementation &&
+ if (codec && other_codec && codec->implementation && other_codec->implementation &&
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
memcpy(encoded_data, decoded_data, decoded_data_len);
*encoded_data_len = decoded_data_len;
@@ -75,8 +74,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
- unsigned int *flag)
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
{
if (codec && other_codec && codec->implementation && other_codec->implementation &&
codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
@@ -100,21 +98,21 @@
}
static switch_status_t switch_proxy_encode(switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *decoded_data,
- uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
- unsigned int *flag)
+ switch_codec_t *other_codec,
+ void *decoded_data,
+ uint32_t decoded_data_len,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+ unsigned int *flag)
{
return SWITCH_STATUS_FALSE;
}
static switch_status_t switch_proxy_decode(switch_codec_t *codec,
- switch_codec_t *other_codec,
- void *encoded_data,
- uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
- unsigned int *flag)
+ switch_codec_t *other_codec,
+ void *encoded_data,
+ uint32_t encoded_data_len,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+ unsigned int *flag)
{
return SWITCH_STATUS_FALSE;
}
@@ -143,7 +141,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -166,7 +164,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -214,7 +212,7 @@
switch_codec_t *other_codec,
void *decoded_data,
uint32_t decoded_data_len,
- uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
+ uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -237,7 +235,7 @@
switch_codec_t *other_codec,
void *encoded_data,
uint32_t encoded_data_len,
- uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
+ uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
{
short *dbuf;
@@ -270,40 +268,39 @@
static void mod_g711_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
{
switch_codec_interface_t *codec_interface;
- int mpf = 10000, spf = 80, bpf = 160, ebpf = 80, count;
+ int mpf = 10000, spf = 80, bpf = 160, ebpf = 80, count;
SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
- }
-
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
+ }
+
SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
- for (count = 12; count > 0; count--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
- switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
- }
+ for (count = 12; count > 0; count--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
+ }
}
SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
{
switch_codec_interface_t *codec_interface;
- int mpf = 10000, spf = 80, bpf = 160, ebpf = 160, bps = 128000, rate = 8000, counta = 1, countb = 12;
- switch_payload_t ianacode[4] = { 0, 10, 117, 119 };
+ int mpf = 10000, spf = 80, bpf = 160, ebpf = 160, bps = 128000, rate = 8000, counta = 1, countb = 12;
+ switch_payload_t ianacode[4] = { 0, 10, 117, 119 };
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1,
- switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1, switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
@@ -311,34 +308,32 @@
SWITCH_CODEC_TYPE_AUDIO, 0, "PROXY", NULL, 8000, 8000, 0,
20000, 160, 320, 320, 1, 1, 12,
switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
-
+
SWITCH_ADD_CODEC(codec_interface, "RAW Signed Linear (16 bit)");
- for (counta = 1; counta <= 3; counta++) {
- for (countb = 12; countb > 0; countb--) {
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "L16", NULL, rate, rate, bps,
- mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 12,
- switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
- }
- rate = rate * 2;
- bps = bps * 2;
- spf = spf * 2;
- bpf = bpf * 2;
- ebpf = ebpf * 2;
- }
+ for (counta = 1; counta <= 3; counta++) {
+ for (countb = 12; countb > 0; countb--) {
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "L16", NULL, rate, rate, bps,
+ mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 12,
+ switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
+ }
+ rate = rate * 2;
+ bps = bps * 2;
+ spf = spf * 2;
+ bpf = bpf * 2;
+ ebpf = ebpf * 2;
+ }
/* these formats below are for file playing. */
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
- 20000, 441, 882, 882, 1, 1, 1,
- switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
-
- switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
- 40000, 441, 882, 882, 1, 1, 1,
- switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
-
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
+ 20000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
+
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
+ 40000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
+
/* indicate that the module should continue to be loaded */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c Tue May 27 07:24:06 2008
@@ -34,11 +34,10 @@
#include <pcre.h>
SWITCH_DECLARE(switch_regex_t *) switch_regex_compile(const char *pattern,
- int options, const char **errorptr, int *erroroffset,
-const unsigned char *tables)
+ int options, const char **errorptr, int *erroroffset, const unsigned char *tables)
{
-
-return pcre_compile(pattern, options, errorptr, erroroffset, tables);
+
+ return pcre_compile(pattern, options, errorptr, erroroffset, tables);
}
@@ -51,7 +50,7 @@
{
pcre_free(data);
-}
+}
SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expression, switch_regex_t **new_re, int *ovector, uint32_t olen)
{
@@ -87,7 +86,7 @@
}
re = pcre_compile(expression, /* the pattern */
- flags, /* default options */
+ flags, /* default options */
&error, /* for error message */
&erroffset, /* for error offset */
NULL); /* use default character tables */
@@ -114,7 +113,7 @@
*new_re = (switch_regex_t *) re;
- end:
+ end:
switch_safe_free(tmp);
return match_count;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_resample.c Tue May 27 07:24:06 2008
@@ -76,9 +76,9 @@
resampler->resampler = resample_open(QUALITY, resampler->factor, resampler->factor);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Activate Resampler %d->%d %f\n", resampler->from_rate, resampler->to_rate,
resampler->factor);
- resampler->from_size = resample_buffer(to_rate, from_rate, (uint32_t)from_size);
+ resampler->from_size = resample_buffer(to_rate, from_rate, (uint32_t) from_size);
resampler->from = (float *) switch_core_alloc(pool, resampler->from_size * sizeof(float));
- resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t)to_size); ;
+ resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);;
resampler->to = (float *) switch_core_alloc(pool, resampler->to_size * sizeof(float));
*new_resampler = resampler;
@@ -231,7 +231,7 @@
x = samples;
}
- for(i = 0; i < x; i++) {
+ for (i = 0; i < x; i++) {
z = data[i] + other_data[i];
switch_normalize_to_16bit(z);
data[i] = (int16_t) z;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c Tue May 27 07:24:06 2008
@@ -137,7 +137,7 @@
srtp_policy_t send_policy;
srtp_policy_t recv_policy;
uint32_t srtp_errs;
-
+
uint16_t seq;
uint32_t ssrc;
uint8_t sending_dtmf;
@@ -185,13 +185,8 @@
};
static int global_init = 0;
-static int rtp_common_write(switch_rtp_t *rtp_session,
- rtp_msg_t *send_msg,
- void *data,
- uint32_t datalen,
- switch_payload_t payload,
- uint32_t timestamp,
- switch_frame_flag_t *flags);
+static int rtp_common_write(switch_rtp_t *rtp_session,
+ rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags);
static switch_status_t ice_out(switch_rtp_t *rtp_session)
@@ -201,7 +196,7 @@
unsigned int elapsed;
switch_size_t bytes;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
+
switch_assert(rtp_session != NULL);
switch_assert(rtp_session->ice_user != NULL);
@@ -228,9 +223,9 @@
switch_socket_sendto(rtp_session->sock, rtp_session->remote_addr, 0, (void *) packet, &bytes);
rtp_session->stuncount = 25;
- end:
+ end:
WRITE_DEC(rtp_session);
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -249,7 +244,7 @@
READ_INC(rtp_session);
WRITE_INC(rtp_session);
-
+
if (!switch_rtp_ready(rtp_session)) {
goto end;
}
@@ -299,12 +294,12 @@
rpacket = switch_stun_packet_build_header(SWITCH_STUN_BINDING_RESPONSE, packet->header.id, stunbuf);
switch_stun_packet_attribute_add_username(rpacket, username, 32);
remote_ip = switch_get_addr(ipbuf, sizeof(ipbuf), rtp_session->from_addr);
- switch_stun_packet_attribute_add_binded_address(rpacket, (char *)remote_ip, switch_sockaddr_get_port(rtp_session->from_addr));
+ switch_stun_packet_attribute_add_binded_address(rpacket, (char *) remote_ip, switch_sockaddr_get_port(rtp_session->from_addr));
bytes = switch_stun_packet_length(rpacket);
switch_socket_sendto(rtp_session->sock, rtp_session->from_addr, 0, (void *) rpacket, &bytes);
}
- end:
+ end:
READ_DEC(rtp_session);
WRITE_DEC(rtp_session);
@@ -349,8 +344,8 @@
if (port_lock) {
switch_mutex_unlock(port_lock);
}
- }
- return START_PORT;
+ }
+ return START_PORT;
}
SWITCH_DECLARE(switch_port_t) switch_rtp_set_end_port(switch_port_t port)
@@ -366,8 +361,8 @@
if (port_lock) {
switch_mutex_unlock(port_lock);
}
- }
- return END_PORT;
+ }
+ return END_PORT;
}
SWITCH_DECLARE(void) switch_rtp_release_port(const char *ip, switch_port_t port)
@@ -378,8 +373,8 @@
return;
}
- switch_mutex_lock(port_lock);
- if ((alloc = switch_core_hash_find(alloc_hash, ip))) {
+ switch_mutex_lock(port_lock);
+ if ((alloc = switch_core_hash_find(alloc_hash, ip))) {
switch_core_port_allocator_free_port(alloc, port);
}
switch_mutex_unlock(port_lock);
@@ -390,7 +385,7 @@
{
switch_port_t port = 0;
switch_core_port_allocator_t *alloc = NULL;
-
+
switch_mutex_lock(port_lock);
alloc = switch_core_hash_find(alloc_hash, ip);
if (!alloc) {
@@ -400,7 +395,7 @@
switch_core_hash_insert(alloc_hash, ip, alloc);
}
-
+
if (switch_core_port_allocator_request_port(alloc, &port) != SWITCH_STATUS_SUCCESS) {
port = 0;
}
@@ -463,7 +458,6 @@
*err = "Bind Error!";
goto done;
}
-
#ifndef WIN32
len = sizeof(i);
switch_socket_opt_set(new_sock, SWITCH_SO_NONBLOCK, TRUE);
@@ -471,7 +465,7 @@
switch_socket_sendto(new_sock, rtp_session->local_addr, 0, (void *) o, &len);
x = 0;
- while(!ilen) {
+ while (!ilen) {
switch_status_t status;
ilen = len;
status = switch_socket_recvfrom(rtp_session->from_addr, new_sock, 0, (void *) i, &ilen);
@@ -511,7 +505,7 @@
if (old_sock) {
switch_socket_close(old_sock);
}
-
+
if (rtp_session->ready != 1) {
WRITE_DEC(rtp_session);
READ_DEC(rtp_session);
@@ -529,7 +523,7 @@
{
switch_sockaddr_t *remote_addr;
*err = "Success";
-
+
if (switch_sockaddr_info_get(&remote_addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !remote_addr) {
*err = "Remote Address Error!";
return SWITCH_STATUS_FALSE;
@@ -545,10 +539,7 @@
SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_session,
switch_rtp_crypto_direction_t direction,
- uint32_t index,
- switch_rtp_crypto_key_type_t type,
- unsigned char *key,
- switch_size_t keylen)
+ uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen)
{
switch_rtp_crypto_key_t *crypto_key;
srtp_policy_t *policy;
@@ -557,10 +548,10 @@
if (direction >= SWITCH_RTP_CRYPTO_MAX || keylen > SWITCH_RTP_MAX_CRYPTO_LEN) {
return SWITCH_STATUS_FALSE;
- }
+ }
crypto_key = switch_core_alloc(rtp_session->pool, sizeof(*crypto_key));
-
+
if (direction == SWITCH_RTP_CRYPTO_RECV) {
policy = &rtp_session->recv_policy;
} else {
@@ -575,7 +566,7 @@
memset(policy, 0, sizeof(*policy));
- switch(crypto_key->type) {
+ switch (crypto_key->type) {
case AES_CM_128_HMAC_SHA1_80:
crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy->rtp);
break;
@@ -586,13 +577,13 @@
break;
}
- policy->next = NULL;
+ policy->next = NULL;
policy->key = (uint8_t *) crypto_key->key;
crypto_policy_set_rtcp_default(&policy->rtcp);
policy->rtcp.sec_serv = sec_serv_none;
policy->rtp.sec_serv = sec_serv_conf_and_auth;
- switch(direction) {
+ switch (direction) {
case SWITCH_RTP_CRYPTO_RECV:
policy->ssrc.type = ssrc_any_inbound;
@@ -645,10 +636,7 @@
switch_payload_t payload,
uint32_t samples_per_interval,
uint32_t ms_per_packet,
- switch_rtp_flag_t flags,
- char *timer_name,
- const char **err,
- switch_memory_pool_t *pool)
+ switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool)
{
switch_rtp_t *rtp_session = NULL;
uint32_t ssrc = rand() & 0xffff;
@@ -718,9 +706,8 @@
}
if (!switch_strlen_zero(timer_name)) {
- if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, pool) ==
- SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ if (switch_core_timer_init(&rtp_session->timer, timer_name, ms_per_packet / 1000, samples_per_interval, pool) == SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Starting timer [%s] %d bytes per %dms\n", timer_name, samples_per_interval, ms_per_packet);
} else {
memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
@@ -742,10 +729,7 @@
switch_payload_t payload,
uint32_t samples_per_interval,
uint32_t ms_per_packet,
- switch_rtp_flag_t flags,
- char *timer_name,
- const char **err,
- switch_memory_pool_t *pool)
+ switch_rtp_flag_t flags, char *timer_name, const char **err, switch_memory_pool_t *pool)
{
switch_rtp_t *rtp_session = NULL;
@@ -768,26 +752,26 @@
*err = "Missing remote port";
goto end;
}
-
+
if (switch_rtp_create(&rtp_session, payload, samples_per_interval, ms_per_packet, flags, timer_name, err, pool) != SWITCH_STATUS_SUCCESS) {
goto end;
}
- switch_mutex_lock(rtp_session->flag_mutex);
+ switch_mutex_lock(rtp_session->flag_mutex);
if (switch_rtp_set_local_address(rtp_session, rx_host, rx_port, err) != SWITCH_STATUS_SUCCESS) {
- switch_mutex_unlock(rtp_session->flag_mutex);
+ switch_mutex_unlock(rtp_session->flag_mutex);
rtp_session = NULL;
goto end;
}
if (switch_rtp_set_remote_address(rtp_session, tx_host, tx_port, err) != SWITCH_STATUS_SUCCESS) {
- switch_mutex_unlock(rtp_session->flag_mutex);
+ switch_mutex_unlock(rtp_session->flag_mutex);
rtp_session = NULL;
goto end;
}
-
- end:
+
+ end:
if (rtp_session) {
switch_mutex_unlock(rtp_session->flag_mutex);
@@ -815,7 +799,7 @@
SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames)
{
- rtp_session->jb = stfu_n_init(queue_frames);
+ rtp_session->jb = stfu_n_init(queue_frames);
return SWITCH_STATUS_SUCCESS;
}
@@ -844,7 +828,7 @@
switch_size_t len = sizeof(o);
switch_assert(rtp_session != NULL);
- switch_mutex_lock(rtp_session->flag_mutex);
+ switch_mutex_lock(rtp_session->flag_mutex);
if (rtp_session->sock) {
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
switch_socket_sendto(rtp_session->sock, rtp_session->local_addr, 0, (void *) &o, &len);
@@ -898,16 +882,16 @@
READ_DEC((*rtp_session));
WRITE_DEC((*rtp_session));
-
+
switch_mutex_lock((*rtp_session)->flag_mutex);
switch_rtp_kill_socket(*rtp_session);
- while(switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) {
+ while (switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_safe_free(pop);
}
-
- while(switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+
+ while (switch_queue_trypop((*rtp_session)->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_safe_free(pop);
}
@@ -1014,25 +998,18 @@
rtp_session->dtmf_data.out_digit_packet[1] |= 0x80;
loops = 3;
}
-
+
rtp_session->dtmf_data.out_digit_packet[2] = (unsigned char) (rtp_session->dtmf_data.out_digit_sub_sofar >> 8);
rtp_session->dtmf_data.out_digit_packet[3] = (unsigned char) rtp_session->dtmf_data.out_digit_sub_sofar;
for (x = 0; x < loops; x++) {
switch_rtp_write_manual(rtp_session,
- rtp_session->dtmf_data.out_digit_packet,
- 4,
- 0,
- rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf,
- &flags);
+ rtp_session->dtmf_data.out_digit_packet, 4, 0, rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
- loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit,
+ loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->dtmf_data.out_digit_sofar,
- rtp_session->dtmf_data.out_digit_sub_sofar,
- rtp_session->dtmf_data.out_digit_dur,
- rtp_session->seq);
+ rtp_session->dtmf_data.out_digit_sofar,
+ rtp_session->dtmf_data.out_digit_sub_sofar, rtp_session->dtmf_data.out_digit_dur, rtp_session->seq);
}
if (loops != 1) {
@@ -1054,7 +1031,7 @@
return;
}
}
-
+
if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_queue, &pop) == SWITCH_STATUS_SUCCESS) {
switch_dtmf_t *rdigit = pop;
int64_t offset;
@@ -1071,12 +1048,12 @@
rtp_session->dtmf_data.out_digit_packet[2] = (unsigned char) (rtp_session->dtmf_data.out_digit_sub_sofar >> 8);
rtp_session->dtmf_data.out_digit_packet[3] = (unsigned char) rtp_session->dtmf_data.out_digit_sub_sofar;
-
+
rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
if (rtp_session->timer.interval) {
offset = rtp_session->timer.samplecount - rtp_session->last_write_samplecount;
if (offset > 0) {
- rtp_session->dtmf_data.timestamp_dtmf = (uint32_t)(rtp_session->dtmf_data.timestamp_dtmf + offset);
+ rtp_session->dtmf_data.timestamp_dtmf = (uint32_t) (rtp_session->dtmf_data.timestamp_dtmf + offset);
}
}
@@ -1084,17 +1061,13 @@
rtp_session->dtmf_data.out_digit_packet,
4,
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BUGGY_2833) ? 0 : 1,
- rtp_session->te,
- rtp_session->dtmf_data.timestamp_dtmf,
- &flags);
+ rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n",
- rtp_session->dtmf_data.out_digit,
+ rtp_session->dtmf_data.out_digit,
rtp_session->dtmf_data.timestamp_dtmf,
- rtp_session->dtmf_data.out_digit_sofar,
- rtp_session->dtmf_data.out_digit_sub_sofar,
- rtp_session->dtmf_data.out_digit_dur,
- rtp_session->seq);
+ rtp_session->dtmf_data.out_digit_sofar,
+ rtp_session->dtmf_data.out_digit_sub_sofar, rtp_session->dtmf_data.out_digit_dur, rtp_session->seq);
free(rdigit);
}
@@ -1108,7 +1081,7 @@
uint8_t check = 0;
stfu_frame_t *jb_frame;
int ret = -1;
-
+
if (!switch_rtp_ready(rtp_session)) {
return -1;
}
@@ -1124,12 +1097,12 @@
bytes = sizeof(rtp_msg_t);
status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *) &rtp_session->recv_msg, &bytes);
-
+
if (bytes < 0) {
ret = (int) bytes;
goto end;
}
-
+
if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
const char *tx_host;
const char *old_host;
@@ -1178,12 +1151,12 @@
if (!bytes && (io_flags & SWITCH_IO_FLAG_NOBLOCK)) {
do_cng = 1;
- goto cng;
+ goto cng;
}
if (rtp_session->timer.interval) {
- check = (uint8_t) (switch_core_timer_check(&rtp_session->timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS);
+ check = (uint8_t) (switch_core_timer_check(&rtp_session->timer, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS);
if (bytes) {
switch_core_timer_sync(&rtp_session->timer);
} else {
@@ -1199,7 +1172,7 @@
} else if (bytes) {
check++;
}
-
+
if (check || bytes) {
do_2833(rtp_session);
}
@@ -1213,25 +1186,25 @@
if (rtp_session->invalid_handler) {
rtp_session->invalid_handler(rtp_session, rtp_session->sock, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
}
-
+
memset(data, 0, 2);
data[0] = 65;
rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;
*flags |= SFF_CNG;
- *payload_type = (switch_payload_t)rtp_session->recv_msg.header.pt;
+ *payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;
ret = 2 + rtp_header_len;
goto end;
}
-
+
if (rtp_session->jb && ((bytes && rtp_session->recv_msg.header.pt == rtp_session->payload) || check)) {
if (bytes) {
if (rtp_session->recv_msg.header.m) {
stfu_n_reset(rtp_session->jb);
}
-
+
stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.body, bytes - rtp_header_len);
bytes = 0;
}
@@ -1248,7 +1221,7 @@
goto cng;
}
}
-
+
if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) {
int sbytes = (int) bytes;
@@ -1274,7 +1247,8 @@
if (++rtp_session->srtp_errs >= MAX_SRTP_ERRS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"error: srtp unprotection failed with code %d%s\n", stat,
- stat == err_status_replay_fail ? " (replay check failed)" : stat == err_status_auth_fail ? " (auth check failed)" : "");
+ stat == err_status_replay_fail ? " (replay check failed)" : stat ==
+ err_status_auth_fail ? " (auth check failed)" : "");
ret = -1;
goto end;
} else {
@@ -1300,13 +1274,13 @@
uint16_t duration = (packet[2] << 8) + packet[3];
char key = switch_rfc2833_to_char(packet[0]);
uint16_t in_digit_seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq);
-
+
if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) {
uint32_t ts = htonl(rtp_session->recv_msg.header.ts);
//int m = rtp_session->recv_msg.header.m;
rtp_session->dtmf_data.in_digit_seq = in_digit_seq;
-
+
//printf("%c %u %u %u\n", key, in_digit_seq, ts, duration);
if (rtp_session->dtmf_data.last_duration > duration && ts == rtp_session->dtmf_data.in_digit_ts) {
@@ -1316,7 +1290,7 @@
if (end) {
if (rtp_session->dtmf_data.in_digit_ts) {
switch_dtmf_t dtmf = { key, duration };
-
+
if (ts > rtp_session->dtmf_data.in_digit_ts) {
dtmf.duration += (ts - rtp_session->dtmf_data.in_digit_ts);
}
@@ -1325,7 +1299,6 @@
rtp_session->dtmf_data.flip = 0;
//printf("you're welcome!\n");
}
-
//printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
//dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
@@ -1336,8 +1309,8 @@
} else if (!rtp_session->dtmf_data.in_digit_ts) {
rtp_session->dtmf_data.in_digit_ts = ts;
rtp_session->dtmf_data.first_digit = key;
- }
-
+ }
+
rtp_session->dtmf_data.last_duration = duration;
}
@@ -1345,7 +1318,7 @@
do_cng = 1;
}
- cng:
+ cng:
if (do_cng) {
memset(&rtp_session->recv_msg.body, 0, 2);
rtp_session->recv_msg.body[0] = 127;
@@ -1364,7 +1337,7 @@
goto end;
}
}
-
+
if (rtp_session->jb && (jb_frame = stfu_n_read_a_frame(rtp_session->jb))) {
memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen);
if (jb_frame->plc) {
@@ -1372,20 +1345,20 @@
}
bytes = jb_frame->dlen + rtp_header_len;
rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
- } else if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { /* We're late! We're Late! */
- uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
-
+ } else if (!bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER)) { /* We're late! We're Late! */
+ uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
+
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK) && status == SWITCH_STATUS_BREAK) {
switch_yield(1000);
continue;
}
-
+
memset(data, 0, 2);
data[0] = 65;
-
+
rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD;
*flags |= SFF_CNG;
- *payload_type = (switch_payload_t)rtp_session->recv_msg.header.pt;
+ *payload_type = (switch_payload_t) rtp_session->recv_msg.header.pt;
ret = 2 + rtp_header_len;
goto end;
}
@@ -1398,7 +1371,7 @@
ret = 0;
goto end;
}
-
+
if (bytes && rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) {
goto do_continue;
}
@@ -1411,7 +1384,7 @@
break;
- do_continue:
+ do_continue:
switch_yield(1000);
}
@@ -1428,7 +1401,7 @@
ret = -1;
}
- end:
+ end:
READ_DEC(rtp_session);
@@ -1453,7 +1426,7 @@
switch_size_t bytes = 0;
switch_dtmf_t *_dtmf = NULL;
void *pop;
-
+
if (!switch_rtp_ready(rtp_session)) {
return bytes;
}
@@ -1483,7 +1456,7 @@
if (rdigit->duration < switch_core_default_dtmf_duration(0)) {
rdigit->duration = switch_core_default_dtmf_duration(0);
}
-
+
if ((switch_queue_trypush(rtp_session->dtmf_data.dtmf_queue, rdigit)) != SWITCH_STATUS_SUCCESS) {
free(rdigit);
return SWITCH_STATUS_FALSE;
@@ -1491,7 +1464,7 @@
} else {
abort();
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -1502,7 +1475,7 @@
if (!switch_rtp_ready(rtp_session)) {
return SWITCH_STATUS_FALSE;
}
-
+
if ((rdigit = malloc(sizeof(*rdigit))) != 0) {
*rdigit = *dtmf;
if (rdigit->duration < switch_core_default_dtmf_duration(0)) {
@@ -1516,11 +1489,11 @@
} else {
abort();
}
-
+
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t * datalen,
+SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t *datalen,
switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
{
int bytes = 0;
@@ -1567,7 +1540,7 @@
frame->flags |= SFF_RFC2833;
}
frame->timestamp = ntohl(rtp_session->recv_msg.header.ts);
- frame->seq = (uint16_t)ntohs((u_short)rtp_session->recv_msg.header.seq);
+ frame->seq = (uint16_t) ntohs((u_short) rtp_session->recv_msg.header.seq);
frame->ssrc = ntohl(rtp_session->recv_msg.header.ssrc);
frame->m = rtp_session->recv_msg.header.m ? SWITCH_TRUE : SWITCH_FALSE;
@@ -1580,14 +1553,15 @@
} else {
bytes -= rtp_header_len;
}
-
+
frame->datalen = bytes;
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
- void **data, uint32_t * datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags, switch_io_flag_t io_flags)
+ void **data, uint32_t *datalen, switch_payload_t *payload_type, switch_frame_flag_t *flags,
+ switch_io_flag_t io_flags)
{
int bytes = 0;
@@ -1609,13 +1583,8 @@
return SWITCH_STATUS_SUCCESS;
}
-static int rtp_common_write(switch_rtp_t *rtp_session,
- rtp_msg_t *send_msg,
- void *data,
- uint32_t datalen,
- switch_payload_t payload,
- uint32_t timestamp,
- switch_frame_flag_t *flags)
+static int rtp_common_write(switch_rtp_t *rtp_session,
+ rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags)
{
switch_size_t bytes;
uint8_t send = 1;
@@ -1633,11 +1602,11 @@
if (flags && *flags & SFF_RFC2833) {
send_msg->header.pt = rtp_session->te;
}
- data = send_msg->body;
- datalen -= rtp_header_len;
+ data = send_msg->body;
+ datalen -= rtp_header_len;
} else {
uint8_t m = 0;
-
+
if (*flags & SFF_RFC2833) {
payload = rtp_session->te;
}
@@ -1655,10 +1624,10 @@
} else {
rtp_session->ts += rtp_session->samples_per_interval;
}
-
+
rtp_session->send_msg.header.ts = htonl(rtp_session->ts);
- if ((rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
+ if ((rtp_session->ts > (rtp_session->last_write_ts + (rtp_session->samples_per_interval * 10)))
|| rtp_session->ts == rtp_session->samples_per_interval) {
m++;
}
@@ -1681,8 +1650,8 @@
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) &&
rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode) {
-
- int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)] = {0};
+
+ int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)] = { 0 };
uint32_t rate = 0;
uint32_t codec_flags = 0;
uint32_t len = sizeof(decoded);
@@ -1706,7 +1675,7 @@
uint32_t score = 0;
int divisor = 0;
if (z) {
-
+
if (!(divisor = rtp_session->vad_data.read_codec->implementation->actual_samples_per_second / 8000)) {
divisor = 1;
}
@@ -1715,7 +1684,7 @@
energy += abs(decoded[y]);
y += rtp_session->vad_data.read_codec->implementation->number_of_channels;
}
-
+
if (++rtp_session->vad_data.start_count < rtp_session->vad_data.start) {
send = 1;
} else {
@@ -1770,7 +1739,7 @@
if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) {
send = 1;
- }
+ }
}
} else {
ret = -1;
@@ -1786,11 +1755,11 @@
if (send) {
send_msg->header.seq = htons(++rtp_session->seq);
-
+
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) {
int sbytes = (int) bytes;
err_status_t stat;
-
+
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET)) {
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET);
@@ -1804,13 +1773,13 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "RE-Activating Secure RTP SEND\n");
}
}
-
+
stat = srtp_protect(rtp_session->send_ctx, &send_msg->header, &sbytes);
if (stat) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error: srtp protection failed with code %d\n", stat);
}
-
+
bytes = sbytes;
}
@@ -1819,7 +1788,7 @@
ret = -1;
goto end;
}
-
+
if (rtp_session->timer.interval) {
rtp_session->last_write_samplecount = rtp_session->timer.samplecount;
}
@@ -1835,7 +1804,7 @@
ret = (int) bytes;
- end:
+ end:
WRITE_DEC(rtp_session);
@@ -1879,7 +1848,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate VAD codec %s %dms\n", codec->implementation->iananame,
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate VAD codec %s %dms\n", codec->implementation->iananame,
codec->implementation->microseconds_per_frame / 1000);
rtp_session->vad_data.diff_level = 400;
rtp_session->vad_data.hangunder = 15;
@@ -1907,14 +1876,14 @@
uint32_t len, ts = 0;
switch_payload_t payload;
rtp_msg_t *send_msg = NULL;
-
+
if (!switch_rtp_ready(rtp_session) || !rtp_session->remote_addr) {
return -1;
}
if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
switch_size_t bytes;
-
+
/* Fast PASS! */
if (!switch_test_flag(frame, SFF_PROXY_PACKET)) {
return 0;
@@ -1938,8 +1907,7 @@
}
if (switch_test_flag(frame, SFF_RTP_HEADER)) {
- return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload,
- (uint32_t)(frame->timestamp), &frame->flags);
+ return switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
}
if (fwd) {
@@ -1949,16 +1917,14 @@
} else {
data = frame->data;
len = frame->datalen;
- ts = (uint32_t)frame->timestamp;
+ ts = (uint32_t) frame->timestamp;
}
return rtp_common_write(rtp_session, send_msg, data, len, payload, ts, &frame->flags);
}
SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session,
- void *data,
- uint32_t datalen,
- uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
+ void *data, uint32_t datalen, uint8_t m, switch_payload_t payload, uint32_t ts, switch_frame_flag_t *flags)
{
switch_size_t bytes;
int ret = -1;
@@ -2011,8 +1977,8 @@
rtp_session->last_write_ts = ts;
ret = (int) bytes;
-
- end:
+
+ end:
WRITE_DEC(rtp_session);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_scheduler.c Tue May 27 07:24:06 2008
@@ -53,7 +53,7 @@
switch_memory_pool_t *memory_pool;
} globals;
-static void switch_scheduler_execute(switch_scheduler_task_container_t * tp)
+static void switch_scheduler_execute(switch_scheduler_task_container_t *tp)
{
switch_event_t *event;
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing task %u %s (%s)\n", tp->task.task_id, tp->desc, switch_str_nil(tp->task.group));
@@ -81,7 +81,7 @@
}
}
-static void *SWITCH_THREAD_FUNC task_own_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC task_own_thread(switch_thread_t *thread, void *obj)
{
switch_scheduler_task_container_t *tp = (switch_scheduler_task_container_t *) obj;
switch_memory_pool_t *pool;
@@ -109,7 +109,7 @@
} else {
int64_t now = switch_timestamp(NULL);
if (now >= tp->task.runtime && !tp->in_thread) {
- int32_t diff = (int32_t)(now - tp->task.runtime);
+ int32_t diff = (int32_t) (now - tp->task.runtime);
if (diff > 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Task was executed late by %d seconds %u %s (%s)\n",
diff, tp->task.task_id, tp->desc, switch_str_nil(tp->task.group));
@@ -158,7 +158,7 @@
return done;
}
-static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t * thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_scheduler_task_thread(switch_thread_t *thread, void *obj)
{
globals.task_thread_running = 1;
@@ -234,7 +234,7 @@
for (tp = globals.task_list; tp; tp = tp->next) {
if (tp->task.task_id == task_id) {
if (switch_test_flag(tp, SSHF_NO_DEL)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Attempt made to delete undeleteable task #%u (group %s)\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Attempt made to delete undeleteable task #%u (group %s)\n",
tp->task.task_id, tp->task.group);
break;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_stun.c Tue May 27 07:24:06 2008
@@ -114,7 +114,7 @@
}
-SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t * buf, uint32_t len)
+SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_parse(uint8_t *buf, uint32_t len)
{
switch_stun_packet_t *packet;
switch_stun_packet_attribute_t *attr;
@@ -133,7 +133,7 @@
/*
* Check packet type (RFC3489(bis?) values)
*/
- switch(packet->header.type) {
+ switch (packet->header.type) {
case SWITCH_STUN_BINDING_REQUEST:
case SWITCH_STUN_BINDING_RESPONSE:
case SWITCH_STUN_BINDING_ERROR_RESPONSE:
@@ -180,7 +180,7 @@
do {
attr->length = ntohs(attr->length);
attr->type = ntohs(attr->type);
- bytes_left -= 4; /* attribute header consumed */
+ bytes_left -= 4; /* attribute header consumed */
if (!attr->length || switch_stun_attribute_padded_length(attr) > bytes_left) {
/*
@@ -195,7 +195,7 @@
* Handle STUN attributes
*/
switch (attr->type) {
- case SWITCH_STUN_ATTR_MAPPED_ADDRESS: /* Address, we only care about this one, but parse the others too */
+ case SWITCH_STUN_ATTR_MAPPED_ADDRESS: /* Address, we only care about this one, but parse the others too */
case SWITCH_STUN_ATTR_RESPONSE_ADDRESS:
case SWITCH_STUN_ATTR_SOURCE_ADDRESS:
case SWITCH_STUN_ATTR_CHANGED_ADDRESS:
@@ -231,7 +231,7 @@
}
break;
- case SWITCH_STUN_ATTR_CHANGE_REQUEST: /* UInt32 */
+ case SWITCH_STUN_ATTR_CHANGE_REQUEST: /* UInt32 */
case SWITCH_STUN_ATTR_LIFETIME:
case SWITCH_STUN_ATTR_BANDWIDTH:
case SWITCH_STUN_ATTR_OPTIONS:
@@ -247,16 +247,16 @@
}
break;
- case SWITCH_STUN_ATTR_USERNAME: /* ByteString, multiple of 4 bytes */
- case SWITCH_STUN_ATTR_PASSWORD: /* ByteString, multiple of 4 bytes */
+ case SWITCH_STUN_ATTR_USERNAME: /* ByteString, multiple of 4 bytes */
+ case SWITCH_STUN_ATTR_PASSWORD: /* ByteString, multiple of 4 bytes */
if (attr->length % 4 != 0) {
/* Invalid */
return NULL;
}
break;
- case SWITCH_STUN_ATTR_DATA: /* ByteString */
- case SWITCH_STUN_ATTR_ERROR_CODE: /* ErrorCode */
+ case SWITCH_STUN_ATTR_DATA: /* ByteString */
+ case SWITCH_STUN_ATTR_ERROR_CODE: /* ErrorCode */
case SWITCH_STUN_ATTR_TRANSPORT_PREFERENCES: /* TransportPrefs */
/*
* No length checking here, since we already checked against the padded length
@@ -271,7 +271,7 @@
}
break;
- case SWITCH_STUN_ATTR_MAGIC_COOKIE: /* ByteString, 4 bytes */
+ case SWITCH_STUN_ATTR_MAGIC_COOKIE: /* ByteString, 4 bytes */
if (attr->length != 4) {
/* Invalid */
return NULL;
@@ -295,12 +295,12 @@
} while (bytes_left >= SWITCH_STUN_ATTRIBUTE_MIN_LEN && switch_stun_packet_next_attribute(attr, end_buf));
- if ((uint32_t)(packet->header.length + 20) > (uint32_t)(len - bytes_left)) {
+ if ((uint32_t) (packet->header.length + 20) > (uint32_t) (len - bytes_left)) {
/*
* the packet length is longer than the length of all attributes?
* for now simply decrease the packet size
*/
- packet->header.length = (uint16_t)((len - bytes_left) - 20);
+ packet->header.length = (uint16_t) ((len - bytes_left) - 20);
}
return packet;
@@ -336,14 +336,14 @@
return "INVALID";
}
-SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t * port)
+SWITCH_DECLARE(uint8_t) switch_stun_packet_attribute_get_mapped_address(switch_stun_packet_attribute_t *attribute, char *ipstr, uint16_t *port)
{
switch_stun_ip_t *ip;
uint8_t x, *i;
char *p = ipstr;
ip = (switch_stun_ip_t *) attribute->value;
- i = (uint8_t *) & ip->address;
+ i = (uint8_t *) &ip->address;
*ipstr = 0;
for (x = 0; x < 4; x++) {
sprintf(p, "%u%s", i[x], x == 3 ? "" : ".");
@@ -361,7 +361,7 @@
return memcpy(username, attribute->value, cpylen);
}
-SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t * buf)
+SWITCH_DECLARE(switch_stun_packet_t *) switch_stun_packet_build_header(switch_stun_message_t type, char *id, uint8_t *buf)
{
switch_stun_packet_header_t *header;
@@ -386,14 +386,14 @@
uint8_t *i, x;
char *p = ipstr;
- attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
+ attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length));
attribute->type = htons(SWITCH_STUN_ATTR_MAPPED_ADDRESS);
attribute->length = htons(8);
ip = (switch_stun_ip_t *) attribute->value;
ip->port = htons(port);
ip->family = 1;
- i = (uint8_t *) & ip->address;
+ i = (uint8_t *) &ip->address;
for (x = 0; x < 4; x++) {
i[x] = (uint8_t) atoi(p);
@@ -415,7 +415,7 @@
if (ulen % 4 != 0) {
return 0;
}
- attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
+ attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length));
attribute->type = htons(SWITCH_STUN_ATTR_USERNAME);
attribute->length = htons(ulen);
if (username) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_swig.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_swig.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_swig.c Tue May 27 07:24:06 2008
@@ -243,7 +243,7 @@
return;
} else {
switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
- switch_core_session_rwunlock(peer_session);
+ switch_core_session_rwunlock(peer_session);
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_time.c Tue May 27 07:24:06 2008
@@ -102,7 +102,7 @@
#endif
-SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable)
+SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable)
{
MONO = enable ? 1 : 0;
switch_time_sync();
@@ -116,7 +116,7 @@
if (MONO) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
- now = ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec/1000) + offset;
+ now = ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000) + offset;
} else {
#endif
now = switch_time_now();
@@ -138,13 +138,13 @@
SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
{
-#if defined(HAVE_CLOCK_NANOSLEEP) && defined(SWITCH_USE_CLOCK_FUNCS)
+#if defined(HAVE_CLOCK_NANOSLEEP) && defined(SWITCH_USE_CLOCK_FUNCS)
struct timespec ts;
ts.tv_sec = t / APR_USEC_PER_SEC;
ts.tv_nsec = (t % APR_USEC_PER_SEC) * 1000;
-
+
clock_nanosleep(CLOCK_REALTIME, 0, &ts, NULL);
-
+
#elif defined(HAVE_USLEEP)
usleep(t);
#elif defined(WIN32)
@@ -161,7 +161,7 @@
timer_private_t *private_info;
int sanity = 0;
- while(globals.STARTED == 0) {
+ while (globals.STARTED == 0) {
switch_yield(100000);
if (++sanity == 10) {
break;
@@ -193,8 +193,8 @@
private_info->roll++; \
private_info->reference = private_info->start = TIMER_MATRIX[timer->interval].tick; \
} \
-
-
+
+
static switch_status_t timer_step(switch_timer_t *timer)
{
timer_private_t *private_info = timer->private_info;
@@ -203,7 +203,7 @@
if (globals.RUNNING != 1 || private_info->ready == 0) {
return SWITCH_STATUS_FALSE;
}
-
+
check_roll();
samples = timer->samples * (private_info->reference - private_info->start);
@@ -214,7 +214,7 @@
timer->samplecount = (uint32_t) samples;
private_info->reference++;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -234,7 +234,7 @@
/* push the reference into the future 2 more intervals to prevent collision */
private_info->reference += 2;
}
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -249,7 +249,7 @@
check_roll();
switch_yield(1000);
}
-
+
if (globals.RUNNING == 1) {
return SWITCH_STATUS_SUCCESS;
}
@@ -275,8 +275,8 @@
} else {
timer->diff = 0;
}
-
- if (timer->diff) {
+
+ if (timer->diff) {
status = SWITCH_STATUS_FALSE;
} else if (step) {
timer_step(timer);
@@ -311,7 +311,7 @@
memset(&globals, 0, sizeof(globals));
switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
-
+
globals.STARTED = globals.RUNNING = 1;
switch_mutex_lock(runtime.throttle_mutex);
runtime.sps = runtime.sps_total;
@@ -319,9 +319,9 @@
if (MONO) {
int loops;
- for(loops = 0; loops < 3; loops++) {
+ for (loops = 0; loops < 3; loops++) {
ts = time_now(0);
- /* if it returns the same value every time it won't be of much use.*/
+ /* if it returns the same value every time it won't be of much use. */
if (ts == last) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Broken MONOTONIC Clock Detected!, Support Disabled.\n");
MONO = 0;
@@ -337,7 +337,7 @@
ts = 0;
last = 0;
fwd_errs = rev_errs = 0;
-
+
while (globals.RUNNING == 1) {
runtime.reference += STEP_MIC;
while ((ts = time_now(runtime.offset)) < runtime.reference) {
@@ -346,7 +346,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Virtual Migration Detected! Syncing Clock\n");
switch_time_sync();
} else {
- int64_t diff = (int64_t)(ts - last);
+ int64_t diff = (int64_t) (ts - last);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Reverse Clock Skew Detected!\n");
runtime.reference = switch_time_now();
current_ms = 0;
@@ -359,8 +359,8 @@
}
switch_yield(STEP_MIC);
last = ts;
- }
-
+ }
+
if (ts > (runtime.reference + too_late)) {
if (MONO) {
@@ -378,7 +378,7 @@
} else {
fwd_errs = 0;
}
-
+
if (fwd_errs > 9 || rev_errs > 9) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Auto Re-Syncing clock.\n");
switch_time_sync();
@@ -388,7 +388,7 @@
runtime.timestamp = ts;
current_ms += STEP_MS;
tick += STEP_MS;
-
+
if (tick >= 1000) {
if (runtime.sps <= 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
@@ -457,7 +457,6 @@
switch_yield(10000);
}
}
-
#if defined(WIN32)
timeEndPeriod(1);
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c Tue May 27 07:24:06 2008
@@ -63,7 +63,7 @@
SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, switch_bool_t default_type, switch_memory_pool_t *pool)
{
switch_network_list_t *new_list;
-
+
if (!pool) {
switch_core_new_memory_pool(&pool);
}
@@ -82,7 +82,7 @@
switch_network_node_t *node;
switch_bool_t ok = list->default_type;
uint32_t bits = 0;
-
+
for (node = list->node_head; node; node = node->next) {
if (node->bits > bits && switch_test_subnet(ip, node->ip, node->mask)) {
if (node->ok) {
@@ -93,7 +93,7 @@
bits = node->bits;
}
}
-
+
return ok;
}
@@ -102,11 +102,11 @@
{
uint32_t ip, mask, bits;
switch_network_node_t *node;
-
+
if (switch_parse_cidr(cidr_str, &ip, &mask, &bits)) {
return SWITCH_STATUS_GENERR;
}
-
+
node = switch_core_alloc(list->pool, sizeof(*node));
node->ip = ip;
@@ -116,7 +116,7 @@
node->next = list->node_head;
list->node_head = node;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -128,21 +128,21 @@
switch_inet_pton(AF_INET, host, &ip);
switch_inet_pton(AF_INET, mask_str, &mask);
-
+
node = switch_core_alloc(list->pool, sizeof(*node));
-
+
node->ip = ip;
node->mask = mask;
node->ok = ok;
/* http://graphics.stanford.edu/~seander/bithacks.html */
mask = mask - ((mask >> 1) & 0x55555555);
- mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333);
+ mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333);
node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
-
+
node->next = list->node_head;
list->node_head = node;
-
+
return SWITCH_STATUS_SUCCESS;
}
@@ -162,7 +162,7 @@
*bit_str++ = '\0';
bits = atoi(bit_str);
-
+
if (bits < 0 || bits > 32) {
return -2;
}
@@ -180,7 +180,7 @@
{
const char *e = NULL;
int depth = 0;
-
+
while (s && *s && *s == ' ') {
s++;
}
@@ -199,7 +199,7 @@
}
}
- return (char *)e;
+ return (char *) e;
}
SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len)
@@ -230,10 +230,10 @@
q = buf;
- for(p = s; x < len; p++) {
- switch(*p) {
+ for (p = s; x < len; p++) {
+ switch (*p) {
case '<':
- if (x + 4 > len -1) {
+ if (x + 4 > len - 1) {
goto end;
}
*q++ = '&';
@@ -243,7 +243,7 @@
x += 4;
break;
case '>':
- if (x + 4 > len -1) {
+ if (x + 4 > len - 1) {
goto end;
}
*q++ = '&';
@@ -253,7 +253,7 @@
x += 4;
break;
default:
- if (x + 1 > len -1) {
+ if (x + 1 > len - 1) {
goto end;
}
*q++ = *p;
@@ -265,7 +265,7 @@
}
}
- end:
+ end:
return buf;
}
@@ -274,33 +274,33 @@
#define B64BUFFLEN 1024
SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen)
{
- int y = 0, bytes = 0;
- size_t x = 0;
- unsigned int b = 0,l = 0;
-
- for(x = 0; x < ilen; x++) {
- b = (b<<8) + in[x];
- l += 8;
- while (l >= 6) {
- out[bytes++] = switch_b64_table[(b>>(l-=6))%64];
- if (++y != 72) {
- continue;
- }
- //out[bytes++] = '\n';
- y=0;
- }
- }
-
- if (l > 0) {
- out[bytes++] = switch_b64_table[((b%16)<<(6-l))%64];
- }
- if (l != 0) {
+ int y = 0, bytes = 0;
+ size_t x = 0;
+ unsigned int b = 0, l = 0;
+
+ for (x = 0; x < ilen; x++) {
+ b = (b << 8) + in[x];
+ l += 8;
+ while (l >= 6) {
+ out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64];
+ if (++y != 72) {
+ continue;
+ }
+ //out[bytes++] = '\n';
+ y = 0;
+ }
+ }
+
+ if (l > 0) {
+ out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64];
+ }
+ if (l != 0) {
while (l < 6) {
out[bytes++] = '=', l += 2;
}
}
- return SWITCH_STATUS_SUCCESS;
+ return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen)
@@ -311,16 +311,16 @@
char *ip, *op = out;
size_t ol = 0;
- for (i=0; i<256; i++) {
+ for (i = 0; i < 256; i++) {
l64[i] = -1;
}
- for (i=0; i<64; i++) {
- l64[(int)switch_b64_table[i]] = (char)i;
+ for (i = 0; i < 64; i++) {
+ l64[(int) switch_b64_table[i]] = (char) i;
}
for (ip = in; ip && *ip; ip++) {
- c = l64[(int)*ip];
+ c = l64[(int) *ip];
if (c == -1) {
continue;
}
@@ -329,14 +329,14 @@
l += 6;
while (l >= 8) {
- op[ol++] = (char)((b >> (l -= 8)) % 256);
- if (ol >= olen -2) {
+ op[ol++] = (char) ((b >> (l -= 8)) % 256);
+ if (ol >= olen - 2) {
goto end;
}
}
}
- end:
+ end:
op[ol++] = '\0';
@@ -366,40 +366,40 @@
unsigned char in[B64BUFFLEN];
unsigned char out[B64BUFFLEN + 512];
- switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int)switch_timestamp(NULL), rand() & 0xffff);
-
- if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
- if (file) {
- if ((ifd = open(file, O_RDONLY)) < 1) {
- return SWITCH_FALSE;
- }
- }
- switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
- if (!write_buf(fd, buf)) {
- return SWITCH_FALSE;
- }
+ switch_snprintf(filename, 80, "%smail.%d%04x", SWITCH_GLOBAL_dirs.temp_dir, (int) switch_timestamp(NULL), rand() & 0xffff);
- if (headers && !write_buf(fd, headers))
- return SWITCH_FALSE;
+ if ((fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644))) {
+ if (file) {
+ if ((ifd = open(file, O_RDONLY)) < 1) {
+ return SWITCH_FALSE;
+ }
+ }
+ switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
+ if (!write_buf(fd, buf)) {
+ return SWITCH_FALSE;
+ }
- if (!write_buf(fd, "\n\n"))
- return SWITCH_FALSE;
+ if (headers && !write_buf(fd, headers))
+ return SWITCH_FALSE;
+
+ if (!write_buf(fd, "\n\n"))
+ return SWITCH_FALSE;
if (body && switch_stristr("content-type", body)) {
switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
} else {
switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
}
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
+ if (!write_buf(fd, buf))
+ return SWITCH_FALSE;
- if (body) {
- if (!write_buf(fd, body)) {
- return SWITCH_FALSE;
- }
- }
+ if (body) {
+ if (!write_buf(fd, body)) {
+ return SWITCH_FALSE;
+ }
+ }
- if (file) {
+ if (file) {
const char *stipped_file = switch_cut_path(file);
const char *new_type;
char *ext;
@@ -412,82 +412,81 @@
}
switch_snprintf(buf, B64BUFFLEN,
- "\n\n--%s\nContent-Type: %s; name=\"%s\"\n"
- "Content-ID: <ATTACHED(a)freeswitch.org>\n"
- "Content-Transfer-Encoding: base64\n"
- "Content-Description: Sound attachment.\n"
- "Content-Disposition: attachment; filename=\"%s\"\n\n",
- bound, mime_type, stipped_file, stipped_file);
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
-
- while ((ilen = read(ifd, in, B64BUFFLEN))) {
- for (x = 0; x < ilen; x++) {
- b = (b << 8) + in[x];
- l += 8;
- while (l >= 6) {
- out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64];
- if (++y != 72)
- continue;
- out[bytes++] = '\n';
- y = 0;
- }
- }
- if (write(fd, &out, bytes) != bytes) {
- return -1;
- } else
- bytes = 0;
-
- }
-
- if (l > 0) {
- out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64];
- }
- if (l != 0)
- while (l < 6) {
- out[bytes++] = '=', l += 2;
- }
- if (write(fd, &out, bytes) != bytes) {
- return -1;
- }
-
- }
-
- switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
- }
-
- if (fd) {
- close(fd);
- }
- if (ifd) {
- close(ifd);
- }
- switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
- if (system(buf)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
- }
+ "\n\n--%s\nContent-Type: %s; name=\"%s\"\n"
+ "Content-ID: <ATTACHED(a)freeswitch.org>\n"
+ "Content-Transfer-Encoding: base64\n"
+ "Content-Description: Sound attachment.\n"
+ "Content-Disposition: attachment; filename=\"%s\"\n\n", bound, mime_type, stipped_file, stipped_file);
+ if (!write_buf(fd, buf))
+ return SWITCH_FALSE;
+
+ while ((ilen = read(ifd, in, B64BUFFLEN))) {
+ for (x = 0; x < ilen; x++) {
+ b = (b << 8) + in[x];
+ l += 8;
+ while (l >= 6) {
+ out[bytes++] = switch_b64_table[(b >> (l -= 6)) % 64];
+ if (++y != 72)
+ continue;
+ out[bytes++] = '\n';
+ y = 0;
+ }
+ }
+ if (write(fd, &out, bytes) != bytes) {
+ return -1;
+ } else
+ bytes = 0;
+
+ }
+
+ if (l > 0) {
+ out[bytes++] = switch_b64_table[((b % 16) << (6 - l)) % 64];
+ }
+ if (l != 0)
+ while (l < 6) {
+ out[bytes++] = '=', l += 2;
+ }
+ if (write(fd, &out, bytes) != bytes) {
+ return -1;
+ }
+
+ }
+
+ switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
+ if (!write_buf(fd, buf))
+ return SWITCH_FALSE;
+ }
+
+ if (fd) {
+ close(fd);
+ }
+ if (ifd) {
+ close(ifd);
+ }
+ switch_snprintf(buf, B64BUFFLEN, "/bin/cat %s | %s %s %s", filename, runtime.mailer_app, runtime.mailer_app_args, to);
+ if (system(buf)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to execute command: %s\n", buf);
+ }
if (unlink(filename) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", filename);
}
- if (file) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to);
- } else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed data to [%s]\n", to);
- }
+ if (file) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed data to [%s]\n", to);
+ }
- return SWITCH_TRUE;
+ return SWITCH_TRUE;
}
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
{
- if (switch_strlen_zero(ip)) return SWITCH_FALSE;
+ if (switch_strlen_zero(ip))
+ return SWITCH_FALSE;
- return (
- strncmp(ip, "10.", 3) &&
+ return (strncmp(ip, "10.", 3) &&
strncmp(ip, "192.168.", 8) &&
strncmp(ip, "127.", 4) &&
strncmp(ip, "255.", 4) &&
@@ -498,12 +497,8 @@
strncmp(ip, "172.17.", 7) &&
strncmp(ip, "172.18.", 7) &&
strncmp(ip, "172.19.", 7) &&
- strncmp(ip, "172.2", 5) &&
- strncmp(ip, "172.30.", 7) &&
- strncmp(ip, "172.31.", 7) &&
- strncmp(ip, "192.0.2.", 8) &&
- strncmp(ip, "169.254.", 8)
- ) ? SWITCH_FALSE : SWITCH_TRUE;
+ strncmp(ip, "172.2", 5) && strncmp(ip, "172.30.", 7) && strncmp(ip, "172.31.", 7) && strncmp(ip, "192.0.2.", 8) && strncmp(ip, "169.254.", 8)
+ )? SWITCH_FALSE : SWITCH_TRUE;
}
SWITCH_DECLARE(switch_bool_t) switch_ast2regex(char *pat, char *rbuf, size_t len)
@@ -515,10 +510,10 @@
}
memset(rbuf, 0, len);
-
+
*(rbuf + strlen(rbuf)) = '^';
- while(p && *p) {
+ while (p && *p) {
if (*p == 'N') {
strncat(rbuf, "[2-9]", len - strlen(rbuf));
} else if (*p == 'X') {
@@ -534,7 +529,7 @@
}
*(rbuf + strlen(rbuf)) = '$';
- return strcmp(pat,rbuf) ? SWITCH_TRUE : SWITCH_FALSE;
+ return strcmp(pat, rbuf) ? SWITCH_TRUE : SWITCH_FALSE;
}
SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch_bool_t dup)
@@ -548,7 +543,7 @@
p = str;
}
- for(;p && *p; p++) {
+ for (; p && *p; p++) {
if (*p == from) {
*p = to;
}
@@ -561,23 +556,25 @@
{
const char *sp = str;
char *p, *s = NULL;
-
- if (!sp) return NULL;
- while(*sp == ' ') {
+ if (!sp)
+ return NULL;
+
+ while (*sp == ' ') {
sp++;
}
-
+
s = strdup(sp);
- if (!s) return NULL;
+ if (!s)
+ return NULL;
p = s + (strlen(s) - 1);
- while(*p == ' ') {
+ while (*p == ' ') {
*p-- = '\0';
}
-
+
return s;
}
@@ -589,12 +586,12 @@
if ((args = strchr(str, '('))) {
e = args - 1;
*args++ = '\0';
- while(*e == ' ') {
+ while (*e == ' ') {
*e-- = '\0';
}
e = args;
br = 1;
- while(e && *e) {
+ while (e && *e) {
if (*e == '(') {
br++;
} else if (br > 1 && *e == ')') {
@@ -642,7 +639,7 @@
for (start = str; *start; start++) {
/* find start of pattern in string */
- for ( ; ((*start) && (toupper(*start) != toupper(*instr))); start++);
+ for (; ((*start) && (toupper(*start) != toupper(*instr))); start++);
if (!*start)
return NULL;
@@ -709,8 +706,9 @@
getaddrinfo(base, NULL, NULL, &address_info);
if (!address_info || WSAIoctl(tmp_socket,
- SIO_ROUTING_INTERFACE_QUERY,
- address_info->ai_addr, (DWORD) address_info->ai_addrlen, &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL, NULL)) {
+ SIO_ROUTING_INTERFACE_QUERY,
+ address_info->ai_addr, (DWORD) address_info->ai_addrlen, &l_address, sizeof(l_address), (LPDWORD) & l_address_len, NULL,
+ NULL)) {
closesocket(tmp_socket);
if (address_info)
@@ -921,8 +919,7 @@
* author:
* Paul Vixie, 1996.
*/
-const char *
-switch_inet_ntop(int af, void const *src, char *dst, size_t size)
+const char *switch_inet_ntop(int af, void const *src, char *dst, size_t size)
{
switch (af) {
@@ -949,14 +946,12 @@
* author:
* Paul Vixie, 1996.
*/
-static const char *
-switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
+static const char *switch_inet_ntop4(const unsigned char *src, char *dst, size_t size)
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
- if (switch_snprintf(tmp, sizeof tmp, fmt,
- src[0], src[1], src[2], src[3]) >= (int)size) {
+ if (switch_snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]) >= (int) size) {
return NULL;
}
@@ -970,8 +965,7 @@
* author:
* Paul Vixie, 1996.
*/
-static const char *
-switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
+static const char *switch_inet_ntop6(unsigned char const *src, char *dst, size_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
@@ -981,14 +975,18 @@
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
- struct { int base, len; } best = { -1 , 0 }, cur = { -1, 0 };
+ struct {
+ int base, len;
+ } best = {
+ -1, 0}, cur = {
+ -1, 0};
unsigned int words[8];
int i;
/*
* Preprocess:
- * Copy the input (bytewise) array into a wordwise array.
- * Find the longest run of 0x00's in src[] for :: shorthanding.
+ * Copy the input (bytewise) array into a wordwise array.
+ * Find the longest run of 0x00's in src[] for :: shorthanding.
*/
for (i = 0; i < 16; i += 2)
words[i / 2] = (src[i] << 8) | (src[i + 1]);
@@ -1021,8 +1019,7 @@
tp = tmp;
for (i = 0; i < 8; i++) {
/* Are we inside the best run of 0x00's? */
- if (best.base != -1 && i >= best.base &&
- i < (best.base + best.len)) {
+ if (best.base != -1 && i >= best.base && i < (best.base + best.len)) {
if (i == best.base)
*tp++ = ':';
continue;
@@ -1031,9 +1028,8 @@
if (i != 0)
*tp++ = ':';
/* Is this address an encapsulated IPv4? */
- if (i == 6 && best.base == 0 &&
- (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
- if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
+ if (i == 6 && best.base == 0 && (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
+ if (!inet_ntop4(src + 12, tp, sizeof tmp - (tp - tmp)))
return (NULL);
tp += strlen(tp);
break;
@@ -1048,7 +1044,7 @@
/*
* Check for overflow, copy, and we're done.
*/
- if ((size_t)(tp - tmp) >= size) {
+ if ((size_t) (tp - tmp) >= size) {
return NULL;
}
@@ -1144,20 +1140,20 @@
char unescaped;
switch (escaped) {
- case 'n':
- unescaped = '\n';
- break;
- case 'r':
- unescaped = '\r';
- break;
- case 't':
- unescaped = '\t';
- break;
- case 's':
- unescaped = ' ';
- break;
- default:
- unescaped = escaped;
+ case 'n':
+ unescaped = '\n';
+ break;
+ case 'r':
+ unescaped = '\r';
+ break;
+ case 't':
+ unescaped = '\t';
+ break;
+ case 's':
+ unescaped = ' ';
+ break;
+ default:
+ unescaped = escaped;
}
return unescaped;
}
@@ -1181,8 +1177,8 @@
int esc = 0;
if (*ptr == ESCAPE_META) {
- e = *(ptr+1);
- if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr+1))) != *(ptr+1)) {
+ e = *(ptr + 1);
+ if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
++ptr;
*dest++ = e;
end = dest;
@@ -1216,28 +1212,28 @@
unsigned int count = 0;
char *ptr = buf;
- int inside_quotes = 0;
+ int inside_quotes = 0;
unsigned int i;
-
+
while (*ptr && count < arraylen) {
switch (state) {
- case START:
- array[count++] = ptr;
- state = FIND_DELIM;
- break;
+ case START:
+ array[count++] = ptr;
+ state = FIND_DELIM;
+ break;
- case FIND_DELIM:
- /* escaped characters are copied verbatim to the destination string */
- if (*ptr == ESCAPE_META) {
- ++ptr;
- } else if (*ptr == '\'') {
- inside_quotes = (1 - inside_quotes);
- } else if (*ptr == delim && !inside_quotes) {
- *ptr = '\0';
- state = START;
- }
+ case FIND_DELIM:
+ /* escaped characters are copied verbatim to the destination string */
+ if (*ptr == ESCAPE_META) {
++ptr;
- break;
+ } else if (*ptr == '\'') {
+ inside_quotes = (1 - inside_quotes);
+ } else if (*ptr == delim && !inside_quotes) {
+ *ptr = '\0';
+ state = START;
+ }
+ ++ptr;
+ break;
}
}
/* strip quotes, escaped chars and leading / trailing spaces */
@@ -1259,43 +1255,43 @@
unsigned int count = 0;
char *ptr = buf;
- int inside_quotes = 0;
+ int inside_quotes = 0;
unsigned int i;
while (*ptr && count < arraylen) {
switch (state) {
- case START:
- array[count++] = ptr;
- state = SKIP_INITIAL_SPACE;
- break;
+ case START:
+ array[count++] = ptr;
+ state = SKIP_INITIAL_SPACE;
+ break;
- case SKIP_INITIAL_SPACE:
- if (*ptr == ' ') {
- ++ptr;
- } else {
- state = FIND_DELIM;
- }
- break;
+ case SKIP_INITIAL_SPACE:
+ if (*ptr == ' ') {
+ ++ptr;
+ } else {
+ state = FIND_DELIM;
+ }
+ break;
- case FIND_DELIM:
- if (*ptr == ESCAPE_META) {
- ++ptr;
- } else if (*ptr == '\'') {
- inside_quotes = (1 - inside_quotes);
- } else if (*ptr == ' ' && !inside_quotes) {
- *ptr = '\0';
- state = SKIP_ENDING_SPACE;
- }
+ case FIND_DELIM:
+ if (*ptr == ESCAPE_META) {
++ptr;
- break;
+ } else if (*ptr == '\'') {
+ inside_quotes = (1 - inside_quotes);
+ } else if (*ptr == ' ' && !inside_quotes) {
+ *ptr = '\0';
+ state = SKIP_ENDING_SPACE;
+ }
+ ++ptr;
+ break;
- case SKIP_ENDING_SPACE:
- if (*ptr == ' ') {
- ++ptr;
- } else {
- state = START;
- }
- break;
+ case SKIP_ENDING_SPACE:
+ if (*ptr == ' ') {
+ ++ptr;
+ } else {
+ state = START;
+ }
+ break;
}
}
/* strip quotes, escaped chars and leading / trailing spaces */
@@ -1311,11 +1307,9 @@
return 0;
}
- memset(array, 0, arraylen * sizeof (*array));
+ memset(array, 0, arraylen * sizeof(*array));
- return (delim == ' ' ?
- separate_string_blank_delim(buf, array, arraylen) :
- separate_string_char_delim(buf, delim, array, arraylen));
+ return (delim == ' ' ? separate_string_blank_delim(buf, array, arraylen) : separate_string_char_delim(buf, delim, array, arraylen));
}
SWITCH_DECLARE(const char *) switch_cut_path(const char *in)
@@ -1389,7 +1383,7 @@
return dest;
}
-SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t * poll, int ms)
+SWITCH_DECLARE(int) switch_socket_waitfor(switch_pollfd_t *poll, int ms)
{
int nsds = 0;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update Tue May 27 07:24:06 2008
@@ -1 +1 @@
-Sun May 25 11:24:02 EDT 2008
+Mon May 26 20:18:27 EDT 2008
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE Tue May 27 07:24:06 2008
@@ -1,35 +1,29 @@
-==============================================
-Release notes for current version of Sofia-SIP
-==============================================
+======================================
+Release notes for Sofia-SIP 1.12.9pre1
+======================================
Changes since last release
--------------------------
-<changes since last written in freshmeat.net "Changes:" style;
- and in less than 10 lines, written in 3rd person English, with
- complete sentences />
-
-Bugs with BYE handling and event fetch/poll (SUBSCRIBE with Expires: 0) have
-been fixed in nua. Bugs with timer handling, RFC2543 dialog/transaction
-matching and gray list handling have been fixed in nta, all introduced by
-release 1.12.8.
-
Stack now supports some load control with NTATAG_MAX_PROCEEDING(), limiting
number of initial INVITE transactions being served concurrently.
-Bugs in blaa and foo have been fixed. The stack now supports
-use of foobar...
+The NAT traversal support in NUA has been improved. It is now possible to
+force rport use at server end with NTATAG_SERVER_RPORT(2), and fource
+routing of requests to a natted transport address detected by application
+with NTATAG_DEFAULT_PROXY().
+
+Bugs with SDP offer/answer overlap, BYE handling and event fetch/poll
+(SUBSCRIBE with Expires: 0) have been fixed in nua. Bugs with timer
+handling, RFC2543 dialog/transaction matching and gray list handling have
+been fixed in nta.
-API/ABI changes and versioning
-------------------------------
+Problems with SDP session handling by soa when media lines are deleted or
+their type is changes have been fixed.
-<see previous release notes at
- http://sofia-sip.sourceforge.net/relnotes/ for examples ;
- - should include all changes to public headers, and
- other important information to developers;
- - and should be updated _continuously_! />
-**template**: New features in API are marked with Doxytag macro @VERSION_1_XX_X.
+API/ABI changes and versioning
+------------------------------
libsofia-sip-ua:
- Added nta_outgoing_bind() to <sofia-sip/nta.h>.
@@ -40,9 +34,8 @@
- Added NTATAG_MAX_PROCEEDING() - limit number of requests accepted in
proceeding queue.
- Using NUTAG_PROXY()/NTATAG_DEFAULT_PROXY() as handle-specific tag.
- Previously, NUTAG_PROXY() was ignored if given with nua_set_hparams(),
- nua_invite(), nua_respond(), etc.
- Added nua_handle_by_call_id(), nta_leg_by_call_id().
+- Using NTATAG_SERVER_RPORT(2) to force rport usage on server side
- 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
@@ -57,33 +50,27 @@
----------------------------
- Michael Jerris: fixes, new features NTATAG_MAX_PROCEEDING(),
- nua_handle_by_call_id(), nta_leg_by_call_id()
+ NTATAG_SERVER_RPORT(2), nua_handle_by_call_id(), nta_leg_by_call_id()
- Colin Whittaker: re-calculating subscription duration when receiving NOTIFY
- Jerry Richards: fix to sip_header_as_string()
- Jussi Mutanen: fix to soa handling within nua
-
-<list of people who contributed to _this_ release
- - update as people's patches are added, or when you commit stuff
- - current development team members (see AUTHORS) may be omitted,
- or listed at the end of the contribur list (depending on the scope
- of the work done since the last release)
- - name of the contributor should be enough (email addresses in AUTHORS),
- plus a _brief_ description of what was contributed
- - roughly sorted by number of patches accepted
-/>
-
-- **template**: First Surname (patch to nua/soa/msg)
+- Bernhard Suttner: fix to Replaces URI handling
See the AUTHORS file in the distribution package.
+
Notes on new features
---------------------
-<information about major new features
- - new/changed/removed functionality
- - links to further documentation
- - section may be omitted for minor releases
-/>
+The NUTAG_PROXY()/NTATAG_DEFAULT_PROXY() is now handle-specific. Previously,
+it was ignored on nua calls except nua_create() and nua_set_params(). Now it
+is stored per-handle and used for all outgoing requests.
+
+The NTATAG_SERVER_RPORT() used to accept only boolean values (0 or 1) and
+the binary code compiled agains older Sofia SIP versions foces the tag value
+to boolean. The updated tag function in version 1.12.9 accepts values 0, 1
+or 2, however.
+
Bugs fixed in this release
--------------------------
@@ -117,12 +104,3 @@
- Fixed sf.net bug #1930055: nat detection did not un-REGISTER natted contact
if fist response to REGISTER was 200 OK.
- Fixed crashes in soa if m= lines were removed from user sdp.
-
-
-< notable bugs fixed in this release
- - check the sf.net bug tracker; see closed bugs,
- sorted by closing date
- - other bugs as fixed in CVS/darcs
-/>
-
-- **template**: #9499652 sf.net bug item title
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac Tue May 27 07:24:06 2008
@@ -11,7 +11,7 @@
dnl ---------------------------
dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
-AC_INIT([sofia-sip], [1.12.8devel])
+AC_INIT([sofia-sip], [1.12.8pre1.12.9.1])
AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])
dnl Includedir specific to this sofia version
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_client.c Tue May 27 07:24:06 2008
@@ -440,6 +440,8 @@
"tcp", "tls", NULL
};
+static char const *const he_no_tls_tports[] = { "tcp", NULL };
+
static tp_stack_class_t http_client_class[1] = { {
sizeof(http_client_class),
he_recv_message,
@@ -456,7 +458,11 @@
if (!he->he_tports)
return -1;
- return tport_tbind(he->he_tports, he_name, he_tports,
+ if (tport_tbind(he->he_tports, he_name, he_tports,
+ TPTAG_SERVER(0), TAG_NEXT(tags)) >= 0)
+ return 0;
+
+ return tport_tbind(he->he_tports, he_name, he_no_tls_tports,
TPTAG_SERVER(0), TAG_NEXT(tags));
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nth/nth_server.c Tue May 27 07:24:06 2008
@@ -688,6 +688,8 @@
"tcp", "tls", NULL
};
+static char const * const http_no_tls_tports[] = { "tcp", NULL };
+
static tp_stack_class_t nth_server_class[1] =
{{
sizeof(nth_server_class),
@@ -738,6 +740,8 @@
srv->srv_max_bodylen = 1 << 30; /* 1 GB */
if (tport_tbind(srv->srv_tports, tpn, http_tports,
+ TAG_END()) >= 0 ||
+ tport_tbind(srv->srv_tports, tpn, http_no_tls_tports,
TAG_END()) >= 0) {
srv->srv_root = root;
srv->srv_mclass = mclass ? mclass : http_default_mclass();
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c Tue May 27 07:24:06 2008
@@ -970,7 +970,7 @@
return 0;
}
-#define safe_free(it) if (it) { free(it); it = NULL; }
+
/** Internal deinitialization */
static
void _su_home_deinit(su_home_t *home)
@@ -1006,17 +1006,16 @@
}
else if (su_is_preloaded(b, b->sub_nodes[i].sua_data))
continue;
-
safefree(b->sub_nodes[i].sua_data);
}
}
if (b->sub_preload && !b->sub_preauto)
- safe_free(b->sub_preload);
+ free(b->sub_preload);
if (b->sub_stats)
- safe_free(b->sub_stats);
+ free(b->sub_stats);
if (!b->sub_auto)
- safe_free(b);
+ free(b);
home->suh_blocks = NULL;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c Tue May 27 07:24:06 2008
@@ -185,13 +185,18 @@
int su_wait_destroy(su_wait_t *waitobj)
{
#if SU_HAVE_WINSOCK
+ su_wait_t w0 = NULL;
assert(waitobj != NULL);
- if (*waitobj)
+ if (*waitobj) {
WSACloseEvent(*waitobj);
+ *waitobj = w0;
+ }
#else
su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
assert(waitobj != NULL);
- *waitobj = w0;
+ if (waitobj) {
+ *waitobj = w0;
+ }
#endif
return waitobj ? 0 : -1;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c Tue May 27 07:24:06 2008
@@ -608,7 +608,15 @@
TEST(e->data->e_status, 100);
TEST_1(sip = sip_object(e->data->e_msg));
TEST_1(sip->sip_retry_after);
+
+#if 1
+ if (e->next) {
+ free_events_in_list(ctx, b->events);
+ free_events_in_list(ctx, a->events);
+ goto passed; /* XXX - once in a while B *does* retry */
+ }
TEST_1(!e->next);
+#endif
free_events_in_list(ctx, b->events);
TEST_1(e = a->events->head); TEST_E(e->data->e_event, nua_i_ack);
@@ -664,6 +672,8 @@
TEST_1(!e->next);
free_events_in_list(ctx, b->events);
+ passed:
+
if (print_headings)
printf("TEST NUA-7.6.3: PASSED\n");
Modified: freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/src/lpc10_decode.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/src/lpc10_decode.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/voipcodecs/src/lpc10_decode.c Tue May 27 07:24:06 2008
@@ -43,6 +43,13 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
+#if (_MSC_VER == 1400) /* fix for broken header files with msvc 2005*/
+#if !defined (_M_IA64) && !defined (_M_AMD64)
+#undef logf
+#define logf(x) ((float)log((double)(x)))
+#endif // !defined (_M_IA64) && !defined (_M_AMD64)
+#endif
+
#include <memory.h>
#include "voipcodecs/telephony.h"
1
0
26 May '08
Author: lukedashjr
Date: Mon May 26 14:23:24 2008
New Revision: 8672
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
Log:
automatic xmlrpc-c config
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in Mon May 26 14:23:24 2008
@@ -307,9 +307,16 @@
SWITCH_AM_CFLAGS="$SWITCH_AM_CFLAGS -I/usr/include/srtp"
SWITCH_AM_LDFLAGS="$SWITCH_AM_LDFLAGS -lsrtp"
-# TODO: make this automatic or something
-XMLRPC_CFLAGS="-I/usr/include/xmlrpc-c"
-XMLRPC_LDFLAGS="-lxmlrpc_server -lxmlrpc_server_abyss -lxmlrpc_xmlparse -lxmlrpc_xmltok"
+AC_MSG_CHECKING(for xmlrpc-c)
+xmlrpc_c_config="`which xmlrpc-c-config xmlrpc-c-conf 2>/dev/null | head -n 1`"
+if test -z "$xmlrpc_c_config"; then
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([xmlrpc-c not found: mod_xml_rpc will not work.])
+else
+ AC_MSG_RESULT(yes)
+ XMLRPC_CFLAGS="$xmlrpc_c_config server-util --cflags"
+ XMLRPC_LDFLAGS="`$xmlrpc_c_config server-util --libs`"
+fi
PKG_CHECK_MODULES([voipcodecs],[voipcodecs],[
AC_SUBST(voipcodecs_CFLAGS)
1
0
[commit] r8670 - freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc
by Freeswitch SVN 26 May '08
by Freeswitch SVN 26 May '08
26 May '08
Author: lukedashjr
Date: Mon May 26 14:10:06 2008
New Revision: 8670
Added:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/token.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.h
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
Log:
better
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Mon May 26 14:10:06 2008
@@ -164,13 +164,13 @@
p = RequestHeaderValue(r, "authorization");
if (p) {
- NextToken((char ** const)&p);
+ NextToken((const char ** const)&p);
x = GetToken(&p);
if (x) {
if (!strcasecmp(x, "basic")) {
- NextToken((char ** const)&p);
+ NextToken((const char ** const)&p);
switch_b64_decode(p, user, sizeof(user));
if ((pass = strchr(user, ':'))) {
*pass++ = '\0';
1
0
[commit] r8668 - freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc
by Freeswitch SVN 26 May '08
by Freeswitch SVN 26 May '08
26 May '08
Author: lukedashjr
Date: Mon May 26 13:51:10 2008
New Revision: 8668
Added:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/bool.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/bool.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/conn.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/data.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/date.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/date.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/http.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/int.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/int.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/session.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/session.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/thread.h
- copied unchanged from r8663, /freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/thread.h
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
Log:
xmlrpc-c builds
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Mon May 26 13:51:10 2008
@@ -39,7 +39,9 @@
#include <xmlrpc-c/abyss.h>
#include <xmlrpc-c/server.h>
#include <xmlrpc-c/server_abyss.h>
-#include "token.h" /* NOTE: From xmlrpc-c's internals */
+
+/* NOTE: Taken from xmlrpc-c's internals: */
+#include "token.h"
#include "http.h"
#include "session.h"
@@ -162,13 +164,13 @@
p = RequestHeaderValue(r, "authorization");
if (p) {
- NextToken((const char **)&p);
+ NextToken((char ** const)&p);
x = GetToken(&p);
if (x) {
if (!strcasecmp(x, "basic")) {
- NextToken((const char **)&p);
+ NextToken((char ** const)&p);
switch_b64_decode(p, user, sizeof(user));
if ((pass = strchr(user, ':'))) {
*pass++ = '\0';
1
0
26 May '08
Author: lukedashjr
Date: Mon May 26 13:10:53 2008
New Revision: 8665
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
Log:
fix problems introduced by merge
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in Mon May 26 13:10:53 2008
@@ -16,7 +16,6 @@
AM_INIT_AUTOMAKE(libfreeswitch,0.1)
AC_CONFIG_SRCDIR([src/switch.c])
AC_CONFIG_HEADER([src/include/switch_private.h])
-AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
AC_PREFIX_DEFAULT(/usr/local/freeswitch)
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
@@ -331,14 +330,6 @@
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h])
-# for xmlrpc-c config.h
-if test x"$ac_cv_header_wchar_h" = xyes; then
- HAVE_WCHAR_H_DEFINE=1
-else
- HAVE_WCHAR_H_DEFINE=0
-fi
-AC_SUBST(HAVE_WCHAR_H_DEFINE)
-
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
@@ -410,45 +401,6 @@
AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
fi
-#
-# xmlrpc-c checks
-#
-
-
-HAVE_LIBWWW_SSL_DEFINE=0
-AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
-
-DIRECTORY_SEPARATOR="/"
-AC_SUBST(DIRECTORY_SEPARATOR)
-
-va_list_is_array=no
-AC_MSG_CHECKING(whether va_list is an array)
-AC_TRY_COMPILE([
-#include <stdarg.h>
-], [va_list list1, list2; list1 = list2;], ,
-va_list_is_array=yes)
-AC_MSG_RESULT($va_list_is_array)
-if test x"$va_list_is_array" = xyes; then
- VA_LIST_IS_ARRAY_DEFINE=1
-else
- VA_LIST_IS_ARRAY_DEFINE=0
-fi
-AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
-
-AC_MSG_CHECKING(whether compiler has __attribute__)
-AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
-compiler_has_attribute=yes,
-compiler_has_attribute=no)
-AC_MSG_RESULT($compiler_has_attribute)
-if test x"$compiler_has_attribute" = xyes; then
- ATTR_UNUSED="__attribute__((__unused__))"
-else
- ATTR_UNUSED=
-fi
-AC_SUBST(ATTR_UNUSED)
-
-
-
AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
@@ -748,8 +700,6 @@
build/getsounds.sh
build/getlib.sh
build/modmake.rules
- libs/xmlrpc-c/include/xmlrpc-c/config.h
- libs/xmlrpc-c/xmlrpc_config.h
scripts/gentls_cert])
AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
1
0
Author: lukedashjr
Date: Mon May 26 12:59:57 2008
New Revision: 8663
Added:
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/README
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/README
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/Rakefile
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/Rakefile
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/routes.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates/voice_events.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/voice_events_controller_generator.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/templates/model.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/voice_model_generator.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/init.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/init.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/install.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/install.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/logger_overide.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/script_base.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/telegraph.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/router.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events/voice_events_base.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/action_controller_extensions.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/dispatcher.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/interface.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/request.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/response.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view/template.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_events_server.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_channel_model.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_conference_model.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_connector.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model/voice_sip_model.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_interface.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_view_server.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/telegraph.yml
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/telegraph.yml
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/voice_events
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/voice_events
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/voice_view
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/lib/voice_view
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/license.txt
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/license.txt
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/test/
- copied from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/test/
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/test/ami_test.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/test/ami_test.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/jpalley/telegraph/trunk/test/rai_test.rb
- copied unchanged from r8662, /freeswitch/trunk/scripts/contrib/jpalley/telegraph/trunk/test/rai_test.rb
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/
- copied from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch.i
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/freeswitch.i
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.cpp
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_mono.h
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_mono.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/freeswitch_wrap.cxx
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/freeswitch_wrap.cxx
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.cpp
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/mod_mono.vcproj
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/mod_mono.vcproj
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/runswig.cmd
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/runswig.cmd
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono/switch_platform.i
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono/switch_platform.i
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/
- copied from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/ApiFunction.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/ApiFunction.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/AppFunction.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/AppFunction.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Demo.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Demo.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Extensions.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Extensions.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Loader.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Loader.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Log.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Log.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/MonoSession.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/MonoSession.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Properties/
- copied from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Properties/
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/Properties/AssemblyInfo.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/Properties/AssemblyInfo.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/mod_mono_managed.csproj
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/
- copied from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/Api.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/Api.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/CoreSession.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/CoreSession.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/Event.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/Event.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/IvrMenu.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/IvrMenu.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/MonoSession.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/MonoSession.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_FILE.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_FILE.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_HashElem.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_HashElem.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_apr_pool_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_apr_pool_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_char_p_char_p_char_p_char_p_char_p_char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_char_p_char_p_char_p_char_p_char_p_char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_enum_switch_asr_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_enum_switch_asr_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_enum_switch_asr_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_enum_switch_asr_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_flag_t_p_q_const__switch_codec_settings__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_enum_switch_originate_flag_t__switch_call_cause_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_enum_switch_originate_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_enum_switch_io_flag_t_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_event__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_event__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_scheduler_task__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_scheduler_task__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_enum_switch_speech_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_enum_switch_speech_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_enum_switch_speech_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long_p_enum_switch_speech_flag_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_timer__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_timer__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_void__void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_void__void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_void__switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_f_void__switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_float.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_float.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_in_addr.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_in_addr.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_int.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_int.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_apr_pool_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_apr_pool_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_char.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_char.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_p_char.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_p_char.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_real_pcre.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_real_pcre.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_sqlite3.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_sqlite3.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_sqlite3_stmt.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_sqlite3_stmt.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_audio_resampler_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_audio_resampler_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_buffer.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_buffer.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_channel.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_channel.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_port_allocator.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_port_allocator.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_session.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_session.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_session_message.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_core_session_message.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_event.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_event.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_hash.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_hash.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_digit_stream.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_digit_stream.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_digit_stream_parser.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_digit_stream_parser.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_menu.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_menu.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_media_bug.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_media_bug.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_network_list.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_network_list.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_rtp.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_rtp.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_xml.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_switch_xml.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_p_void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_real_pcre.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_real_pcre.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_short.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_short.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_sqlite3.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_sqlite3.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_sqlite3_stmt.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_sqlite3_stmt.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_asr_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_asr_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_buffer.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_buffer.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_call_cause_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_call_cause_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_channel.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_channel.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_core_port_allocator.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_core_port_allocator.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_core_session.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_core_session.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_event_types_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_event_types_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_file_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_file_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_frame_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_frame_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_hash.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_hash.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_action_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_action_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_digit_stream.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_digit_stream.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_digit_stream_parser.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_digit_stream_parser.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu_action_function_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu_action_function_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu_xml_ctx.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ivr_menu_xml_ctx.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_loadable_module_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_loadable_module_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_media_bug.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_media_bug.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_mutex_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_mutex_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_network_list.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_network_list.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_pollfd_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_pollfd_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_rtp.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_rtp.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_size_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_size_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_sockaddr_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_sockaddr_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_socket_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_socket_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_speech_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_speech_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ssize_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_ssize_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_time_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_switch_time_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_time_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_time_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_char.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_char.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_int.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_int.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_long.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_long.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_short.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_unsigned_short.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_void.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/SWIGTYPE_p_void.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/Stream.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/Stream.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitch.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/freeswitch.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/freeswitchPINVOKE_fixed.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/input_callback_state_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/input_callback_state_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/session_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_abc_type_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_abc_type_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_api_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_api_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_app_log.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_app_log.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_application_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_application_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_application_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_application_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_asr_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_handle.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_asr_handle.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_asr_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_audio_col_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_audio_col_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_audio_resampler_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_audio_resampler_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bind_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_bind_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bitpack_mode_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_bitpack_mode_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bitpack_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_bitpack_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_bool_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_bool_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_call_cause_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_call_cause_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_application.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_caller_application.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_extension.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_caller_extension.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_caller_profile.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_caller_profile_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_caller_profile_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_channel_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_channel_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_channel_state_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_channel_state_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_channel_timetable.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_channel_timetable.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_chat_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_chat_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec_implementation.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_settings.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec_settings.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_codec_type_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_codec_type_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_config.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_config.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_session_message.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_types_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_session_message_types_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_thread_session.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_thread_session.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_core_time_duration.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_core_time_duration.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_dialplan_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_dialplan_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directories.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_directories.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directory_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_directory_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directory_handle.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_directory_handle.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_directory_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_directory_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_dtmf_direction_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_dtmf_direction_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_dtmf_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_dtmf_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_eavesdrop_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_eavesdrop_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_endpoint_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_endpoint_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_event.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_event.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_event_header.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_event_header.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_event_node.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_event_node.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_event_subclass.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_event_subclass.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_event_types_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_event_types_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_file_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_file_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_file_handle.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_file_handle.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_file_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_file_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_frame_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_frame_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_input_args_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_input_args_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_input_type_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_input_type_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_kill_channel.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_kill_channel.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_outgoing_channel.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_read_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_receive_event.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_receive_event.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_receive_message.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_receive_message.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_recv_dtmf.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_recv_dtmf.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_resurrect_session.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_resurrect_session.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_send_dtmf.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_send_dtmf.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_state_change.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_state_change.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_read_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_video_write_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hook_write_frame.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_event_hooks.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_event_hooks.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routine_name_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_routine_name_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_io_routines.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_ivr_action_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_ivr_action_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_ivr_menu_flags.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_ivr_menu_flags.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_ivr_option_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_ivr_option_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_loadable_module_function_table_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_loadable_module_function_table_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_log_level_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_log_level_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_log_node_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_log_node_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_management_action_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_management_action_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_management_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_management_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_bug_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_media_bug_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_media_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_media_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_module_interface_name_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_module_interface_name_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_originate_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_originate_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_port_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_port_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_priority_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_priority_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_direction_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_direction_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_key.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_key.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_key_type_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_rtp_crypto_key_type_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_rtp_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_rtp_hdr_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_rtp_hdr_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_say_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_say_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_say_method_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_say_method_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_say_type_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_say_type_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_scheduler_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_scheduler_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_scheduler_task.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_scheduler_task.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_session_ctl_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_session_ctl_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_signal_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_signal_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_speech_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_handle.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_speech_handle.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_speech_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_stack_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_stack_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_state_handler_name_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_state_handler_name_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_state_handler_table.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_state_handler_table.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_status_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_status_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_stream_handle.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_stream_handle.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_text_channel_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_text_channel_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_timer.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_timer_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer_func_name_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_timer_func_name_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_timer_interface.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_timer_interface.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_unicast_conninfo.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_unicast_conninfo.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_unicast_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_unicast_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_vad_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_vad_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_xml.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_xml_flag_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swig/switch_xml_section_t.cs
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swig/switch_xml_section_t.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_mono_managed/swigStringFix.exe
- copied unchanged from r8662, /freeswitch/trunk/src/mod/languages/mod_mono_managed/swigStringFix.exe
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile.srcdir.in
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Makefile.srcdir.in
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile.version
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Makefile.version
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/CleanAll.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/CleanAll.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/CleanWin32.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/CleanWin32.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ReadMeOld.txt
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeOld.txt
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/UsingProxyDSP.txt
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/UsingProxyDSP.txt
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/abyss.2008.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/abyss.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/abyss.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/configwin32.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/configwin32.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/curllink.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/curllink.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/delsln.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/delsln.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/diffcfg.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/diffcfg.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/gennmtab.2008.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/gennmtab.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/gennmtab.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/mkvers.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/mkvers1.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers1.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/transport_config.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/transport_config.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/updcfg.bat
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/updcfg.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/win32_config.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/win32_config.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlhttpsys.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlhttpsys.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlparse.2008.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlparse.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlparse.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc-c/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc-c/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc-c/config.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc-c/config.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.2008.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_config.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_config.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_cpp_proxy.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_cpp_proxy.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_misc.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_misc.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpccpp.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpccpp.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmltok.2008.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmltok.dsp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmltok.vcproj
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/common.mk
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/common.mk
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/config.mk.in
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/config.mk.in
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/dll-common.make
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/dll-common.make
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/INSTALL
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/doc/INSTALL
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/dylib-common.make
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/dylib-common.make
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/asynch_client.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/cpp/asynch_client.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/pstream_client.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_client.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/pstream_inetd_server.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_inetd_server.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_inetd_server.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_inetd_server.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_loop_server.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_loop_server.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/interrupted_client.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/interrupted_server.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_inetd_server.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_inetd_server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_socket_server.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_socket_server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss_opensslsock.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_opensslsock.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss_unixsock.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_unixsock.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss_winsock.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_winsock.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base64.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base64.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/c_util.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/c_util.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_global.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_global.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_transport.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_transport.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/config.h.in
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/config.h.in
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/inttypes.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/inttypes.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/packetsocket.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/packetsocket.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/select_int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/select_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_pstream.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_pstream.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/sleep_int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/sleep_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/string_int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/string_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/time_int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/time_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/irix-common.make
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/irix-common.make
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/HISTORY
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/HISTORY
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/conf/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/conf/abyss.conf
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/abyss.conf
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/conf/mime.types
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/mime.types
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/htdocs/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/htdocs/index.htm
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/index.htm
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/example/htdocs/pwrabyss.gif
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/pwrabyss.gif
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/abyss_info.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/abyss_info.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/channel.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/channel.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/chanswitch.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/chanswitch.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/date.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/date.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/file.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/handler.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/handler.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/init.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/init.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/response.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/response.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/session.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/session.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_openssl.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_openssl.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_unix.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_win.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket_win.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/thread.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/thread_fork.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_fork.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/thread_pthread.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_pthread.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/thread_windows.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_windows.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/trace.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/trace.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/nametab.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/nametab.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/asprintf.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/asprintf.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/error.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/error.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/make_printable.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/make_printable.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/memblock.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/memblock.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/select.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/select.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/sleep.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/sleep.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/time.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/time.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libutil/utf8.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/libutil/utf8.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/cmdline_parser_cpp.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/cmdline_parser_cpp.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/assertx.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/assertx.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/c_util.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/c_util.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/cmdline_parser.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/cmdline_parser.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/girmath.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/girmath.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/girstring.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/girstring.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/int.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/stdargx.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/stdargx.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/string_parser.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/string_parser.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/unistdx.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/include/unistdx.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/string_parser.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/string_parser.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/stripcaseeq.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/lib/util/stripcaseeq.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/missing
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/missing
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/base64.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/base64.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/curl.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/curl.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/env_wrap.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/env_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/env_wrap.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/env_wrap.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/girerr.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/girerr.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/libwww.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/libwww.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/packetsocket.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/packetsocket.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/pstream.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/pstream.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/server_pstream.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/server_pstream.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/registry.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/registry.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/registry.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/registry.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/server_abyss.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_abyss.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/server_abyss.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_abyss.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/server_pstream.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_pstream.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/server_pstream.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_pstream.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/test.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/test.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/testclient.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/testclient.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/testclient_dummy.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient_dummy.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/tools.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/tools.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/test/tools.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/tools.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/wininet.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/cpp/wininet.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/double.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/double.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/double.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/double.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/method.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/method.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/method.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/method.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/parse_value.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/parse_value.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/parse_value.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/parse_value.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/registry.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/registry.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/registry.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/registry.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/resource.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/resource.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/system_method.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/system_method.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/system_method.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/system_method.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/abyss.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/abyss.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/abyss.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/abyss.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/client_dummy.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/client_dummy.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/data/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/data/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/data/req_no_params.xml
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_no_params.xml
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/data/req_out_of_order.xml
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_out_of_order.xml
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/data/req_value_name.xml
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_value_name.xml
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/data/sample_add_call.xml
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/data/sample_add_call.xml
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/method_registry.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/method_registry.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/method_registry.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/method_registry.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize_value.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/serialize_value.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize_value.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/test/serialize_value.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/trace.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/trace.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/version.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/version.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_build.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_build.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_client_global.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_client_global.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_decompose.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_decompose.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_info.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_server_info.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_string.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_string.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/common.mk
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/common.mk
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/lib/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/lib/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/lib/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/lib/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/lib/dumpvalue.c
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/lib/dumpvalue.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/lib/include/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/lib/include/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/lib/include/dumpvalue.h
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/lib/include/dumpvalue.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/perl_packetsocket/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/perl_packetsocket/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/perl_packetsocket/PacketSocket.pm
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/perl_packetsocket/PacketSocket.pm
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.hpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpc_cpp_proxy.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpc_cpp_proxy.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_pstream/
- copied from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_pstream/Makefile
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_pstream/test
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/test
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.cpp
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.html
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.html
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/transport_config.make
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/transport_config.make
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/unix-common.make
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/unix-common.make
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc-c-config.main
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/xmlrpc-c-config.main
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc-c-config.test.main
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/xmlrpc-c-config.test.main
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc_amconfig.h.in
- copied unchanged from r8662, /freeswitch/trunk/libs/xmlrpc-c/xmlrpc_amconfig.h.in
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln
freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.sln
freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
freeswitch/branches/lukedashjr/syslibs/freeswitch/build/config/config.sub
freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules
freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec
freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/freeswitch_java.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Makefile.am
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/http/http_tag_class.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_mime.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stun.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_md5.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_port.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_vector.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/open_c/group/test_nua.mmp
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/ (props changed)
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/GNUmakefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/README
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ (props changed)
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ConfigureWin32.bat
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ReadMeWin32.txt
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/cpptest.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/rpctest.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/transport_config_win32.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsw
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/configure.in
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/COPYING
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/HISTORY
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/TODO
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/auth_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/gen_sample_add_xml.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/synch_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_loop_server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_int.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/transport.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/ (props changed)
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conf.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/file.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/main.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/trace.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/xmlrpc_curl_transport.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/expat.html
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/gennmtab/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmldef.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_impl.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_ns.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlfile.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlwf.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/xmlrpc_libwww_transport.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/casprintf.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/cmdline_parser.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/getoptx.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/bool.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/casprintf.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/cmdline_parser.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/pthreadx.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/pthreadx_win32.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/xmlrpc_wininet_transport.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/mkinstalldirs
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/XmlRpcCpp.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client_simple.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/girmem.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/outcome.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/param_list.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/registry.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/server_abyss.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/value.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/xml.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/cgi.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/parse_xml.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/server_abyss.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/value.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_array.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_authcookie.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_client.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_data.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_datetime.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_expat.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_libxml2.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_parse.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_serialize.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_abyss.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_cgi.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_w32httpsys.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_struct.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/turbocharger/mod_gzip.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.hpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cpp
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.html
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/Makefile
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/xmlrpc_transport.c
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/version.h
freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc_config.h.in
Log:
MERGE to: http://svn.freeswitch.org/svn/freeswitch/trunk@8662
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.2008.sln Mon May 26 12:59:57 2008
@@ -125,6 +125,8 @@
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}"
ProjectSection(SolutionItems) = preProject
+ conf\sip_profiles\external.xml = conf\sip_profiles\external.xml
+ conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml
conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml
EndProjectSection
EndProject
@@ -505,11 +507,12 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2008.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
ProjectSection(ProjectDependencies) = postProject
+ {0D108721-EAE8-4BAF-8102-D8960EC93647} = {0D108721-EAE8-4BAF-8102-D8960EC93647}
+ {B535402E-38D2-4D54-8360-423ACBD17192} = {B535402E-38D2-4D54-8360-423ACBD17192}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94}
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
- {155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.2008.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
@@ -585,13 +588,6 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curllib", "libs\win32\curl\curllib.2008.vcproj", "{87EE9DA4-DE1E-4448-8324-183C98DCA588}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlrpc", "libs\win32\xmlrpc\xmlrpc.2008.vcproj", "{A3FE0076-B366-429D-A238-D7304DA7D3C1}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Abyss", "libs\win32\xmlrpc\Abyss.2008.vcproj", "{356EC96D-4C9F-47B5-9083-FC328B87BA94}"
- ProjectSection(ProjectDependencies) = postProject
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml", "libs\win32\apr-util\xml.2008.vcproj", "{155844C3-EC5F-407F-97A4-A2DDADED9B2F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js", "libs\win32\js\js.2008.vcproj", "{204FA0DE-305D-4414-AE2E-F195A23F390D}"
@@ -859,6 +855,14 @@
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "abyss", "libs\xmlrpc-c\Windows\abyss.2008.vcproj", "{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlrpc", "libs\xmlrpc-c\Windows\xmlrpc.2008.vcproj", "{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlparse", "libs\xmlrpc-c\Windows\xmlparse.2008.vcproj", "{0D108721-EAE8-4BAF-8102-D8960EC93647}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmltok", "libs\xmlrpc-c\Windows\xmltok.2008.vcproj", "{B535402E-38D2-4D54-8360-423ACBD17192}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -1121,18 +1125,6 @@
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|Win32.ActiveCfg = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|Win32.Build.0 = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|x64.ActiveCfg = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|Win32.ActiveCfg = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|Win32.Build.0 = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|x64.ActiveCfg = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|Win32.ActiveCfg = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|Win32.Build.0 = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|x64.ActiveCfg = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|Win32.ActiveCfg = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|Win32.Build.0 = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|x64.ActiveCfg = Release|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|Win32
@@ -1433,6 +1425,30 @@
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1505,8 +1521,6 @@
{49C34584-B6DA-448F-83CF-27584DC9FC90} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
@@ -1514,6 +1528,10 @@
{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {0D108721-EAE8-4BAF-8102-D8960EC93647} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {B535402E-38D2-4D54-8360-423ACBD17192} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{5927104D-C14C-4AC8-925C-4AB681762E75} = {C120A020-773F-4EA3-923F-B67AF28B750D}
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D}
{988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.sln
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.sln (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Freeswitch.sln Mon May 26 12:59:57 2008
@@ -3,19 +3,19 @@
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.vcproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
ProjectSection(ProjectDependencies) = postProject
- {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
- {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
- {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
- {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
- {EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
+ {EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EEF031CB-FED8-451E-A471-91EC8D4F6750}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+ {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+ {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9}
+ {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761} = {50AD0E28-B8D7-4FCC-8FC3-599F6AC69761}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g729", "src\mod\codecs\mod_g729\mod_g729.vcproj", "{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}"
@@ -25,34 +25,34 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sndfile", "src\mod\formats\mod_sndfile\mod_sndfile.vcproj", "{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {0A18A071-125E-442F-AFF7-A3F68ABECF99}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_speex", "src\mod\codecs\mod_speex\mod_speex.vcproj", "{5580D60E-0F77-4716-9CD4-B8E5986FA375}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{1C469CDD-A3AF-4A94-A592-B2CF12F2D918} = {1C469CDD-A3AF-4A94-A592-B2CF12F2D918}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_woomera", "src\mod\endpoints\mod_woomera\mod_woomera.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Codecs", "Codecs", "{F881ADA2-2F1A-4046-9FEB-191D9422D781}"
@@ -73,8 +73,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_xml", "src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.vcproj", "{07113B25-D3AF-4E04-BA77-4CD1171F022C}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "FreeSwitchSetup", "w32\Setup\Setup.vdproj", "{B17FFBE6-A942-4056-8346-B624FB5D995B}"
@@ -88,22 +88,22 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dialplan_directory", "src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.vcproj", "{A27CCA23-1541-4337-81A4-F0A6413078A0}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_zeroconf", "src\mod\event_handlers\mod_zeroconf\mod_zeroconf.vcproj", "{C7705DC4-2088-493E-AF8D-65BC6D65C125}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {49C34584-B6DA-448F-83CF-27584DC9FC90} = {49C34584-B6DA-448F-83CF-27584DC9FC90}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_multicast", "src\mod\event_handlers\mod_event_multicast\mod_event_multicast.vcproj", "{784113EF-44D9-4949-835D-7065D3C7AD08}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libteletone", "libs\libteletone\libteletone.vcproj", "{89385C74-5860-4174-9CAF-A39E7C48909C}"
@@ -112,10 +112,10 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey", "src\mod\languages\mod_spidermonkey\mod_spidermonkey.vcproj", "{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
- {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ASR-TTS", "ASR-TTS", "{4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}"
@@ -127,22 +127,22 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.vcproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{989BB874-7AF1-44CB-8E5C-CC8113D267E8} = {989BB874-7AF1-44CB-8E5C-CC8113D267E8}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.vcproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
ProjectSection(ProjectDependencies) = postProject
- {1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {1906D736-08BD-4EE1-924F-B536249B9A54} = {1906D736-08BD-4EE1-924F-B536249B9A54}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.vcproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Loggers", "Loggers", "{A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}"
@@ -156,35 +156,36 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
ProjectSection(ProjectDependencies) = postProject
- {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94}
+ {B535402E-38D2-4D54-8360-423ACBD17192} = {B535402E-38D2-4D54-8360-423ACBD17192}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
- {155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}
+ {0D108721-EAE8-4BAF-8102-D8960EC93647} = {0D108721-EAE8-4BAF-8102-D8960EC93647}
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_conference", "src\mod\applications\mod_conference\mod_conference.vcproj", "{C24FB505-05D7-4319-8485-7540B44C8603}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\applications\mod_dptools\mod_dptools.vcproj", "{B5881A85-FE70-4F64-8607-2CAAE52669C6}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_socket", "src\mod\event_handlers\mod_event_socket\mod_event_socket.vcproj", "{05515420-16DE-4E63-BE73-85BE85BA5142}"
ProjectSection(ProjectDependencies) = postProject
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Libraries", "_Libraries", "{EB910B0D-F27D-4B62-B67B-DE834C99AC5B}"
@@ -193,8 +194,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.vcproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
ProjectSection(ProjectDependencies) = postProject
- {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {E727E8F6-935D-46FE-8B0E-37834748A0E3}
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "libs\srtp\libsrtp.vcproj", "{EEF031CB-FED8-451E-A471-91EC8D4F6750}"
@@ -232,37 +233,30 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mDNSResponder static library", "libs\win32\howl\libmDNSResponder.vcproj", "{49C34584-B6DA-448F-83CF-27584DC9FC90}"
ProjectSection(ProjectDependencies) = postProject
- {5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75}
{0D826AF5-0506-4C50-BB8B-7DB019AC21AE} = {0D826AF5-0506-4C50-BB8B-7DB019AC21AE}
+ {5927104D-C14C-4AC8-925C-4AB681762E75} = {5927104D-C14C-4AC8-925C-4AB681762E75}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsndfile", "libs\win32\libsndfile\libsndfile.vcproj", "{3D0370CA-BED2-4657-A475-32375CBCB6E4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "curllib", "libs\win32\curl\curllib.vcproj", "{87EE9DA4-DE1E-4448-8324-183C98DCA588}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlrpc", "libs\win32\xmlrpc\xmlrpc.vcproj", "{A3FE0076-B366-429D-A238-D7304DA7D3C1}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Abyss", "libs\win32\xmlrpc\Abyss.vcproj", "{356EC96D-4C9F-47B5-9083-FC328B87BA94}"
- ProjectSection(ProjectDependencies) = postProject
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml", "libs\win32\apr-util\xml.vcproj", "{155844C3-EC5F-407F-97A4-A2DDADED9B2F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js", "libs\win32\js\js.vcproj", "{204FA0DE-305D-4414-AE2E-F195A23F390D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}"
ProjectSection(ProjectDependencies) = postProject
- {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.vcproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}"
ProjectSection(ProjectDependencies) = postProject
- {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}
+ {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.vcproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}"
@@ -274,70 +268,70 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_g723_1", "src\mod\codecs\mod_g723_1\mod_g723_1.vcproj", "{FEA1EEF7-876F-48DE-88BF-C0E3E606D758}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_native_file", "src\mod\formats\mod_native_file\mod_native_file.vcproj", "{9254C4B0-6F60-42B6-BB3A-36D63FC001C7}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
ProjectSection(ProjectDependencies) = postProject
- {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
ProjectSection(ProjectDependencies) = postProject
- {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
ProjectSection(ProjectDependencies) = postProject
- {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_curl", "src\mod\xml_int\mod_xml_curl\mod_xml_curl.vcproj", "{AB91A099-7690-4ECF-8994-E458F4EA1ED4}"
ProjectSection(ProjectDependencies) = postProject
- {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "say", "say", "{6CD61A1D-797C-470A-BE08-8C31B68BB336}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_en", "src\mod\say\mod_say_en\mod_say_en.vcproj", "{988CACF7-3FCB-4992-BE69-77872AE67DC8}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "portaudio", "libs\portaudio\build\msvc\portaudio.vcproj", "{0A18A071-125E-442F-AFF7-A3F68ABECF99}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_cdr", "src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.vcproj", "{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}"
ProjectSection(ProjectDependencies) = postProject
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
- {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_amr", "src\mod\codecs\mod_amr\mod_amr.vcproj", "{8DEB383C-4091-4F42-A56F-C9E46D552D79}"
@@ -410,16 +404,16 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpcore", "libs\openmrcp\mrcpcore\mrcpcore.vcproj", "{829A9309-3B94-43C0-846B-7EC9D6D35F8B}"
ProjectSection(ProjectDependencies) = postProject
- {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
{AA91F0AC-6562-435E-814C-5C94689FEFA2} = {AA91F0AC-6562-435E-814C-5C94689FEFA2}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtspcore", "libs\openmrcp\rtspcore\rtspcore.vcproj", "{EB751DC4-87BD-4766-B78D-DFB64BA9F988}"
ProjectSection(ProjectDependencies) = postProject
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
- {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
{829A9309-3B94-43C0-846B-7EC9D6D35F8B} = {829A9309-3B94-43C0-846B-7EC9D6D35F8B}
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpmediaframe", "libs\openmrcp\module\mrcpmediaframe\mrcpmediaframe.vcproj", "{9EA22C31-BB7E-4C40-A698-2C6792D1E0C6}"
@@ -436,8 +430,8 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "libs\openmrcp\module\mrcpsofiasip\mrcpsofiasip.vcproj", "{819C7242-6184-46FE-BC7B-C7E25C0581EE}"
ProjectSection(ProjectDependencies) = postProject
- {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
{829A9309-3B94-43C0-846B-7EC9D6D35F8B} = {829A9309-3B94-43C0-846B-7EC9D6D35F8B}
+ {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2agent", "libs\openmrcp\module\mrcpv2agent\mrcpv2agent.vcproj", "{FB64EA08-3BC0-48AE-BE4B-74F1024B756E}"
@@ -447,27 +441,27 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libopenmrcpclient", "libs\openmrcp\platform\libopenmrcpclient\libopenmrcpclient.vcproj", "{A407B661-D7DC-4E30-B268-FFF3296C35E6}"
ProjectSection(ProjectDependencies) = postProject
- {CF78E84D-8456-44F2-8197-0E0E88D30A3C} = {CF78E84D-8456-44F2-8197-0E0E88D30A3C}
- {819C7242-6184-46FE-BC7B-C7E25C0581EE} = {819C7242-6184-46FE-BC7B-C7E25C0581EE}
- {9EA22C31-BB7E-4C40-A698-2C6792D1E0C6} = {9EA22C31-BB7E-4C40-A698-2C6792D1E0C6}
{FB64EA08-3BC0-48AE-BE4B-74F1024B756E} = {FB64EA08-3BC0-48AE-BE4B-74F1024B756E}
+ {9EA22C31-BB7E-4C40-A698-2C6792D1E0C6} = {9EA22C31-BB7E-4C40-A698-2C6792D1E0C6}
+ {819C7242-6184-46FE-BC7B-C7E25C0581EE} = {819C7242-6184-46FE-BC7B-C7E25C0581EE}
+ {CF78E84D-8456-44F2-8197-0E0E88D30A3C} = {CF78E84D-8456-44F2-8197-0E0E88D30A3C}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_openmrcp", "src\mod\asr_tts\mod_openmrcp\mod_openmrcp.vcproj", "{E7116F50-2B10-472F-92BD-C8667AA9C1AE}"
ProjectSection(ProjectDependencies) = postProject
- {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
- {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
- {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
- {A407B661-D7DC-4E30-B268-FFF3296C35E6} = {A407B661-D7DC-4E30-B268-FFF3296C35E6}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {A407B661-D7DC-4E30-B268-FFF3296C35E6} = {A407B661-D7DC-4E30-B268-FFF3296C35E6}
+ {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+ {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+ {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey_socket\mod_spidermonkey_socket.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
ProjectSection(ProjectDependencies) = postProject
- {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voicemail", "src\mod\applications\mod_voicemail\mod_voicemail.vcproj", "{D7F1E3F2-A3F4-474C-8555-15122571AF52}"
@@ -832,26 +826,26 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_tone_stream", "src\mod\formats\mod_tone_stream\mod_tone_stream.vcproj", "{1A789A98-71EF-4EBD-8007-FC9ED585D32E}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libvoipcodecs", "libs\voipcodecs\libvoipcodecs.vcproj", "{CF70F278-3364-4395-A2E1-23501C9B8AD2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_voipcodecs", "src\mod\codecs\mod_voipcodecs\mod_voipcodecs.vcproj", "{9EED03C8-8315-4214-8D13-8FF5FA46D93C}"
ProjectSection(ProjectDependencies) = postProject
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {CF70F278-3364-4395-A2E1-23501C9B8AD2}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\openmrcp\aprtoolkit\aprtoolkit.vcproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey_curl\mod_spidermonkey_curl.vcproj", "{2CCED6DC-26FF-40F2-9585-E9E1049A4599}"
ProjectSection(ProjectDependencies) = postProject
- {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
- {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
- {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
+ {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+ {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+ {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_fsv", "src\mod\applications\mod_fsv\mod_fsv.vcproj", "{4AE157CF-F2DD-4B5D-A1EE-4AC173B4F9AC}"
@@ -864,6 +858,14 @@
{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "abyss", "libs\xmlrpc-c\Windows\abyss.vcproj", "{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmltok", "libs\xmlrpc-c\Windows\xmltok.vcproj", "{B535402E-38D2-4D54-8360-423ACBD17192}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlrpc", "libs\xmlrpc-c\Windows\xmlrpc.vcproj", "{CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xmlparse", "libs\xmlrpc-c\Windows\xmlparse.vcproj", "{0D108721-EAE8-4BAF-8102-D8960EC93647}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -1126,18 +1128,6 @@
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32
{87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|Win32.ActiveCfg = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|Win32.Build.0 = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Debug|x64.ActiveCfg = Debug|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|Win32.ActiveCfg = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|Win32.Build.0 = Release|Win32
- {A3FE0076-B366-429D-A238-D7304DA7D3C1}.Release|x64.ActiveCfg = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|Win32.ActiveCfg = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|Win32.Build.0 = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Debug|x64.ActiveCfg = Debug|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|Win32.ActiveCfg = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|Win32.Build.0 = Release|Win32
- {356EC96D-4C9F-47B5-9083-FC328B87BA94}.Release|x64.ActiveCfg = Release|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|Win32
@@ -1438,6 +1428,30 @@
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32
{7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32
+ {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32
+ {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1495,8 +1509,6 @@
{49C34584-B6DA-448F-83CF-27584DC9FC90} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {A3FE0076-B366-429D-A238-D7304DA7D3C1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
- {356EC96D-4C9F-47B5-9083-FC328B87BA94} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{204FA0DE-305D-4414-AE2E-F195A23F390D} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
@@ -1505,6 +1517,10 @@
{0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{ACFD96F2-58AA-491D-B4C0-33BD0BD57FDE} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {B535402E-38D2-4D54-8360-423ACBD17192} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+ {0D108721-EAE8-4BAF-8102-D8960EC93647} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000}
{8F992C49-6C51-412F-B2A3-34EAB708EB65} = {0C808854-54D1-4230-BFF5-77B5FD905000}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am Mon May 26 12:59:57 2008
@@ -276,8 +276,8 @@
$(MAKE) -j modules
sofia-reconf:
+ cd libs/sofia-sip && sh ./autogen.sh
cd libs/sofia-sip && $(MAKE) clean
- cd libs/sofia-sip && autoreconf -fi
cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
current: update-clean
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/config/config.sub
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/config/config.sub (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/config/config.sub Mon May 26 12:59:57 2008
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-# Inc.
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
-timestamp='2006-07-02'
+timestamp='2008-01-16'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -72,8 +72,8 @@
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -245,12 +245,12 @@
| bfin \
| c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
- | fr30 | frv \
+ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore \
+ | maxq | mb | microblaze | mcore | mep \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -276,6 +276,7 @@
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
+ | score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
@@ -284,7 +285,7 @@
| tahoe | thumb | tic4x | tic80 | tron \
| v850 | v850e \
| we32k \
- | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k)
basic_machine=$basic_machine-unknown
;;
@@ -323,7 +324,7 @@
| clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
- | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
@@ -367,11 +368,15 @@
| tron-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa*-* \
| ymp-* \
| z8k-*)
;;
+ # Recognize the basic CPU types without company name, with glob match.
+ xtensa*)
+ basic_machine=$basic_machine-unknown
+ ;;
# Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS.
386bsd)
@@ -442,6 +447,14 @@
basic_machine=ns32k-sequent
os=-dynix
;;
+ blackfin)
+ basic_machine=bfin-unknown
+ os=-linux
+ ;;
+ blackfin-*)
+ basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -474,8 +487,8 @@
basic_machine=craynv-cray
os=-unicosmp
;;
- cr16c)
- basic_machine=cr16c-unknown
+ cr16)
+ basic_machine=cr16-unknown
os=-elf
;;
crds | unos)
@@ -667,6 +680,14 @@
basic_machine=m68k-isi
os=-sysv
;;
+ m68knommu)
+ basic_machine=m68k-unknown
+ os=-linux
+ ;;
+ m68knommu-*)
+ basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
m88k-omron*)
basic_machine=m88k-omron
;;
@@ -682,6 +703,10 @@
basic_machine=i386-pc
os=-mingw32
;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
miniframe)
basic_machine=m68000-convergent
;;
@@ -808,6 +833,14 @@
basic_machine=i860-intel
os=-osf
;;
+ parisc)
+ basic_machine=hppa-unknown
+ os=-linux
+ ;;
+ parisc-*)
+ basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+ os=-linux
+ ;;
pbd)
basic_machine=sparc-tti
;;
@@ -909,6 +942,10 @@
sb1el)
basic_machine=mipsisa64sb1el-unknown
;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
sei)
basic_machine=mips-sei
os=-seiux
@@ -920,6 +957,9 @@
basic_machine=sh-hitachi
os=-hms
;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
sh64)
basic_machine=sh64-unknown
;;
@@ -1009,6 +1049,10 @@
basic_machine=tic6x-unknown
os=-coff
;;
+ tile*)
+ basic_machine=tile-unknown
+ os=-linux-gnu
+ ;;
tx39)
basic_machine=mipstx39-unknown
;;
@@ -1214,7 +1258,7 @@
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1366,6 +1410,9 @@
# system, and we'll never get to this point.
case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
spu-*)
os=-elf
;;
@@ -1406,6 +1453,9 @@
m68*-cisco)
os=-aout
;;
+ mep-*)
+ os=-elf
+ ;;
mips*-cisco)
os=-elf
;;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/build/modmake.rules.in Mon May 26 12:59:57 2008
@@ -29,7 +29,7 @@
LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
ALL_CFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
-ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURC $(OUR_CFLAGS)
+ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS)
LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/ivr.conf.xml Mon May 26 12:59:57 2008
@@ -5,7 +5,7 @@
<menu name="demo_ivr"
greet-long="phrase:demo_ivr_main_menu"
greet-short="phrase:demo_ivr_main_menu_short"
- invalid-sound="voicemail/vm-hello.wav"
+ invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
exit-sound="voicemail/vm-goodbye.wav"
timeout ="10000"
inter-digit-timeout="2000"
@@ -23,7 +23,7 @@
<menu name="demo_ivr_submenu"
greet-long="phrase:demo_ivr_sub_menu"
greet-short="phrase:demo_ivr_sub_menu_short"
- invalid-sound="voicemail/vm-hello.wav"
+ invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
exit-sound="voicemail/vm-goodbye.wav"
timeout="15000"
max-failures="3">
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml Mon May 26 12:59:57 2008
@@ -76,6 +76,7 @@
<!-- <load module="mod_perl"/> -->
<!-- <load module="mod_python"/> -->
<!-- <load module="mod_java"/> -->
+ <!-- <load module="mod_lua"/> -->
<!-- ASR /TTS -->
<!-- <load module="mod_cepstral"/> -->
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml Mon May 26 12:59:57 2008
@@ -12,7 +12,6 @@
<param name="tone-spec" value="%(1000, 0, 640)"/>
<param name="callback-dialplan" value="XML"/>
<param name="callback-context" value="default"/>
- <param name="terminator-key" value="#"/>
<param name="play-new-messages-key" value="1"/>
<param name="play-saved-messages-key" value="2"/>
<param name="main-menu-key" value="0"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/dialplan/default.xml Mon May 26 12:59:57 2008
@@ -71,6 +71,16 @@
</condition>
</extension>
+ <extension name="eavesdrop">
+ <condition field="destination_number" expression="^779$">
+ <action application="answer"/>
+ <action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/>
+ <action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/>
+ <action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/>
+ <action application="eavesdrop" data="all"/>
+ </condition>
+ </extension>
+
<extension name="call_return">
<condition field="destination_number" expression="^\*69$|^869$">
<action application="transfer" data="${db(select/call_return/${caller_id_number})}"/>
@@ -136,9 +146,10 @@
<action application="answer"/>
<action application="sleep" data="1000"/>
<action application="voicemail" data="check default $${domain} ${dialed_ext}"/>
- <anti-action application="bind_meta_app" data="1 a a execute_extension::dx XML features"/>
- <anti-action application="bind_meta_app" data="2 a a record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
- <anti-action application="bind_meta_app" data="3 a a execute_extension::cf XML features"/>
+ <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
+ <anti-action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
+ <anti-action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+ <anti-action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
<anti-action application="set" data="transfer_ringback=${us-ring}"/>
<anti-action application="set" data="call_timeout=30"/>
<!-- <anti-action application="set" data="sip_exclude_contact=${network_addr}"/> -->
@@ -199,6 +210,8 @@
<!-- a sample IVR -->
<extension name="ivr_demo">
<condition field="destination_number" expression="5000">
+ <action application="answer"/>
+ <action application="sleep" data="2000"/>
<action application="ivr" data="demo_ivr"/>
</condition>
</extension>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/demo/demo-ivr.xml Mon May 26 12:59:57 2008
@@ -15,8 +15,6 @@
<input pattern="(.*)">
<match>
<!-- string together several existing sound files to create one long greeting -->
- <action function="execute" data="answer"/>
- <action function="execute" data="sleep(1000)"/>
<action function="play-file" data="ivr/ivr-welcome_to_freeswitch.wav"/>
<action function="execute" data="sleep(250)"/>
<action function="play-file" data="ivr/ivr-this_ivr_will_let_you_test_features.wav"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/en.xml Mon May 26 12:59:57 2008
@@ -1,6 +1,6 @@
<include>
<language name="en" sound-path="$${base_dir}/sounds/en/us/callie" tts-engine="cepstral" tts-voice="callie">
- <X-PRE-PROCESS cmd="include" data="demo/demo*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
+ <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
<!--voicemail_en_tts is purely implemented with tts, we need a files based implementation too -->
<X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>
</language>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/external.xml Mon May 26 12:59:57 2008
@@ -26,6 +26,7 @@
<param name="use-rtp-timer" value="true"/>
<param name="rtp-timer-name" value="soft"/>
<param name="manage-presence" value="false"/>
+ <param name="aggressive-nat-detection" value="true"/>
<param name="inbound-codec-negotiation" value="generous"/>
<param name="nonce-ttl" value="60"/>
<param name="auth-calls" value="false"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml Mon May 26 12:59:57 2008
@@ -36,6 +36,7 @@
<param name="sip-ip" value="$${local_ip_v4}"/>
<param name="hold-music" value="$${hold_music}"/>
<param name="apply-nat-acl" value="rfc1918"/>
+ <param name="aggressive-nat-detection" value="true"/>
<!--<param name="enable-timer" value="false"/>-->
<!--<param name="enable-100rel" value="false"/>-->
<!--<param name="apply-inbound-acl" value="rfc1918"/>-->
@@ -97,6 +98,8 @@
<!--<param name="disable-transcoding" value="true"/>-->
<!-- Used for when phones respond to a challenged ACK with method INVITE in the hash -->
<!--<param name="NDLB-broken-auth-hash" value="true"/>-->
+ <!-- add a ;received="<ip>:<port>" to the contact when replying to register for nat handling -->
+ <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
<param name="auth-calls" value="true"/>
<!-- on authed calls, authenticate *all* the packets not just invite -->
<param name="auth-all-packets" value="false"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/nat.xml Mon May 26 12:59:57 2008
@@ -17,6 +17,7 @@
<param name="hold-music" value="$${hold_music}"/>
<param name="rtp-timer-name" value="soft"/>
<param name="manage-presence" value="false"/>
+ <param name="aggressive-nat-detection" value="true"/>
<param name="inbound-codec-negotiation" value="generous"/>
<param name="nonce-ttl" value="60"/>
<param name="auth-calls" value="false"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in Mon May 26 12:59:57 2008
@@ -3,11 +3,11 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.0.rc6], BUG-REPORT-ADDRESS)
+AC_INIT([freeswitch], [1.0.pre4], BUG-REPORT-ADDRESS)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0])
-AC_SUBST(SWITCH_VERSION_MICRO, [rc6])
-AC_SUBST(SWITCH_VERSION_REVISION, [8500])
+AC_SUBST(SWITCH_VERSION_MICRO, [pre4])
+#AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
AC_SUBST(SOUNDS_VERSION, [1.0.1])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
@@ -16,6 +16,7 @@
AM_INIT_AUTOMAKE(libfreeswitch,0.1)
AC_CONFIG_SRCDIR([src/switch.c])
AC_CONFIG_HEADER([src/include/switch_private.h])
+AC_CONFIG_HEADER([libs/xmlrpc-c/xmlrpc_amconfig.h])
AC_PREFIX_DEFAULT(/usr/local/freeswitch)
# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script
@@ -328,7 +329,15 @@
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
-AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h])
+AC_CHECK_HEADERS([sys/types.h sys/resource.h sched.h wchar.h sys/filio.h sys/ioctl.h])
+
+# for xmlrpc-c config.h
+if test x"$ac_cv_header_wchar_h" = xyes; then
+ HAVE_WCHAR_H_DEFINE=1
+else
+ HAVE_WCHAR_H_DEFINE=0
+fi
+AC_SUBST(HAVE_WCHAR_H_DEFINE)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -344,9 +353,11 @@
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([gethostname vasprintf mmap mlock mlockall usleep])
AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
+AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
+AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
AC_CHECK_DECL([RLIMIT_MEMLOCK],
[AC_DEFINE([HAVE_RLIMIT_MEMLOCK],[1],[RLIMIT_MEMLOCK constant for setrlimit])],,
@@ -399,6 +410,45 @@
AC_DEFINE([USE_SCHED_SETSCHEDULER],[1],[Enable round-robin scheduler using sched_setscheduler])
fi
+#
+# xmlrpc-c checks
+#
+
+
+HAVE_LIBWWW_SSL_DEFINE=0
+AC_SUBST(HAVE_LIBWWW_SSL_DEFINE)
+
+DIRECTORY_SEPARATOR="/"
+AC_SUBST(DIRECTORY_SEPARATOR)
+
+va_list_is_array=no
+AC_MSG_CHECKING(whether va_list is an array)
+AC_TRY_COMPILE([
+#include <stdarg.h>
+], [va_list list1, list2; list1 = list2;], ,
+va_list_is_array=yes)
+AC_MSG_RESULT($va_list_is_array)
+if test x"$va_list_is_array" = xyes; then
+ VA_LIST_IS_ARRAY_DEFINE=1
+else
+ VA_LIST_IS_ARRAY_DEFINE=0
+fi
+AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
+
+AC_MSG_CHECKING(whether compiler has __attribute__)
+AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
+compiler_has_attribute=yes,
+compiler_has_attribute=no)
+AC_MSG_RESULT($compiler_has_attribute)
+if test x"$compiler_has_attribute" = xyes; then
+ ATTR_UNUSED="__attribute__((__unused__))"
+else
+ ATTR_UNUSED=
+fi
+AC_SUBST(ATTR_UNUSED)
+
+
+
AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
@@ -629,6 +679,15 @@
PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`"
PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`"
PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
+ PYTHON_LIBDIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_config_var(\"LIBDIR\");'`"
+
+ # handle python being installed into /usr/local
+ AC_MSG_CHECKING([python libdir])
+ if test -z "`echo $PYTHON_LIBDIR | grep "/usr/lib"`" ; then
+ PYTHON_LDFLAGS="-L$PYTHON_LIBDIR $PYTHON_LDFLAGS"
+ LIBS="-L$PYTHON_LIBDIR $LIBS"
+ fi
+ AC_MSG_RESULT([$PYTHON_LIBDIR])
# check libpython
AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
@@ -689,6 +748,8 @@
build/getsounds.sh
build/getlib.sh
build/modmake.rules
+ libs/xmlrpc-c/include/xmlrpc-c/config.h
+ libs/xmlrpc-c/xmlrpc_config.h
scripts/gentls_cert])
AM_CONDITIONAL(ISLINUX, [test `uname -s` = Linux])
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog Mon May 26 12:59:57 2008
@@ -1,11 +1,13 @@
freeswitch (1.0~rc6-1) unstable; urgency=low
- * Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
+ * Changed to not allow pass_2833 on transcoded calls
+ (it never worked, now it will tell you)
* Enhanced sofia sip nat handling
* Fix libedit build on solaris
* Fix session timers in mod_sofia
* Fix conference fire-call
- * Change: add var_event down into the endpoints so chans with no parents can still pass options
+ * Change: add var_event down into the endpoints so chans
+ with no parents can still pass options
* Added enable-post-var param to xml_rpc
* Fix mod_lua build on solaris
* Many fixes found by Klockwork (www.klocwork.com)
@@ -15,7 +17,7 @@
* Fixed att_xfer issue
* Fix sip now includes the Allow-Events header in more places
--- Michael Jerris <mike(a)jerris.com> Tue, 13 May 2008 02:01:00 -0400
+ -- Michael Jerris <mike(a)jerris.com> Tue, 13 May 2008 02:01:00 -0400
freeswitch (1.0~rc5-1) unstable; urgency=low
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/control Mon May 26 12:59:57 2008
@@ -15,77 +15,58 @@
a soft-switch. It can be used as a simple switching engine, a media gateway
or a media server to host IVR applications using simple scripts or XML to
control the callflow.
-Homepage: http://www.freeswitch.org/
Package: freeswitch-dev
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: Development Package for the FreeSwitch open source telephony platform
-Homepage: http://www.freeswitch.org/
-
Package: freeswitch-spidermonkey
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: A Javascript engine for freeswitch
-Homepage: http://www.freeswitch.org/
Package: freeswitch-perl
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: A perl engine for freeswitch
-Homepage: http://www.freeswitch.org/
Package: freeswitch-lua
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: A lua engine for freeswitch
-Homepage: http://www.freeswitch.org/
-
-
-
Package: freeswitch-codec-passthru-g7231
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: Pass through g723.1 Codec support for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Package: freeswitch-codec-passthru-amr
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: Pass through AMR Codec support for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Package: freeswitch-codec-passthru-g729
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: Pass through g729 Codec support for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
-
-
-
Package: freeswitch-lang-en
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: English language files for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Package: freeswitch-lang-de
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: German language files for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Package: freeswitch-lang-fr
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: French language files for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Package: freeswitch-lang-it
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
Description: Italian language files for the FreeSWITCH open source telephony platform
-Homepage: http://www.freeswitch.org/
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/files Mon May 26 12:59:57 2008
@@ -1,10 +1,12 @@
-freeswitch_1.0~rc5-1_i386.deb net extra
-freeswitch-spidermonkey_1.0~rc5-1_i386.deb net extra
-freeswitch-dev_1.0~rc5-1_i386.deb net extra
-freeswitch-codec-passthru-g7231_1.0~rc5-1_i386.deb net extra
-freeswitch-codec-passthru-amr_1.0~rc5-1_i386.deb net extra
-freeswitch-codec-passthru-g729_1.0~rc5-1_i386.deb net extra
-freeswitch-lang-en_1.0~rc5-1_i386.deb net extra
-freeswitch-lang-de_1.0~rc5-1_i386.deb net extra
-freeswitch-lang-fr_1.0~rc5-1_i386.deb net extra
-freeswitch-lang-it_1.0~rc5-1_i386.deb net extra
+freeswitch_1.0~rc6-1_i386.deb net extra
+freeswitch-dev_1.0~rc6-1_i386.deb net extra
+freeswitch-spidermonkey_1.0~rc6-1_i386.deb net extra
+freeswitch-perl_1.0~rc6-1_i386.deb net extra
+freeswitch-lua_1.0~rc6-1_i386.deb net extra
+freeswitch-codec-passthru-g7231_1.0~rc6-1_i386.deb net extra
+freeswitch-codec-passthru-amr_1.0~rc6-1_i386.deb net extra
+freeswitch-codec-passthru-g729_1.0~rc6-1_i386.deb net extra
+freeswitch-lang-en_1.0~rc6-1_i386.deb net extra
+freeswitch-lang-de_1.0~rc6-1_i386.deb net extra
+freeswitch-lang-fr_1.0~rc6-1_i386.deb net extra
+freeswitch-lang-it_1.0~rc6-1_i386.deb net extra
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/rules Mon May 26 12:59:57 2008
@@ -71,7 +71,7 @@
dh_testroot
rm -f build-stamp
- -$(MAKE) clean megaclean
+ -$(MAKE) update-clean
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub build/config/config.sub
endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/freeswitch.spec Mon May 26 12:59:57 2008
@@ -5,7 +5,7 @@
Summary: FreeSWITCH open source telephony platform
License: MPL
Group: Productivity/Telephony/Servers
-Version: 1.0.rc5
+Version: 1.0.rc6
Release: 1
URL: http://www.freeswitch.org/
Packager: Michal Bielicki
@@ -115,29 +115,27 @@
%description spidermonkey
-%package lang-en
-Summary: Provides english language dependand modules and sounds for the FreeSwitch Open Source telephone platform.
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
+%package lua
+Summary: Lua support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
-%description lang-en
-English language phrases module and directory structure for say module and voicemail
+%description lua
-%package lang-de
-Summary: Provides german language dependand modules and sounds for the FreeSwitch Open Source telephone platform.
-Group: System/Libraries
-Requires: %{name} = %{version}-%{release}
+%package perl
+Summary: Perl support for the FreeSWITCH open source telephony platform
+Group: System/Libraries
+Requires: %{name} = %{version}-%{release}
-%description lang-de
-German language phrases module and directory structure for say module and voicemail
+%description perl
-%package lang-fr
-Summary: Provides french language dependand modules and sounds for the FreeSwitch Open Source telephone platform.
+%package lang-en
+Summary: Provides english language dependand modules and sounds for the FreeSwitch Open Source telephone platform.
Group: System/Libraries
Requires: %{name} = %{version}-%{release}
-%description lang-fr
-French language phrases module and directory structure for say module and voicemail
+%description lang-en
+English language phrases module and directory structure for say module and voicemail
%prep
%setup -q
@@ -163,15 +161,16 @@
ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_woomera ../../libs/openzap/mod_openzap"
EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv"
FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream"
-LANGUAGES_MODULES=
+LANGUAGES_MODULES="languages/mod_perl languages/mod_lua"
LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog"
-SAY_MODULES="say/mod_say_en say/mod_say_fr say/mod_say_de"
+SAY_MODULES="say/mod_say_en"
TIMERS_MODULES=
DISABLED_MODULES="applications/mod_sountouch directories/mod_ldap languages/mod_java languages/mod_python languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf formats/mod_shout say/mod_say_it say/mod_say_es say/mod_say_nl"
XML_INT_MODULES="xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr"
MYMODULES="$PASSTHRU_CODEC_MODULES $SPIDERMONKEY_MODULES $APPLICATIONS_MODULES $ASR_TTS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $DOTNET_MODULES $ENDPOINTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES"
export MODULES=$MYMODULES
+rm modules.conf
touch modules.conf
for i in $MODULES; do echo $i >> modules.conf; done
export VERBOSE=yes
@@ -179,8 +178,13 @@
export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH
export ACLOCAL_FLAGS="-I /usr/share/aclocal"
-./bootstrap.sh
-%configure -C \
+if test ! -f Makefile.in
+then
+ bootstrap.sh
+fi
+
+
+ %configure -C \
--prefix=%{prefix} \
--bindir=%{prefix}/bin \
--libdir=%{prefix}/lib \
@@ -205,6 +209,12 @@
%{__make}
%install
+# delete unsupported langugages for now
+rm -rf conf/lang/de
+rm -rf conf/lang/fr
+rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/de
+rm -rf $RPM_BUILD_ROOT%{prefix}/conf/lang/fr
+
%{__make} DESTDIR=$RPM_BUILD_ROOT install
# Create a log dir
@@ -275,8 +285,8 @@
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/nat
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan/extensions
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/default
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/outbound
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/external
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/jingle_profiles
%ifos linux
%config(noreplace) %attr(0644, freeswitch, daemon) /etc/monit.d/freeswitch.monitrc
@@ -286,6 +296,7 @@
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.conf
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml
@@ -321,8 +332,8 @@
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/default/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/outbound/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/nat/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/*
@@ -397,6 +408,19 @@
%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/spidermonkey.conf.xml
+%files lua
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_lua*.so*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/lua.conf.xml
+
+%files perl
+%defattr(-,freeswitch,daemon)
+%{prefix}/mod/mod_perl*.so*
+%{prefix}/perl/*
+%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/perl.conf.xml
+
%files devel
%defattr(-, freeswitch, daemon)
%{prefix}/lib/*.a
@@ -414,25 +438,13 @@
%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/vm/*.xml
%{prefix}/mod/mod_say_en.so*
-%files lang-de
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/demo
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/de/vm
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/demo/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/de/vm/*.xml
-%{prefix}/mod/mod_say_de.so*
-
-%files lang-fr
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/demo
-%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/vm
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/demo/*.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/vm/*.xml
-%{prefix}/mod/mod_say_fr.so*
-
%changelog
+* Thu May 22 2008 - michal.bielicki(a)voiceworks.pl
+- disabled beta class language stuff
+- bumped revision up to rc6
+- added mod_lua
+- added mod_perl
+- Only bootstrap if no Makfile.in exists
* Mon Feb 04 2008 - michal.bielicki(a)voiceworks.pl
- More fixes to specfile
- First go at SFE files
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands/Originate.cs Mon May 26 12:59:57 2008
@@ -89,9 +89,8 @@
public override CommandReply CreateReply(string dataToParse)
{
- dataToParse = dataToParse.Replace(" ", string.Empty);
- string[] nameValue = dataToParse.Split(':');
- if (nameValue[0].ToLower() == "success")
+ string[] nameValue = dataToParse.Split(' ');
+ if (nameValue[0].Length > 0 && nameValue[0][0] == '+')
return new OriginateReply(true, nameValue[1]);
else
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/g711.h Mon May 26 12:59:57 2008
@@ -369,7 +369,7 @@
uint8_t alaw_to_ulaw(uint8_t alaw);
/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711.
- \param alaw The u-law sample to transcode.
+ \param ulaw The u-law sample to transcode.
\return The best matching A-law value.
*/
uint8_t ulaw_to_alaw(uint8_t ulaw);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h Mon May 26 12:59:57 2008
@@ -44,6 +44,8 @@
switch_time_t profile_created;
switch_time_t created;
switch_time_t answered;
+ switch_time_t progress;
+ switch_time_t progress_media;
switch_time_t hungup;
switch_time_t transferred;
struct switch_channel_timetable *next;
@@ -225,8 +227,6 @@
/*!
* Start iterating over the entries in the channel variable list.
* @param channel the channel to intterate the variales for
- * @param pool The pool to allocate the switch_hash_index_t iterator. If this
- * pool is NULL, then an internal, non-thread-safe iterator is used.
* @remark Use switch_hash_next and switch_hash_this with this function to iterate all the channel variables
*/
SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_channel_t *channel);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_console.h Mon May 26 12:59:57 2008
@@ -58,18 +58,22 @@
*/
SWITCH_DECLARE(void) switch_console_loop(void);
+#ifndef SWIG
/*!
\brief A method akin to printf that allows you to redirect output to a specific console "channel"
*/
SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line,
const char *fmt, ...) PRINTF_FUNCTION(5, 6);
+#endif
SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_raw_write(switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen);
+#ifndef SWIG
/*!
\brief A method akin to printf for dealing with api streams
*/
SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_write(switch_stream_handle_t *handle, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
+#endif
SWITCH_END_EXTERN_C
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h Mon May 26 12:59:57 2008
@@ -124,6 +124,7 @@
\param session the session to add the bug to
\param callback a callback for events
\param user_data arbitrary user data
+ \param stop_time absolute time at which the bug is automatically removed
\param flags flags to choose the stream
\param new_bug pointer to assign new bug to
\return SWITCH_STATUS_SUCCESS if the operation was a success
@@ -214,22 +215,29 @@
\brief Initilize the port allocator
\param start the starting port
\param end the ending port
- \param inc the amount to increment each port
+ \param flags flags to change allocator behaviour (e.g. only even/odd portnumbers)
\param new_allocator new pointer for the return value
\return SWITCH_STATUS_SUCCESS if the operation was a success
*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_new(_In_ switch_port_t start,
- _In_ switch_port_t end,
- _In_ switch_port_flag_t flags,
- _Out_ switch_core_port_allocator_t **new_allocator);
+ _In_ switch_port_t end,
+ _In_ switch_port_flag_t flags,
+ _Out_ switch_core_port_allocator_t **new_allocator);
/*!
\brief Get a port from the port allocator
\param alloc the allocator object
- \param port a pointer to the port
+ \param port_ptr a pointer to the port
\return SUCCESS
*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_request_port(_In_ switch_core_port_allocator_t *alloc, _Out_ switch_port_t *port_ptr);
+
+/*!
+ \brief Return unused port to the port allocator
+ \param alloc the allocator object
+ \param port the port
+ \return SUCCESS
+*/
SWITCH_DECLARE(switch_status_t) switch_core_port_allocator_free_port(_In_ switch_core_port_allocator_t *alloc, _In_ switch_port_t port);
/*!
@@ -724,11 +732,12 @@
/*!
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
\param session the originating session
+ \param var_event - NEEDDESC -
\param endpoint_name the name of the module to use for the new session
\param caller_profile the originator's caller profile
\param new_session a NULL pointer to aim at the newly created session
\param pool optional existing memory pool to donate to the session
- \paeam flags flags to use
+ \param flags flags to use
\return the cause code of the attempted call
*/
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt_ switch_core_session_t *session,
@@ -800,24 +809,49 @@
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event);
+
+/*!
+ \brief Flush the private event queue of a session
+ \param session the session to flush
+ \return SWITCH_STATUS_SUCCESS if the events have been flushed
+*/
SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session);
+
/*!
\brief Read a frame from a session
\param session the session to read from
\param frame a NULL pointer to a frame to aim at the newly read frame
- \param timeout number of milliseconds to wait for data
+ \param flags - NEEDDESC -
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was read
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+/*!
+ \brief Read a video frame from a session
+ \param session the session to read from
+ \param frame a NULL pointer to a frame to aim at the newly read frame
+ \param flags - NEEDDESC -
+ \param stream_id which logical media channel to use
+ \return SWITCH_STATUS_SUCCESS a if the frame was read
+*/
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(_In_ switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
+
+/*!
+ \brief Write a video frame to a session
+ \param session the session to write to
+ \param frame a pointer to a frame to write
+ \param flags - NEEDDESC -
+ \param stream_id which logical media channel to use
+ \return SWITCH_STATUS_SUCCESS a if the frame was written
+*/
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(_In_ switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
/*!
\brief Reset the buffers and resampler on a session
\param session the session to reset
+ \param flush_dtmf flush all queued dtmf events too
*/
SWITCH_DECLARE(void) switch_core_session_reset(_In_ switch_core_session_t *session, switch_bool_t flush_dtmf);
@@ -825,7 +859,7 @@
\brief Write a frame to a session
\param session the session to write to
\param frame the frame to write
- \param timeout number of milliseconds to wait for data
+ \param flags - NEEDDESC -
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was written
*/
@@ -834,7 +868,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_perform_kill_channel(_In_ switch_core_session_t *session,
const char *file, const char *func, int line, switch_signal_t sig);
-/*!
+/*!
\brief Send a signal to a channel
\param session session to send signal to
\param sig signal to send
@@ -1498,13 +1532,14 @@
/*!
\brief Change user and/or group of the running process
- \long Several possible combinations:
- - user only (group NULL): switch to user and his primary group (and supplementary groups, if supported)
- - user and group: switch to user and specified group (only)
- - group only (user NULL): switch group only
\param user name of the user to switch to (or NULL)
\param group name of the group to switch to (or NULL)
\return 0 on success, -1 otherwise
+
+ Several possible combinations:
+ - user only (group NULL): switch to user and his primary group (and supplementary groups, if supported)
+ - user and group: switch to user and specified group (only)
+ - group only (user NULL): switch group only
*/
SWITCH_DECLARE(int32_t) change_user_group(const char *user, const char *group);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h Mon May 26 12:59:57 2008
@@ -192,14 +192,14 @@
SWITCH_DECLARE(void) setPrivate(char *var, void *val);
SWITCH_DECLARE(void *)getPrivate(char *var);
SWITCH_DECLARE(const char *)getVariable(char *var);
- SWITCH_DECLARE(switch_status_t) process_callback_result(char *ret);
+ SWITCH_DECLARE(switch_status_t) process_callback_result(char *result);
SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
/** \brief Record to a file
- * \param filename
+ * \param file_name
* \param <[max_len]> maximum length of the recording in seconds
- * \param <[silence_threshold]> energy level audio must fall below
+ * \param <[silence_threshold]> energy level audio must fall below
* to be considered silence (500 is a good starting point).
* \param <[silence_secs]> seconds of silence to interrupt the record.
*/
@@ -214,12 +214,13 @@
/** \brief Originate a call to a destination
*
- * \param a_leg_sessoin - the session where the call is originating from
- * and also the session in which _this_ session was
- * created
+ * \param a_leg_session - the session where the call is originating from
+ * and also the session in which _this_ session was
+ * created
* \param dest - a string representing destination, eg, sofia/mydomain.com/foo@bar.com
+ * \param timeout - time to wait for call to be answered
* \return an int status code indicating success or failure
- *
+ *
*/
SWITCH_DECLARE(int) originate(CoreSession *a_leg_session,
char *dest,
@@ -227,12 +228,12 @@
/** \brief set a DTMF callback function
- *
- * The DTMF callback function will be set and persist
- * for the life of the session, and be called when a dtmf
- * is pressed by user during streamfile(), collectDigits(), and
- * certain other methods are executing.
- *
+ *
+ * The DTMF callback function will be set and persist
+ * for the life of the session, and be called when a dtmf
+ * is pressed by user during streamfile(), collectDigits(), and
+ * certain other methods are executing.
+ *
*/
SWITCH_DECLARE(void) setDTMFCallback(void *cbfunc, char *funcargs);
@@ -240,14 +241,14 @@
SWITCH_DECLARE(void) set_tts_parms(char *tts_name, char *voice_name);
/**
- * For timeout milliseconds, call the dtmf function set previously
+ * For timeout milliseconds, call the dtmf function set previously
* by setDTMFCallback whenever a dtmf or event is received
*/
SWITCH_DECLARE(int) collectDigits(int timeout);
/**
- * Collect up to maxdigits digits worth of digits
- * and store them in dtmf_buf. In the case of mod_python, the
+ * Collect up to maxdigits digits worth of digits
+ * and store them in dtmf_buf. In the case of mod_python, the
* dtmf_buf parameter is configured to act as a _return_ value,
* (see mod_python.i). This does NOT call any callbacks upon
* receiving dtmf digits. For that, use collectDigits.
@@ -268,12 +269,12 @@
/** \brief Play a file into channel and collect dtmfs
*
- * See API docs in switch_ivr.h: switch_play_and_get_digits(..)
- *
- * NOTE: this does not call any dtmf callbacks set by
- * setDTMFCallback(..) as it uses its own internal callback
- * handler.
- */
+ * See API docs in switch_ivr.h: switch_play_and_get_digits(..)
+ *
+ * NOTE: this does not call any dtmf callbacks set by
+ * setDTMFCallback(..) as it uses its own internal callback
+ * handler.
+ */
SWITCH_DECLARE(char *) playAndGetDigits(int min_digits,
int max_digits,
int max_tries,
@@ -287,7 +288,7 @@
*
* \param file - the path to the .wav/.mp3 to be played
* \param starting_sample_count - the index of the sample to
- * start playing from
+ * start playing from
* \return an int status code indicating success or failure
*
*/
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h Mon May 26 12:59:57 2008
@@ -167,6 +167,7 @@
*/
SWITCH_DECLARE(char *) switch_event_get_body(switch_event_t *event);
+#ifndef SWIG
/*!
\brief Add a header to an event
\param event the event to add the header to
@@ -177,7 +178,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_event_add_header(switch_event_t *event, switch_stack_t stack,
const char *header_name, const char *fmt, ...) PRINTF_FUNCTION(4, 5);
-
+#endif
/*!
\brief Add a string header to an event
\param event the event to add the header to
@@ -262,6 +263,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode);
+#ifndef SWIG
/*!
\brief Render a XML representation of an event sutable for printing or network transport
\param event the event to render
@@ -270,6 +272,7 @@
\note the body supplied by this function will supersede an existing body the event may have
*/
SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
+#endif
/*!
\brief Determine if the event system has been initilized
@@ -277,6 +280,7 @@
*/
SWITCH_DECLARE(switch_status_t) switch_event_running(void);
+#ifndef SWIG
/*!
\brief Add a body to an event
\param event the event to add to body to
@@ -285,6 +289,7 @@
\note the body parameter can be shadowed by the switch_event_reserve_subclass_detailed function
*/
SWITCH_DECLARE(switch_status_t) switch_event_add_body(switch_event_t *event, const char *fmt, ...) PRINTF_FUNCTION(2, 3);
+#endif
SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const char *in);
SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char *file, _In_z_ char *func, _In_ int line,
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h Mon May 26 12:59:57 2008
@@ -207,15 +207,41 @@
\brief Record a session to disk
\param session the session to record
\param file the path to the file
+ \param limit stop recording after this amount of time (in ms, 0 = never stop)
\param fh file handle to use (NULL for builtin one)
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t *session, char *file, uint32_t limit, switch_file_handle_t *fh);
+
+/*!
+ \brief Eavesdrop on a another session
+ \param session our session
+ \param uuid the uuid of the session to spy on
+ \param require_group - NEEDDESC -
+ \param flags - NEEDDESC -
+ \return SWITCH_STATUS_SUCESS if all is well
+*/
SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session_t *session,
const char *uuid,
const char *require_group,
switch_eavesdrop_flag_t flags);
+
+/*!
+ \brief - NEEDDESC -
+ \param session the session to displace
+ \param file
+ \param limit
+ \param flags
+ \return SWITCH_STATUS_SUCCESS if all is well
+*/
SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_t *session, const char *file, uint32_t limit, const char *flags);
+
+/*!
+ \brief Stop displacing a session
+ \param session the session
+ \param file - NEEDDESC -
+ \return SWITCH_STATUS_SUCCESS if all is well
+*/
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_displace_session(switch_core_session_t *session, const char *file);
/*!
@@ -244,6 +270,7 @@
/*!
\brief Start generating DTMF inband
\param session the session to generate on
+ \param read_stream - NEEDDESC -
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_core_session_t *session, switch_bool_t read_stream);
@@ -256,7 +283,7 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_generate_session(switch_core_session_t *session);
/*!
- \brief XXX DESCRIBE ME
+ \brief - NEEDDESC -
\param session the session to act on
\return SWITCH_STATUS_SUCCESS if all is well - maybe more XXX FIXME
*/
@@ -464,6 +491,7 @@
\brief Signal the session with a protocol specific hold message.
\param uuid the uuid of the session to hold
\param message optional message
+ \param moh play music-on-hold
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_hold_uuid(const char *uuid, const char *message, switch_bool_t moh);
@@ -479,6 +507,7 @@
\brief Signal the session with a protocol specific hold message.
\param session the session to hold
\param message optional message
+ \param moh play music-on-hold
\return SWITCH_STATUS_SUCCESS if all is well
*/
SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh);
@@ -638,8 +667,13 @@
*\param name A pointer to the name of this menu.
*\param greeting_sound Optional pointer to a main sound (press 1 for this 2 for that).
*\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
- *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
*\param invalid_sound Optional pointer to a sound to play after invalid input.
+ *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
+ *\param confirm_macro - NEEDDESC -
+ *\param confirm_key - NEEDDESC -
+ *\param confirm_attempts - NEEDDESC -
+ *\param inter_timeout - NEEDDESC -
+ *\param digit_len - NEEDDESC -
*\param timeout A number of milliseconds to pause before looping.
*\param max_failures Maximum number of failures to withstand before hangingup This resets everytime you enter the menu.
*\param pool memory pool (NULL to create one).
@@ -738,7 +772,8 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
switch_input_args_t *args);
SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms);
-SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid);
+SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen);
+SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg);
SWITCH_DECLARE(void) switch_ivr_park_session(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t *session, switch_core_session_t *peer_session);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_log.h Mon May 26 12:59:57 2008
@@ -82,13 +82,14 @@
*/
SWITCH_DECLARE(switch_status_t) switch_log_shutdown(void);
-
+#ifndef SWIG
/*!
\brief Write log data to the logging engine
\param channel the log channel to write to
\param file the current file
\param func the current function
\param line the current line
+ \param userdata ununsed
\param level the current log level
\param fmt desired format
\param ... variable args
@@ -98,7 +99,7 @@
_In_z_ const char *func, _In_ int line,
_In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
_In_z_ _Printf_format_string_ const char *fmt, ...) PRINTF_FUNCTION(7, 8);
-
+#endif
/*!
\brief Shut down the logging engine
\note to be called at application termination by the core
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h Mon May 26 12:59:57 2008
@@ -92,7 +92,7 @@
switch_size_t data_len;
switch_size_t alloc_len;
switch_size_t alloc_chunk;
- switch_event_t *event;
+ switch_event_t *param_event;
};
struct switch_io_event_hooks;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h Mon May 26 12:59:57 2008
@@ -293,6 +293,7 @@
\param datalen a pointer to the datalen
\param payload_type the IANA payload of the packet
\param flags flags
+ \param io_flags i/o flags
\return the number of bytes read
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void *data, uint32_t * datalen,
@@ -301,10 +302,17 @@
/*!
\brief Queue RFC2833 DTMF data into an RTP Session
\param rtp_session the rtp session to use
- \param digits the digit string to queue
- \param duration the duration of the dtmf
+ \param dtmf the dtmf digits to queue
+ \return SWITCH_STATUS_SUCCESS on success
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
+
+/*!
+ \brief Queue RFC2833 DTMF data into an RTP Session - NEEDDESC -
+ \param rtp_session the rtp session to use
+ \param dtmf the dtmf digits to queue
+ \return SWITCH_STATUS_SUCCESS on success
+*/
SWITCH_DECLARE(switch_status_t) switch_rtp_queue_rfc2833_in(switch_rtp_t *rtp_session, const switch_dtmf_t *dtmf);
/*!
@@ -329,6 +337,7 @@
\param datalen a pointer to the datalen
\param payload_type the IANA payload of the packet
\param flags flags
+ \param io_flags i/o flags
\return the number of bytes read
*/
SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read(switch_rtp_t *rtp_session,
@@ -338,9 +347,10 @@
\brief Read data from a given RTP session without copying
\param rtp_session the RTP session to read from
\param frame a frame to populate with information
+ \param io_flags i/o flags
\return the number of bytes read
*/
-SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flagsm);
+SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp_session, switch_frame_t *frame, switch_io_flag_t io_flags);
/*!
\brief Enable VAD on an RTP Session
@@ -376,7 +386,6 @@
\param m set mark bit or not
\param payload the IANA payload number
\param ts then number of bytes to increment the timestamp by
- \param ssrc the ssrc
\param flags frame flags
\return the number of bytes written
*/
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_stun.h Mon May 26 12:59:57 2008
@@ -226,6 +226,7 @@
/*!
\brief Increment an attribute pointer to the next attribute in it's packet
\param attribute the pointer to increment
+ \param end pointer to the end of the buffer
\return true or false depending on if there are any more attributes
*/
#define switch_stun_packet_next_attribute(attribute, end) (attribute && (attribute = (switch_stun_packet_attribute_t *) (attribute->value + switch_stun_attribute_padded_length(attribute))) && ((void *)attribute < end) && attribute->length && ((void *)(attribute + switch_stun_attribute_padded_length(attribute)) < end))
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h Mon May 26 12:59:57 2008
@@ -140,6 +140,7 @@
#define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
#define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
+#define SWITCH_DISABLE_APP_LOG_VARIABLE "disable_app_log"
#define SWITCH_SPEECH_KEY "speech"
#define SWITCH_UUID_BRIDGE "uuid_bridge"
#define SWITCH_BITS_PER_BYTE 8
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h Mon May 26 12:59:57 2008
@@ -154,8 +154,8 @@
*/
#define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
-#define end_of(_s) *(_s + strlen(_s) - 1)
-#define end_of_p(_s) (_s + strlen(_s) - 1)
+#define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1)
+#define end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1)
/*!
\brief Test for the existance of a flag on an arbitary object
\param obj the object to test
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_xml.h Mon May 26 12:59:57 2008
@@ -189,8 +189,17 @@
///\brief Converts an switch_xml structure back to xml. Returns a string of xml data that
///\ must be freed.
///\param xml the xml node
+///\param prn_header add <?xml version..> header too
///\return the xml text string
SWITCH_DECLARE(char *) switch_xml_toxml(switch_xml_t xml, switch_bool_t prn_header);
+
+///\brief Converts an switch_xml structure back to xml using the buffer passed in the parameters.
+///\param xml the xml node
+///\param buf buffer to use
+///\param buflen size of buffer
+///\param offset offset to start at
+///\param prn_header add <?xml version..> header too
+///\return the xml text string
SWITCH_DECLARE(char *) switch_xml_toxml_buf(switch_xml_t xml, char *buf, switch_size_t buflen, switch_size_t offset, switch_bool_t prn_header);
///\brief returns a NULL terminated array of processing instructions for the given
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c Mon May 26 12:59:57 2008
@@ -114,9 +114,9 @@
char *host = NULL;
const char *err = NULL;
- if (stream->event && (host = switch_event_get_header(stream->event, "http-host"))) {
+ if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
- if ((path_info = switch_event_get_header(stream->event, "http-path-info"))) {
+ if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
cmd = path_info;
delim = '/';
}
@@ -200,9 +200,9 @@
char *host = NULL;
const char *err = NULL;
- if (stream->event && (host = switch_event_get_header(stream->event, "http-host"))) {
+ if (stream->param_event && (host = switch_event_get_header(stream->param_event, "http-host"))) {
stream->write_function(stream, "Content-Type: text/xml\r\n\r\n");
- if ((path_info = switch_event_get_header(stream->event, "http-path-info"))) {
+ if ((path_info = switch_event_get_header(stream->param_event, "http-path-info"))) {
cmd = path_info;
delim = '/';
}
@@ -522,8 +522,8 @@
switch_core_measure_time(switch_core_uptime(), &duration);
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
+ if (stream->param_event) {
+ http = switch_event_get_header(stream->param_event, "http-host");
}
if (http || (cmd && strstr(cmd, "html"))) {
@@ -1943,8 +1943,8 @@
}
}
- if (stream->event) {
- holder.http = switch_event_get_header(stream->event, "http-host");
+ if (stream->param_event) {
+ holder.http = switch_event_get_header(stream->param_event, "http-host");
}
holder.print_title = 1;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c Mon May 26 12:59:57 2008
@@ -3663,8 +3663,8 @@
return SWITCH_STATUS_FALSE;
}
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
+ if (stream->param_event) {
+ http = switch_event_get_header(stream->param_event, "http-host");
}
if (http) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c Mon May 26 12:59:57 2008
@@ -217,10 +217,35 @@
}
}
-#define INTERCEPT_SYNTAX "<uuid>"
+#define INTERCEPT_SYNTAX "[-bleg] <uuid>"
SWITCH_STANDARD_APP(intercept_function)
{
- switch_ivr_intercept_session(session, data);
+ int argc;
+ char *argv[4] = { 0 };
+ char *mydata;
+ char *uuid;
+ switch_bool_t bleg = SWITCH_FALSE;
+
+ if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+ if (!strcasecmp(argv[0], "-bleg")) {
+ if (argv[1]) {
+ uuid = argv[1];
+ bleg = SWITCH_TRUE;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", INTERCEPT_SYNTAX);
+ return;
+ }
+ } else {
+ uuid = argv[0];
+ }
+
+ switch_ivr_intercept_session(session, uuid, bleg);
+ }
+ return;
+ }
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Usage: %s\n", INTERCEPT_SYNTAX);
}
#define MAX_SPY 3000
@@ -1233,6 +1258,19 @@
dtmf handler function you can hook up to be executed when a digit is dialed during playback
if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
*/
+static switch_status_t bridge_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
+{
+ char *str = (char *) buf;
+
+ if (str && input && itype == SWITCH_INPUT_TYPE_DTMF) {
+ switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+ if (strchr(str, dtmf->digit)) {
+ return SWITCH_STATUS_BREAK;
+ }
+ }
+ return SWITCH_STATUS_SUCCESS;
+}
+
static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
{
switch (itype) {
@@ -1810,7 +1848,29 @@
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
switch_ivr_signal_bridge(session, peer_session);
} else {
- switch_ivr_multi_threaded_bridge(session, peer_session, NULL, NULL, NULL);
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ switch_channel_t *peer_channel = switch_core_session_get_channel(peer_session);
+ char *a_key = (char *)switch_channel_get_variable(channel, "bridge_terminate_key");
+ char *b_key = (char *)switch_channel_get_variable(peer_channel, "bridge_terminate_key");
+ int ok = 0;
+ switch_input_callback_function_t func = NULL;
+
+ if (a_key) {
+ a_key = switch_core_session_strdup(session, a_key);
+ ok++;
+ }
+ if (b_key) {
+ b_key = switch_core_session_strdup(session, b_key);
+ ok++;
+ }
+ if (ok) {
+ func = bridge_on_dtmf;
+ } else {
+ a_key = NULL;
+ b_key = NULL;
+ }
+
+ switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
}
}
end:
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c Mon May 26 12:59:57 2008
@@ -740,13 +740,13 @@
pop = NULL;
if (moh && do_wait) {
- switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args);
+ switch_status_t moh_status = switch_ivr_play_file(session, NULL, moh, &args);
memset(&args, 0, sizeof(args));
args.read_frame_callback = consumer_read_frame_callback;
args.user_data = node_list;
switch_ivr_play_file(session, NULL, moh, &args);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
+ if (!SWITCH_READ_ACCEPTABLE(moh_status)) {
break;
}
}
@@ -1153,13 +1153,13 @@
if (!x) {
stream->write_function(stream, "none\n");
}
- } else {
- if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
- len = node_consumer_wait_count(node);
- }
+ } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) {
+ len = node_consumer_wait_count(node);
switch_mutex_lock(node->mutex);
stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len);
switch_mutex_unlock(node->mutex);
+ } else {
+ stream->write_function(stream, "none\n");
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c Mon May 26 12:59:57 2008
@@ -952,8 +952,10 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
}
if (switch_channel_ready(channel)) {
+ /* TODO Rel 1.0 : Add Playback of Prompt <message is too short, please rerecord your message>, then go back at record_file */
goto record_file;
} else {
+ status = SWITCH_STATUS_BREAK;
goto end;
}
} else {
@@ -1741,7 +1743,9 @@
switch_file_handle_t fh = { 0 };
switch_input_args_t args = { 0 };
char *email_vm = NULL;
+ char *email_vm_notify = NULL;
int send_mail = 0;
+ int send_mail_only = 0;
cc_t cc = { 0 };
char *read_flags = NORMAL_FLAG_STRING;
int priority = 3;
@@ -1804,8 +1808,12 @@
if (!strcasecmp(var, "vm-mailto")) {
email_vm = switch_core_session_strdup(session, val);
+ } else if (!strcasecmp(var, "vm-mailto-notify")) {
+ email_vm_notify = switch_core_session_strdup(session, val);
} else if (!strcasecmp(var, "email-addr")) {
email_addr = val;
+ } else if (!strcasecmp(var, "vm-email-only")) {
+ send_mail_only = switch_true(val);
} else if (!strcasecmp(var, "vm-email-all-messages")) {
send_mail = switch_true(val);
} else if (!strcasecmp(var, "vm-delete-file")) {
@@ -1944,7 +1952,7 @@
}
}
- if (!send_mail && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ if (!send_mail_only && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
char *usql;
switch_event_t *event;
char *mwi_id = NULL;
@@ -1979,7 +1987,7 @@
end:
- if (send_mail && !switch_strlen_zero(email_vm)) {
+ if (send_mail && !switch_strlen_zero(email_vm) && switch_file_exists(file_path, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event;
char *from;
char *body;
@@ -2080,10 +2088,13 @@
} else {
switch_simple_email(email_vm, from, header_string, body, NULL);
}
+ if (!switch_strlen_zero(email_vm_notify)) {
+ switch_simple_email(email_vm_notify, from, header_string, body, NULL);
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", email_vm);
switch_safe_free(body);
- if (email_delete) {
+ if (email_delete && send_mail_only) {
if (unlink(file_path) != 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", file_path);
}
@@ -2417,8 +2428,8 @@
struct holder holder;
char *ref = NULL;
- if (stream->event) {
- ref = switch_event_get_header(stream->event, "http-referer");
+ if (stream->param_event) {
+ ref = switch_event_get_header(stream->param_event, "http-referer");
}
sql = switch_mprintf("select * from voicemail_msgs where username='%s' and domain='%s' and file_path like '%%%s'", user, domain, file);
@@ -2516,7 +2527,7 @@
strcmp(argv[10], URGENT_FLAG_STRING) ? "normal" : "urgent", create_date, heard, duration_str);
switch_snprintf(title_b4, sizeof(title_b4), "%s <%s> %s", argv[5], argv[6], rss_date);
- switch_url_encode(title_b4, title_aft, sizeof(title_aft)-1);
+ switch_url_encode(title_b4, title_aft, sizeof(title_aft));
holder->stream->write_function(holder->stream,
"<br><object width=550 height=15 \n"
@@ -2766,13 +2777,13 @@
return SWITCH_STATUS_FALSE;
}
- if (stream->event) {
- host = switch_event_get_header(stream->event, "http-host");
- port = switch_event_get_header(stream->event, "http-port");
- uri = switch_event_get_header(stream->event, "http-uri");
- user = switch_event_get_header(stream->event, "freeswitch-user");
- domain = switch_event_get_header(stream->event, "freeswitch-domain");
- path_info = switch_event_get_header(stream->event, "http-path-info");
+ if (stream->param_event) {
+ host = switch_event_get_header(stream->param_event, "http-host");
+ port = switch_event_get_header(stream->param_event, "http-port");
+ uri = switch_event_get_header(stream->param_event, "http-uri");
+ user = switch_event_get_header(stream->param_event, "freeswitch-user");
+ domain = switch_event_get_header(stream->param_event, "freeswitch-domain");
+ path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
if (!switch_strlen_zero(cmd)) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c Mon May 26 12:59:57 2008
@@ -1532,8 +1532,8 @@
char cmd_buf[1024] = "";
char *http = NULL;
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
+ if (stream->param_event) {
+ http = switch_event_get_header(stream->param_event, "http-host");
}
@@ -1553,7 +1553,7 @@
#if 0
switch_event_header_t *hp;
stream->write_function(stream, "<pre>");
- for (hp = stream->event->headers; hp; hp = hp->next) {
+ for (hp = stream->param_event->headers; hp; hp = hp->next) {
stream->write_function(stream, "[%s]=[%s]\n", hp->name, hp->value);
}
stream->write_function(stream, "</pre>");
@@ -1561,8 +1561,8 @@
stream->write_function(stream, "Content-type: text/html\n\n");
- wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
- action = switch_event_get_header(stream->event, "action");
+ wcmd = switch_str_nil(switch_event_get_header(stream->param_event, "wcmd"));
+ action = switch_event_get_header(stream->param_event, "action");
if (action) {
if (strlen(action) == 1) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c Mon May 26 12:59:57 2008
@@ -1538,19 +1538,19 @@
"pa dtmf <digit string>\n"
"pa flags [on|off] [ear] [mouth]\n"
"pa devlist\n"
- "pa indev [#<num>|<partial name>\n"
- "pa outdev [#<num>|<partial name>\n"
- "pa ringdev [#<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
+ "pa indev #<num>|<partial name>\n"
+ "pa outdev #<num>|<partial name>\n"
+ "pa ringdev #<num>|<partial name>\n" "--------------------------------------------------------------------------------\n";
- if (stream->event) {
- http = switch_event_get_header(stream->event, "http-host");
+ if (stream->param_event) {
+ http = switch_event_get_header(stream->param_event, "http-host");
}
if (http) {
stream->write_function(stream, "Content-type: text/html\n\n");
- wcmd = switch_str_nil(switch_event_get_header(stream->event, "wcmd"));
- action = switch_event_get_header(stream->event, "action");
+ wcmd = switch_str_nil(switch_event_get_header(stream->param_event, "wcmd"));
+ action = switch_event_get_header(stream->param_event, "action");
if (action) {
if (strlen(action) == 1) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c Mon May 26 12:59:57 2008
@@ -1497,6 +1497,7 @@
char *p;
sofia_profile_t *profile = NULL;
const char *exclude_contact = NULL;
+ char *reply = "";
if (!cmd) {
stream->write_function(stream, "%s", "");
@@ -1543,11 +1544,13 @@
if (profile) {
struct cb_helper cb;
switch_stream_handle_t mystream = { 0 };
+
if (!domain || !strchr(domain, '.')) {
domain = profile->name;
}
SWITCH_STANDARD_STREAM(mystream);
+ switch_assert(mystream.data);
cb.profile = profile;
cb.stream = &mystream;
@@ -1561,19 +1564,20 @@
switch_assert(sql);
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
switch_safe_free(sql);
- if (mystream.data) {
- char *str = mystream.data;
- *(str + (strlen(str) - 1)) = '\0';
+ reply = (char *) mystream.data;
+ if (!switch_strlen_zero(reply) && end_of(reply) == ',') {
+ end_of(reply) = '\0';
}
- stream->write_function(stream, "%s", mystream.data);
+ stream->write_function(stream, "%s", reply);
+ reply = NULL;
switch_safe_free(mystream.data);
- goto end;
}
}
- stream->write_function(stream, "%s", "");
+ if (reply) {
+ stream->write_function(stream, "%s", reply);
+ }
-end:
switch_safe_free(data);
if (profile) {
@@ -1856,7 +1860,7 @@
tech_pvt->dest_to = switch_core_session_sprintf(nsession, "sip:%s@%s", dest_to, host);
}
}
-
+
if (!tech_pvt->dest_to) {
tech_pvt->dest_to = tech_pvt->dest;
@@ -1886,6 +1890,8 @@
cause = SWITCH_CAUSE_SUCCESS;
if (session) {
+ switch_channel_t *o_channel = switch_core_session_get_channel(session);
+
switch_ivr_transfer_variable(session, nsession, SOFIA_REPLACES_HEADER);
switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
@@ -1903,6 +1909,19 @@
tech_pvt->bte = ctech_pvt->te;
tech_pvt->bcng_pt = ctech_pvt->cng_pt;
}
+
+ if (switch_channel_test_flag(o_channel, CF_PROXY_MEDIA)) {
+ const char *r_sdp = switch_channel_get_variable(o_channel, SWITCH_R_SDP_VARIABLE);
+
+ if (switch_stristr("m=video", r_sdp)) {
+ sofia_glue_tech_choose_video_port(tech_pvt, 1);
+ tech_pvt->video_rm_encoding = "PROXY-VID";
+ tech_pvt->video_rm_rate = 90000;
+ tech_pvt->video_codec_ms = 0;
+ switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
+ switch_set_flag(tech_pvt, TFLAG_VIDEO);
+ }
+ }
}
goto done;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h Mon May 26 12:59:57 2008
@@ -145,7 +145,9 @@
PFLAG_WORKER_RUNNING = (1 << 17),
PFLAG_UNREG_OPTIONS_FAIL = (1 << 18),
PFLAG_DISABLE_TIMER = (1 << 19),
- PFLAG_DISABLE_100REL = (1 << 20)
+ PFLAG_DISABLE_100REL = (1 << 20),
+ PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
+ PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22)
} PFLAGS;
typedef enum {
@@ -555,7 +557,7 @@
switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
void sofia_glue_do_xfer_invite(switch_core_session_t *session);
uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
- sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event);
+ sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event, const char *is_nat);
extern switch_endpoint_interface_t *sofia_endpoint_interface;
void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
switch_status_t sofia_on_hangup(switch_core_session_t *session);
@@ -634,4 +636,6 @@
switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
void sofia_presence_event_thread_start(void);
void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id);
+switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force);
+switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c Mon May 26 12:59:57 2008
@@ -549,6 +549,7 @@
TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)),
TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)),
NTATAG_UDP_MTU(65536),
+ NTATAG_SERVER_RPORT(2),
TAG_IF(tportlog, TPTAG_LOG(1)),
TAG_END()); /* Last tag should always finish the sequence */
@@ -591,6 +592,7 @@
node->nua = nua_create(profile->s_root, /* Event loop */
sofia_event_callback, /* Callback for processing events */
profile, /* Additional data to pass to callback */
+ NTATAG_SERVER_RPORT(2),
NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */
nua_set_params(node->nua,
@@ -1122,6 +1124,10 @@
switch_set_flag(profile, TFLAG_LATE_NEGOTIATION);
} else if (!strcasecmp(var, "inbound-proxy-media") && switch_true(val)) {
switch_set_flag(profile, TFLAG_PROXY_MEDIA);
+ } else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
+ profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
+ } else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
+ profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
} else if (!strcasecmp(var, "rfc2833-pt")) {
profile->te = (switch_payload_t) atoi(val);
} else if (!strcasecmp(var, "cng-pt")) {
@@ -2049,6 +2055,7 @@
goto done;
}
}
+
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
&& (other_session = switch_core_session_locate(uuid))) {
other_channel = switch_core_session_get_channel(other_session);
@@ -2084,9 +2091,7 @@
}
if (switch_channel_get_state(channel) == CS_HIBERNATE) {
switch_set_flag_locked(tech_pvt, TFLAG_READY);
- if (switch_channel_get_state(channel) == CS_NEW) {
- switch_channel_set_state(channel, CS_INIT);
- }
+ switch_channel_set_state(channel, CS_INIT);
switch_set_flag(tech_pvt, TFLAG_SDP);
}
goto done;
@@ -2652,7 +2657,7 @@
int is_auth = 0, calling_myself = 0;
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
int network_port = 0;
- char *sticky = NULL, *is_nat = NULL;
+ char *is_nat = NULL;
if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
@@ -2664,12 +2669,26 @@
nua_respond(nh, SIP_503_SERVICE_UNAVAILABLE, TAG_END());
return;
}
-
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
-
- if (profile->nat_acl_count) {
+
+ if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sip && sip->sip_via) {
+ const char *port = sip->sip_via->v_port;
+ const char *host = sip->sip_via->v_host;
+
+ if (host && sip->sip_via->v_received) {
+ is_nat = "via received";
+ } else if (host && strcmp(network_ip, host)) {
+ is_nat = "via host";
+ } else if (port && atoi(port) != network_port) {
+ is_nat = "via port";
+ }
+ }
+ }
+
+ if (!is_nat && profile->nat_acl_count) {
uint32_t x = 0;
int ok = 1;
char *last_acl = NULL;
@@ -2692,7 +2711,6 @@
}
}
}
-
if (profile->acl_count) {
uint32_t x = 0;
@@ -2723,33 +2741,28 @@
}
}
}
-
if (!is_auth &&
((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
calling_myself++;
} else {
- if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event)) {
+ if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event, NULL)) {
if (v_event) {
switch_event_destroy(&v_event);
}
- switch_safe_free(sticky);
return;
}
- switch_safe_free(sticky);
}
is_auth++;
}
-
if (!(sip->sip_contact && sip->sip_contact->m_url)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
nua_respond(nh, 400, "Missing Contact Header", TAG_END());
return;
}
-
if (!sofia_endpoint_interface || !(session = switch_core_session_request(sofia_endpoint_interface, NULL))) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
return;
@@ -2761,6 +2774,8 @@
switch_core_session_destroy(&session);
return;
}
+
+
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip);
@@ -3194,7 +3209,7 @@
if (is_nat) {
switch_set_flag(tech_pvt, TFLAG_NAT);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on acl %s\n", is_nat);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on %s\n", is_nat);
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c Mon May 26 12:59:57 2008
@@ -35,8 +35,6 @@
#include "mod_sofia.h"
#include <switch_stun.h>
-switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt);
-switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force);
void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force)
{
@@ -222,7 +220,7 @@
if (switch_test_flag(tech_pvt, TFLAG_VIDEO)) {
if (!switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && !switch_channel_test_flag(tech_pvt->channel, CF_EARLY_MEDIA) &&
!tech_pvt->local_sdp_video_port) {
- sofia_glue_tech_choose_video_port(tech_pvt);
+ sofia_glue_tech_choose_video_port(tech_pvt, 0);
}
if ((v_port = tech_pvt->adv_sdp_video_port)) {
@@ -518,14 +516,16 @@
return SWITCH_STATUS_SUCCESS;
}
-switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt)
+switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force)
{
char *ip = tech_pvt->profile->rtpip;
switch_port_t sdp_port;
char tmp[50];
- if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->adv_sdp_video_port) {
- return SWITCH_STATUS_SUCCESS;
+ if (!force) {
+ if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || tech_pvt->local_sdp_video_port) {
+ return SWITCH_STATUS_SUCCESS;
+ }
}
if (tech_pvt->local_sdp_video_port) {
@@ -714,7 +714,8 @@
const char *err;
char rip[128] = "";
char rp[128] = "";
- char *p, *ip_ptr = NULL, *port_ptr = NULL;
+ char rvp[128] = "";
+ char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL;
int x;
if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
@@ -728,6 +729,10 @@
if ((p = (char *)switch_stristr("m=audio ", tech_pvt->remote_sdp_str))) {
port_ptr = p + 8;
}
+
+ if ((p = (char *)switch_stristr("m=video ", tech_pvt->remote_sdp_str))) {
+ vid_port_ptr = p + 8;
+ }
if (!(ip_ptr && port_ptr)) {
return SWITCH_STATUS_FALSE;
@@ -747,12 +752,46 @@
p++;
}
+ p = vid_port_ptr;
+ x = 0;
+ while(x < sizeof(rvp) && p && *p && (*p >= '0' && *p <= '9')) {
+ rvp[x++] = *p;
+ p++;
+ }
+
+
if (switch_strlen_zero(tech_pvt->remote_sdp_audio_ip) || !tech_pvt->remote_sdp_audio_port) {
tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, rip);
tech_pvt->remote_sdp_audio_port = (switch_port_t) atoi(rp);
}
- if (!strcmp(tech_pvt->remote_sdp_audio_ip, rip) && atoi(rp) == tech_pvt->remote_sdp_audio_port) {
+ if (*rvp) {
+ tech_pvt->remote_sdp_video_ip = switch_core_session_strdup(tech_pvt->session, rip);
+ tech_pvt->remote_sdp_video_port = (switch_port_t) atoi(rvp);
+ }
+
+ if (tech_pvt->remote_sdp_video_ip && tech_pvt->remote_sdp_video_port) {
+ if (!strcmp(tech_pvt->remote_sdp_video_ip, rip) && atoi(rvp) == tech_pvt->remote_sdp_video_port) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote video address:port [%s:%d] has not changed.\n",
+ tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
+ } else {
+ switch_set_flag_locked(tech_pvt, TFLAG_VIDEO);
+ switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
+ if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
+ if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, &err) !=
+ SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
+ tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port);
+ /* Reactivate the NAT buster flag. */
+ switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+ }
+ }
+ }
+ }
+
+ if (tech_pvt->remote_sdp_audio_ip && !strcmp(tech_pvt->remote_sdp_audio_ip, rip) && atoi(rp) == tech_pvt->remote_sdp_audio_port) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
return SWITCH_STATUS_SUCCESS;
@@ -777,14 +816,14 @@
void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
{
switch_size_t len;
- char *p, *q, *ip_ptr = NULL, *port_ptr = NULL;
+ char *p, *q, *ip_ptr = NULL, *port_ptr = NULL, *vport_ptr = NULL;
int x;
if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
return;
}
- len = strlen(tech_pvt->local_sdp_str) + 256;
+ len = strlen(tech_pvt->local_sdp_str) + 384;
if ((p = (char *)switch_stristr("c=IN IP4 ", tech_pvt->local_sdp_str))) {
ip_ptr = p + 9;
@@ -798,6 +837,10 @@
if ((p = (char *)switch_stristr("m=audio ", tech_pvt->local_sdp_str))) {
port_ptr = p + 8;
}
+
+ if ((p = (char *)switch_stristr("m=video ", tech_pvt->local_sdp_str))) {
+ vport_ptr = p + 8;
+ }
if (!(ip_ptr && port_ptr)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s SDP has no audio in it.\n%s\n",
@@ -805,6 +848,13 @@
return;
}
+ if (vport_ptr) {
+ sofia_glue_tech_choose_video_port(tech_pvt, 1);
+ tech_pvt->video_rm_encoding = "PROXY-VID";
+ tech_pvt->video_rm_rate = 90000;
+ tech_pvt->video_codec_ms = 0;
+ }
+
if (switch_strlen_zero(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(tech_pvt->channel));
@@ -840,6 +890,16 @@
while(p && *p && (*p >= '0' && *p <= '9')) {
p++;
}
+ } else if (vport_ptr && tech_pvt->adv_sdp_video_port && p == vport_ptr) {
+ char port_buf[25] = "";
+
+ switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_video_port);
+ strncpy(q, port_buf, strlen(port_buf));
+ q += strlen(port_buf);
+ x = 0;
+ while(p && *p && (*p >= '0' && *p <= '9')) {
+ p++;
+ }
}
*q++ = *p++;
@@ -868,7 +928,7 @@
uint32_t session_timeout = 0;
const char *val;
const char *rep;
- char *sticky;
+ char *sticky = NULL;
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
@@ -1001,19 +1061,15 @@
SIPTAG_CONTACT_STR(invite_contact),
TAG_END());
-
- if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
- (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
- ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+
+ if (strstr(tech_pvt->dest, ";nat") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+ switch_set_flag(tech_pvt, TFLAG_NAT);
tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
sticky = tech_pvt->record_route;
session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
switch_channel_set_variable(channel, "sip_nat_detected", "true");
}
-
-
-
-
+
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
@@ -1104,7 +1160,6 @@
sofia_glue_tech_patch_sdp(tech_pvt);
}
-
nua_invite(tech_pvt->nh,
NUTAG_AUTOANSWER(0),
NUTAG_SESSION_TIMER(session_timeout),
@@ -1112,6 +1167,7 @@
TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
+ TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1),
@@ -1544,14 +1600,16 @@
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
- switch_channel_get_name(tech_pvt->channel),
- tech_pvt->local_sdp_audio_ip,
- tech_pvt->local_sdp_audio_port,
- tech_pvt->remote_sdp_audio_ip,
- tech_pvt->remote_sdp_audio_port,
- tech_pvt->agreed_pt,
- tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ if (!switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
+ switch_channel_get_name(tech_pvt->channel),
+ tech_pvt->local_sdp_audio_ip,
+ tech_pvt->local_sdp_audio_port,
+ tech_pvt->remote_sdp_audio_ip,
+ tech_pvt->remote_sdp_audio_port,
+ tech_pvt->agreed_pt,
+ tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ }
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
@@ -1571,13 +1629,23 @@
}
goto video;
}
-
+
if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
goto end;
}
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
timer_name = NULL;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
+ switch_channel_get_name(tech_pvt->channel),
+ tech_pvt->local_sdp_audio_ip,
+ tech_pvt->local_sdp_audio_port,
+ tech_pvt->remote_sdp_audio_ip,
+ tech_pvt->remote_sdp_audio_port,
+ tech_pvt->agreed_pt,
+ tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+
} else {
timer_name = tech_pvt->profile->timer_name;
}
@@ -1687,13 +1755,17 @@
sofia_glue_check_video_codecs(tech_pvt);
- if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding) {
+ if (switch_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
if (!tech_pvt->local_sdp_video_port) {
- sofia_glue_tech_choose_video_port(tech_pvt);
+ sofia_glue_tech_choose_video_port(tech_pvt, 1);
}
flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+
+ if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
+ flags |= SWITCH_RTP_FLAG_PROXY_MEDIA;
+ }
sofia_glue_tech_set_video_codec(tech_pvt, 0);
/* set video timer to 10ms so it can co-exist with audio */
@@ -1709,7 +1781,8 @@
&err,
switch_core_session_get_pool(tech_pvt->session));
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%sVIDEO RTP [%s] %s:%d->%s:%d codec: %u ms: %d [%s]\n",
+ switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) ? "PROXY " : "",
switch_channel_get_name(tech_pvt->channel),
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_video_port,
@@ -2130,7 +2203,8 @@
int framerate = 0;
const switch_codec_implementation_t *mimp = NULL;
int vmatch = 0, i;
-
+ switch_channel_set_variable(tech_pvt->channel, "video_possible", "true");
+
connection = sdp->sdp_connection;
if (m->m_connections) {
connection = m->m_connections;
@@ -2152,7 +2226,7 @@
if (!(rm_encoding = map->rm_encoding)) {
rm_encoding = "";
}
-
+
for (i = 0; i < tech_pvt->num_codecs; i++) {
const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
@@ -2204,6 +2278,7 @@
}
}
+
switch_set_flag_locked(tech_pvt, TFLAG_SDP);
return match;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c Mon May 26 12:59:57 2008
@@ -274,23 +274,21 @@
switch_safe_free(sql);
- if (h.total) {
- sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'",
- stream.data, user, host);
+
+ sql = switch_mprintf("select sip_user,sip_host,contact,'%q' from sip_registrations where sip_user='%q' and sip_host='%q'",
+ stream.data, user, host);
- switch_assert (sql != NULL);
- sofia_glue_execute_sql_callback(profile,
- SWITCH_FALSE,
- profile->ireg_mutex,
- sql,
- sofia_presence_mwi_callback2,
- &h);
-
- switch_safe_free(sql);
- }
-
+ switch_assert (sql != NULL);
+ sofia_glue_execute_sql_callback(profile,
+ SWITCH_FALSE,
+ profile->ireg_mutex,
+ sql,
+ sofia_presence_mwi_callback2,
+ &h);
+
+ switch_safe_free(sql);
switch_safe_free(stream.data);
@@ -1136,7 +1134,7 @@
char *sub_to_user = argv[0];
char *sub_to_host = argv[1];
char *event = "message-summary";
- char *contact = argv[2];
+ char *contact, *o_contact = argv[2];
char *body = argv[3];
char *id = NULL;
nua_handle_t *nh;
@@ -1145,7 +1143,7 @@
id = switch_mprintf("sip:%s@%s", sub_to_user, sub_to_host);
- contact = sofia_glue_get_url_from_contact(contact, 0);
+ contact = sofia_glue_get_url_from_contact(o_contact, 1);
nh = nua_handle(h->profile->nua, NULL,
NUTAG_URL(contact),
@@ -1156,8 +1154,10 @@
nua_notify(nh,
NUTAG_NEWSUB(1),
+ TAG_IF(strstr(o_contact, ";nat"), NUTAG_PROXY(contact)),
SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR("application/simple-message-summary"), SIPTAG_PAYLOAD_STR(body), TAG_END());
-
+
+ switch_safe_free(contact);
switch_safe_free(id);
return 0;
@@ -1189,40 +1189,97 @@
switch_event_t *sevent;
int sub_state;
int sent_reply = 0;
+ su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
+ int network_port = 0;
+ char network_ip[80];
+ const char *contact_host, *contact_user;
+ char *port;
+ char new_port[25] = "";
+ char *is_nat = NULL;
+
+ if (!(contact && sip->sip_contact->m_url)) {
+ nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END());
+ return;
+ }
+
+ get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
+ network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
tl_gets(tags,
NUTAG_SUBSTATE_REF(sub_state), TAG_END());
event = sip_header_as_string(profile->home, (void *) sip->sip_event);
- if (contact) {
- char *port = (char *) contact->m_url->url_port;
- char new_port[25] = "";
-
- display = contact->m_display;
-
- if (switch_strlen_zero(display)) {
- if (from) {
- display = from->a_display;
- if (switch_strlen_zero(display)) {
- display = "\"user\"";
- }
+ port = (char *) contact->m_url->url_port;
+ contact_host = sip->sip_contact->m_url->url_host;
+ contact_user = sip->sip_contact->m_url->url_user;
+
+ display = contact->m_display;
+
+ if (switch_strlen_zero(display)) {
+ if (from) {
+ display = from->a_display;
+ if (switch_strlen_zero(display)) {
+ display = "\"user\"";
}
- } else {
- display = "\"user\"";
}
-
- if (port) {
- switch_snprintf(new_port, sizeof(new_port), ":%s", port);
+ } else {
+ display = "\"user\"";
+ }
+
+ if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sip && sip->sip_via) {
+ const char *v_port = sip->sip_via->v_port;
+ const char *v_host = sip->sip_via->v_host;
+
+ if (v_host && sip->sip_via->v_received) {
+ is_nat = "via received";
+ } else if (v_host && strcmp(network_ip, v_host)) {
+ is_nat = "via host";
+ } else if (v_port && atoi(v_port) != network_port) {
+ is_nat = "via port";
+ }
}
+ }
- if (contact->m_url->url_params) {
- contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>",
- display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params);
- } else {
- contact_str = switch_mprintf("%s <sip:%s@%s%s>", display, contact->m_url->url_user, contact->m_url->url_host, new_port);
+ if (!is_nat && profile->nat_acl_count) {
+ uint32_t x = 0;
+ int ok = 1;
+ char *last_acl = NULL;
+
+ if (!switch_strlen_zero(contact_host)) {
+ for (x = 0 ; x < profile->nat_acl_count; x++) {
+ last_acl = profile->nat_acl[x];
+ if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
+ break;
+ }
+ }
+
+ if (ok) {
+ is_nat = last_acl;
+ }
}
}
+
+
+ if (is_nat) {
+ contact_host = network_ip;
+ switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
+ port = NULL;
+ }
+
+
+ if (port) {
+ switch_snprintf(new_port, sizeof(new_port), ":%s", port);
+ }
+
+ if (contact->m_url->url_params) {
+ contact_str = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
+ display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params, is_nat ? ";nat" : "");
+ } else {
+ contact_str = switch_mprintf("%s <sip:%s@%s%s>%s", display, contact->m_url->url_user, contact_host, new_port, is_nat ? ";nat" : "");
+ }
+
if (to) {
to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host); //, to->a_url->url_port);
@@ -1336,14 +1393,25 @@
switch_mutex_unlock(profile->ireg_mutex);
+
if (status < 200) {
- nua_respond(nh, SIP_202_ACCEPTED,
+ char *sticky = NULL;
+
+ if (is_nat) {
+ sticky = switch_mprintf("sip:%s@%s:%d", contact_user, network_ip, network_port);
+ }
+
+ nua_respond(nh, SIP_202_ACCEPTED,
NUTAG_WITH_THIS(nua),
SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
+ TAG_IF(sticky, NUTAG_PROXY(sticky)),
//SIPTAG_FROM(sip->sip_to),
//SIPTAG_TO(sip->sip_from),
//SIPTAG_CONTACT_STR(contact_str),
TAG_END());
+
+ switch_safe_free(sticky);
+
}
sent_reply++;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c Mon May 26 12:59:57 2008
@@ -333,7 +333,7 @@
if (now) {
- switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%NATHACK%%'");
+ switch_snprintf(sql, sizeof(sql), "select * from sip_registrations where status like '%%AUTO-NAT%%'");
sofia_glue_execute_sql_callback(profile,
SWITCH_TRUE,
NULL,
@@ -414,7 +414,7 @@
}
uint8_t sofia_reg_handle_register(nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sip_t const *sip, sofia_regtype_t regtype, char *key,
- uint32_t keylen, switch_event_t **v_event)
+ uint32_t keylen, switch_event_t **v_event, const char *is_nat)
{
sip_to_t const *to = NULL;
sip_expires_t const *expires = NULL;
@@ -439,6 +439,7 @@
const char *reg_desc = "Registered";
const char *call_id = NULL;
char *force_user;
+ char received_data[128] = "";
/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
@@ -465,8 +466,16 @@
if (contact->m_url) {
const char *port = contact->m_url->url_port;
char new_port[25] = "";
+ const char *contact_host = contact->m_url->url_host;
display = contact->m_display;
-
+
+ if (is_nat) {
+ reg_desc = "Registered(AUTO-NAT)";
+ contact_host = network_ip;
+ switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
+ port = NULL;
+ }
+
if (switch_strlen_zero(display)) {
if (to) {
display = to->a_display;
@@ -480,11 +489,19 @@
switch_snprintf(new_port, sizeof(new_port), ":%s", port);
}
+ if (is_nat && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+ switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
+ }
+
if (contact->m_url->url_params) {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>",
- display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s;%s>%s%s",
+ display, contact->m_url->url_user, contact_host, new_port, contact->m_url->url_params,
+ received_data,
+ is_nat ? ";nat" : "");
} else {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>", display, contact->m_url->url_user, contact->m_url->url_host, new_port);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s%s>%s%s", display, contact->m_url->url_user, contact_host, new_port,
+ received_data,
+ is_nat ? ";nat" : "");
}
}
@@ -526,18 +543,23 @@
}
if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) {
+
+ if (*received_data && (profile->pflags & PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
+ switch_snprintf(received_data, sizeof(received_data), ";received=\"%s:%d\"", network_ip, network_port);
+ }
+
if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
if (contact->m_url->url_params) {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
- display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>%s;nat",
+ display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params, received_data);
} else {
- switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
+ switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>%s;nat", display, contact->m_url->url_user, network_ip, network_port, received_data);
}
if (strstr(v_contact_str, "tls")) {
reg_desc = "Registered(TLSHACK)";
} else {
- reg_desc = "Registered(NATHACK)";
+ reg_desc = "Registered(AUTO-NAT)";
exptime = 20;
}
nat_hack = 1;
@@ -609,8 +631,6 @@
sql = switch_mprintf("insert into sip_registrations values ('%q', '%q','%q','%q','%q', '%q', %ld, '%q')", call_id,
to_user, to_host, contact_str, reg_desc,
rpid, (long) switch_timestamp(NULL) + (long) exptime * 2, agent);
-
-
if (sql) {
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
@@ -698,38 +718,52 @@
if (regtype == REG_REGISTER) {
char *new_contact = NULL;
+ char new_port[30] = "";
+ char exp_param[128] = "";
+
+ if (exptime) {
+ switch_snprintf(exp_param, sizeof(exp_param), ";expires=%ld", exptime);
+ }
+
+
+ if (contact->m_url->url_port) {
+ switch_snprintf(new_port, sizeof(new_port), ":%s", contact->m_url->url_port);
+ }
+
+ if (contact->m_url->url_params) {
+ new_contact = switch_mprintf("%s <sip:%s@%s%s;%s>%s",
+ display, contact->m_url->url_user, contact->m_url->url_host, new_port, contact->m_url->url_params,
+ exp_param);
+ } else {
+ new_contact = switch_mprintf("%s <sip:%s@%s%s>%s",
+ display, contact->m_url->url_user, contact->m_url->url_host, new_port,
+ exp_param);
+ }
+
+ nua_respond(nh,
+ SIP_200_OK,
+ SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
+ switch_safe_free(new_contact);
if (exptime) {
- if (nat_hack) {
- new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
- } else {
- new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
- }
- nua_respond(nh,
- SIP_200_OK,
- SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
- switch_safe_free(new_contact);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", "%s", profile->name);
switch_event_fire(&event);
- }
- } else {
- nua_respond(nh,
- SIP_200_OK,
- SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
-
- if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
- switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
- switch_event_fire(&s_event);
+ } else {
+ if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
+ switch_event_fire(&s_event);
+ }
}
}
+
return 1;
}
@@ -747,6 +781,7 @@
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
sofia_regtype_t type = REG_REGISTER;
int network_port = 0;
+ char *is_nat = NULL;
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
@@ -765,6 +800,45 @@
goto end;
}
+ if ((profile->pflags & PFLAG_AGGRESSIVE_NAT_DETECTION)) {
+ if (sip && sip->sip_via) {
+ const char *port = sip->sip_via->v_port;
+ const char *host = sip->sip_via->v_host;
+
+ if (host && sip->sip_via->v_received) {
+ is_nat = "via received";
+ } else if (host && strcmp(network_ip, host)) {
+ is_nat = "via host";
+ } else if (port && atoi(port) != network_port) {
+ is_nat = "via port";
+ }
+ }
+ }
+
+ if (!is_nat && profile->nat_acl_count) {
+ uint32_t x = 0;
+ int ok = 1;
+ char *last_acl = NULL;
+ const char *contact_host = NULL;
+
+ if (sip && sip->sip_contact && sip->sip_contact->m_url) {
+ contact_host = sip->sip_contact->m_url->url_host;
+ }
+
+ if (!switch_strlen_zero(contact_host)) {
+ for (x = 0 ; x < profile->nat_acl_count; x++) {
+ last_acl = profile->nat_acl[x];
+ if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
+ break;
+ }
+ }
+
+ if (ok) {
+ is_nat = last_acl;
+ }
+ }
+ }
+
if (profile->reg_acl_count) {
uint32_t x = 0;
int ok = 1;
@@ -796,7 +870,7 @@
goto end;
}
- sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event);
+ sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event, is_nat);
if (v_event) {
switch_event_fire(&v_event);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c Mon May 26 12:59:57 2008
@@ -471,7 +471,7 @@
static void woomera_printf(woomera_profile * profile, switch_socket_t * socket, char *fmt, ...)
{
- char *stuff;
+ char *stuff = NULL;
size_t res = 0, len = 0;
va_list ap;
@@ -479,13 +479,13 @@
#ifndef vasprintf
stuff = (char *) malloc(10240);
switch_assert(stuff);
- vsnprintf(stuff, 10240, fmt, ap);
+ res = vsnprintf(stuff, 10240, fmt, ap);
#else
res = vasprintf(&stuff, fmt, ap);
switch_assert(stuff);
#endif
va_end(ap);
- if (res == -1) {
+ if (res < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of memory\n");
} else {
if (profile && globals.debug) {
@@ -494,10 +494,11 @@
}
len = strlen(stuff);
switch_socket_send(socket, stuff, &len);
+ }
+ if (stuff) {
free(stuff);
}
-
}
static char *woomera_message_header(woomera_message * wmsg, char *key)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c Mon May 26 12:59:57 2008
@@ -120,10 +120,9 @@
if (switch_dir_open(&source->dir_handle, source->location, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
- return NULL;
+ goto done;
}
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "open directory: %s\n", source->location);
switch_yield(1000000);
while(RUNNING) {
@@ -181,11 +180,11 @@
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
- return NULL;
+ switch_dir_close(source->dir_handle);
+ source->dir_handle = NULL;
+ goto done;
}
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
-
while (RUNNING) {
switch_core_timer_next(&timer);
olen = source->samples;
@@ -231,6 +230,9 @@
source->dir_handle = NULL;
}
+done:
+ switch_buffer_destroy(&audio_buffer);
+
if (fd > -1) {
close(fd);
}
@@ -252,7 +254,7 @@
return SWITCH_STATUS_FALSE;
}
- alt_path = switch_mprintf("%s%s%d", path, SWITCH_PATH_SEPARATOR, handle->samplerate);
+ alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
switch_mutex_lock(globals.mutex);
if ((source = switch_core_hash_find(globals.source_hash, alt_path))) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_shout/mod_shout.c Mon May 26 12:59:57 2008
@@ -1017,7 +1017,7 @@
argv[1], argv[4], argv[5], argv[7], argv[8] ? argv[8] : "N/A", argv[9] ? argv[9] : "N/A", argv[10], argv[11]);
snprintf(title_b4, sizeof(title_b4), "%s <%s>", argv[4], argv[5]);
- switch_url_encode(title_b4, title_aft, sizeof(title_aft)-1);
+ switch_url_encode(title_b4, title_aft, sizeof(title_aft));
mp3 = switch_mprintf("http://%s:%s%s/mp3/%s/%s.mp3", holder->host, holder->port, holder->uri, argv[0], argv[5]);
m3u = switch_mprintf("http://%s:%s%s/m3u/mp3/%s/%s.mp3.m3u", holder->host, holder->port, holder->uri, argv[0], argv[5]);
@@ -1032,7 +1032,7 @@
void do_telecast(switch_stream_handle_t *stream)
{
- char *path_info = switch_event_get_header(stream->event, "http-path-info");
+ char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
char *uuid = strdup(path_info + 4);
switch_core_session_t *tsession;
char *fname = "stream.mp3";
@@ -1042,7 +1042,7 @@
}
if (!(tsession = switch_core_session_locate(uuid))) {
- char *ref = switch_event_get_header(stream->event, "http-referer");
+ char *ref = switch_event_get_header(stream->param_event, "http-referer");
stream->write_function(stream,"Content-type: text/html\r\n\r\n<h2>Not Found!</h2>\n"
"<META http-equiv=\"refresh\" content=\"1;URL=%s\">", ref);
} else {
@@ -1140,7 +1140,7 @@
void do_broadcast(switch_stream_handle_t *stream)
{
- char *path_info = switch_event_get_header(stream->event, "http-path-info");
+ char *path_info = switch_event_get_header(stream->param_event, "http-path-info");
char *file;
lame_global_flags *gfp = NULL;
switch_file_handle_t fh = {0};
@@ -1254,9 +1254,9 @@
struct holder holder;
char *errmsg;
- holder.host = switch_event_get_header(stream->event, "http-host");
- holder.port = switch_event_get_header(stream->event, "http-port");
- holder.uri = switch_event_get_header(stream->event, "http-uri");
+ holder.host = switch_event_get_header(stream->param_event, "http-host");
+ holder.port = switch_event_get_header(stream->param_event, "http-port");
+ holder.uri = switch_event_get_header(stream->param_event, "http-uri");
holder.stream = stream;
stream->write_function(stream, "Content-type: text/html\r\n\r\n");
@@ -1286,11 +1286,11 @@
return SWITCH_STATUS_FALSE;
}
- if (stream->event) {
- host = switch_event_get_header(stream->event, "http-host");
- port = switch_event_get_header(stream->event, "http-port");
- uri = switch_event_get_header(stream->event, "http-uri");
- path_info = switch_event_get_header(stream->event, "http-path-info");
+ if (stream->param_event) {
+ host = switch_event_get_header(stream->param_event, "http-host");
+ port = switch_event_get_header(stream->param_event, "http-port");
+ uri = switch_event_get_header(stream->param_event, "http-uri");
+ path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
if (!path_info) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c Mon May 26 12:59:57 2008
@@ -149,7 +149,7 @@
switch_zmalloc(alt_path, alt_len);
switch_copy_string(alt_path, path, alt_len);
- if ((last = strrchr(alt_path, *SWITCH_PATH_SEPARATOR))) {
+ if ((last = strrchr(alt_path, '/'))) {
next = ++last;
ldup = strdup(last);
switch_assert(ldup);
@@ -158,7 +158,18 @@
path = alt_path;
}
}
-
+#ifdef WIN32
+ else if ((last = strrchr(alt_path, '\\'))) {
+ next = ++last;
+ ldup = strdup(last);
+ switch_assert(ldup);
+ switch_snprintf(next, alt_len - (last - alt_path), "%d%s%s", handle->samplerate, SWITCH_PATH_SEPARATOR, ldup);
+ if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {
+ path = alt_path;
+ }
+ }
+#endif
+
if (!context->handle) {
if ((context->handle = sf_open(path, mode, &context->sfinfo)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening File [%s] [%s]\n", path, sf_strerror(context->handle));
@@ -323,18 +334,22 @@
char *p;
struct format_map *map = switch_core_permanent_alloc(sizeof(*map));
switch_assert(map);
-
+
map->ext = switch_core_permanent_strdup(info.extension);
map->uext = switch_core_permanent_strdup(info.extension);
map->format = info.format;
- for (p = map->ext; *p; p++) {
- *p = (char) tolower(*p);
+ if (map->ext) {
+ for (p = map->ext; *p; p++) {
+ *p = (char) tolower(*p);
+ }
+ switch_core_hash_insert(globals.format_hash, map->ext, map);
}
- for (p = map->uext; *p; p++) {
- *p = (char) toupper(*p);
+ if (map->uext) {
+ for (p = map->uext; *p; p++) {
+ *p = (char) toupper(*p);
+ }
+ switch_core_hash_insert(globals.format_hash, map->uext, map);
}
- switch_core_hash_insert(globals.format_hash, map->ext, map);
- switch_core_hash_insert(globals.format_hash, map->uext, map);
supported_formats[len++] = (char *) info.extension;
}
format = info.format;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/freeswitch_java.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/freeswitch_java.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/freeswitch_java.cpp Mon May 26 12:59:57 2008
@@ -215,7 +215,7 @@
const char *callbackResultUTF = env->GetStringUTFChars(callbackResult, NULL);
if (callbackResultUTF)
{
- status = process_callback_result((char*) callbackResultUTF, &cb_state, session);
+ status = process_callback_result((char*) callbackResultUTF);
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
}
else
@@ -303,7 +303,7 @@
callbackResultUTF = env->GetStringUTFChars(callbackResult, NULL);
if (callbackResultUTF)
{
- status = process_callback_result((char*) callbackResultUTF, &cb_state, session);
+ status = process_callback_result((char*) callbackResultUTF);
env->ReleaseStringUTFChars(callbackResult, callbackResultUTF);
}
else
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java Mon May 26 12:59:57 2008
@@ -117,8 +117,8 @@
return freeswitchJNI.CoreSession_getVariable(swigCPtr, this, var);
}
- public SWIGTYPE_p_switch_status_t process_callback_result(String ret) {
- return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_process_callback_result(swigCPtr, this, ret), true);
+ public SWIGTYPE_p_switch_status_t process_callback_result(String result) {
+ return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_process_callback_result(swigCPtr, this, result), true);
}
public void say(String tosay, String module_name, String say_type, String say_method) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua.cpp Mon May 26 12:59:57 2008
@@ -113,13 +113,13 @@
}
-static void lua_parse_and_execute(lua_State *L, char *input_code)
+static int lua_parse_and_execute(lua_State *L, char *input_code)
{
int error = 0;
if (switch_strlen_zero(input_code)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
- return;
+ return 1;
}
if (*input_code == '~') {
@@ -172,6 +172,8 @@
}
lua_pop(L, 1); /* pop error message from the stack */
}
+
+ return error;
}
static void *SWITCH_THREAD_FUNC lua_thread_run(switch_thread_t *thread, void *obj)
@@ -298,13 +300,15 @@
lua_State *L = lua_init();
char code[1024] = "";
char *mycmd;
+ int error;
+
if (switch_strlen_zero(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no args specified!\n");
return;
}
snprintf(code, sizeof(code), "~session = freeswitch.Session(\"%s\");", switch_core_session_get_uuid(session));
- lua_parse_and_execute(L, code);
+ error = lua_parse_and_execute(L, code);
mycmd = strdup((char *)data);
switch_assert(mycmd);
@@ -312,10 +316,11 @@
lua_parse_and_execute(L, mycmd);
lua_uninit(L);
free(mycmd);
+
}
SWITCH_STANDARD_API(luarun_api_function) {
-
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
} else {
@@ -331,7 +336,8 @@
lua_State *L = lua_init();
char *mycmd;
-
+ int error;
+
if (switch_strlen_zero(cmd)) {
stream->write_function(stream, "");
} else {
@@ -340,11 +346,17 @@
switch_assert(mycmd);
mod_lua_conjure_stream(L, stream, "stream", 1);
- if (stream->event) {
- mod_lua_conjure_event(L, stream->event, "env", 1);
+ if (stream->param_event) {
+ mod_lua_conjure_event(L, stream->param_event, "env", 1);
}
- lua_parse_and_execute(L, mycmd);
+ if ((error = lua_parse_and_execute(L, mycmd))) {
+ if (switch_event_get_header(stream->param_event, "http-host")) {
+ stream->write_function(stream, "Content-Type: text/html\n\n<H2>Error Executing Script</H2>");
+ } else {
+ stream->write_function(stream, "-ERR encounterd\n");
+ }
+ }
lua_uninit(L);
free(mycmd);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl.c Mon May 26 12:59:57 2008
@@ -266,8 +266,8 @@
if (cmd) {
if (stream) {
mod_perl_conjure_stream(my_perl, stream, "stream");
- if (stream->event) {
- mod_perl_conjure_event(my_perl, stream->event, "env");
+ if (stream->param_event) {
+ mod_perl_conjure_event(my_perl, stream->param_event, "env");
}
}
//Perl_safe_eval(my_perl, cmd);
@@ -497,7 +497,7 @@
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
- SWITCH_ADD_APP(app_interface, "perl", NULL, NULL, perl_function, NULL, SAF_NONE);
+ SWITCH_ADD_APP(app_interface, "perl", NULL, NULL, perl_function, NULL, SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_API(api_interface, "perlrun", "run a script", perlrun_api_function, "<script>");
SWITCH_ADD_API(api_interface, "perl", "run a script", perl_api_function, "<script>");
/* indicate that the module should continue to be loaded */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp Mon May 26 12:59:57 2008
@@ -4675,7 +4675,7 @@
dXSARGS;
if ((items < 2) || (items > 2)) {
- SWIG_croak("Usage: CoreSession_process_callback_result(self,ret);");
+ SWIG_croak("Usage: CoreSession_process_callback_result(self,result);");
}
res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
if (!SWIG_IsOK(res1)) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Mon May 26 12:59:57 2008
@@ -196,7 +196,7 @@
if (argc > 1) {
char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
char *hval = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
- switch_event_add_header(ro->stream->event, SWITCH_STACK_BOTTOM, hname, "%s", hval);
+ switch_event_add_header(ro->stream->param_event, SWITCH_STACK_BOTTOM, hname, "%s", hval);
*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
return JS_TRUE;
}
@@ -217,7 +217,7 @@
if (argc > 0) {
char *hname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- char *val = switch_event_get_header(ro->stream->event, hname);
+ char *val = switch_event_get_header(ro->stream->param_event, hname);
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, val));
return JS_TRUE;
}
@@ -243,14 +243,14 @@
if (!strcasecmp(how, "xml")) {
switch_xml_t xml;
char *xmlstr;
- if ((xml = switch_event_xmlize(ro->stream->event, SWITCH_VA_NONE))) {
+ if ((xml = switch_event_xmlize(ro->stream->param_event, SWITCH_VA_NONE))) {
xmlstr = switch_xml_toxml(xml, SWITCH_FALSE);
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, xmlstr));
return JS_TRUE;
}
} else {
char *buf;
- switch_event_serialize(ro->stream->event, &buf, SWITCH_TRUE);
+ switch_event_serialize(ro->stream->param_event, &buf, SWITCH_TRUE);
if (buf) {
*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, buf));
free(buf);
@@ -2174,8 +2174,15 @@
CHANNEL_SANITY_CHECK();
if (argc > 1) {
- cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- cause = switch_channel_str2cause(cause_name);
+ if(JSVAL_IS_INT(argv[0])) {
+ int32 i = 0;
+ JS_ValueToInt32(cx, argv[0], &i);
+ cause = i;
+ }
+ else {
+ cause_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+ cause = switch_channel_str2cause(cause_name);
+ }
}
switch_channel_hangup(channel, cause);
@@ -2424,7 +2431,7 @@
enum session_tinyid {
SESSION_NAME, SESSION_STATE,
PROFILE_DIALPLAN, PROFILE_CID_NAME, PROFILE_CID_NUM, PROFILE_IP, PROFILE_ANI, PROFILE_ANI_II, PROFILE_DEST,
- SESSION_UUID, SESSION_CAUSE
+ SESSION_UUID, SESSION_CAUSE, SESSION_CAUSECODE
};
static JSFunctionSpec session_methods[] = {
@@ -2469,6 +2476,7 @@
{"destination", PROFILE_DEST, JSPROP_READONLY | JSPROP_PERMANENT},
{"uuid", SESSION_UUID, JSPROP_READONLY | JSPROP_PERMANENT},
{"cause", SESSION_CAUSE, JSPROP_READONLY | JSPROP_PERMANENT},
+ {"causecode", SESSION_CAUSECODE, JSPROP_READONLY | JSPROP_PERMANENT},
{0}
};
@@ -2501,6 +2509,11 @@
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(jss->cause)));
}
break;
+ case SESSION_CAUSECODE:
+ if (jss) {
+ *vp = INT_TO_JSVAL(jss->cause);
+ }
+ break;
default:
*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
}
@@ -2511,6 +2524,9 @@
case SESSION_CAUSE:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_cause2str(switch_channel_get_cause(channel))));
break;
+ case SESSION_CAUSECODE:
+ *vp = INT_TO_JSVAL(switch_channel_get_cause(channel));
+ break;
case SESSION_NAME:
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_channel_get_name(channel)));
break;
@@ -3406,8 +3422,8 @@
struct request_obj ro = {0};
char *path_info = NULL;
- if (stream->event) {
- path_info = switch_event_get_header(stream->event, "http-path-info");
+ if (stream->param_event) {
+ path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
if (switch_strlen_zero(cmd) && path_info) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Mon May 26 12:59:57 2008
@@ -56,9 +56,9 @@
* and the default curl activity is to print to stdout, something not as desirable
* so we have a dummy function here
*/
-static void httpCallBack()
+static size_t httpCallBack(char *buffer, size_t size, size_t nitems, void *outstream)
{
- return;
+ return size * nitems;
}
static switch_status_t my_on_hangup(switch_core_session_t *session)
@@ -130,10 +130,10 @@
xml_text_escaped = malloc(need_bytes);
switch_assert(xml_text_escaped);
- memset(xml_text_escaped, 0, sizeof(xml_text_escaped));
+ memset(xml_text_escaped, 0, need_bytes);
if (globals.encode == 1) {
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
- switch_url_encode(xml_text, xml_text_escaped, need_bytes - 1);
+ switch_url_encode(xml_text, xml_text_escaped, need_bytes);
} else {
headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
switch_b64_encode((unsigned char *)xml_text, need_bytes / 3, (unsigned char *)xml_text_escaped, need_bytes);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.2008.vcproj Mon May 26 12:59:57 2008
@@ -39,7 +39,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows""
PreprocessorDefinitions="ABYSS_WIN32"
UsePrecompiledHeader="0"
/>
@@ -103,7 +103,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows""
PreprocessorDefinitions="ABYSS_WIN32"
UsePrecompiledHeader="0"
/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c Mon May 26 12:59:57 2008
@@ -36,19 +36,20 @@
#endif
#include <xmlrpc-c/base.h>
-#ifdef ABYSS_WIN32
-#undef strcasecmp
-#endif
#include <xmlrpc-c/abyss.h>
#include <xmlrpc-c/server.h>
#include <xmlrpc-c/server_abyss.h>
#include "token.h" /* NOTE: From xmlrpc-c's internals */
+#include "http.h"
+#include "session.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_rpc_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown);
SWITCH_MODULE_RUNTIME_FUNCTION(mod_xml_rpc_runtime);
SWITCH_MODULE_DEFINITION(mod_xml_rpc, mod_xml_rpc_load, mod_xml_rpc_shutdown, mod_xml_rpc_runtime);
+static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len);
+
static struct {
uint16_t port;
uint8_t running;
@@ -147,7 +148,8 @@
static abyss_bool http_directory_auth(TSession *r, char *domain_name)
{
- char *p, *x;
+ char *p;
+ char *x;
char z[256], t[80];
char user[512];
char *pass;
@@ -160,13 +162,13 @@
p = RequestHeaderValue(r, "authorization");
if (p) {
- NextToken(&p);
+ NextToken((const char **)&p);
x = GetToken(&p);
if (x) {
if (!strcasecmp(x, "basic")) {
- NextToken(&p);
+ NextToken((const char **)&p);
switch_b64_decode(p, user, sizeof(user));
if ((pass = strchr(user, ':'))) {
*pass++ = '\0';
@@ -177,7 +179,7 @@
*domain_name++ = '\0';
at++;
} else {
- domain_name = r->host;
+ domain_name = (char *)r->requestInfo.host;
if (!strncasecmp(domain_name, "www.", 3)) {
domain_name += 4;
}
@@ -192,7 +194,7 @@
Base64Encode(z, t);
if (!strcmp(p, t)) {
- r->user=strdup(user);
+ r->requestInfo.user=strdup(user);
goto authed;
}
@@ -239,7 +241,7 @@
}
if (!(mypass1 && mypass2)) {
- r->user=strdup(user);
+ r->requestInfo.user=strdup(user);
goto authed;
} else {
if (mypass1) {
@@ -251,7 +253,7 @@
Base64Encode(z, t);
if (!strcmp(p, t)) {
- r->user=strdup(box ? box : user);
+ r->requestInfo.user=strdup(box ? box : user);
goto authed;
}
}
@@ -265,7 +267,7 @@
Base64Encode(z, t);
if (!strcmp(p, t)) {
- r->user=strdup(box ? box : user);
+ r->requestInfo.user=strdup(box ? box : user);
goto authed;
}
}
@@ -280,7 +282,7 @@
Base64Encode(z, t);
if (!strcmp(p, t)) {
- r->user=strdup(box);
+ r->requestInfo.user=strdup(box);
goto authed;
}
}
@@ -295,7 +297,7 @@
Base64Encode(z, t);
if (!strcmp(p, t)) {
- r->user=strdup(box);
+ r->requestInfo.user=strdup(box);
goto authed;
}
}
@@ -305,7 +307,7 @@
authed:
- ResponseAddField(r, "freeswitch-user", r->user);
+ ResponseAddField(r, "freeswitch-user", r->requestInfo.user);
ResponseAddField(r, "freeswitch-domain", domain_name);
if (x_domain_root) {
@@ -334,8 +336,8 @@
char *domain_name, *e;
abyss_bool ret = FALSE;
- if (!strncmp(r->uri, "/domains/", 9)) {
- domain_name = strdup(r->uri + 9);
+ if (!strncmp(r->requestInfo.uri, "/domains/", 9)) {
+ domain_name = strdup(r->requestInfo.uri + 9);
switch_assert(domain_name);
if ((e = strchr(domain_name, '/'))) {
@@ -344,7 +346,7 @@
if (!strcmp(domain_name, "this")) {
free(domain_name);
- domain_name = strdup(r->host);
+ domain_name = strdup(r->requestInfo.host);
}
ret = !http_directory_auth(r, domain_name);
@@ -355,8 +357,8 @@
const char *list[2] = {"index.html", "index.txt"};
int x;
- if (!strncmp(r->uri, "/pub", 4)) {
- char *p = r->uri;
+ if (!strncmp(r->requestInfo.uri, "/pub", 4)) {
+ char *p = (char *)r->requestInfo.uri;
char *new_uri = p + 4;
if (!new_uri) {
new_uri = "/";
@@ -388,11 +390,11 @@
}
}
- r->uri = strdup(new_uri);
+ r->requestInfo.uri = strdup(new_uri);
free(p);
} else {
- if (globals.realm && strncmp(r->uri, "/pub", 4)) {
+ if (globals.realm && strncmp(r->requestInfo.uri, "/pub", 4)) {
ret = !http_directory_auth(r, NULL);
}
}
@@ -400,6 +402,39 @@
return ret;
}
+
+static abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len)
+{
+ if (s->chunkedwrite && s->chunkedwritemode)
+ {
+ char t[16];
+
+ if (ConnWrite(s->conn,t,sprintf(t,"%x"CRLF,len)))
+ if (ConnWrite(s->conn,buffer,len))
+ return ConnWrite(s->conn,CRLF,2);
+
+ return FALSE;
+ }
+
+ return ConnWrite(s->conn,buffer,len);
+}
+
+static abyss_bool HTTPWriteEnd(TSession *s)
+{
+ if (!s->chunkedwritemode)
+ return TRUE;
+
+ if (s->chunkedwrite)
+ {
+ /* May be one day trailer dumping will be added */
+ s->chunkedwritemode=FALSE;
+ return ConnWrite(s->conn,"0"CRLF CRLF,5);
+ }
+
+ s->requestInfo.keepalive=FALSE;
+ return TRUE;
+}
+
abyss_bool handler_hook(TSession * r)
{
//char *mime = "text/html";
@@ -419,14 +454,17 @@
stream.write_function = http_stream_write;
stream.raw_write_function = http_stream_raw_write;
- if ((command = strstr(r->uri, "/api/"))) {
+ if (!r || !r->requestInfo.uri) {
+ return FALSE;
+ }
+
+ if ((command = strstr(r->requestInfo.uri, "/api/"))) {
command += 5;
- } else if ((command = strstr(r->uri, "/webapi/"))) {
+ } else if ((command = strstr(r->requestInfo.uri, "/webapi/"))) {
command += 8;
html++;
} else {
- ret = FALSE;
- goto end;
+ return FALSE;
}
if ((path_info = strchr(command, '/'))) {
@@ -481,41 +519,40 @@
auth:
- if (switch_event_create(&stream.event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
+ if (switch_event_create(&stream.param_event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
const char * const content_length = RequestHeaderValue(r, "content-length");
if (fs_user)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-User", "%s", fs_user);
if (fs_domain)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", "%s", fs_domain);
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", "%s", fs_domain);
if (path_info)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", "%s", path_info);
- if (r->uri)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->uri);
- if (r->query)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", r->query);
- if (r->host)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-HOST", "%s", r->host);
- if (r->from)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-FROM", "%s", r->from);
- if (r->useragent)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-USER-AGENT", "%s", r->useragent);
- if (r->referer)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-REFERER", "%s", r->referer);
- if (r->requestline)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-REQUESTLINE", "%s", r->requestline);
- if (r->user)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-USER", "%s", r->user);
- if (r->port)
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-PORT", "%u", r->port);
- if (r->query || content_length) {
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", "%s", path_info);
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-URI", "%s", r->requestInfo.uri);
+ if (r->requestInfo.query)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", r->requestInfo.query);
+ if (r->requestInfo.host)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-HOST", "%s", r->requestInfo.host);
+ if (r->requestInfo.from)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-FROM", "%s", r->requestInfo.from);
+ if (r->requestInfo.useragent)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-USER-AGENT", "%s", r->requestInfo.useragent);
+ if (r->requestInfo.referer)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-REFERER", "%s", r->requestInfo.referer);
+ if (r->requestInfo.requestline)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-REQUESTLINE", "%s", r->requestInfo.requestline);
+ if (r->requestInfo.user)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-USER", "%s", r->requestInfo.user);
+ if (r->requestInfo.port)
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-PORT", "%u", r->requestInfo.port);
+ if (r->requestInfo.query || content_length) {
char *q, *qd;
char *next;
- char *query = r->query;
+ char *query = (char *)r->requestInfo.query;
char *name, *val;
char qbuf[8192] = "";
- if (r->method == m_post && content_length) {
+ if (r->requestInfo.method == m_post && content_length) {
int len = atoi(content_length);
int qlen = 0;
@@ -541,13 +578,13 @@
if (qlen >= len) {
break;
}
- } while ((succeeded = ConnRead(r->conn, r->server->timeout)));
+ } while ((succeeded = ConnRead(r->conn, 2000)));
query = qbuf;
}
}
if (query) {
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", query);
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", "%s", query);
qd = strdup(query);
switch_assert(qd != NULL);
@@ -573,7 +610,7 @@
name = q;
if ((val = strchr(name, '='))) {
*val++ = '\0';
- switch_event_add_header(stream.event, SWITCH_STACK_BOTTOM, name, "%s", val);
+ switch_event_add_header(stream.param_event, SWITCH_STACK_BOTTOM, name, "%s", val);
}
q = next;
} while (q != NULL);
@@ -593,9 +630,16 @@
//HTTPWrite(r, "<pre>\n\n", 7);
/* generation of the date field */
- if (DateToString(&r->date, buf)) {
- ResponseAddField(r,"Date", buf);
+ {
+ const char * dateValue;
+
+ DateToString(r->date, &dateValue);
+
+ if (dateValue) {
+ ResponseAddField(r, "Date", dateValue);
+ }
}
+
/* Generation of the server field */
ResponseAddField(r,"Server", "FreeSWITCH-" SWITCH_VERSION_FULL "-mod_xml_rpc");
@@ -620,17 +664,24 @@
}
- if (switch_api_execute(command, r->query, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
+ if (switch_api_execute(command, r->requestInfo.query, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
ResponseStatus(r, 200);
- r->done = TRUE;
+ r->responseStarted = TRUE;
+ //r->done = TRUE;
} else {
ResponseStatus(r, 404);
ResponseError(r);
}
- SocketClose(&(r->conn->socket));
+ //SocketClose(&(r->conn->socket));
+
HTTPWriteEnd(r);
- ConnClose(r->conn);
+ //if(r->conn->channelP)
+ //ConnKill(r->conn);
+ //ChannelInterrupt(r->conn->channelP);
+ //ConnClose(r->conn);
+ //ChannelDestroy(r->conn->channelP);
+ r->requestInfo.keepalive = 0;
end:
@@ -755,15 +806,19 @@
ServerCreate(&globals.abyssServer, "XmlRpcServer", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir, logfile);
xmlrpc_server_abyss_set_handler(&env, &globals.abyssServer, "/RPC2", registryP);
+ ServerInit(&globals.abyssServer);
+#if 0
if (ServerInit(&globals.abyssServer) != TRUE) {
globals.running = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to start HTTP Port %d\n", globals.port);
return SWITCH_STATUS_TERM;
}
+#endif
ServerAddHandler(&globals.abyssServer, handler_hook);
ServerAddHandler(&globals.abyssServer, auth_hook);
+ ServerSetKeepaliveTimeout(&globals.abyssServer, 1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Starting HTTP Port %d, DocRoot [%s]\n", globals.port, SWITCH_GLOBAL_dirs.htdocs_dir);
ServerRun(&globals.abyssServer);
globals.running = 0;
@@ -773,8 +828,9 @@
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_rpc_shutdown)
{
- globals.abyssServer.running = 0;
- shutdown(globals.abyssServer.listensock, 2);
+ //globals.abyssServer.running = 0;
+ //shutdown(globals.abyssServer.listensock, 2);
+ ServerTerminate(&globals.abyssServer);
while(globals.running) {
switch_yield(100000);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.vcproj Mon May 26 12:59:57 2008
@@ -22,15 +22,63 @@
CharacterSet="2"
>
<Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows""
PreprocessorDefinitions="ABYSS_WIN32"
UsePrecompiledHeader="0"
/>
<Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
Name="VCLinkerTool"
AdditionalLibraryDirectories="..\..\..\..\libs\xmlrpc\lib;"..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)";"..\..\..\..\libs\apr-util\xml\expat\lib\LibD""
/>
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
</Configuration>
<Configuration
Name="Release|Win32"
@@ -39,15 +87,63 @@
CharacterSet="2"
>
<Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c""
+ AdditionalIncludeDirectories=""$(InputDir)..\..\..\..\libs\xmlrpc-c\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src";"$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include";"$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows""
PreprocessorDefinitions="ABYSS_WIN32"
UsePrecompiledHeader="0"
/>
<Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
Name="VCLinkerTool"
AdditionalLibraryDirectories="..\..\..\..\libs\xmlrpc\lib;"..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)";"..\..\..\..\libs\apr-util\xml\expat\lib\LibR""
/>
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
</Configuration>
</Configurations>
<References>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c Mon May 26 12:59:57 2008
@@ -130,9 +130,10 @@
uint8_t x;
const char *str = "UNKNOWN";
- for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) ; x++) {
+ for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) -1 ; x++) {
if (CAUSE_CHART[x].cause == cause) {
str = CAUSE_CHART[x].name;
+ break;
}
}
@@ -147,9 +148,10 @@
if (*str > 47 && *str < 58) {
cause = atoi(str);
} else {
- for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) && CAUSE_CHART[x].name; x++) {
+ for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) - 1 && CAUSE_CHART[x].name; x++) {
if (!strcasecmp(CAUSE_CHART[x].name, str)) {
cause = CAUSE_CHART[x].cause;
+ break;
}
}
}
@@ -1139,6 +1141,8 @@
if (channel->caller_profile && channel->caller_profile->times) {
channel->caller_profile->times->transferred = caller_profile->times->profile_created;
caller_profile->times->answered = channel->caller_profile->times->answered;
+ caller_profile->times->progress = channel->caller_profile->times->progress;
+ caller_profile->times->progress_media = channel->caller_profile->times->progress_media;
caller_profile->times->created = channel->caller_profile->times->created;
caller_profile->times->hungup = channel->caller_profile->times->hungup;
} else {
@@ -1368,6 +1372,11 @@
if (!switch_channel_test_flag(channel, CF_RING_READY)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
switch_channel_set_flag(channel, CF_RING_READY);
+ if (channel->caller_profile && channel->caller_profile->times) {
+ switch_mutex_lock(channel->profile_mutex);
+ channel->caller_profile->times->progress = switch_timestamp_now();
+ switch_mutex_unlock(channel->profile_mutex);
+ }
return SWITCH_STATUS_SUCCESS;
}
@@ -1392,6 +1401,12 @@
switch_event_fire(&event);
}
+ if (channel->caller_profile && channel->caller_profile->times) {
+ switch_mutex_lock(channel->profile_mutex);
+ channel->caller_profile->times->progress_media = switch_timestamp_now();
+ switch_mutex_unlock(channel->profile_mutex);
+ }
+
/* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send
a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel
*/
@@ -1875,7 +1890,7 @@
encode_buf = tmp;
}
- switch_url_encode(prof[x], encode_buf, encode_len - 1);
+ switch_url_encode(prof[x], encode_buf, encode_len);
stream.write_function(&stream, "%s=%s&", prof_names[x], encode_buf);
}
@@ -1895,7 +1910,7 @@
encode_buf = tmp;
}
- switch_url_encode((char *) val, encode_buf, encode_len - 1);
+ switch_url_encode((char *) val, encode_buf, encode_len);
stream.write_function(&stream, "%s=%s&", (char *) var, encode_buf);
}
@@ -1920,10 +1935,10 @@
switch_caller_profile_t *caller_profile, *ocp;
switch_app_log_t *app_log, *ap;
char *last_app = NULL, *last_arg = NULL;
- char start[80] = "", answer[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
- int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0;
- switch_time_t uduration = 0, legbillusec = 0, billusec = 0;
- time_t tt_created = 0, tt_answered = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created;
+ char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
+ int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
+ switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
+ time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0 , mtt_progress_media = 0;
if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
return SWITCH_STATUS_FALSE;
@@ -1966,6 +1981,18 @@
switch_channel_set_variable(channel, "answer_stamp", answer);
}
+ if (caller_profile->times->progress) {
+ switch_time_exp_lt(&tm, caller_profile->times->progress);
+ switch_strftime(progress, &retsize, sizeof(progress), fmt, &tm);
+ switch_channel_set_variable(channel, "progress_stamp", progress);
+ }
+
+ if (caller_profile->times->progress_media) {
+ switch_time_exp_lt(&tm, caller_profile->times->progress_media);
+ switch_strftime(progress_media, &retsize, sizeof(progress_media), fmt, &tm);
+ switch_channel_set_variable(channel, "progress_media_stamp", progress_media);
+ }
+
switch_time_exp_lt(&tm, caller_profile->times->hungup);
switch_strftime(end, &retsize, sizeof(end), fmt, &tm);
switch_channel_set_variable(channel, "end_stamp", end);
@@ -1991,6 +2018,20 @@
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
switch_channel_set_variable(channel, "answer_uepoch", tmp);
+ tt_progress = (time_t) (caller_profile->times->progress / 1000000);
+ mtt_progress = (time_t) (caller_profile->times->progress / 1000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
+ switch_channel_set_variable(channel, "answer_epoch", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
+
+ tt_progress_media = (time_t) (caller_profile->times->progress_media / 1000000);
+ mtt_progress_media = (time_t) (caller_profile->times->progress_media / 1000);
+ switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress_media);
+ switch_channel_set_variable(channel, "answer_epoch", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
+ switch_channel_set_variable(channel, "answer_uepoch", tmp);
+
tt_hungup = (time_t) (caller_profile->times->hungup / 1000000);
mtt_hungup = (time_t) (caller_profile->times->hungup / 1000);
@@ -2012,6 +2053,20 @@
legbillmsec = (int32_t)(mtt_hungup - mtt_prof_created);
legbillusec = caller_profile->times->hungup - caller_profile->times->profile_created;
}
+
+ if (caller_profile->times->progress) {
+ progresssec = (int32_t)(tt_progress - tt_created);
+ progressmsec = (int32_t)(mtt_progress - mtt_created);
+ progressusec = caller_profile->times->progress - caller_profile->times->created;
+ }
+
+ if (caller_profile->times->progress_media) {
+ progress_mediasec = (int32_t)(tt_progress - tt_created);
+ progress_mediamsec = (int32_t)(mtt_progress - mtt_created);
+ progress_mediausec = caller_profile->times->progress - caller_profile->times->created;
+ }
+
+
}
switch_channel_set_variable(channel, "last_app", last_app);
@@ -2024,6 +2079,12 @@
switch_snprintf(tmp, sizeof(tmp), "%d", billsec);
switch_channel_set_variable(channel, "billsec", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%d", progresssec);
+ switch_channel_set_variable(channel, "progresssec", tmp);
+
+ switch_snprintf(tmp, sizeof(tmp), "%d", progress_mediasec);
+ switch_channel_set_variable(channel, "progress_mediasec", tmp);
+
switch_snprintf(tmp, sizeof(tmp), "%d", legbillsec);
switch_channel_set_variable(channel, "flow_billsec", tmp);
@@ -2033,6 +2094,12 @@
switch_snprintf(tmp, sizeof(tmp), "%d", billmsec);
switch_channel_set_variable(channel, "billmsec", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%d", progressmsec);
+ switch_channel_set_variable(channel, "progressmsec", tmp);
+
+ switch_snprintf(tmp, sizeof(tmp), "%d", progressusec);
+ switch_channel_set_variable(channel, "progress_mediamsec", tmp);
+
switch_snprintf(tmp, sizeof(tmp), "%d", legbillmsec);
switch_channel_set_variable(channel, "flow_billmsec", tmp);
@@ -2042,6 +2109,12 @@
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, billusec);
switch_channel_set_variable(channel, "billusec", tmp);
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, progressusec);
+ switch_channel_set_variable(channel, "progressusec", tmp);
+
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, progress_mediausec);
+ switch_channel_set_variable(channel, "progress_mediausec", tmp);
+
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, legbillusec);
switch_channel_set_variable(channel, "flow_billusec", tmp);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c Mon May 26 12:59:57 2008
@@ -525,7 +525,7 @@
if (h.words == 0) {
stream.write_function(&stream,
"select distinct a1 from complete where "
- "a1 not in (select name from interfaces) and ");
+ "a1 not in (select name from interfaces) %s ", argc ? "and" : "");
} else {
stream.write_function(&stream,
"select distinct a%d from complete where ", h.words + 1);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c Mon May 26 12:59:57 2008
@@ -329,6 +329,9 @@
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
switch_channel_set_flag(peer_channel, CF_PROXY_MEDIA);
+ if (switch_channel_test_flag(channel, CF_VIDEO)) {
+ switch_channel_set_flag(peer_channel, CF_VIDEO);
+ }
}
if (profile) {
@@ -1013,22 +1016,25 @@
const switch_application_interface_t *application_interface, const char *arg) {
switch_app_log_t *log, *lp;
switch_event_t *event;
+ const char *var;
if (!arg) {
arg = "";
}
- log = switch_core_session_alloc(session, sizeof(*log));
+ if (!(var = switch_channel_get_variable(session->channel, SWITCH_DISABLE_APP_LOG_VARIABLE)) || (!(switch_true(var)))) {
+ log = switch_core_session_alloc(session, sizeof(*log));
- log->app = switch_core_session_strdup(session, application_interface->interface_name);
- log->arg = switch_core_session_strdup(session, arg);
+ log->app = switch_core_session_strdup(session, application_interface->interface_name);
+ log->arg = switch_core_session_strdup(session, arg);
- for(lp = session->app_log; lp && lp->next; lp = lp->next);
+ for(lp = session->app_log; lp && lp->next; lp = lp->next);
- if (lp) {
- lp->next = log;
- } else {
- session->app_log = log;
+ if (lp) {
+ lp->next = log;
+ } else {
+ session->app_log = log;
+ }
}
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp Mon May 26 12:59:57 2008
@@ -1036,7 +1036,7 @@
}
-SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *ret)
+SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *result)
{
switch_file_handle_t *fh = NULL;
@@ -1044,7 +1044,7 @@
this_check(SWITCH_STATUS_FALSE);
sanity_check(SWITCH_STATUS_FALSE);
- if (switch_strlen_zero(ret)) {
+ if (switch_strlen_zero(result)) {
return SWITCH_STATUS_SUCCESS;
}
@@ -1076,10 +1076,10 @@
}
- if (!strncasecmp(ret, "speed", 4)) {
+ if (!strncasecmp(result, "speed", 4)) {
char *p;
- if ((p = strchr(ret, ':'))) {
+ if ((p = strchr(result, ':'))) {
p++;
if (*p == '+' || *p == '-') {
int step;
@@ -1096,28 +1096,28 @@
return SWITCH_STATUS_FALSE;
- } else if (!strcasecmp(ret, "pause")) {
+ } else if (!strcasecmp(result, "pause")) {
if (switch_test_flag(fh, SWITCH_FILE_PAUSE)) {
switch_clear_flag(fh, SWITCH_FILE_PAUSE);
} else {
switch_set_flag(fh, SWITCH_FILE_PAUSE);
}
return SWITCH_STATUS_SUCCESS;
- } else if (!strcasecmp(ret, "stop")) {
+ } else if (!strcasecmp(result, "stop")) {
return SWITCH_STATUS_FALSE;
- } else if (!strcasecmp(ret, "restart")) {
+ } else if (!strcasecmp(result, "restart")) {
unsigned int pos = 0;
fh->speed = 0;
switch_core_file_seek(fh, &pos, 0, SEEK_SET);
return SWITCH_STATUS_SUCCESS;
- } else if (!strncasecmp(ret, "seek", 4)) {
+ } else if (!strncasecmp(result, "seek", 4)) {
switch_codec_t *codec;
unsigned int samps = 0;
unsigned int pos = 0;
char *p;
codec = switch_core_session_get_read_codec(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got codec\n");
- if ((p = strchr(ret, ':'))) {
+ if ((p = strchr(result, ':'))) {
p++;
if (*p == '+' || *p == '-') {
int step;
@@ -1146,7 +1146,7 @@
return SWITCH_STATUS_SUCCESS;
}
- if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
+ if (!strcmp(result, "true") || !strcmp(result, "undefined")) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "return success\n");
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c Mon May 26 12:59:57 2008
@@ -770,7 +770,7 @@
/* handle any bad things in the string like newlines : etc that screw up the serialized format */
if (encode) {
- switch_url_encode(hp->value, encode_buf, encode_len - 1);
+ switch_url_encode(hp->value, encode_buf, encode_len);
} else {
switch_snprintf(encode_buf, encode_len, "[%s]", hp->value);
}
@@ -1319,7 +1319,7 @@
encode_buf = tmp;
}
- switch_url_encode(prof[x], encode_buf, encode_len - 1);
+ switch_url_encode(prof[x], encode_buf, encode_len);
stream.write_function(&stream, "%s=%s&", prof_names[x], encode_buf);
}
@@ -1348,7 +1348,7 @@
encode_buf = tmp;
}
- switch_url_encode((char *) val, encode_buf, encode_len - 1);
+ switch_url_encode((char *) val, encode_buf, encode_len);
stream.write_function(&stream, "%s=%s&", (char *) var, encode_buf);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c Mon May 26 12:59:57 2008
@@ -440,12 +440,22 @@
switch_event_t *event;
switch_unicast_conninfo_t *conninfo = NULL;
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
+ uint32_t rate;
+ uint32_t bpf;
if (switch_channel_test_flag(channel, CF_CONTROLLED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that is under control already.\n");
return SWITCH_STATUS_FALSE;
}
+ if (!read_codec || !read_codec->implementation) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot park channels that have no read codec.\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
+ rate = read_codec->implementation->actual_samples_per_second;
+ bpf = read_codec->implementation->bytes_per_frame;
+
if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Careful, Channel is unanswered. Pre-answering...\n");
switch_channel_pre_answer(channel);
@@ -457,7 +467,7 @@
switch_event_fire(&event);
}
- while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED)) {
+ while (read_codec && switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED)) {
if ((status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id)) == SWITCH_STATUS_SUCCESS) {
if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -479,14 +489,14 @@
switch_size_t len = 0;
uint32_t flags = 0;
switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
- uint32_t rate = read_codec->implementation->actual_samples_per_second;
uint32_t dlen = sizeof(decoded);
switch_status_t tstatus;
switch_byte_t *sendbuf = NULL;
uint32_t sendlen = 0;
if (switch_test_flag(read_frame, SFF_CNG)) {
- sendlen = read_codec->implementation->bytes_per_frame;
+ sendlen = bpf;
+ switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE);
memset(decoded, 255, sendlen);
sendbuf = decoded;
tstatus = SWITCH_STATUS_SUCCESS;
@@ -557,6 +567,7 @@
}
}
+
switch_channel_clear_flag(channel, CF_CONTROLLED);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNPARK) == SWITCH_STATUS_SUCCESS) {
@@ -1582,6 +1593,19 @@
switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
switch_xml_set_txt_d(time_tag, tmp);
+ if (!(time_tag = switch_xml_add_child_d(x_times, "progress_time", t_off++))) {
+ goto error;
+ }
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
+ switch_xml_set_txt_d(time_tag, tmp);
+
+
+ if (!(time_tag = switch_xml_add_child_d(x_times, "progress_media_time", t_off++))) {
+ goto error;
+ }
+ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
+ switch_xml_set_txt_d(time_tag, tmp);
+
if (!(time_tag = switch_xml_add_child_d(x_times, "answered_time", t_off++))) {
goto error;
}
@@ -1689,6 +1713,7 @@
return status;
}
+
/* For Emacs:
* Local Variables:
* mode:c
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c Mon May 26 12:59:57 2008
@@ -929,11 +929,43 @@
return status;
}
-SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid)
+SWITCH_DECLARE(switch_status_t) switch_ivr_find_bridged_uuid(const char *uuid, char *b_uuid, switch_size_t blen)
+{
+ switch_core_session_t *rsession;
+ switch_status_t status = SWITCH_STATUS_FALSE;
+
+ switch_assert(uuid);
+
+ if ((rsession = switch_core_session_locate(uuid))) {
+ switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
+ const char *brto;
+
+ if ((brto = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+ switch_copy_string(b_uuid, brto, blen);
+ status = SWITCH_STATUS_SUCCESS;
+ }
+ switch_core_session_rwunlock(rsession);
+ }
+
+ return status;
+
+}
+
+SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session, const char *uuid, switch_bool_t bleg)
{
switch_core_session_t *rsession, *bsession = NULL;
switch_channel_t *channel, *rchannel, *bchannel;
const char *buuid;
+ char brto[SWITCH_UUID_FORMATTED_LENGTH + 1] = "";
+
+ if (bleg) {
+ if (switch_ivr_find_bridged_uuid(uuid, brto, sizeof(brto)) == SWITCH_STATUS_SUCCESS) {
+ uuid = switch_core_session_strdup(session, brto);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid bridged to %s\n", uuid);
+ return;
+ }
+ }
if (switch_strlen_zero(uuid) || !(rsession = switch_core_session_locate(uuid))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid %s\n", uuid);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c Mon May 26 12:59:57 2008
@@ -589,6 +589,7 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, char *script, int32_t loops, switch_input_args_t *args)
{
teletone_generation_session_t ts;
+ switch_dtmf_t dtmf = {0};
switch_buffer_t *audio_buffer;
switch_frame_t *read_frame = NULL;
switch_codec_t *read_codec = NULL, write_codec = { 0 };
@@ -624,6 +625,7 @@
}
for(;;) {
+ int done = 0;
switch_status_t status;
if (!switch_channel_ready(channel)) {
@@ -643,8 +645,37 @@
break;
}
- if (args && (args->read_frame_callback)) {
- if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) {
+ if (args && (args->input_callback || args->buf || args->buflen)) {
+ /*
+ dtmf handler function you can hook up to be executed when a digit is dialed during gentones
+ if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+ */
+ if (switch_channel_has_dtmf(channel)) {
+ if (!args->input_callback && !args->buf) {
+ status = SWITCH_STATUS_BREAK;
+ done = 1;
+ break;
+ }
+ switch_channel_dequeue_dtmf(channel, &dtmf);
+ if (args->input_callback) {
+ status = args->input_callback(session, (void *)&dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen);
+ } else {
+ *((char *)args->buf) = dtmf.digit;
+ status = SWITCH_STATUS_BREAK;
+ }
+ }
+
+ if (args->input_callback) {
+ switch_event_t *event;
+
+ if (switch_core_session_dequeue_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+ status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen);
+ switch_event_destroy(&event);
+ }
+ }
+
+ if (status != SWITCH_STATUS_SUCCESS) {
+ done = 1;
break;
}
}
@@ -735,15 +766,18 @@
dup = switch_core_session_strdup(session, alt);
engine = dup;
- if ((voice = strchr(engine, ':'))) {
- *voice++ = '\0';
- if ((text = strchr(voice, ':'))) {
- *text++ = '\0';
+ if (!switch_strlen_zero(engine)) {
+ if ((voice = strchr(engine, ':'))) {
+ *voice++ = '\0';
+ if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
+ *text++ = '\0';
+ }
}
}
- if (engine && voice && text) {
+
+ if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
return switch_ivr_speak_text(session, engine, voice, text, args);
- } else if (engine && !(voice && text)) {
+ } else if (!switch_strlen_zero(engine) && !(voice && text)) {
text = engine;
engine = (char *)switch_channel_get_variable(channel, "tts_engine");
voice = (char *)switch_channel_get_variable(channel, "tts_voice");
@@ -1386,6 +1420,9 @@
char *tp;
switch_size_t mylen = strlen(text) + extra + 1;
tmp = malloc(mylen);
+ if (!tmp) {
+ return SWITCH_STATUS_MEMERR;
+ }
memset(tmp, 0, mylen);
tp = tmp;
for (p = text; p && *p; p++) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c Mon May 26 12:59:57 2008
@@ -154,13 +154,18 @@
for (impl = ptr->implementations; impl; impl = impl->next) {
if (!impl->iananame) {
load_interface = 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
+ break;
+ }
+ if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
+ load_interface = 0;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
+ "Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name, key);
break;
}
}
- if (!load_interface) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
- "Failed to load codec interface %s from %s due to no iana name in an implementation.\n", ptr->interface_name, key);
- } else {
+ if (load_interface) {
for (impl = ptr->implementations; impl; impl = impl->next) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
"Adding Codec '%s' (%s) %dhz %dms\n",
@@ -1336,28 +1341,31 @@
switch_assert(stream->data != NULL);
switch_assert(stream->write_function != NULL);
- if (!stream->event) {
- switch_event_create(&stream->event, SWITCH_EVENT_API);
+ if (!stream->param_event) {
+ switch_event_create(&stream->param_event, SWITCH_EVENT_API);
}
- if (stream->event) {
+ if (stream->param_event) {
if (cmd) {
- switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command", "%s", cmd);
+ switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", "%s", cmd);
}
if (arg) {
- switch_event_add_header(stream->event, SWITCH_STACK_BOTTOM, "API-Command-Argument", "%s", arg);
+ switch_event_add_header(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", "%s", arg);
}
}
+
if (cmd && (api = switch_loadable_module_get_api_interface(cmd)) != 0) {
- status = api->function(arg, session, stream);
+ if ((status = api->function(arg, session, stream)) != SWITCH_STATUS_SUCCESS) {
+ stream->write_function(stream, "COMMAND RETURNED ERROR!\n");
+ }
} else {
status = SWITCH_STATUS_FALSE;
stream->write_function(stream, "INVALID COMMAND!\n");
}
- if (stream->event) {
- switch_event_fire(&stream->event);
+ if (stream->param_event) {
+ switch_event_fire(&stream->param_event);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c Mon May 26 12:59:57 2008
@@ -268,7 +268,7 @@
memset(&to, 0, sizeof(to));
FD_SET(fd, &can_write);
to.tv_sec = 0;
- to.tv_usec = 5000;
+ to.tv_usec = 100000;
if (select(fd+1, NULL, &can_write, NULL, &to) > 0) {
aok = FD_ISSET(fd, &can_write);
} else {
@@ -298,6 +298,8 @@
node->level = level;
node->content = content;
node->timestamp = now;
+
+
if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
free(node->data);
if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_odbc.c Mon May 26 12:59:57 2008
@@ -144,8 +144,14 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connecting %s\n", handle->dsn);
- result = SQLConnect(handle->con, (SQLCHAR *) handle->dsn, SQL_NTS, (SQLCHAR *) handle->username, SQL_NTS, (SQLCHAR *) handle->password, SQL_NTS);
-
+ if(!strstr(handle->dsn, "DRIVER")) {
+ result = SQLConnect(handle->con, (SQLCHAR *) handle->dsn, SQL_NTS, (SQLCHAR *) handle->username, SQL_NTS, (SQLCHAR *) handle->password, SQL_NTS);
+ } else {
+ SQLCHAR outstr[1024] = {0};
+ SQLSMALLINT outstrlen = 0;
+ result = SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT)strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen, SQL_DRIVER_NOPROMPT);
+ }
+
if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) {
char *err_str;
if ((err_str = switch_odbc_handle_get_error(handle, NULL))) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_pcm.c Mon May 26 12:59:57 2008
@@ -299,6 +299,13 @@
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+ SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
+ switch_core_codec_add_implementation(pool, codec_interface,
+ SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
+ 0, 0, 0, 0, 1, 1, 1,
+ switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
+
+
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 0, "PROXY", NULL, 8000, 8000, 0,
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c Mon May 26 12:59:57 2008
@@ -765,7 +765,7 @@
}
if (!tx_port) {
- *err = "Missing local port";
+ *err = "Missing remote port";
goto end;
}
@@ -1130,7 +1130,34 @@
goto end;
}
- if (bytes > 0) {
+ if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
+ const char *tx_host;
+ const char *old_host;
+ char bufa[30], bufb[30];
+ tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
+ old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
+ if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
+ const char *err;
+ uint32_t old = rtp_session->remote_port;
+
+ if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
+ if (++rtp_session->autoadj_tally >= 10) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+ "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
+ switch_sockaddr_get_port(rtp_session->from_addr));
+ switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), &err);
+ }
+ }
+ }
+ }
+
+ if (bytes && rtp_session->autoadj_window) {
+ if (--rtp_session->autoadj_window == 0) {
+ switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+ }
+ }
+
+ if (bytes) {
rtp_session->missed_count = 0;
}
@@ -1372,33 +1399,6 @@
goto end;
}
- if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
- const char *tx_host;
- const char *old_host;
- char bufa[30], bufb[30];
- tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
- old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
- if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
- const char *err;
- uint32_t old = rtp_session->remote_port;
-
- if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
- if (++rtp_session->autoadj_tally >= 10) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
- "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
- switch_sockaddr_get_port(rtp_session->from_addr));
- switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), &err);
- }
- }
- }
- }
-
- if (rtp_session->autoadj_window) {
- if (--rtp_session->autoadj_window == 0) {
- switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
- }
- }
-
if (bytes && rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) {
goto do_continue;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c Mon May 26 12:59:57 2008
@@ -373,11 +373,10 @@
if ((ifd = open(file, O_RDONLY)) < 1) {
return SWITCH_FALSE;
}
-
- switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
- if (!write_buf(fd, buf)) {
- return SWITCH_FALSE;
- }
+ }
+ switch_snprintf(buf, B64BUFFLEN, "MIME-Version: 1.0\nContent-Type: multipart/mixed; boundary=\"%s\"\n", bound);
+ if (!write_buf(fd, buf)) {
+ return SWITCH_FALSE;
}
if (headers && !write_buf(fd, headers))
@@ -386,15 +385,13 @@
if (!write_buf(fd, "\n\n"))
return SWITCH_FALSE;
- if (file) {
- if (body && switch_stristr("content-type", body)) {
- switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
- } else {
- switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
- }
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
- }
+ if (body && switch_stristr("content-type", body)) {
+ switch_snprintf(buf, B64BUFFLEN, "--%s\n", bound);
+ } else {
+ switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
+ }
+ if (!write_buf(fd, buf))
+ return SWITCH_FALSE;
if (body) {
if (!write_buf(fd, body)) {
@@ -456,11 +453,9 @@
}
- if (file) {
- switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
- if (!write_buf(fd, buf))
- return SWITCH_FALSE;
- }
+ switch_snprintf(buf, B64BUFFLEN, "\n\n--%s--\n.\n", bound);
+ if (!write_buf(fd, buf))
+ return SWITCH_FALSE;
}
if (fd) {
@@ -478,7 +473,6 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "failed to delete file [%s]\n", filename);
}
-
if (file) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Emailed file [%s] to [%s]\n", filename, to);
} else {
@@ -1415,15 +1409,18 @@
return 0;
}
- memset(buf, 0, len);
-
if (!url) {
return 0;
}
+ len--;
+
for (p = url; *p; p++) {
+ if (x >= len) {
+ break;
+ }
if (*p < ' ' || *p > '~' || strchr(urlunsafe, *p)) {
- if ((x + 3) > len) {
+ if ((x + 3) >= len) {
break;
}
buf[x++] = '%';
@@ -1432,10 +1429,9 @@
} else {
buf[x++] = *p;
}
- if (x == len) {
- break;
- }
}
+ buf[x] = '\0';
+
return x;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update Mon May 26 12:59:57 2008
@@ -1 +1 @@
-Wed May 21 00:25:55 CEST 2008
+Sun May 25 11:24:02 EDT 2008
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/RELEASE Mon May 26 12:59:57 2008
@@ -9,6 +9,14 @@
and in less than 10 lines, written in 3rd person English, with
complete sentences />
+Bugs with BYE handling and event fetch/poll (SUBSCRIBE with Expires: 0) have
+been fixed in nua. Bugs with timer handling, RFC2543 dialog/transaction
+matching and gray list handling have been fixed in nta, all introduced by
+release 1.12.8.
+
+Stack now supports some load control with NTATAG_MAX_PROCEEDING(), limiting
+number of initial INVITE transactions being served concurrently.
+
Bugs in blaa and foo have been fixed. The stack now supports
use of foobar...
@@ -24,7 +32,17 @@
**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).
+- Added nta_outgoing_bind() to <sofia-sip/nta.h>.
+- Allow changing TPTAG_LOG() and TPTAG_DUMP() values after tport_create()
+- Added NUTAG_SHUTDOWN_EVENTS(). If NUTAG_SHUTDOWN_EVENTS(1) nua setting is
+ used, nua sends events to application normally during shutdown, too.
+- Added NUTAG_SUB_EXPIRES() - default expiration time of subscription
+- Added NTATAG_MAX_PROCEEDING() - limit number of requests accepted in
+ proceeding queue.
+- Using NUTAG_PROXY()/NTATAG_DEFAULT_PROXY() as handle-specific tag.
+ Previously, NUTAG_PROXY() was ignored if given with nua_set_hparams(),
+ nua_invite(), nua_respond(), etc.
+- Added nua_handle_by_call_id(), nta_leg_by_call_id().
- 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
@@ -38,6 +56,12 @@
Contributors to this release
----------------------------
+- Michael Jerris: fixes, new features NTATAG_MAX_PROCEEDING(),
+ nua_handle_by_call_id(), nta_leg_by_call_id()
+- Colin Whittaker: re-calculating subscription duration when receiving NOTIFY
+- Jerry Richards: fix to sip_header_as_string()
+- Jussi Mutanen: fix to soa handling within nua
+
<list of people who contributed to _this_ release
- update as people's patches are added, or when you commit stuff
- current development team members (see AUTHORS) may be omitted,
@@ -64,6 +88,37 @@
Bugs fixed in this release
--------------------------
+- Fixed sf.net bug #1827511: BYE can now be authenticated with
+ nua_authenticate().
+- Fixed problems re-calculating the subscription duration upon NOTIFY.
+ Thanks to Colin Whittaker for reporting the problem and proposing a fix to
+ the problem.
+- Fixed crash when SOATAG_ORDERED_USER(1) was used and multiple m= lines were
+ added to the session.
+- Fixed problem with an error response terminating the session usage but
+ not triggering nua_i_state event reporting that to application.
+ Thanks to AlienPenguin for reporting the problem
+- Fixed crash and general lossage with event fetch (SUBSCRIBE with Expires: 0)
+ Thanks to Jarkko Riekki for reporting the problem.
+- Handle NULL argument to su_free() gracefully even if free() does not.
+ Thanks for Michael Jerris for submitting the patch.
+- Do not use PT 9 (G722) as invalid PT (currently use 19).
+- Fixed problems handling m�llisecond timers in nta on 64-bit platforms.
+ Thanks to David Knell and Michael Jerris for reporting it.
+- Allow-Events is now included by nua in messages initiating dialogs.
+ Thanks to Jerry Richards for pointing out the problem.
+- Now checking that pointer is not NULL before calling free()
+ Thanks to Michail Jerris for submitting patch.
+- Fixed bug in sip_header_as_string() converting longish header to string
+ Thanks to Jerry Richards for submitting a patch
+- Fixed problem with soa session activation.
+ Thanks to Jussi Mutanen for patch.
+- Fixed problems handling host:port in user-supplied Via headers.
+- Fixed sf.net bug #1930055: nat detection did not un-REGISTER natted contact
+ if fist response to REGISTER was 200 OK.
+- Fixed crashes in soa if m= lines were removed from user sdp.
+
+
< notable bugs fixed in this release
- check the sf.net bug tracker; see closed bugs,
sorted by closing date
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/configure.ac Mon May 26 12:59:57 2008
@@ -105,6 +105,8 @@
PKG_CHECK_MODULES(CHECK, check >= 0.9.4, have_check="yes", have_check="no")
AM_CONDITIONAL(HAVE_CHECK, test x"$have_check" = "xyes")
+AC_CHECK_HEADERS([fnmatch.h])
+
### internal modules
### ----------------
AC_DEFINE([HAVE_SOFIA_SIP], 1, [Define to 1 always])
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Doxyfile.aliases Mon May 26 12:59:57 2008
@@ -54,5 +54,7 @@
"EXP_1_12_7=@since Experimental in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.7.txt\">1.12.7</a>, available if --enable-experimental configuration option is given" \
"VERSION_1_12_8=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
"NEW_1_12_8=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.8.txt\">1.12.8</a>" \
+ "VERSION_1_12_9=<a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
+ "NEW_1_12_9=@since New in <a href=\"http://sofia-sip.sf.net/relnotes/relnotes-sofia-sip-1.12.9.txt\">1.12.9</a>" \
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/Makefile.am Mon May 26 12:59:57 2008
@@ -28,7 +28,7 @@
# Including Doxyfile.rfc in dist breaks make manpages
-Doxyfile.rfc:
+Doxyfile.rfc: Makefile.am
$(AWK) 'END { b="\\"; q="\\\""; \
print "# Autogenerated aliases for RFCs "from" .. "to ; \
print "ALIASES += " b; \
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/docs/conformance.docs Mon May 26 12:59:57 2008
@@ -756,7 +756,7 @@
<a name="3856"></a><a name="3859"></a>
<tr valign=top>
<th align="left">
- @RFC3856: Presence <br />
+ @RFC3856: Presence <br>
@RFC3859: Common Profile for Presence
</th>
<td>
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/http/http_tag_class.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/http/http_tag_class.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/http/http_tag_class.c Mon May 26 12:59:57 2008
@@ -117,10 +117,13 @@
http_header_t const *h, **hh;
http = (http_t const *)src->t_value;
+ if (http == NULL)
+ return dst;
+
mc = (void *)http->http_common->h_class;
hh = (void *)msg_hclass_offset(mc, http, hc);
- if (http == NULL ||
+ if (hh == NULL ||
(char *)hh >= ((char *)http + http->http_size) ||
(char *)hh < (char *)&http->http_request)
return dst;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c Mon May 26 12:59:57 2008
@@ -728,6 +728,9 @@
else
basic = malloc(basiclen + 1);
+ if (basic == NULL)
+ return -1;
+
/*
* Basic authentication consists of username and password separated by
* colon and then base64 encoded.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c Mon May 26 12:59:57 2008
@@ -537,11 +537,10 @@
if (n < 0 || n >= INT_MAX)
continue;
if (n >= upsize) {
- upsize = n + 1;
- userpass = realloc(userpass == buffer ? NULL : userpass, upsize);
- if (userpass == NULL)
- continue;
- base64_d(userpass, upsize - 1, au->au_params[0]);
+ void *b = realloc(userpass == buffer ? NULL : userpass, upsize = n + 1);
+ if (b == NULL)
+ break;
+ base64_d(userpass = b, upsize - 1, au->au_params[0]);
}
userpass[n] = 0;
if (!(pass = strchr(userpass, ':')))
@@ -1079,13 +1078,15 @@
if (!*pass || !*user)
continue;
- realm = ""; ident = "";
-
- if ((realm = strchr(pass, ':'))) {
+ if ((realm = strchr(pass, ':')))
*realm++ = '\0';
- if ((ident = strchr(realm, ':')))
- *ident++ = '\0';
- }
+ else
+ realm = "";
+
+ if ((ident = strchr(realm, ':')))
+ *ident++ = '\0';
+ else
+ ident = "";
apw = fresh + i++;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_basic.c Mon May 26 12:59:57 2008
@@ -212,10 +212,11 @@
msg_payload_t *msg_payload_create(su_home_t *home, void const *data, usize_t len)
{
msg_header_t *h = msg_header_alloc(home, msg_payload_class, len + 1);
- msg_payload_t *pl = h->sh_payload;
- if (pl) {
+ if (h) {
+ msg_payload_t *pl = (msg_payload_t *)h;
char *b = msg_header_data(h->sh_common);
+
if (data)
memcpy(b, data, len);
else
@@ -227,6 +228,7 @@
return pl;
}
+
return NULL;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_mime.c Mon May 26 12:59:57 2008
@@ -1871,8 +1871,10 @@
b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
MSG_STRING_DUP(b, c->c_type, o->c_type);
- c->c_subtype = strchr(c->c_type, '/');
- c->c_subtype++;
+
+ c->c_subtype = c->c_type ? strchr(c->c_type, '/') : NULL;
+ if (c->c_subtype)
+ c->c_subtype++;
assert(b <= end); (void)end;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser.c Mon May 26 12:59:57 2008
@@ -1312,8 +1312,8 @@
char b[], isize_t bsiz,
int eos)
{
- msg_mclass_t const *mc = msg->m_class;
- msg_href_t const *hr = mc->mc_payload;
+ msg_mclass_t const *mc;
+ msg_href_t const *hr;
msg_header_t *h, *h0;
msg_payload_t *pl;
char *x;
@@ -1322,6 +1322,8 @@
return -1;
assert(!msg->m_chunk);
+ mc = msg->m_class;
+ hr = mc->mc_payload;
if (return_payload == NULL)
return_payload = &h0;
@@ -1334,7 +1336,7 @@
return -1;
append_parsed(msg, mo, hr, h, 0);
- pl = h->sh_payload;
+ pl = (msg_payload_t*)h;
*return_payload = h;
if (bsiz >= body_len) {
@@ -1832,9 +1834,15 @@
else
bsiz = used + n + 1;
+ if (bsiz < msg_min_size) {
+ errno = ENOMEM;
+ su_free(home, b);
+ return NULL;
+ }
+
b2 = su_realloc(home, b, bsiz);
- if (b2 == NULL || bsiz < msg_min_size) {
+ if (b2 == NULL) {
errno = ENOMEM;
su_free(home, b);
return NULL;
@@ -1896,7 +1904,7 @@
msg_header_t **separator;
msg_header_t **payload;
msg_header_t **multipart;
- msg_mclass_t const *mc = msg->m_class;
+ msg_mclass_t const *mc;
msg_header_t **tail, ***ptail;
if (!msg)
@@ -1914,6 +1922,7 @@
serialize_first(msg, h);
+ mc = msg->m_class;
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
if (mc->mc_multipart->hr_class)
@@ -2115,13 +2124,14 @@
msg_header_t **head,
msg_header_t *h)
{
- msg_mclass_t const *mc = msg->m_class;
+ msg_mclass_t const *mc;
msg_header_t **hh;
msg_header_t **separator;
msg_header_t **payload;
assert(msg && pub && head && h);
+ mc = msg->m_class;
separator = (msg_header_t **)((char *)pub + mc->mc_separator->hr_offset);
payload = (msg_header_t **)((char *)pub + mc->mc_payload->hr_offset);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/msg_parser_util.c Mon May 26 12:59:57 2008
@@ -191,9 +191,9 @@
issize_t (*scanner)(char *s),
int sep)
{
- char const *auto_list[MSG_N_PARAMS];
- char const **list = auto_list, **re_list;
- int N = MSG_N_PARAMS, n = 0;
+ char const *stack[MSG_N_PARAMS];
+ char const **list = stack, **re_list;
+ size_t N = MSG_N_PARAMS, n = 0;
issize_t tlen;
char *s = *ss;
char const **start;
@@ -221,7 +221,7 @@
if (tlen > 0) {
if (n + 1 == N) { /* Reallocate list? */
N = MSG_PARAMS_NUM(N + 1);
- if (list == auto_list || list == *append_list) {
+ if (list == stack || list == *append_list) {
re_list = su_alloc(home, N * sizeof(*list));
if (re_list)
memcpy(re_list, list, n * sizeof(*list));
@@ -247,23 +247,25 @@
*ss = s;
- if (n > 0 && list == auto_list) {
+ if (n == 0) {
+ *append_list = NULL;
+ return 0;
+ }
+
+ if (list == stack) {
size_t size = sizeof(*list) * MSG_PARAMS_NUM(n + 1);
list = su_alloc(home, size);
if (!list) return -1;
- memcpy((void *)list, auto_list, n * sizeof(*list));
+ memcpy((void *)list, stack, n * sizeof(*list));
}
list[n] = NULL;
- if (n == 0)
- list = NULL;
-
*append_list = list;
return 0;
error:
*start = NULL;
- if (list != auto_list && list != *append_list)
+ if (list != stack && list != *append_list)
su_free(home, list);
return -1;
}
@@ -362,7 +364,8 @@
for (n = 0; params[n]; n++)
;
N = MSG_PARAMS_NUM(n + 1);
- } else {
+ }
+ else {
params = stack;
N = MSG_PARAMS_NUM(1);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c Mon May 26 12:59:57 2008
@@ -1493,8 +1493,9 @@
nta_incoming_t *irq,
sip_t const *sip)
{
- nea_sub_t *s = NULL;
- s = nea_sub_create(nes);
+ nea_sub_t *s = nea_sub_create(nes);
+ if (s == NULL)
+ return 500;
s->s_from = sip_from_dup(nes->nes_home, sip->sip_from);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Mon May 26 12:59:57 2008
@@ -987,7 +987,7 @@
void *smime = agent->sa_smime;
uint32_t flags = agent->sa_flags;
int rport = agent->sa_rport;
- int server_rport = agent->sa_server_rport;
+ unsigned server_rport = agent->sa_server_rport;
int tcp_rport = agent->sa_tcp_rport;
unsigned preload = agent->sa_preload;
unsigned threadpool = agent->sa_tport_threadpool;
@@ -2579,7 +2579,7 @@
rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
msg_header_replace_param(msg_home(msg), v->v_common, rport);
}
- else {
+ 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);
}
@@ -3310,7 +3310,7 @@
url_t reg_url[1];
url_string_t const *original = request_uri;
- if (!leg || !msg)
+ if (!leg || !msg || !sip)
return -1;
if (!sip->sip_route && leg->leg_route) {
@@ -4086,6 +4086,10 @@
/** Get dialog leg by @CallID.
*
+ * @note Usually there should be only single dialog per @CallID on
+ * User-Agents. However, proxies may fork requests initiating the dialog and
+ * result in multiple calls per @CallID.
+ *
* @since New in @VERSION_1_12_9.
*/
SOFIAPUBFUN
@@ -4718,7 +4722,7 @@
irq->irq_record_route =
sip_record_route_copy(home, sip->sip_record_route);
}
- irq->irq_branch = irq->irq_via->v_branch;
+ irq->irq_branch = sip->sip_via->v_branch;
irq->irq_reliable_tp = tport_is_reliable(tport);
if (sip->sip_timestamp)
@@ -5818,7 +5822,7 @@
msg = nta_msg_create(irq->irq_agent, 0);
sip = sip_object(msg);
- if (status != 0)
+ if (sip && status != 0)
sip->sip_status = sip_status_create(msg_home(msg), status, phrase, NULL);
if (nta_incoming_response_headers(irq, msg, sip) < 0)
@@ -5901,7 +5905,7 @@
return -1;
}
- if (msg == NULL)
+ if (msg == NULL || sip == NULL)
return -1;
if (msg == irq->irq_response)
@@ -8399,6 +8403,8 @@
if (!internal && orq->orq_delay == UINT_MAX)
outgoing_estimate_delay(orq, sip);
+ assert(!internal || status >= 300);
+
if (orq->orq_cc)
agent_accept_compressed(orq->orq_agent, msg, orq->orq_cc);
@@ -9545,6 +9551,9 @@
rlen = strlen(na->na_replace) + 1;
sq = su_zalloc(home, (sizeof *sq) + rlen);
+ if (sq == NULL)
+ continue;
+
*tail = sq, tail = &sq->sq_next;
sq->sq_otype = sres_type_naptr;
sq->sq_priority = na->na_prefer;
@@ -10664,9 +10673,9 @@
}
if (rack) {
- rack->ra_cseq = orq->orq_cseq->cs_seq;
- rack->ra_method = orq->orq_cseq->cs_method;
- rack->ra_method_name = orq->orq_cseq->cs_method_name;
+ rack->ra_cseq = oorq->orq_cseq->cs_seq;
+ rack->ra_method = oorq->orq_cseq->cs_method;
+ rack->ra_method_name = oorq->orq_cseq->cs_method_name;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_internal.h Mon May 26 12:59:57 2008
@@ -226,7 +226,7 @@
/** If true, use rport at client */
unsigned sa_rport:1;
/** If true, use rport at server */
- unsigned sa_server_rport:1;
+ unsigned sa_server_rport:2;
/** If true, use rport with tcp, too */
unsigned sa_tcp_rport:1;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta_tag.c Mon May 26 12:59:57 2008
@@ -685,10 +685,10 @@
* unsigned int
*
* @par Values
- * - Value of @i delta-seconds in @RetryAfter header, from 0 to 86400
+ * - Value of @a delta-seconds in @RetryAfter header, from 0 to 86400
*
* @par Default Value
- * - 0 (no Retry-After is included)
+ * - 0 (no @RetryAfter header is included)
*
* @sa NTATAG_TIMEOUT_408()
*/
@@ -1334,7 +1334,7 @@
*
* @sa @RFC3581, NTATAG_CLIENT_RPORT(), NTATAG_TCP_RPORT(), @Via
*/
-tag_typedef_t ntatag_server_rport = BOOLTAG_TYPEDEF(server_rport);
+tag_typedef_t ntatag_server_rport = UINTTAG_TYPEDEF(server_rport);
/**@def NTATAG_TCP_RPORT(x)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c Mon May 26 12:59:57 2008
@@ -54,7 +54,7 @@
for (patterns = test_patterns; *patterns; patterns++) {
if (!fnmatch(*patterns, name, 0)) {
if (strcmp(*patterns, "*")) {
- printf("%s: match with %s\n", name, *patterns);
+ printf("%s: running\n", name);
}
_tcase_add_test(tc, tf, name, 0, 0, 1);
return;
@@ -64,14 +64,13 @@
for (patterns = test_patterns; *patterns; patterns++) {
if (!strcmp(*patterns, name) || !strcmp(*patterns, "*")) {
if (strcmp(*patterns, "*")) {
- printf("%s: match with %s\n", name, *patterns);
+ printf("%s: running\n", name);
}
_tcase_add_test(tc, tf, name, 0, 0, 1);
return;
}
}
#endif
- printf("%s: no match\n", name);
}
int main(int argc, char *argv[])
@@ -91,6 +90,7 @@
patterns = calloc(i, sizeof *patterns);
+ /* Split by commas */
for (i = 0, s = cases;; i++) {
patterns[i] = s;
if (s == NULL)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c Mon May 26 12:59:57 2008
@@ -411,7 +411,7 @@
/* 2.1 - Basic call cases */
-START_TEST(basic_call_with_bye_by_nua)
+START_TEST(call_2_1_1)
{
nua_handle_t *nh;
@@ -429,7 +429,7 @@
END_TEST
-START_TEST(basic_call_with_bye_to_nua)
+START_TEST(call_2_1_2)
{
nua_handle_t *nh;
@@ -447,7 +447,7 @@
END_TEST
-START_TEST(call_to_nua_with_bye_to_nua)
+START_TEST(call_2_1_3)
{
nua_handle_t *nh;
@@ -463,7 +463,7 @@
END_TEST
-START_TEST(call_to_nua_with_bye_by_nua)
+START_TEST(call_2_1_4)
{
nua_handle_t *nh;
@@ -479,7 +479,7 @@
END_TEST
-START_TEST(call_to_nua_with_bye_by_nua_challenged)
+START_TEST(call_2_1_5)
{
nua_handle_t *nh;
@@ -572,17 +572,51 @@
END_TEST
+START_TEST(call_2_1_7)
+{
+ nua_handle_t *nh, *nh2;
+ sip_replaces_t *replaces;
+
+ s2_case("2.1.7", "Call lookup",
+ "Test dialog and call-id lookup");
+
+ nh = nua_handle(nua, NULL, SIPTAG_TO(s2->local), TAG_END());
+
+ invite_by_nua(nh, TAG_END());
+
+ nh2 = nua_handle_by_call_id(nua, dialog->call_id->i_id);
+ fail_if(!nh2); fail_if(nh != nh2); nua_handle_unref(nh2);
+
+ replaces = sip_replaces_format(NULL, "%s;from-tag=%s;to-tag=%s",
+ dialog->call_id->i_id,
+ dialog->local->a_tag,
+ dialog->remote->a_tag);
+ fail_if(!replaces);
+
+ nh2 = nua_handle_by_replaces(nua, replaces);
+ fail_if(!nh2); fail_if(nh != nh2); nua_handle_unref(nh2);
+
+ msg_header_free_all(NULL, (msg_header_t *)replaces);
+
+ bye_by_nua(nh, TAG_END());
+
+ nua_handle_destroy(nh);
+}
+END_TEST
+
+
TCase *invite_tcase(void)
{
TCase *tc = tcase_create("2.1 - Basic INVITE");
tcase_add_checked_fixture(tc, call_setup, call_teardown);
{
- tcase_add_test(tc, basic_call_with_bye_by_nua);
- tcase_add_test(tc, basic_call_with_bye_to_nua);
- tcase_add_test(tc, call_to_nua_with_bye_to_nua);
- tcase_add_test(tc, call_to_nua_with_bye_by_nua);
- tcase_add_test(tc, call_to_nua_with_bye_by_nua_challenged);
+ tcase_add_test(tc, call_2_1_1);
+ tcase_add_test(tc, call_2_1_2);
+ tcase_add_test(tc, call_2_1_3);
+ tcase_add_test(tc, call_2_1_4);
+ tcase_add_test(tc, call_2_1_5);
tcase_add_test(tc, call_2_1_6);
+ tcase_add_test(tc, call_2_1_7);
}
return tc;
}
@@ -1104,7 +1138,7 @@
/* ====================================================================== */
/* Weird call termination cases */
-START_TEST(terminating_re_invite)
+START_TEST(bye_4_1_1)
{
nua_handle_t *nh;
struct message *bye, *r481;
@@ -1146,7 +1180,7 @@
END_TEST
-START_TEST(bye_invite_glare)
+START_TEST(bye_4_1_2)
{
nua_handle_t *nh;
struct message *bye, *r481;
@@ -1181,7 +1215,7 @@
}
END_TEST
-START_TEST(call_4_1_3)
+START_TEST(bye_4_1_3)
{
nua_handle_t *nh;
struct message *bye;
@@ -1222,7 +1256,7 @@
END_TEST
-START_TEST(call_4_1_4)
+START_TEST(bye_4_1_4)
{
nua_handle_t *nh;
struct message *bye;
@@ -1261,7 +1295,7 @@
END_TEST
-START_TEST(call_4_1_5)
+START_TEST(bye_4_1_5)
{
nua_handle_t *nh;
struct message *bye;
@@ -1298,7 +1332,7 @@
END_TEST
-START_TEST(bye_invite_glare2)
+START_TEST(bye_4_1_6)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1336,7 +1370,7 @@
END_TEST
-START_TEST(bye_invite_glare3)
+START_TEST(bye_4_1_7)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1373,7 +1407,7 @@
}
END_TEST
-START_TEST(bye_then_respond)
+START_TEST(bye_4_1_8)
{
nua_handle_t *nh;
struct message *bye, *r486;
@@ -1412,7 +1446,102 @@
END_TEST
-START_TEST(bye_with_timer)
+START_TEST(bye_4_1_9)
+{
+ nua_handle_t *nh;
+ struct message *bye;
+ struct event *i_bye;
+
+ s2_case("4.1.6", "Send BYE, receive BYE, destroy",
+ "NUA sends BYE, receives BYE and handle gets destroyed");
+
+ nh = invite_to_nua(TAG_END());
+
+ mark_point();
+
+ s2_flush_events();
+
+ nua_bye(nh, TAG_END());
+ bye = s2_wait_for_request(SIP_METHOD_BYE);
+ fail_if(!bye);
+
+ s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ i_bye = s2_wait_for_event(nua_i_bye, 200);
+ fail_if(!i_bye);
+ s2_free_event(i_bye), i_bye = NULL;
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ nua_handle_destroy(nh);
+ mark_point();
+
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+
+ mark_point();
+ s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_free_message(bye);
+
+ mark_point();
+ while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
+ su_root_step(s2->root, 10);
+ }
+}
+END_TEST
+
+
+START_TEST(bye_4_1_10)
+{
+ nua_handle_t *nh;
+ struct message *invite, *bye;
+ struct event *i_bye;
+
+ s2_case("4.1.6", "Send auto-BYE upon receiving 501, receive BYE, destroy",
+ "NUA sends BYE, receives BYE and handle gets destroyed");
+
+ nh = invite_to_nua(TAG_END());
+
+ mark_point();
+
+ s2_flush_events();
+
+ nua_invite(nh, TAG_END());
+ invite = s2_wait_for_request(SIP_METHOD_INVITE);
+ fail_if(!invite);
+ s2_respond_to(invite, dialog, SIP_501_NOT_IMPLEMENTED, TAG_END());
+ s2_free_message(invite);
+
+ fail_unless(s2_check_request(SIP_METHOD_ACK));
+
+ bye = s2_wait_for_request(SIP_METHOD_BYE);
+ fail_if(!bye);
+
+ fail_unless(s2_check_callstate(nua_callstate_calling));
+ fail_unless(s2_check_event(nua_r_invite, 501));
+ fail_unless(s2_check_callstate(nua_callstate_terminating));
+
+ s2_request_to(dialog, SIP_METHOD_BYE, NULL, TAG_END());
+ i_bye = s2_wait_for_event(nua_i_bye, 200);
+ fail_if(!i_bye);
+ s2_free_event(i_bye), i_bye = NULL;
+ fail_unless(s2_check_callstate(nua_callstate_terminated));
+ fail_unless(s2_check_response(200, SIP_METHOD_BYE));
+ nua_handle_destroy(nh);
+
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+ su_root_step(s2->root, 10);
+
+ s2_respond_to(bye, dialog, SIP_200_OK, TAG_END());
+ s2_free_message(bye);
+
+ while (su_home_check_alloc((su_home_t *)nua, (void *)nh)) {
+ su_root_step(s2->root, 10);
+ }
+}
+END_TEST
+
+START_TEST(bye_4_2_1)
{
nua_handle_t *nh;
struct message *bye;
@@ -1456,12 +1585,12 @@
}
END_TEST
-START_TEST(bye_with_timer2)
+START_TEST(bye_4_2_2)
{
nua_handle_t *nh;
struct message *bye;
- s2_case("4.2.1", "BYE in progress while call timer expires",
+ s2_case("4.2.2", "BYE in progress while call timer expires",
"NUA receives INVITE, "
"activates call timers, "
"sends BYE, BYE challenged, "
@@ -1507,16 +1636,18 @@
TCase *tc = tcase_create("4 - Call Termination");
tcase_add_checked_fixture(tc, call_setup, call_teardown);
{
- tcase_add_test(tc, terminating_re_invite);
- tcase_add_test(tc, bye_invite_glare);
- tcase_add_test(tc, call_4_1_3);
- tcase_add_test(tc, call_4_1_4);
- tcase_add_test(tc, call_4_1_5);
- tcase_add_test(tc, bye_invite_glare2);
- tcase_add_test(tc, bye_invite_glare3);
- tcase_add_test(tc, bye_with_timer);
- tcase_add_test(tc, bye_with_timer2);
- tcase_add_test(tc, bye_then_respond);
+ tcase_add_test(tc, bye_4_1_1);
+ tcase_add_test(tc, bye_4_1_2);
+ tcase_add_test(tc, bye_4_1_3);
+ tcase_add_test(tc, bye_4_1_4);
+ tcase_add_test(tc, bye_4_1_5);
+ tcase_add_test(tc, bye_4_1_6);
+ tcase_add_test(tc, bye_4_1_7);
+ tcase_add_test(tc, bye_4_1_8);
+ tcase_add_test(tc, bye_4_1_9);
+ tcase_add_test(tc, bye_4_1_10);
+ tcase_add_test(tc, bye_4_2_1);
+ tcase_add_test(tc, bye_4_2_2);
tcase_set_timeout(tc, 5);
}
return tc;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua.c Mon May 26 12:59:57 2008
@@ -1036,7 +1036,7 @@
if (nua) {
#if HAVE_OPEN_C
struct nua_stack_handle_by_replaces_args a;
- a.retval = NULL;
+ a.retval = NULL;
a.nua = nua;
a.r = r;
#else
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c Mon May 26 12:59:57 2008
@@ -379,8 +379,12 @@
/* Destroy saved client request */
if (cr0 != du->du_cr && nua_client_is_bound(du->du_cr)) {
nua_client_bind(cr = du->du_cr, NULL);
- if (!nua_client_is_queued(cr) &&
- !nua_client_is_reporting(cr))
+
+ if (nua_client_is_queued(cr))
+ nua_client_request_complete(cr);
+ else if (nua_client_is_reporting(cr))
+ ;
+ else
nua_client_request_destroy(cr);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h Mon May 26 12:59:57 2008
@@ -501,6 +501,9 @@
#define nua_dialog_usage_public(p) ((p) ? (nua_dialog_usage_t*)(p) - 1 : NULL)
#endif
+#define NUA_DIALOG_USAGE_PRIVATE(du) ((void *)((du) + 1))
+#define NUA_DIALOG_USAGE_PUBLIC(pu) ((void *)((nua_dialog_usage_t *)(pu) - 1))
+
/* ---------------------------------------------------------------------- */
int nua_client_create(nua_owner_t *owner,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_event_server.c Mon May 26 12:59:57 2008
@@ -145,7 +145,7 @@
if (ev == NULL) {
char *o_type = su_strdup(home, event->o_type);
- char *o_subtype = strchr(o_type, '.');
+ char *o_subtype = o_type ? strchr(o_type, '.') : NULL;
if (o_subtype)
*o_subtype++ = '\0';
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Mon May 26 12:59:57 2008
@@ -1103,7 +1103,6 @@
if (nh == dnh || nh->nh_prefs != dnh->nh_prefs) {
dst = nh->nh_prefs, *old = *dst;
- assert(dst);
}
else {
dst = su_zalloc(home, sizeof *dst), memset(old, 0, sizeof *old);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c Mon May 26 12:59:57 2008
@@ -110,7 +110,7 @@
nua_server_request_t *sr
)
{
- struct publish_usage *pu = nua_dialog_usage_private(du);
+ struct publish_usage *pu = NUA_DIALOG_USAGE_PRIVATE(du);
su_free(nh->nh_home, pu->pu_etag);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Mon May 26 12:59:57 2008
@@ -188,7 +188,7 @@
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
- nua_registration_t *nr = nua_dialog_usage_private(du);
+ nua_registration_t *nr = NUA_DIALOG_USAGE_PRIVATE(du);
if (ds->ds_has_register)
return -1; /* There can be only one usage */
@@ -207,7 +207,7 @@
nua_client_request_t *cr,
nua_server_request_t *sr)
{
- nua_registration_t *nr = nua_dialog_usage_private(du);
+ nua_registration_t *nr = NUA_DIALOG_USAGE_PRIVATE(du);
if (nr->nr_list)
nua_registration_remove(nr); /* Remove from list of registrations */
@@ -236,7 +236,7 @@
nua_dialog_state_t const *ds,
sip_t const *sip)
{
- nua_registration_t *nr = nua_dialog_usage_private(du);
+ nua_registration_t *nr = NUA_DIALOG_USAGE_PRIVATE(du);
if (nr->nr_ob)
outbound_peer_info(nr->nr_ob, sip);
}
@@ -1016,16 +1016,18 @@
msg_t *msg,
int error)
{
- nua_dialog_usage_t *du = nua_dialog_usage_public(nr);
+ nua_dialog_usage_t *du;
tp_name_t const *tpn;
- int pending = nr->nr_error_report_id;
+ int pending;
- assert(tport == nr->nr_tport);
-
- if (!nr->nr_tport)
+ assert(nr && tport == nr->nr_tport);
+ if (nr == NULL || tport != nr->nr_tport)
return;
- if (tport_release(nr->nr_tport, pending, NULL, NULL, nr, 0) < 0)
+ du = NUA_DIALOG_USAGE_PUBLIC(nr);
+ pending = nr->nr_error_report_id;
+
+ if (tport_release(tport, pending, NULL, NULL, nr, 0) < 0)
SU_DEBUG_1(("nua_register: tport_release() failed\n"));
nr->nr_error_report_id = 0;
@@ -1110,7 +1112,7 @@
nua_dialog_usage_t *du)
{
nua_client_request_t *cr = du->du_cr;
- nua_registration_t *nr = nua_dialog_usage_private(du);
+ nua_registration_t *nr = NUA_DIALOG_USAGE_PRIVATE(du);
if (cr) {
if (nua_client_is_queued(cr)) /* Already registering. */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Mon May 26 12:59:57 2008
@@ -223,7 +223,7 @@
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
- nua_session_usage_t *ss = nua_dialog_usage_private(du);
+ nua_session_usage_t *ss = NUA_DIALOG_USAGE_PRIVATE(du);
if (ds->ds_has_session)
return -1;
@@ -243,12 +243,14 @@
nua_client_request_t *cr0,
nua_server_request_t *sr0)
{
- nua_session_usage_t *ss = nua_dialog_usage_private(du);
+ nua_session_usage_t *ss = NUA_DIALOG_USAGE_PRIVATE(du);
nua_client_request_t *cr, *cr_next;
+ nua_server_request_t *sr;
cr = du->du_cr;
- if (cr != cr0 && cr && cr->cr_orq && cr->cr_status >= 200) {
+ if (cr != cr0 && cr && cr->cr_orq && cr->cr_status >= 200 &&
+ cr->cr_method == sip_method_invite) {
ss->ss_reporting = 1;
nua_invite_client_ack(cr, NULL);
ss->ss_reporting = 0;
@@ -267,11 +269,13 @@
if (cr == du->du_cr && cr->cr_orq)
continue;
- nua_stack_event(nh->nh_nua, nh,
- NULL,
- cr->cr_event,
- SIP_481_NO_TRANSACTION,
- NULL);
+ if (cr->cr_status < 200) {
+ nua_stack_event(nh->nh_nua, nh,
+ NULL,
+ cr->cr_event,
+ SIP_481_NO_TRANSACTION,
+ NULL);
+ }
nua_client_request_destroy(cr);
@@ -291,6 +295,12 @@
signal_call_state_change(nh, ss, status, phrase, nua_callstate_terminated);
}
+ /* Application can respond to BYE after the session usage has terminated */
+ for (sr = ds->ds_sr; sr; sr = sr->sr_next) {
+ if (sr->sr_usage == du && sr->sr_method == sip_method_bye)
+ sr->sr_usage = NULL;
+ }
+
ds->ds_has_session = 0;
nh->nh_has_invite = 0;
nh->nh_active_call = 0;
@@ -724,10 +734,15 @@
if (!du)
return -1;
+ ss = nua_dialog_usage_private(du);
+
+ if (ss->ss_state >= nua_callstate_terminating)
+ return nua_client_return(cr, 900, "Session is terminating", msg);
+
if (nua_client_bind(cr, du) < 0)
return nua_client_return(cr, 900, "INVITE already in progress", msg);
- ss = nua_dialog_usage_private(du);
+ cr->cr_neutral = 0;
session_timer_preferences(ss->ss_timer,
sip,
@@ -737,8 +752,6 @@
NH_PGET(nh, refresher),
NH_PGET(nh, min_se));
- cr->cr_neutral = 0;
-
return 0;
}
@@ -755,6 +768,9 @@
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
+ if (ss->ss_state >= nua_callstate_terminating)
+ return nua_client_return(cr, 900, "Session is terminating", msg);
+
assert(ss);
invite_timeout = NH_PGET(nh, invite_timeout);
@@ -1167,7 +1183,7 @@
if (error < 0) {
if (ss->ss_reason == NULL)
ss->ss_reason = "SIP;cause=500;text=\"Internal Error\"";
- ss->ss_reporting = 1; /* We report state here if BYE fails */
+ ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
signal_call_state_change(nh, ss, 500, "Internal Error",
@@ -1212,6 +1228,7 @@
char const *invite_branch;
assert(cr->cr_orq);
+ assert(cr->cr_method == sip_method_invite);
if (!ds->ds_leg) {
@@ -1461,7 +1478,7 @@
nua_dialog_usage_t *du,
sip_time_t now)
{
- nua_session_usage_t *ss = nua_dialog_usage_private(du);
+ nua_session_usage_t *ss = NUA_DIALOG_USAGE_PRIVATE(du);
nua_client_request_t const *cr = du->du_cr;
nua_server_request_t const *sr;
@@ -1508,7 +1525,7 @@
nua_dialog_state_t *ds,
nua_dialog_usage_t *du)
{
- nua_session_usage_t *ss = nua_dialog_usage_private(du);
+ nua_session_usage_t *ss = NUA_DIALOG_USAGE_PRIVATE(du);
nua_server_request_t *sr, *sr_next;
nua_client_request_t *cri;
@@ -1675,6 +1692,8 @@
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
assert(ss);
+ if (ss->ss_state >= nua_callstate_terminating)
+ return nua_client_return(cr, 900, "Session is terminating", msg);
cri = du->du_cr;
@@ -2465,7 +2484,7 @@
nua_stack_event(nh->nh_nua, nh, NULL,
nua_i_media_error, status, phrase, NULL);
- ss->ss_reporting = 1; /* We report state here if BYE fails */
+ ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
@@ -2562,7 +2581,7 @@
/* send BYE, too, if 200 OK (or 183 to re-INVITE) timeouts */
ss->ss_reason = reason;
- ss->ss_reporting = 1; /* We report state here if BYE fails */
+ ss->ss_reporting = 1; /* We report terminated state here if BYE fails */
error = nua_client_create(nh, nua_r_bye, &nua_bye_client_methods, NULL);
ss->ss_reporting = 0;
@@ -2675,19 +2694,22 @@
return sr->sr_status;
if (sr->sr_sdp) {
- nua_session_usage_t *ss = nua_dialog_usage_private(sr->sr_usage);
+ nua_session_usage_t *ss = NUA_DIALOG_USAGE_PRIVATE(sr->sr_usage);
+ char const *offeranswer;
/* XXX - check for overlap? */
- if (sri->sr_offer_sent)
- sr->sr_answer_recv = 1, ss->ss_oa_recv = Answer;
- else
- sr->sr_offer_recv = 1, ss->ss_oa_recv = Offer;
+ if (sri->sr_offer_sent && !sri->sr_answer_recv)
+ sr->sr_answer_recv = 1, sri->sr_answer_recv = 1, offeranswer = Answer;
+ else
+ sr->sr_offer_recv = 1, offeranswer = Offer;
+
+ ss->ss_oa_recv = offeranswer;
if (nh->nh_soa &&
soa_set_remote_sdp(nh->nh_soa, NULL, sr->sr_sdp, sr->sr_sdp_len) < 0) {
SU_DEBUG_5(("nua(%p): %s server: error parsing %s\n", (void *)nh,
- "PRACK", Offer));
+ "PRACK", offeranswer));
return
sr->sr_status = soa_error_as_sip_response(nh->nh_soa, &sr->sr_phrase);
}
@@ -2710,7 +2732,7 @@
if (nh->nh_soa == NULL) {
if (sr->sr_offer_recv && session_get_description(sip, NULL, NULL))
- sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer;
+ sr->sr_answer_sent = 1, ss ? ss->ss_oa_sent = Answer : Answer;
}
else if ((sr->sr_offer_recv && soa_generate_answer(nh->nh_soa, NULL) < 0) ||
(sr->sr_answer_recv && soa_process_answer(nh->nh_soa, NULL) < 0)) {
@@ -2724,7 +2746,7 @@
if (session_include_description(nh->nh_soa, 1, msg, sip) < 0)
sr_status(sr, SIP_500_INTERNAL_SERVER_ERROR);
else
- sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer;
+ sr->sr_answer_sent = 1, ss ? ss->ss_oa_sent = Answer : Answer;
}
}
@@ -3134,6 +3156,8 @@
if (du == NULL) /* Call terminated */
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
assert(ss);
+ if (ss->ss_state >= nua_callstate_terminating)
+ return nua_client_return(cr, 900, "Session is terminating", msg);
cri = du->du_cr;
@@ -3377,7 +3401,7 @@
}
sr->sr_offer_recv = 1;
- ss->ss_oa_recv = Offer;
+ ss ? ss->ss_oa_recv = Offer : Offer;
}
return 0;
@@ -3395,7 +3419,7 @@
if (200 <= sr->sr_status && sr->sr_status < 300 && sr->sr_sdp) {
if (nh->nh_soa == NULL) {
- sr->sr_answer_sent = 1, ss->ss_oa_sent = Answer;
+ sr->sr_answer_sent = 1, ss ? ss->ss_oa_sent = Answer : Answer;
}
else if (soa_generate_answer(nh->nh_soa, NULL) < 0) {
SU_DEBUG_5(("nua(%p): %s server: %s %s\n",
@@ -3592,7 +3616,9 @@
if (nh->nh_soa)
soa_terminate(nh->nh_soa, 0);
- cr->cr_usage = du;
+
+ du->du_cr = NULL;
+ nua_client_bind(cr, du);
return 0;
}
@@ -3605,15 +3631,34 @@
nua_session_usage_t *ss;
char const *reason = NULL;
+ int error;
+ nua_server_request_t *sr;
+
if (du == NULL)
return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg);
ss = nua_dialog_usage_private(du);
reason = ss->ss_reason;
- return nua_base_client_trequest(cr, msg, sip,
- SIPTAG_REASON_STR(reason),
- TAG_NEXT(tags));
+ error = nua_base_client_trequest(cr, msg, sip,
+ SIPTAG_REASON_STR(reason),
+ TAG_NEXT(tags));
+
+ if (error == 0) {
+ nua_dialog_usage_reset_refresh(du);
+ ss->ss_timer->timer_set = 0;
+
+ /* Terminate server transactions associated with session, too. */
+ for (sr = du->du_dialog->ds_sr; sr; sr = sr->sr_next) {
+ if (sr->sr_usage == du && nua_server_request_is_pending(sr) &&
+ sr->sr_method != sip_method_bye) {
+ sr_status(sr, SIP_486_BUSY_HERE);
+ nua_server_respond(sr, 0);
+ }
+ }
+ }
+
+ return error;
}
/** @NUA_EVENT nua_r_bye
@@ -3663,18 +3708,28 @@
}
else {
nua_session_usage_t *ss = nua_dialog_usage_private(du);
+ nua_client_request_t *cri;
+
+ if (ss->ss_reporting) {
+ return 1; /* Somebody else's problem */
+ }
+ else if (cr->cr_waiting) {
+ return 1; /* Application problem */
+ }
+
+ nua_client_bind(cr, NULL);
signal_call_state_change(nh, ss, status, "to BYE",
nua_callstate_terminated);
- if (ss && !ss->ss_reporting) {
- if (du->du_cr == NULL ||
- !nua_client_is_queued(du->du_cr) ||
- du->du_cr->cr_status >= 200) {
- /* INVITE is completed, we can zap the session... */;
- cr->cr_usage = NULL;
- nua_session_usage_destroy(nh, ss);
- }
+ for (cri = du->du_dialog->ds_cr; cri; cri = cri->cr_next) {
+ if (cri->cr_method == sip_method_invite)
+ break;
+ }
+
+ if (!cri || cri->cr_status >= 200) {
+ /* INVITE is completed, we can zap the session... */;
+ nua_session_usage_destroy(nh, ss);
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c Mon May 26 12:59:57 2008
@@ -543,8 +543,6 @@
nua_event_t event;
int error = 0;
- assert(tags);
-
if (nh) {
if (!nh->nh_prev)
nh_append(nua, nh);
@@ -1043,7 +1041,7 @@
SIPTAG_FROM(from), /* Remote AoR */
TAG_END());
- if (nua_stack_init_handle(nh->nh_nua, nh, NULL) < 0)
+ if (nh && nua_stack_init_handle(nua, nh, NULL) < 0)
nh_destroy(nua, nh), nh = NULL;
if (nh && create_dialog) {
@@ -1860,8 +1858,6 @@
int terminated;
int handle_can_be_terminated = initial && !sr->sr_event;
- assert(nh);
-
if (sr->sr_application) {
/* There was an error sending response */
if (sr->sr_application != sr->sr_status)
@@ -2010,7 +2006,6 @@
NULL);
}
- cr->cr_owner = nh;
cr->cr_methods = methods;
cr->cr_event = event;
cr->cr_method = method;
@@ -2020,17 +2015,25 @@
cr->cr_auto = 1;
if (su_msg_is_non_null(nh->nh_nua->nua_signal)) {
- nua_event_data_t const *e = su_msg_data(nh->nh_nua->nua_signal)->ee_data;
+ nua_event_data_t *e = su_msg_data(nh->nh_nua->nua_signal)->ee_data;
if (tags == e->e_tags && event == e->e_event) {
cr->cr_auto = 0;
+
if (tags) {
nua_move_signal(cr->cr_signal, nh->nh_nua->nua_signal);
- cr->cr_tags = tags;
+ if (cr->cr_signal) {
+ /* Steal reference from signal */
+ cr->cr_owner = e->e_nh, e->e_nh = NULL;
+ cr->cr_tags = tags;
+ }
}
}
}
+ if (cr->cr_owner == NULL)
+ cr->cr_owner = nua_handle_ref(nh);
+
if (tags && cr->cr_tags == NULL)
cr->cr_tags = tl_tlist(nh->nh_home, TAG_NEXT(tags));
@@ -2099,6 +2102,7 @@
void nua_client_request_complete(nua_client_request_t *cr)
{
+ nua_client_request_remove(cr);
if (cr && cr->cr_methods->crm_complete)
cr->cr_methods->crm_complete(cr);
}
@@ -2116,7 +2120,6 @@
nua_destroy_signal(cr->cr_signal);
- nua_client_request_remove(cr);
nua_client_bind(cr, NULL);
if (cr->cr_msg)
@@ -2125,7 +2128,6 @@
if (cr->cr_orq)
nta_outgoing_destroy(cr->cr_orq);
-
cr->cr_orq = NULL;
if (cr->cr_timer)
@@ -2135,6 +2137,8 @@
su_free(nh->nh_home, cr->cr_target);
su_free(nh->nh_home, cr);
+
+ nua_handle_unref(nh);
}
/** Bind client request to a dialog usage */
@@ -2803,10 +2807,12 @@
char const *phrase,
sip_t const *sip)
{
- nua_handle_t *nh = cr->cr_owner;
+ nua_handle_t *nh;
assert(cr && status >= 200 && phrase && sip);
+ nh = cr->cr_owner;
+
if (cr->cr_retry_count > NH_PGET(nh, retry_count))
return 0;
@@ -3075,6 +3081,7 @@
nua_handle_t *nh = cr->cr_owner;
sip_method_t method = cr->cr_method;
nua_dialog_usage_t *du;
+ nua_client_request_t *cr_next;
cr->cr_reporting = 1, nh->nh_ds->ds_reporting = 1;
@@ -3132,14 +3139,15 @@
cr->cr_phrase = NULL;
cr->cr_reporting = 0, nh->nh_ds->ds_reporting = 0;
+ cr_next = nh->nh_ds->ds_cr;
+
if (!nua_client_is_queued(cr) && !nua_client_is_bound(cr))
nua_client_request_destroy(cr);
if (method == sip_method_cancel)
return 1;
- return
- nua_client_next_request(nh->nh_ds->ds_cr, method == sip_method_invite);
+ return nua_client_next_request(cr_next, method == sip_method_invite);
}
/** Send event, zap transaction but leave cr in list */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c Mon May 26 12:59:57 2008
@@ -107,7 +107,7 @@
* #nua_i_info, #nua_i_update, #nua_i_message, #nua_i_subscribe,
* #nua_i_notify, #nua_i_method, #nua_i_register
* Settings:
- * - NUTAG_APPL_METHOD()
+ * - NUTAG_APPL_METHOD(), NUTAG_PROXY()
* - NUTAG_ALLOW(), SIPTAG_ALLOW(), and SIPTAG_ALLOW_STR()
* - NUTAG_SUPPORTED(), SIPTAG_SUPPORTED(), and SIPTAG_SUPPORTED_STR()
*
@@ -838,6 +838,8 @@
* #nua_i_notify.
*
* Corresponding tag taking reference parameter is NUTAG_SUB_EXPIRES_REF().
+ *
+ * @NEW_1_12_9.
*/
tag_typedef_t nutag_sub_expires = UINTTAG_TYPEDEF(substate);
@@ -873,7 +875,7 @@
*
* Corresponding tag taking reference parameter is NUTAG_NEWSUB_REF().
*
- * @since @NEW_1_12_5.
+ * @NEW_1_12_5.
*/
tag_typedef_t nutag_newsub = BOOLTAG_TYPEDEF(newsub);
@@ -2738,7 +2740,7 @@
/**@def NUTAG_PROXY(x)
*
- * Outbound proxy URL
+ * Outbound proxy URL.
*
* Same tag as NTATAG_DEFAULT_PROXY()
*
@@ -2746,11 +2748,23 @@
* nua_set_params() \n
* nua_get_params() \n
* nua_create()
+ * @note
+ * Since @VERSION_1_12_9, NUTAG_PROXY()/NTATAG_DEFAULT_PROXY() can be used
+ * to set handle-specific outbound route. The route is set with \n
+ * nua_set_hparams(), \n
+ * nua_invite(), nua_prack(), nua_ack(), nua_update(), nua_respond(), \n
+ * nua_info(), nua_cancel(), nua_bye(), \n
+ * nua_register(), nua_unregister(), nua_publish(), nua_unpublish(), \n
+ * nua_subscribe(), nua_unsubscribe(), nua_refer(), nua_notify(), \n
+ * nua_options(), nua_message(), nua_method()
*
* @par Parameter type
* url_string_t const * (either char const * or url_t *)
*
* @par Values
+ * NULL implies routing based on request-URI or Route header.
+ * Non-NULL is used as invisible routing URI, ie., routing URI that is
+ * not included in the request.
*
* Corresponding tag taking reference parameter is NUTAG_PROXY_REF().
*/
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c Mon May 26 12:59:57 2008
@@ -723,6 +723,9 @@
unsigned d = ob->ob_keepalive.interval;
+ if (msg == NULL)
+ return -1;
+
assert(regsip); assert(regsip->sip_request);
if (m && m->m_params) {
@@ -842,6 +845,13 @@
if (status < 200)
return 0;
+ if (sip == NULL) {
+ SU_DEBUG_3(("outbound(%p): keepalive %u %s\n", (void *)ob->ob_owner,
+ status, phrase));
+ ob->ob_oo->oo_keepalive_error(ob->ob_owner, ob, status, phrase, TAG_END());
+ return 0;
+ }
+
if (status == 401 || status == 407) {
if (sip->sip_www_authenticate)
challenged += auc_challenge(ob->ob_keepalive.auc,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c Mon May 26 12:59:57 2008
@@ -98,7 +98,7 @@
/* Internal prototypes */
static void parse_message(sdp_parser_t *p);
-static void parsing_error(sdp_parser_t *p, char const *fmt, ...);
+static int parsing_error(sdp_parser_t *p, char const *fmt, ...);
/** Parse an SDP message.
*
@@ -357,7 +357,7 @@
if (!STRICT(p))
strip = SPACE TAB; /* skip initial whitespace */
else
- strip = NULL;
+ strip = "";
p->pr_ok = 1;
p->pr_session->sdp_size = sizeof(p->pr_session);
@@ -550,18 +550,15 @@
sdp_media_t *m;
if (!p || !p->pr_ok)
- ;
+ return -1;
else if (sdp->sdp_version[0] != 0)
- parsing_error(p, "Incorrect version");
+ return parsing_error(p, "Incorrect version");
else if (!sdp->sdp_origin)
- parsing_error(p, "No o= present");
+ return parsing_error(p, "No o= present");
else if (p->pr_strict && !sdp->sdp_subject)
- parsing_error(p, "No s= present");
+ return parsing_error(p, "No s= present");
else if (p->pr_strict && !sdp->sdp_time)
- parsing_error(p, "No t= present");
-
- if (!p->pr_ok)
- return -1;
+ return parsing_error(p, "No t= present");
/* If there is no session level c= check that one exists for all media */
/* c= line may be missing if this is a RTSP description */
@@ -1707,7 +1704,7 @@
if (!STRICT(p))
strip = SPACE TAB; /* skip initial whitespace */
else
- strip = NULL;
+ strip = "";
for (;
record && p->pr_ok;
@@ -1846,7 +1843,7 @@
size_t n;
char *retval = *message;
- if (strip)
+ if (strip[0])
retval += strspn(retval, strip);
n = strcspn(retval, sep);
@@ -1867,7 +1864,7 @@
return retval;
}
-static void parsing_error(sdp_parser_t *p, char const *fmt, ...)
+static int parsing_error(sdp_parser_t *p, char const *fmt, ...)
{
int n;
va_list ap;
@@ -1878,6 +1875,8 @@
va_end(ap);
p->pr_ok = 0;
+
+ return -1;
}
static void parse_alloc_error(sdp_parser_t *p, const char *typename)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c Mon May 26 12:59:57 2008
@@ -681,17 +681,15 @@
static void printing_error(sdp_printer_t *p, const char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
-
+
if (p->pr_ok) {
int n;
-
+ va_start(ap, fmt);
n = vsnprintf(p->pr_buffer, p->pr_bsiz, fmt, ap);
-
- p->pr_ok = 0;
+ va_end(ap);
}
- va_end(ap);
+ p->pr_ok = 0;
}
static void sdp_printf(sdp_printer_t *p, const char *fmt, ...)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_mime.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_mime.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_mime.c Mon May 26 12:59:57 2008
@@ -554,46 +554,18 @@
issize_t sip_content_type_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
{
- sip_content_type_t *c;
-
- assert(h);
-
- c = h->sh_content_type;
-
- /* "Content-type:" type/subtyp *(; parameter))) */
- if (/* Parse protocol */
- sip_version_d(&s, &c->c_type) == -1 || /* compacts token / token */
- (c->c_subtype = strchr(c->c_type, '/')) == NULL ||
- (*s == ';' && msg_params_d(home, &s, &c->c_params) == -1) ||
- (*s != '\0'))
- return -1;
-
- c->c_subtype++;
-
- return 0;
+ return msg_content_type_d(home, (msg_header_t *)h, s, slen);
}
issize_t sip_content_type_e(char b[], isize_t bsiz, sip_header_t const *h, int flags)
{
- char *b0 = b, *end = b + bsiz;
- sip_content_type_t const *c = h->sh_content_type;
-
- MSG_STRING_E(b, end, c->c_type);
- MSG_PARAMS_E(b, end, c->c_params, flags);
- MSG_TERM_E(b, end);
-
- return b - b0;
+ return msg_content_type_e(b, bsiz, (msg_header_t const *)h, flags);
}
static
isize_t sip_content_type_dup_xtra(sip_header_t const *h, isize_t offset)
{
- sip_content_type_t const *c = h->sh_content_type;
-
- MSG_PARAMS_SIZE(offset, c->c_params);
- offset += MSG_STRING_SIZE(c->c_type);
-
- return offset;
+ return msg_content_type_dup_xtra((msg_header_t *)h, offset);
}
/** Duplicate one #sip_content_type_t object */
@@ -601,18 +573,9 @@
char *sip_content_type_dup_one(sip_header_t *dst, sip_header_t const *src,
char *b, isize_t xtra)
{
- sip_content_type_t *c = dst->sh_content_type;
- sip_content_type_t const *o = src->sh_content_type;
- char *end = b + xtra;
-
- b = msg_params_dup(&c->c_params, o->c_params, b, xtra);
- MSG_STRING_DUP(b, c->c_type, o->c_type);
- c->c_subtype = strchr(c->c_type, '/');
- c->c_subtype++;
-
- assert(b <= end); (void)end;
-
- return b;
+ return msg_content_type_dup_one((msg_header_t *)dst,
+ (msg_header_t const *)src,
+ b, xtra);
}
/* ====================================================================== */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_tag_class.c Mon May 26 12:59:57 2008
@@ -158,7 +158,8 @@
(msg_pub_t *)sip, hc);
/* Is header present in the SIP message? */
- if ((char *)hh >= ((char *)sip + sip->sip_size) ||
+ if (hh == NULL ||
+ (char *)hh >= ((char *)sip + sip->sip_size) ||
(char *)hh < (char *)&sip->sip_request)
return dst;
@@ -234,8 +235,12 @@
if (h == SIP_NONE) { /* Remove header */
hh = msg_hclass_offset(msg_mclass(msg), (msg_pub_t *)sip, hc);
- while (*hh)
- msg_header_remove(msg, (msg_pub_t *)sip, *hh);
+ if (hh != NULL &&
+ (char *)hh < ((char *)sip + sip->sip_size) &&
+ (char *)hh >= (char *)&sip->sip_request) {
+ while (*hh)
+ msg_header_remove(msg, (msg_pub_t *)sip, *hh);
+ }
continue;
}
@@ -441,18 +446,21 @@
msg_hclass_t *hc = NULL;
hnv = su_strlst_item(l, i);
- n = strcspn(hnv, "=");
+ n = hnv ? strcspn(hnv, "=") : 0;
if (n == 0)
break;
if (n == 4 && strncasecmp(hnv, "body", 4) == 0)
t = siptag_payload, hc = sip_payload_class;
- else for (j = 0; (t = sip_tag_list[j]); j++) {
- hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
- if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
- break;
- else if (n == (size_t)hc->hc_len && strncasecmp(hnv, hc->hc_name, n) == 0)
- break;
+ else {
+ for (j = 0; (t = sip_tag_list[j]); j++) {
+ hc = (msg_hclass_t *)sip_tag_list[j]->tt_magic;
+ if (n == 1 && strncasecmp(hnv, hc->hc_short, 1) == 0)
+ break;
+ else if (n == (size_t)hc->hc_len &&
+ strncasecmp(hnv, hc->hc_name, n) == 0)
+ break;
+ }
}
value = (char *)hnv + n;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/sip_util.c Mon May 26 12:59:57 2008
@@ -364,17 +364,17 @@
*/
issize_t sip_header_field_d(su_home_t *home, sip_header_t *h, char *s, isize_t slen)
{
- assert(SIP_HDR_TEST(h));
-
if (h && s && s[slen] == '\0') {
size_t n = span_lws(s);
s += n; slen -= n;
-
+
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);
}
else
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sip/torture_sip.c Mon May 26 12:59:57 2008
@@ -2227,7 +2227,6 @@
static int test_content_disposition(void)
{
- /* Test Accept header */
sip_content_disposition_t *cd, *cd0;
su_home_t *home;
@@ -2247,6 +2246,38 @@
END();
}
+
+static int test_content_type(void)
+{
+ sip_content_type_t *c;
+ sip_content_type_t c0[1];
+ su_home_t *home;
+
+ BEGIN();
+
+ TEST_1(home = su_home_create());
+ TEST_1(c = sip_content_type_make(home, "application/sdp ; charset = utf-8"));
+ TEST_S(c->c_type, "application/sdp");
+ TEST_S(c->c_subtype, "sdp");
+ TEST_1(c->c_params && c->c_params[0] && !c->c_params[1]);
+ TEST_S(c->c_params[0], "charset=utf-8");
+ TEST_P(c->c_params[1], NULL);
+
+ sip_content_type_init(c0);
+ c = sip_content_type_dup(home, c0);
+ TEST_P(c->c_type, NULL);
+ TEST_P(c->c_subtype, NULL);
+
+ c0->c_type = "text";
+ c = sip_content_type_dup(home, c0);
+ TEST_S(c->c_type, "text");
+ TEST_P(c->c_subtype, NULL);
+
+ su_home_unref(home);
+ END();
+}
+
+
static int test_www_authenticate(void)
{
sip_www_authenticate_t *www;
@@ -3570,6 +3601,7 @@
retval |= test_refer(); fflush(stdout);
retval |= test_route(); fflush(stdout);
retval |= test_request_disposition(); fflush(stdout);
+ retval |= test_content_type(); fflush(stdout);
retval |= test_caller_prefs(); fflush(stdout);
retval |= test_callerpref_scoring(); fflush(stdout);
retval |= test_warning(); fflush(stdout);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa.c Mon May 26 12:59:57 2008
@@ -881,37 +881,41 @@
/** Set capabilities */
int
-soa_base_set_capability_sdp(soa_session_t *ss,
- sdp_session_t *sdp, char const *str0, isize_t len0)
+soa_base_set_capability_sdp(soa_session_t *ss,
+ sdp_session_t *_sdp,
+ char const *str0, isize_t len0)
{
+ sdp_session_t sdp[1];
sdp_origin_t o[1] = {{ sizeof(o) }};
sdp_connection_t *c, c0[1] = {{ sizeof(c0) }};
char c_address[64];
sdp_time_t t[1] = {{ sizeof(t) }};
sdp_media_t *m;
+ *sdp = *_sdp;
+
if (sdp->sdp_origin)
*o = *sdp->sdp_origin;
else
o->o_address = c0;
- sdp->sdp_origin = o;
-
if (soa_init_sdp_origin(ss, o, c_address) < 0)
return -1;
+ sdp->sdp_origin = o;
+
if (!sdp->sdp_subject)
- sdp->sdp_subject = "-";
+ sdp->sdp_subject = "-"; /* s=- */
- sdp->sdp_time = t;
+ sdp->sdp_time = t; /* t=0 0 */
/* Set port to zero - or should we check that port is already zero? */
for (m = sdp->sdp_media; m; m = m->m_next)
m->m_port = 0;
- c = sdp->sdp_origin->o_address;
-
if (sdp->sdp_connection == NULL) {
+ c = sdp->sdp_origin->o_address;
+
for (m = sdp->sdp_media; m; m = m->m_next)
if (m->m_connections == NULL)
break;
@@ -1977,6 +1981,9 @@
sdp_parser_t *parser = NULL;
sdp_session_t sdp[1];
+ if (ss == NULL)
+ return -1;
+
switch (what) {
case soa_capability_sdp_kind:
ssd = ss->ss_caps;
@@ -1994,15 +2001,16 @@
return -1;
}
- if (sdp_str && str_len == -1)
- str_len = strlen(sdp_str);
-
- if (sdp0)
+ if (sdp0) {
new_version = sdp_session_cmp(sdp0, ssd->ssd_sdp) != 0;
- else if (sdp_str)
+ sdp_str = NULL, str_len = -1;
+ }
+ else if (sdp_str) {
+ if (str_len == -1)
+ str_len = strlen(sdp_str);
new_version = !ssd->ssd_unparsed ||
- str0ncmp(sdp_str, ssd->ssd_unparsed, str_len) != 0 ||
- ssd->ssd_unparsed[str_len] != '\0';
+ str0ncmp(sdp_str, ssd->ssd_unparsed, str_len + 1) != 0;
+ }
else
return (void)su_seterrno(EINVAL), -1;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c Mon May 26 12:59:57 2008
@@ -1117,6 +1117,8 @@
if (action == generate_offer)
remote = NULL;
+ else if (remote == NULL)
+ return soa_set_status(ss, 500, "No remote SDP");
/* Pre-negotiation Step: Expand truncated remote SDP */
if (local && remote) switch (action) {
@@ -1127,6 +1129,8 @@
SU_DEBUG_5(("%s: remote %s is truncated: expanding\n",
by, action == generate_answer ? "offer" : "answer"));
remote = soa_sdp_expand_media(tmphome, remote, local);
+ if (remote == NULL)
+ return soa_set_status(ss, 500, "Cannot expand remote session");
}
default:
break;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c Mon May 26 12:59:57 2008
@@ -1026,7 +1026,10 @@
if (res->res_n_servers == 0)
return (void)su_seterrno(ENETDOWN), (sres_query_t *)NULL;
- if (sres_has_search_domain(res))
+ if (domain[dlen - 1] == '.')
+ /* Domain ends with dot - do not search */
+ dots = res->res_config->c_opt.ndots;
+ else if (sres_has_search_domain(res))
for (dots = 0, dot = strchr(domain, '.');
dots < res->res_config->c_opt.ndots && dot;
dots++, dot = strchr(dot + 1, '.'))
@@ -1045,6 +1048,8 @@
char const *const *domains = res->res_config->c_search;
char search[SRES_MAXDNAME + 1];
+ assert(dlen < SRES_MAXDNAME);
+
memcpy(search, domain, dlen);
search[dlen++] = '.';
search[dlen] = '\0';
@@ -1062,7 +1067,9 @@
sub = sres_query_alloc(res, sres_answer_subquery, (void *)query,
type, search);
- if (sres_send_dns_query(res, sub) == 0) {
+ if (sub == NULL) {
+ }
+ else if (sres_send_dns_query(res, sub) == 0) {
query->q_subqueries[i] = sub;
}
else {
@@ -1430,7 +1437,10 @@
{
int i, n;
- for (n = 0, i = 0; answers && answers[i]; i++) {
+ if (res == NULL || answers == NULL)
+ return su_seterrno(EFAULT);
+
+ for (n = 0, i = 0; answers[i]; i++) {
if (answers[i]->sr_record->r_status ||
answers[i]->sr_record->r_class != sres_class_in ||
(type != 0 && answers[i]->sr_record->r_type != type)) {
@@ -2010,6 +2020,10 @@
if (name_servers_length > MAX_DATALEN) break;
name_servers = su_realloc(home, name_servers, name_servers_length);
+ if (name_servers == NULL) {
+ ret = ERROR_BUFFER_OVERFLOW;
+ break;
+ }
}
/* if reading the key was succesful, continue */
@@ -3411,23 +3425,26 @@
#define ADDRSIZE 48
#endif
char host[ADDRSIZE] = "*";
+ uint16_t port = 0;
if (from == NULL)
;
else if (from->ss_family == AF_INET) {
struct sockaddr_in const *sin = (void *)from;
su_inet_ntop(AF_INET, &sin->sin_addr, host, sizeof host);
+ port = sin->sin_port;
}
#if HAVE_SIN6
else if (from->ss_family == AF_INET6) {
struct sockaddr_in6 const *sin6 = (void *)from;
su_inet_ntop(AF_INET6, &sin6->sin6_addr, host, sizeof host);
+ port = sin6->sin6_port;
}
#endif
SU_DEBUG_5(("sres_resolver_receive(%p, %p) id=%u (from [%s]:%u)\n",
(void *)res, (void *)query, m->m_id,
- host, ntohs(((struct sockaddr_in *)from)->sin_port)));
+ host, ntohs(port)));
}
}
@@ -3447,7 +3464,7 @@
{
sres_record_t *rr = NULL, **answers = NULL, *error = NULL;
sres_query_t *query = NULL, **hq;
- su_home_t *chome = CHOME(res->res_cache);
+ su_home_t *chome;
hash_value_t hash;
int err;
unsigned i, total, errorcount = 0;
@@ -3455,6 +3472,7 @@
assert(res && m && return_answers);
time(&res->res_now);
+ chome = CHOME(res->res_cache);
*qq = NULL;
*return_answers = NULL;
@@ -3737,8 +3755,9 @@
a6->a6_suffix.u6_addr[i] = m_get_uint8(m);
if (a6->a6_prelen > 0) {
- /* Zero pad bits */
- a6->a6_suffix.u6_addr[16 - suffixlen] &= 0xff >> (a6->a6_prelen & 7);
+ if (suffixlen > 0)
+ /* Zero pad bits */
+ a6->a6_suffix.u6_addr[16 - suffixlen] &= 0xff >> (a6->a6_prelen & 7);
offset = m->m_offset, prefixlen = m_get_domain(NULL, 0, m, 0) + 1;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_blocking.c Mon May 26 12:59:57 2008
@@ -111,7 +111,7 @@
sres_socket_t new_socket,
sres_socket_t old_socket)
{
- int i, N = b->n_sockets;
+ int i, N;
if (b == NULL)
return -1;
@@ -123,6 +123,8 @@
return 0;
}
+ N = b->n_sockets;
+
if (old_socket != INVALID_SOCKET) {
for (i = 0; i < N; i++) {
if (b->fds[i].fd == old_socket)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stun.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stun.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/stun/stun.c Mon May 26 12:59:57 2008
@@ -81,7 +81,7 @@
/** STUN log. */
su_log_t stun_log[] = { SU_LOG_INIT("stun", "STUN_DEBUG", SU_DEBUG) };
-/**@var STUN_DEBUG
+/**@var char const STUN_DEBUG[]
*
* Environment variable determining the debug log level for @b stun module.
*
@@ -90,7 +90,7 @@
*
* @sa <sofia-sip/su_debug.h>, stun_log, SOFIA_DEBUG
*/
-extern char const STUN__DEBUG[];
+extern char const STUN_DEBUG[];
enum {
STUN_SENDTO_TIMEOUT = 1000,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_alloc.h Mon May 26 12:59:57 2008
@@ -103,6 +103,8 @@
SU_DLL void su_home_check(su_home_t const *home);
+SU_DLL int su_home_check_alloc(su_home_t const *home, void const *data);
+
SU_DLL int su_home_mutex_lock(su_home_t *home);
SU_DLL int su_home_mutex_unlock(su_home_t *home);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c Mon May 26 12:59:57 2008
@@ -283,7 +283,7 @@
su_block_find_collision_size;
#endif
-su_inline su_alloc_t *su_block_find(su_block_t *b, void const *p)
+su_inline su_alloc_t *su_block_find(su_block_t const *b, void const *p)
{
size_t h, h0, probe;
@@ -306,8 +306,10 @@
probe = (b->sub_n > SUB_P) ? SUB_P : 1;
do {
- if (b->sub_nodes[h].sua_data == p)
- return &b->sub_nodes[h];
+ if (b->sub_nodes[h].sua_data == p) {
+ su_alloc_t const *retval = &b->sub_nodes[h];
+ return (su_alloc_t *)retval; /* discard const */
+ }
h += probe;
if (h >= b->sub_n)
h -= b->sub_n;
@@ -463,7 +465,7 @@
home->suh_blocks = b2;
if (sub && !sub->sub_auto)
- safefree(sub);
+ free(sub);
sub = b2;
}
@@ -836,6 +838,27 @@
safefree(data);
}
+/** Check if pointer has been allocated through home.
+ *
+ * @param home pointer to a memory home
+ * @param data pointer to a memory area possibly allocated though home
+ */
+int su_home_check_alloc(su_home_t const *home, void const *data)
+{
+ int retval = 0;
+
+ if (home && data) {
+ su_block_t const *sub = MEMLOCK(home);
+ su_alloc_t *allocation = su_block_find(sub, data);
+
+ retval = allocation != NULL;
+
+ UNLOCK(home);
+ }
+
+ return retval;
+}
+
/** Check home consistency.
*
* Ensures that the home structure and all memory blocks allocated through
@@ -1065,7 +1088,7 @@
else
used = s->sub_used;
- if ((used && d == NULL) || 3 * used > 2 * d->sub_n) {
+ if (used && (d == NULL || 3 * used > 2 * d->sub_n)) {
if (d)
for (n = n2 = d->sub_n; 3 * used > 2 * n2; n2 = 4 * n2 + 3)
;
@@ -1099,7 +1122,9 @@
d = d2;
}
- if ((n = s->sub_n)) {
+ if (s->sub_used) {
+ n = s->sub_n;
+
for (i = 0; i < n; i++)
if (s->sub_nodes[i].sua_data) {
su_block_add(d, s->sub_nodes[i].sua_data)[0] = s->sub_nodes[i];
@@ -1111,6 +1136,7 @@
}
if (s->sub_stats) {
+ /* XXX */
}
}
@@ -1626,7 +1652,7 @@
/** Retrieve statistics from memory home.
*/
void su_home_get_stats(su_home_t *home, int include_clones,
- su_home_stat_t hs[1],
+ su_home_stat_t *hs,
isize_t size)
{
su_block_t *sub;
@@ -1634,7 +1660,7 @@
if (hs == NULL || size < (sizeof hs->hs_size))
return;
- memset(hs, 0, size);
+ memset((void *)hs, 0, size);
sub = MEMLOCK(home);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_base_port.c Mon May 26 12:59:57 2008
@@ -560,11 +560,18 @@
su_root_destroy(task->sut_root);
}
+/**Wait for the clone to exit.
+ * @internal
+ *
+ * Called by su_port_wait() and su_clone_wait()
+ */
void su_base_port_wait(su_clone_r rclone)
{
su_port_t *self;
su_root_t *root_to_wait;
+ assert(*rclone);
+
self = su_msg_from(rclone)->sut_port;
assert(self == su_msg_to(rclone)->sut_port);
root_to_wait = su_msg_to(rclone)->sut_root;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_md5.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_md5.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_md5.c Mon May 26 12:59:57 2008
@@ -332,7 +332,7 @@
p = ctx->in + count;
*p++ = 0x80;
- /* Bytes of padding needde to make 64 bytes */
+ /* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_port.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_port.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_port.c Mon May 26 12:59:57 2008
@@ -427,10 +427,18 @@
#endif
}
+/** Wait for clone to exit.
+ *
+ * @internal
+ *
+ * Called by su_clone_wait().
+ */
void su_port_wait(su_clone_r rclone)
{
su_port_t *cloneport;
+ assert(*rclone);
+
cloneport = su_msg_to(rclone)->sut_port;
cloneport->sup_vtable->su_port_wait(rclone);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_pthread_port.c Mon May 26 12:59:57 2008
@@ -388,6 +388,8 @@
/** Wait for the pthread clone to exit.
* @internal
+ *
+ * Called by su_port_wait() and su_clone_wait().
*/
void su_pthread_port_wait(su_clone_r rclone)
{
@@ -395,6 +397,8 @@
struct su_pthread_port_waiting_parent mom[1];
pthread_t tid;
+ assert(*rclone);
+
clone = su_msg_to(rclone)->sut_port;
parent = su_msg_from(rclone)->sut_port;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_taglist.c Mon May 26 12:59:57 2008
@@ -155,7 +155,7 @@
if (m < 0)
return m;
- if (m == 0 && (size_t)n < size)
+ if (m == 0 && 0 < n && (size_t)n < size)
b[--n] = '\0';
return n + m;
@@ -756,6 +756,8 @@
va_end(aq);
t = rv = malloc(size);
+ if (rv == NULL)
+ return rv;
tagi[0].t_tag = tag;
tagi[0].t_value = value;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_vector.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_vector.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_vector.c Mon May 26 12:59:57 2008
@@ -236,13 +236,18 @@
*/
int su_vector_append(su_vector_t *vector, void *item)
{
- size_t index = vector->v_len;
+ size_t index;
- if (vector && su_vector_make_place(vector, index)) {
- vector->v_list[index] = item;
- return 0;
- }
- return -1;
+ if (vector == 0)
+ return -1;
+
+ index = vector->v_len;
+
+ if (su_vector_make_place(vector, index) <= 0)
+ return -1;
+
+ vector->v_list[index] = item;
+ return 0;
}
/**Get a numbered item from list.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/su/su_wait.c Mon May 26 12:59:57 2008
@@ -185,17 +185,14 @@
int su_wait_destroy(su_wait_t *waitobj)
{
#if SU_HAVE_WINSOCK
- su_wait_t w0 = NULL;
+ assert(waitobj != NULL);
if (*waitobj)
WSACloseEvent(*waitobj);
-#elif SU_HAVE_POLL || HAVE_SELECT
- su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
#else
su_wait_t w0 = { INVALID_SOCKET, 0, 0 };
-#endif
assert(waitobj != NULL);
*waitobj = w0;
-
+#endif
return waitobj ? 0 : -1;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport.c Mon May 26 12:59:57 2008
@@ -1178,7 +1178,6 @@
ta_list ta;
int n;
tport_params_t const *tpp;
- tport_primary_t const *pri = self->tp_pri;
int connect;
if (self == NULL)
@@ -1207,7 +1206,9 @@
TPTAG_THRPRQSIZE(tpp->tpp_thrprqsize),
TPTAG_SIGCOMP_LIFETIME(tpp->tpp_sigcomp_lifetime),
TPTAG_STUN_SERVER(tpp->tpp_stun_server),
- TAG_IF(pri, TPTAG_PUBLIC(pri ? pri->pri_public : 0)),
+ TAG_IF(self->tp_pri,
+ TPTAG_PUBLIC(self->tp_pri ?
+ self->tp_pri->pri_public : 0)),
TPTAG_TOS(tpp->tpp_tos),
TAG_END());
@@ -2956,7 +2957,7 @@
#if SU_HAVE_IN6
if (su->su_family == AF_INET6) {
ipaddr[0] = '[';
- su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr + 1, sizeof(ipaddr) - 1);
+ su_inet_ntop(su->su_family, SU_ADDR(su), ipaddr + 1, SU_ADDRSIZE);
strcat(ipaddr, "]");
}
else {
@@ -4680,7 +4681,9 @@
n_canon = 0;
s = su_alloc(home, n_proto + n_canon + n_host + n_port + n_comp);
-
+ if (s == NULL)
+ return -1;
+
if (n_proto)
dst->tpn_proto = memcpy(s, src->tpn_proto, n_proto), s += n_proto;
else
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_logging.c Mon May 26 12:59:57 2008
@@ -152,13 +152,17 @@
char label[24] = "";
char *comp = "";
char name[SU_ADDRSIZE] = "";
- su_sockaddr_t const *su = msg_addr(msg);
+ su_sockaddr_t const *su;
unsigned short second, minute, hour;
+ assert(self); assert(msg);
+
second = (unsigned short)(now.tv_sec % 60);
minute = (unsigned short)((now.tv_sec / 60) % 60);
hour = (unsigned short)((now.tv_sec / 3600) % 24);
+ su = msg_addr(msg);
+
#if SU_HAVE_IN6
if (su->su_family == AF_INET6) {
if (su->su_sin6.sin6_flowinfo)
@@ -183,10 +187,13 @@
size_t n, su_iovec_t const iov[], size_t iovused,
char const *what, char const *how)
{
- tport_master_t *mr = self->tp_master;
+ tport_master_t *mr;
char stamp[128];
size_t i;
+ assert(self); assert(msg);
+
+ mr = self->tp_master;
if (!mr->mr_dump_file)
return;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_tag.c Mon May 26 12:59:57 2008
@@ -226,7 +226,7 @@
* If true, respond with PONG to PING. Default value is 0 (false).
*
* If set, the ping-pong protocol is used on TCP connections. If a ping (at
- * least 4 whitespace characters) is received within messages, a pong
+ * least 4 whitespace characters) is received between messages, a pong
* (CR-LF) is sent in response.
*
* Use with tport_tcreate(), tport_tbind(), tport_set_params(), nua_create(),
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tcp.c Mon May 26 12:59:57 2008
@@ -277,7 +277,8 @@
if (n <= 0)
return (int)n;
- SU_DEBUG_7(("%s(%p): received keepalive\n", __func__, (void *)self));
+ SU_DEBUG_7(("%s(%p): received keepalive (total %u)\n", __func__,
+ (void *)self, self->tp_ping));
N -= n, self->tp_ping += n;
@@ -449,7 +450,9 @@
__func__, (void *)self,
"closing connection", TPN_ARGS(self->tp_name),
" because of PONG timeout"));
- tport_close(self);
+ tport_error_report(self, EPIPE, NULL);
+ if (!self->tp_closed)
+ tport_close(self);
return;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/open_c/group/test_nua.mmp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/open_c/group/test_nua.mmp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/open_c/group/test_nua.mmp Mon May 26 12:59:57 2008
@@ -42,7 +42,7 @@
SOURCEPATH ..\..\libsofia-sip-ua\su
SOURCE memmem.c
-SOURCEPATH ..\..\libsofia-sip-ua\nua
+SOURCEPATH ..\..\tests
SOURCE test_nua.c
SOURCE test_ops.c
SOURCE test_init.c
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am Mon May 26 12:59:57 2008
@@ -32,20 +32,13 @@
libtestnat_a_SOURCES = test_nat.h test_nat.c test_nat_tags.c
-#
-# Install in special test package
-#
-testsdir = ${libdir}/tests/libsofia-sip-ua-tests
-tests_PROGRAMS =
-
if HAVE_CHECK
TESTS += check_sofia
-tests_PROGRAMS += check_sofia
+check_PROGRAMS += check_sofia
endif
check_sofia_CFLAGS = @CHECK_CFLAGS@
-
check_sofia_SOURCES = check_sofia.c check_sofia.h \
suite_for_nua.c
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.dsp Mon May 26 12:59:57 2008
@@ -725,6 +725,10 @@
# End Source File
# Begin Source File
+SOURCE="..\..\libsofia-sip-ua\nua\nua_types.h"
+# End Source File
+# Begin Source File
+
SOURCE="..\..\libsofia-sip-ua\nua\outbound.c"
# End Source File
# Begin Source File
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/libsofia-sip-ua/libsofia_sip_ua.vcproj Mon May 26 12:59:57 2008
@@ -3232,6 +3232,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\..\libsofia-sip-ua\nua\nua_types.h"
+ >
+ </File>
+ <File
RelativePath="..\..\libsofia-sip-ua\nua\outbound.c"
>
<FileConfiguration
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.dsp Mon May 26 12:59:57 2008
@@ -89,39 +89,39 @@
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_100rel.c"
+SOURCE="..\..\..\tests\test_100rel.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_basic_call.c"
+SOURCE="..\..\..\tests\test_basic_call.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_call_hold.c"
+SOURCE="..\..\..\tests\test_call_hold.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_call_reject.c"
+SOURCE="..\..\..\tests\test_call_reject.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_cancel_bye.c"
+SOURCE="..\..\..\tests\test_cancel_bye.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_extension.c"
+SOURCE="..\..\..\tests\test_extension.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_init.c"
+SOURCE="..\..\..\tests\test_init.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nat.c"
+SOURCE="..\..\..\tests\test_nat.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nat.h"
+SOURCE="..\..\..\tests\test_nat.h"
# End Source File
# Begin Source File
@@ -129,55 +129,55 @@
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nua.c"
+SOURCE="..\..\..\tests\test_nua.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nua.h"
+SOURCE="..\..\..\tests\test_nua.h"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nua_api.c"
+SOURCE="..\..\..\tests\test_nua_api.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_nua_params.c"
+SOURCE="..\..\..\tests\test_nua_params.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_offer_answer.c"
+SOURCE="..\..\..\tests\test_offer_answer.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_ops.c"
+SOURCE="..\..\..\tests\test_ops.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_proxy.c"
+SOURCE="..\..\..\tests\test_proxy.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_proxy.h"
+SOURCE="..\..\..\tests\test_proxy.h"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_refer.c"
+SOURCE="..\..\..\tests\test_refer.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_register.c"
+SOURCE="..\..\..\tests\test_register.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_session_timer.c"
+SOURCE="..\..\..\tests\test_session_timer.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_simple.c"
+SOURCE="..\..\..\tests\test_simple.c"
# End Source File
# Begin Source File
-SOURCE="..\..\..\libsofia-sip-ua\nua\test_sip_events.c"
+SOURCE="..\..\..\tests\test_sip_events.c"
# End Source File
# Begin Source File
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/win32/tests/test_nua/test_nua.vcproj Mon May 26 12:59:57 2008
@@ -234,7 +234,7 @@
>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_100rel.c"
+ RelativePath="..\..\..\tests\test_100rel.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -256,7 +256,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_basic_call.c"
+ RelativePath="..\..\..\tests\test_basic_call.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -278,7 +278,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_call_hold.c"
+ RelativePath="..\..\..\tests\test_call_hold.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -300,7 +300,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_call_reject.c"
+ RelativePath="..\..\..\tests\test_call_reject.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -322,7 +322,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_cancel_bye.c"
+ RelativePath="..\..\..\tests\test_cancel_bye.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -344,7 +344,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_extension.c"
+ RelativePath="..\..\..\tests\test_extension.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -366,7 +366,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_init.c"
+ RelativePath="..\..\..\tests\test_init.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -388,7 +388,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nat.c"
+ RelativePath="..\..\..\tests\test_nat.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -410,7 +410,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nat.h"
+ RelativePath="..\..\..\tests\test_nat.h"
>
</File>
<File
@@ -436,7 +436,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nua.c"
+ RelativePath="..\..\..\tests\test_nua.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -458,11 +458,11 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nua.h"
+ RelativePath="..\..\..\tests\test_nua.h"
>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nua_api.c"
+ RelativePath="..\..\..\tests\test_nua_api.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -484,7 +484,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_nua_params.c"
+ RelativePath="..\..\..\tests\test_nua_params.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -506,11 +506,11 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_offer_answer.c"
+ RelativePath="..\..\..\tests\test_offer_answer.c"
>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_ops.c"
+ RelativePath="..\..\..\tests\test_ops.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -532,7 +532,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_proxy.c"
+ RelativePath="..\..\..\tests\test_proxy.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -554,11 +554,11 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_proxy.h"
+ RelativePath="..\..\..\tests\test_proxy.h"
>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_refer.c"
+ RelativePath="..\..\..\tests\test_refer.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -580,7 +580,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_register.c"
+ RelativePath="..\..\..\tests\test_register.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -602,7 +602,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_session_timer.c"
+ RelativePath="..\..\..\tests\test_session_timer.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -624,7 +624,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_simple.c"
+ RelativePath="..\..\..\tests\test_simple.c"
>
<FileConfiguration
Name="Debug|Win32"
@@ -646,7 +646,7 @@
</FileConfiguration>
</File>
<File
- RelativePath="..\..\..\libsofia-sip-ua\nua\test_sip_events.c"
+ RelativePath="..\..\..\tests\test_sip_events.c"
>
<FileConfiguration
Name="Debug|Win32"
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/GNUmakefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/GNUmakefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/GNUmakefile Mon May 26 12:59:57 2008
@@ -1,80 +1,151 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)
-endif
-SUBDIR = .
-BUILDDIR = $(SRCDIR)
-VPATH = .:$(SRCDIR)
+include Makefile.srcdir
-include $(SRCDIR)/Makefile.config
+BLDDIR = $(CURDIR)
+SUBDIR =
-SUBDIRS = include src lib tools
+export SRCDIR
+export BLDDIR
-PROGRAMS_TO_INSTALL = xmlrpc-c-config
+include $(BLDDIR)/Makefile.version
+include $(BLDDIR)/config.mk
+
+SUBDIRS = include lib src tools examples
+
+# The reason we don't build tools and examples by default is that they
+# contain executables, which require significantly more from the
+# environment to build than libraries. Ergo, they are signficantly
+# more likely to fail to build. Indeed, when 'tools' was built by
+# default, the majority of the reported build problems were with that.
+# Since they are ancillary to the package, building them by default is
+# not worth causing the whole build to fail.
-# We're in a transition between the bloated, complex GNU
-# Autoconf/Automake style of build, in which 'configure' creates all
-# the make files, to simpler static make files. Some directories have
-# been converted; some haven't. So we have the hack of putting
-# 'xmlrpc_config.h' as the first dependency of 'all' to make sure
-# 'configure runs before anything in the case that the user neglects
-# to run 'configure' before doing 'make'.
+# As with any subdirectory, to build 'tools' or 'examples', cd to the
+# subdirectory and make there.
+
+DEFAULT_SUBDIRS = include lib src
+
+PROGRAMS_TO_INSTALL = xmlrpc-c-config
-default: xmlrpc_config.h all
+default: xmlrpc-c-config xmlrpc-c-config.test $(DEFAULT_SUBDIRS:%=%/all)
.PHONY: all
all: xmlrpc-c-config xmlrpc-c-config.test $(SUBDIRS:%=%/all)
-# We don't want the transport_config.h rule in Makefile.common:
+# The examples subdirectory is special, because even the make file in there
+# is designed to be an example. So it has to be simple and as close as
+# possible to something a person could use outside of the Xmlrpc-c source
+# tree. One ramification of that is that it does not specify dependencies
+# on other parts of the Xmlrpc-c build. That means we must separately
+# ensure that the Xmlrpc-c libraries are built before making the example
+# programs.
+#
+# It also means that you have to manually clean the examples directory
+# in order to get the examples rebuilt after you modify the Xmlrpc-c
+# libraries.
+
+examples/all: xmlrpc-c-config.test lib/all src/all include/all
+
+# Parallel make (make --jobs) is not smart enough to coordinate builds
+# between submakes, so a naive parallel make would cause certain
+# targets to get built multiple times simultaneously. That is usually
+# unacceptable. So we introduce extra dependencies here just to make
+# sure such targets are already up to date before the submake starts,
+# for the benefit of parallel make. Note that we ensure that parallel
+# make works for 'make all' in the top directory, but it may still fail
+# for the aforementioned reason for other invocations.
+
+tools/all: include/all lib/all src/all
+src/all lib/all: include/all
+src/all: lib/all
+
+MAJOR := $(XMLRPC_MAJOR_RELEASE)
+MINOR := $(XMLRPC_MINOR_RELEASE)
+POINT := $(XMLRPC_POINT_RELEASE)
+version.h: $(SRCDIR)/Makefile.version
+ rm -f $@
+ echo "/* Generated by make file rule */" >>$@
+ echo "#define XMLRPC_C_VERSION" \
+ \"Xmlrpc-c $(MAJOR).$(MINOR).$(POINT)"\"" >>$@
+ echo "#define XMLRPC_VERSION_MAJOR $(MAJOR)" >>$@
+ echo "#define XMLRPC_VERSION_MINOR $(MINOR)" >>$@
+ echo "#define XMLRPC_VERSION_POINT $(POINT)" >>$@
+
+# We don't want common.mk's rule for version.h
+OMIT_VERSION_H = Y
+
+# We don't want common.mk's rule for transport_config.h
OMIT_TRANSPORT_CONFIG_H = Y
-transport_config.h: $(BUILDDIR)/Makefile.config
+
+include transport_config.make
+
+# shell_config is a fragment to place inside a Bourne shell program that
+# sets variables that tell how the build is configured.
+
+shell_config: $(BLDDIR)/config.mk
+ rm -f $@
+ @echo "Lots of echoes to '$@' suppressed here ..."
+ @echo '#' >>$@
+ @echo '#######################################################' >>$@
+ @echo "# From '$@'" >>$@
+ @echo '#######################################################' >>$@
+ @echo 'ENABLE_ABYSS_THREADS="$(ENABLE_ABYSS_THREADS)"' >>$@
+ @echo 'ENABLE_LIBXML2_BACKEND="$(ENABLE_LIBXML2_BACKEND)"' >>$@
+ @echo 'MUST_BUILD_WININET_CLIENT="$(MUST_BUILD_WININET_CLIENT)"'>>$@
+ @echo 'MUST_BUILD_CURL_CLIENT="$(MUST_BUILD_CURL_CLIENT)"' >>$@
+ @echo 'MUST_BUILD_LIBWWW_CLIENT="$(MUST_BUILD_LIBWWW_CLIENT)"' >>$@
+ @echo 'NEED_RPATH="$(NEED_RPATH)"' >>$@
+ @echo 'NEED_WL_RPATH="$(NEED_WL)RPATH)"' >>$@
+ @echo 'LSOCKET="$(LSOCKET)"' >>$@
+ @echo 'WININET_LDADD="$(WININET_LDADD)"' >>$@
+ @echo 'WININET_RPATH="$(WININET_RPATH)"' >>$@
+ @echo 'WININET_WL_RPATH="$(WININET_WL_RPATH)"' >>$@
+ @echo 'CURL_LDADD="$(CURL_LDADD)"' >>$@
+ @echo 'CURL_RPATH="$(CURL_RPATH)"' >>$@
+ @echo 'CURL_WL_RPATH="$(CURL_WL_RPATH)"' >>$@
+ @echo 'LIBWWW_LDADD="$(LIBWWW_LDADD)"' >>$@
+ @echo 'LIBWWW_RPATH="$(LIBWWW_RPATH)"' >>$@
+ @echo 'LIBWWW_WL_RPATH="$(LIBWWW_WL_RPATH)"' >>$@
+ @echo 'XMLRPC_MAJOR_RELEASE="$(XMLRPC_MAJOR_RELEASE)"' >>$@
+ @echo 'XMLRPC_MINOR_RELEASE="$(XMLRPC_MINOR_RELEASE)"' >>$@
+ @echo 'XMLRPC_POINT_RELEASE="$(XMLRPC_POINT_RELEASE)"' >>$@
+ @echo 'FEATURE_LIST="$(FEATURE_LIST)"' >>$@
+ @echo 'PREFIX="$(PREFIX)"' >>$@
+ @echo 'HEADERINST_DIR="$(HEADERINST_DIR)"' >>$@
+ @echo 'LIBINST_DIR="$(LIBINST_DIR)"' >>$@
+ @echo 'BLDDIR="$(BLDDIR)"' >>$@
+ @echo 'ABS_SRCDIR="$(ABS_SRCDIR)"' >>$@
+ @echo '#######################################################' >>$@
+
+# We don't want config.mk's xmlrpc-c-config.test rule:
+OMIT_XMLRPC_C_CONFIG_TEST = Y
+
+xmlrpc-c-config xmlrpc-c-config.test:%: %.main shell_config
rm -f $@
- echo '/* This file was generated by a make rule */' >>$@
-ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
- echo '#define MUST_BUILD_WININET_CLIENT 1' >>$@
-else
- echo '#define MUST_BUILD_WININET_CLIENT 0' >>$@
-endif
-ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
- echo '#define MUST_BUILD_CURL_CLIENT 1' >>$@
-else
- echo '#define MUST_BUILD_CURL_CLIENT 0' >>$@
-endif
-ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
- echo '#define MUST_BUILD_LIBWWW_CLIENT 1' >>$@
-else
- echo '#define MUST_BUILD_LIBWWW_CLIENT 0' >>$@
-endif
- echo "static const char * const XMLRPC_DEFAULT_TRANSPORT =" >>$@
-ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
- echo '"libwww";' >>$@
-else
- ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
- echo '"curl";' >>$@
- else
- ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
- echo '"wininet";' >>$@
- else
- @echo 'ERROR: no client XML transport configured'; rm $@; false
- endif
- endif
-endif
+ @echo "Echoes to '$@' suppressed here ..."
+ @echo '#! /bin/sh' >>$@
+ @echo '#' >>$@
+ @echo '# This file was generated by a make rule' >>$@
+ @echo '#' >>$@
+ cat shell_config >>$@
+ cat $< >>$@
+ chmod a+rx $@
.PHONY: clean clean-local
clean: $(SUBDIRS:%=%/clean) clean-common clean-local
clean-local:
- rm -f transport_config.h
+ rm -f transport_config.h version.h
.PHONY: distclean distclean-local
distclean: $(SUBDIRS:%=%/distclean) distclean-common distclean-local
distclean-local: clean-local
- rm -f config.log config.status Makefile.config libtool
- rm -f xmlrpc_config.h xmlrpc_amconfig.h stamp-h xmlrpc-c.spec
- rm -f xmlrpc-c-config xmlrpc-c-config.test
+ rm -f config.log config.status config.mk Makefile.srcdir
+ rm -f xmlrpc_config.h xmlrpc_amconfig.h stamp-h
+ rm -f shell_config xmlrpc-c-config xmlrpc-c-config.test
+ rm -f TAGS
-.PHONY: tags
-tags: $(SUBDIRS:%=%/tags) TAGS
+check: $(SUBDIRS:%=%/check)
DISTFILES =
@@ -82,29 +153,31 @@
distdir: distdir-common
.PHONY: install
-install: $(SUBDIRS:%=%/install) install-common install-compat-hdr
-
-.PHONY: install-compat-hdr
-install-compat-hdr:
-# Install old names of header files for backward compatibility
- cd $(DESTDIR)$(HEADERINST_DIR); \
- rm -f xmlrpc.h xmlrpc_client.h xmlrpc_server.h xmlrpc_cgi.h \
- xmlrpc_server_abyss.h xmlrpc_server_w32httpsys.h \
- XmlRpcCpp.h; \
- $(LN_S) xmlrpc-c/oldxmlrpc.h xmlrpc.h; \
- $(LN_S) xmlrpc-c/client.h xmlrpc_client.h; \
- $(LN_S) xmlrpc-c/server.h xmlrpc_server.h; \
- $(LN_S) xmlrpc-c/server_cgi.h xmlrpc_cgi.h; \
- $(LN_S) xmlrpc-c/server_abyss.h xmlrpc_server_abyss.h; \
- $(LN_S) xmlrpc-c/server_w32httpsys.h xmlrpc_server_w32httpsys.h; \
- $(LN_S) xmlrpc-c/oldcppwrapper.hpp XmlRpcCpp.h ;\
+install: $(DEFAULT_SUBDIRS:%=%/install) install-common
.PHONY: dep
-dep: $(SUBDIRS:%=%/dep)
+dep: version.h $(BLDDIR)/include/xmlrpc-c/config.h $(SUBDIRS:%=%/dep)
-xmlrpc-c-config xmlrpc-c-config.test xmlrpc_config.h xmlrpc_amconfig.h \
+xmlrpc_config.h xmlrpc_amconfig.h \
:%:%.in $(SRCDIR)/configure
$(SRCDIR)/configure
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
+
+# A trick to catch a common user error. When you don't run 'configure',
+# you don't have a Makefile.srcdir, which means $(SRCDIR) is null.
+
+/common.mk:
+ @echo =======================================
+ @echo = You must run Configure before Make. =
+ @echo =======================================
+ false
+
+# 'tags' generates/updates an Emacs tags file, anmed TAGS, in the current
+# directory. Use with Emacs command 'find-tag'.
+
+.PHONY: tags
+tags:
+ find . -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" | \
+ etags -
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Makefile Mon May 26 12:59:57 2008
@@ -7,8 +7,11 @@
# GNU Make uses a make file named "GNUmakefile" in preference to "Makefile"
# if it exists. This package contains a "GNUmakefile".
+default: all
+
all install clean dep depend:
@echo "You must use GNU Make to build this. You are running some "
@echo "other Make. GNU Make may be installed on your system with "
@echo "the name 'gmake'. If not, see http://www.gnu.org/software ."
@echo
+ false
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/README
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/README (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/README Mon May 26 12:59:57 2008
@@ -36,51 +36,17 @@
configure the build to use that instead. There's no really pressing
reason to do that, though.
-Once you have the prerequisite libraries installed, you can issue
-these commands:
+BUILDING, INSTALLING
+--------------------
+
+See the file doc/INSTALL.
+
+In the simplest case, it's just a conventional
$ ./configure
$ make
$ make install
-(There's supposed to be a 'make check' step in there too, to validate
-that everything built OK, but it's broken right now - 2005.01.07).
-
-To see it work, run a simple server like this:
-
- $ examples/xmlrpc_sample_add_server 8080
-
-Then run a client that does an RPC to this server:
-
- $ examples/xmlrpc_sample_add_client
-
-(I don't mean to imply that the above are consecutive shell commands;
-They can't be, because the server program runs indefinitely).
-
-Also try other sample servers and clients, described in examples/README.
-
-
-You may want to pass a '--prefix' argument to 'configure'. See
-'./configure --help' for details.
-
-You may also want to disable client XML transports that you won't be
-using. In particular, the Libwww transport can be inconvenient, because
-it typically uses about 20 shared libraries. Any XML-RPC client
-program that uses Xmlrpc-c, whether or not the program uses any of the
-libwww facilities, must attach all those libraries, and that can take
-a significant amount of time.
-
-See './configure --help' for the options that disable certain transports.
-
-
-
-WINDOWS
--------
-
-All of the above is essentially for Unix-type operating systems. To
-build and use Xmlrpc-c on Windows, see the file
-Windows/ReadMeWin32.txt.
-
ADDITIONAL INFORMATION
----------------------
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ConfigureWin32.bat
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ConfigureWin32.bat (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ConfigureWin32.bat Mon May 26 12:59:57 2008
@@ -1,7 +1,35 @@
-@echo off
-echo creating Win32 header files...
-copy .\xmlrpc_win32_config.h ..\config.h
-copy .\xmlrpc_win32_config.h ..\xmlrpc_config.h
-copy .\transport_config_win32.h ..\transport_config.h
-echo completed creating win32 header files.
-pause
+@REM Windows build
+@REM This must be RUN once to establish some header files,
+@REM that are generated by the automake process
+@echo creating Win32 header files...once only
+@set TEMPV=
+@if EXIST ..\include\xmlrpc-c\config.h goto DN1
+copy .\win32_config.h ..\include\xmlrpc-c\config.h > nul
+@set TEMPV=%TEMPV% ..\include\xmlrpc-c\config.h
+:DN1
+@if EXIST ..\xmlrpc_config.h goto DN2
+copy .\xmlrpc_win32_config.h ..\xmlrpc_config.h > nul
+@set TEMPV=%TEMPV% ..\xmlrpc_config.h
+:DN2
+@if EXIST ..\transport_config.h goto DN3
+copy .\transport_config_win32.h ..\transport_config.h > nul
+@set TEMPV=%TEMPV% ..\transport_config.h
+:DN3
+@if EXIST ..\version.h goto DN4
+call mkvers
+@set TEMPV=%TEMPV% ..\version.h
+:DN4
+@if EXIST ..\examples\config.h goto DN5
+copy .\xmlrpc_win32_config.h ..\examples\config.h > nul
+@set TEMPV=%TEMPV% ..\examples\config.h
+:DN5
+@if "%TEMPV%." == "." goto ALLDN
+@echo Generated the following win32 header files ...
+@echo %TEMPV%
+@goto END
+
+:ALLDN
+@echo Using previous copies ... Use CleanWin32.bat to remove, and do again ...
+@goto END
+
+:END
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ReadMeWin32.txt
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ReadMeWin32.txt (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/ReadMeWin32.txt Mon May 26 12:59:57 2008
@@ -1,116 +1,64 @@
-Build Instructions For XML-RPC For C/C++ On Windows
----------------------------------------------------
-
-The following instructions do not fully work in this release. There
-is no trivial way to build this release for Windows. The last release
-that was known to build without special effort on the part of the user
-is 1.02.
-
-Since then, nobody has maintained the code for Windows, and changes that
-were made for other platforms broke some things for Windows. Most likely,
-anyone with a passing knowledge of building C code on Windows could
-update this code to work on Windows without any in-depth study of it. If
-you do so, please contribute your work to save other users the trouble.
-
-The majority of the work that needs to be done to make the code build on
-Windows is simply adjusting project files to reflect the fact that files
-have been created, deleted, and moved since they were written.
-
-
-This release includes the option to compile the "http.sys" version of the
-XMLRPC-C server. If you do not wish to build in the http.sys server,
-set the MUST_BUILD_HTTP_SYS_SERVER to 0 in the transport_config_win32.h and/or
-the transport_config.h file. Successful conpilation requires installation
-of the Microsoft Platform SDK for Windows XP SP2 (or later) to get the latest
-header and link libraries required to support this functionality. After
-installation, be sure to properly register the directories as documented
-in the Platform SDK help file topic "Installing the Platform SDK with
-Visual Studio". Download the Platform SDK from:
-http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
-
-To create the three headers required for Win32 WinInet compilation, run the
-ConfigureWin32.bat found in the Windows directory. If you wish to alter the
-transports that are built to include curl or libwww, adjust the preprocessor
-definitions at the top of the transport_config_win32.h and/or
-the transport_config.h files. See the file UsingCURLinWin32.txt for
-more information on using the curl transport.
-
-To compile, open the xmlrpc.dsw file in Visual Studio 6 or greater. The
-project will convert and work fine in Visual Studio 2003 as well -
-other versions of Visual Studio were not tested.
-NOTE: If you get an error while opening or converting the project files,
-it is likely due to using WinRar or similar to decompress the distribution
-tarball. You can use WinZip or another utility to correctly decompress the
-.tgz file.
-
-Suggested testing for evaluation of the library involves a few projects.
-Here is a quick getting started guide:
-
-1) Set the Active Project to query_meerkat and build it in release or debug
- modes. The dependent projects will be built automatically. In the
- project settings dialog, add the argument for what you wish to query
- meerkat for - "Windows" is a good query. Run the project. This will
- query the meerkat server for articles related to windows and output the
- results to the console.
-
-2) Set the Active Project to xmlrpc_sample_add_server and build it in
- release or debug modes. The dependent projects will be built
- automatically. In the project settings dialog, add the argument for
- the port to 8080. This will run the server sample which adds two
- numbers and returns a result. You should run this from a command
- prompt instead of through Visual Studio so you may run the sample
- client as well.
-
-3) Set the Active Project to xmlrpc_sample_add_sync_client or
- xmlrpc_sample_add_async_client and build it in release or debug modes.
- The dependent projects will be built automatically. This will run
- the client sample which submits two numbers to be added to the server
- application as described above and displays the result. Note that the
- client example comes in the sync and async varieties.
-
-Steven Bone
-July 27, 2005
-sbone(a)pobox.com
-
-WIN32 CHANGES
-
-Changes from the 1.02 release for Win32:
-1) Option to easily disable the http.sys server for those who do not need
- it or wish to download the Platform SDK.
-
-Changes from the 1.01 -> 1.02 release for Win32:
-1) Project files for gennmtab, xmlparse, and xmltok updated to include the
- path to the xmlrpc_config.h file.
-2) Bugfix for WinInet authentication.
-3) Supports xmlrpc_xportparms, xmlrpc_wininet_xportparms added
- *potential breaking change* - now by default we fail on invalid
- SSL certs, use the xmlrpc_wininet_xportparms option to enable old
- behavior.
-4) Added project file for xmlrpc_sample_auth_client
-5) Added project and src for a http.sys based xmlrpc-c server. See comments
- in the source files. This supports Windows XP SP2 and Windows Server
- 2003 and allows other http.sys based applications to bind to the same
- port. In Server 2003, IIS uses http.sys and thus the XML-RPC server
- can be run on the standard port 80 along with IIS. The sample also
- supports https and basic authentication. It tested OK with
- http://validator.xmlrpc.com/ Note that the Platform SDK headers and
- link libraries for Windows XP SP2 or newer are required to compile
- xmlrpc-c for this module. If you are not using this server, it is
- safe to exclude the xmlrpc_server_w32httpsys.c file from the xmlrpc
- project and these dependencies will not be required. You can get the
- latest platform SDK at
- http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
- Be sure after installation to choose the program to "register the PSDK
- directories with Visual Studio" so the newer headers are found.
-6) Better support for libcurl. Updated project files, transport_config_win32.h,
- added documentation UsingCURLinWin32.txt.
-
-Changes from the 1.00 -> 1.01 release for Win32:
-1) Project files now reflect static linking for the expat XML library.
-2) Example projects were created/updated to keep them in sync with the
- distribution. The project files were moved into the .\Windows
- directory
-3) Projects for the rpc and cpp tests were created. The
- xmlrpc_win32_config.h defines the directory for the test files relative
- to the output directory
-4) Major refactoring of the Wininet Transport.
\ No newline at end of file
+Build Instructions For XML-RPC For C/C++ On Windows
+---------------------------------------------------
+
+Latest Windows work was done by
+
+ Geoff McLane
+ 19 October, 2007
+ home: http://geoffair.net
+
+
+1. Run the batch file ConfigureWin32.bat, found in the Windows
+directory. This will copy four(4) headers to the appropriate folders.
+
+2. Load xmlrpc.dsw in MSVC[7,8] or later, and build the Release or Debug
+configurations. DLL configurations are not included, and may not compile.
+
+This build requires that you have a Microsoft SDK, or Plaform SDK
+installed, since among other things, it uses <http.h>, and
+HTTPAPI.LIB, from the SDK.
+
+Once built, the rpctest.exe, in the bin folder, should run with no errors,
+and the xmlrpc_sample_add_server.exe, using port 8080, and
+xmlrpc_sample_add_sync_client.exe should communicate ... proving 7+5 = 12 ;=))
+
+Have fun.
+
+PS: Several other batch files are included in the Windows folder ...
+
+delsln.bat - to delete all the MSVC7 and 8 solution file.
+
+diffcfg.bat - compare the headers in windows with the version used in
+the compile. Requires diff.exe to be in the path.
+
+updcfg.bat - copy the 3 manually maintained configuration files back
+to the Windows folder (for distribution).
+
+cleawin32.bat - deletes the headers used in the compile. That is does the
+opposite of ConfigureWin32.bat.
+
+cleanall.bat - to remove ALL the binary files created. Requires an xdelete
+program which will recursively delete an entire folder.
+
+
+There is some historical information in ReadMeOld.txt, which used to be
+the contents of this file. Some of it is still valid.
+
+
+Developing XML-RPC For C/C++ for Windows
+----------------------------------------
+
+If you fix or enhance something in the Windows build system, please send
+your updates to the Xmlrpc-c maintainer to be included in future releases
+so others don't have to repeat your work.
+
+Output of a Subversion 'diff' is usually the best way to send updates,
+but you can also send complete files or just a description of the
+change if that is easier.
+
+For the project files, we distribute only MSVC6-compatible DSP and DSW
+files (which are, of course, usable as input to later versions of MSVC
+as well). That means if you need to modify something in the project
+files and you are not using MSVC6, you must edit the project files
+manually as text files. Modifying them via the IDE would simply
+generate new files in a format that cannot be used with older MSVC.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt Mon May 26 12:59:57 2008
@@ -1,64 +1,128 @@
-Background:
-Let�s say you need to support a xmlrpc-c client running as a service. In this
-situation you cannot use WinInet. Details of the restriction can be found on
-the libcurl website or various Microsoft KB articles. The alternative is to use
-libcurl. This document describes the steps required to use libcurl as your
-transport mechanism as supported by the latest files and projects provided in
-the xmlrpc-c distribution. The assumption is that you can successfully compile
-the distribution of xmlrpc-c.
-
-Overview:
-The default projects in xmlrpc-c create standalone executables that do not
-require other DLL�s (release mode). While the case can be made for this
-behavior pro and con, it is beyond this document to justify it. Therefore, we
-need to create static link libraries for libcurl that mimics this behavior.
-Once the link libraries are created, we can then add them (plus the requisite
-curl headers) into the xmlrpc-c project. Finally, we enable the compilation of
-the curl transport file and tell xmlrpc-c that we will be using curl. Lastly,
-we build and test the project.
-
-Steps to use CURL with Win32 xmlrpc-c:
-1. Download the CURL source. In the �include� folder of the CURL distribution,
-copy the curl directory to the �lib� directory of xmlbpc-c. When you are done
-with this step, you should have a curl.h file located in the directory
-xmlrpc-c\lib\curl\. The xmlrpc project looks in this relative path for the
-necessary headers.
-
-2. In the CURL distribution, lib directory, is a file called Makefile.vc6. Edit
-this file. The line starting with CCNODBG should be changed to:
-CCNODBG = cl.exe /MT /O2 /DNDEBUG
-The /MT option links with the Multithreaded non-dll version of the c runtime.
-If this change is not made, the project will not link, as this is the default
-setting for the xmlrpc-c projects. In debug mode, we use the dll version of the
-c runtime as it makes memory leak checking tools work better.
-
-3. Open a command prompt window and run the vcvars32.bat file in your Visual C++
-distribution. If you are using Studio 2002 or 2003, use the �Visual Studio
-Command Prompt� from the Start menu to open the console.
-
-4. Compile release and debug mode libraries. For the purposes of this tutorial,
-we are going to build only the curl library without ssl or zlib support. In the
-command prompt, navigate to the curl\lib directory and execute the following
-commands:
-nmake -f Makefile.vc6 CFG=debug
-nmake -f Makefile.vc6 CFG=release
-
-5. The above step should have generated two static link libraries in the
-curl\lib directory: libcurl.lib and libcurld.lib. Copy these files into the
-root of the xmlrpc-c\lib\ directory. This step ends our involvement with the
-actual CURL distribution. The remainder of the steps are for XMLRPC-C.
-
-6. Open the xmlrpc-c Visual Studio workspace (Instructions for VC++ 6, other
-versions are slightly different). In File View, expand the xmlrpc project.
-Under �Source Files� there is an entry for xmlrpc_curl_transport.c This is not
-included in any build paths by default. To enable it for compilation, right
-click the file to change the settings. In the dropdown, select �All
-Configurations.� Pick the General tab and uncheck the �Exclude File From Build�
-setting. Press OK to save your changes to the project.
-
-7. In the �Header Files� section of the xmlrpc project is a file called
-�transport_config.h�. Edit this file to set the MUST_BUILD_CURL_CLIENT to 1,
-and if you wish to change the default transport to curl, change the
-XMLRPC_DEFAULT_TRANSPORT to �curl�.
-
-8. Compile and test one or more of the sample client projects.
+Background:
+
+Let�s say you need to have a Xmlrpc-c client running as a service.
+In this situation you cannot use WinInet. Details of the restriction
+can be found on the libcurl website or various Microsoft KB articles.
+The alternative is to use libcurl. This document describes the steps
+required to use libcurl as your client XML transport mechanism.
+
+Overview:
+
+The default projects in Xmlrpc-c create standalone executables that do
+not require other DLL�s (release mode). While the case can be made
+for this behavior pro and con, it is beyond this document to justify
+it. Therefore, we need to create static link libraries for libcurl
+that mimics this behavior. Once the link libraries are created, we
+can then add them (plus the requisite curl headers) into the Xmlrpc-c
+project. Finally, we enable the compilation of the curl transport
+file and tell Xmlrpc-c that we will be using curl. Lastly, we build
+and test the project.
+
+Steps to use CURL with Win32 Xmlrpc-c:
+
+1. Download the CURL source. In the �include� folder of the
+CURL distribution, copy the curl directory to the �lib�
+directory of xmlrpc-c. When you are done with this step, you should
+have a curl.h file located in the directory xmlrpc-c\lib\curl\. The
+xmlrpc project looks in this relative path for the necessary headers.
+
+2. In the CURL distribution, lib directory, is a file called
+Makefile.vc6. Edit this file. The line starting with CCNODBG should
+be changed to:
+
+CCNODBG = cl.exe /MT /O2 /DNDEBUG
+
+The /MT option links with the Multithreaded non-dll version of the c
+runtime. If this change is not made, the project will not link, as
+this is the default setting for the Xmlrpc-c projects.
+
+3. Open a command prompt window and run the vcvars32.bat file in your
+Visual C++ distribution. If you are using Studio 2002 or 2003, use
+the �Visual Studio Command Prompt� from the Start menu to open
+the console.
+
+4. Compile release and debug mode libraries. For the purposes of this
+tutorial, we are going to build only the curl library without ssl or
+zlib compression capability. In the command prompt, navigate to the
+curl\lib directory and execute the following commands:
+
+nmake -f Makefile.vc6 CFG=debug RTLIBCFG=static
+nmake -f Makefile.vc6 CFG=release RTLIBCFG=static
+
+5. The above step should have generated two static link libraries in
+the curl\lib directory: libcurl.lib and libcurld.lib. Copy these
+files into the root of the xmlrpc-c\lib\ directory. This step ends
+our involvement with the actual CURL distribution. The remainder of
+the steps are for Xmlrpc-c.
+
+6. Open the Xmlrpc-c Visual Studio workspace (Instructions for VC++ 6,
+other versions are slightly different). In File View, expand the
+xmlrpc project. Under "Source Files" there is an entry for
+xmlrpc_curl_transport.c This is not included in any build paths by
+default. To enable it for compilation, right click the file to change
+the settings. In the dropdown, select "All Configurations." Pick the
+General tab and uncheck the "Exclude File From Build" setting. Press
+OK to save your changes to the project.
+
+7. In the "Header Files" section of the xmlrpc project is a file
+called "transport_config.h". Edit this file to set the
+MUST_BUILD_CURL_CLIENT to 1, and if you wish to change the default
+transport to curl, change the XMLRPC_DEFAULT_TRANSPORT to "curl".
+
+8. Compile and test one or more of the sample client projects.
+
+USING MSVC8 - 2007/11/25
+========================
+
+This is for MSVC8, but most will apply to all version of Microsoft
+Visual Studio.
+
+Download the CURL source. Run the buildconf.bat to generate some
+additional files. This builds a 'dummy' hugehelp.c, but it can also
+be built using the src\mkhelp.pl Perl script. You may have to build
+you own VCPROJ file for CURL, if you want to use MSVC. It does
+provide a Makefile.vc6 as mentioned above.
+
+To build all the CURL library variations, use
+> nmake /nologo vc-all
+but note this will use the /MD[d] DLL runtime. Only by adding
+RTCFGLIB=static to each of the makefile commands will /MT[d] be
+used.
+
+Essentially, for building the static Debug or Release CURL libraries,
+it is all the sources in the curl\lib folder. Make sure you choose /MT
+and /MTd for the runtime, and build both using say the name libcurl.lib.
+
+When you have Debug\libcurl.lib and Release\libcurl.lib built, you
+are ready to build and link them with Xmlrpc-c.
+
+After running xmlrpc-c\Windows\configurewin32.bat, loading xmlrpc.dsw
+will convert all the projects to VCPROJ files. In the File View, in
+the xmlrpc project, in the properties of xmlrpc_curl_transport.c,
+change 'Exclude file from build' from 'yes' to 'no', for Debug
+and Release.
+
+In the 'Header Files' section, open the "transport_config.h" file,
+and change MUST_BUILD_CURL_CLIENT to 1, and the XMLRPC_DEFAULT_TRANSPORT
+to "curl", if desired.
+
+As usual, for each of the 'client' projects, and rpctest, in the properties,
+Linker section, you can add the library libcurl.lib on the Input tab, and
+the relative path to the library in the General tab to something like -
+..\..\curl\Debug and ..\..\curl\Release, or where ever you built or
+copied these static libraries too.
+
+Or you can adjust the Windows/curlink.h, to directly point to your
+respective Debug and Release static CURL libraries, either where you
+built them, or where you copied them too.
+
+Now, Xmlrpc-c should build using the CURL transport.
+
+Note, for the final linking, all RUNTIME libraries MUST be the SAME.
+A mixture of /MD and /MT will give big linkage problems. Any one project
+built with the alterate RUNTIME will show many items defined more than
+once. And of course, you can also NOT mix Debug with Release. That is
+/MDd with /MD, nor /MTd with /MT, or else there will be unresolved
+debug items.
+
+EOF
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/cpptest.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/cpptest.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/cpptest.dsp Mon May 26 12:59:57 2008
@@ -1,102 +1,121 @@
-# Microsoft Developer Studio Project File - Name="cpptest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=cpptest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "cpptest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "cpptest.mak" CFG="cpptest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "cpptest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "cpptest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "cpptest"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "cpptest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release\cpptest"
-# PROP Intermediate_Dir "Release\cpptest"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\src" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib\xmlrpc.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\cpptest.exe"
-
-!ELSEIF "$(CFG)" == "cpptest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug\cpptest"
-# PROP Intermediate_Dir "Debug\cpptest"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\src" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib\xmlrpcD.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\cpptest.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "cpptest - Win32 Release"
-# Name "cpptest - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\cpptest.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="cpptest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=cpptest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "cpptest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "cpptest.mak" CFG="cpptest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "cpptest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "cpptest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "cpptest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release\cpptest"
+# PROP Intermediate_Dir "Release\cpptest"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\lib\xmlrpccpp.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\cpptest.exe"
+
+!ELSEIF "$(CFG)" == "cpptest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug\cpptest"
+# PROP Intermediate_Dir "Debug\cpptest"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../.." /I ".." /I "../include" /I "../lib/util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /D "_CRT_SECURE_NO_WARNINGS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\lib\xmlrpccppD.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\cpptestD.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "cpptest - Win32 Release"
+# Name "cpptest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\cpp\test\registry.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\test\server_abyss.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\test\server_pstream.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\test\test.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\test\testclient_dummy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\test\tools.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/rpctest.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/rpctest.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/rpctest.dsp Mon May 26 12:59:57 2008
@@ -1,236 +1,210 @@
-# Microsoft Developer Studio Project File - Name="rpctest" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=rpctest - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "rpctest.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "rpctest.mak" CFG="rpctest - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "rpctest - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "rpctest - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "rpctest"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "rpctest - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release\rpctest"
-# PROP Intermediate_Dir "Release\rpctest"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /I "../lib/util/include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\rpctest.exe"
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy test files
-PostBuild_Cmds=copy ..\src\testdata\*.* .
-# End Special Build Tool
-
-!ELSEIF "$(CFG)" == "rpctest - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug\rpctest"
-# PROP Intermediate_Dir "Debug\rpctest"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\include" /I "../lib/util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\rpctestD.exe" /pdbtype:sept
-# Begin Special Build Tool
-SOURCE="$(InputPath)"
-PostBuild_Desc=Copy test files
-PostBuild_Cmds=copy ..\src\testdata\*.* .
-# End Special Build Tool
-
-!ENDIF
-
-# Begin Target
-
-# Name "rpctest - Win32 Release"
-# Name "rpctest - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\src\test\cgi.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\client.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\conf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\conn.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\http.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\parse_xml.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\serialize.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\server.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\server_abyss.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\socket.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\test.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\thread.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\token.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\token.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\trace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\value.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\xml_data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_server_abyss.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=..\src\test\client.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\parse_xml.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\serialize.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\server_abyss.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\test.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\value.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\test\xml_data.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "TestFiles"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE="..\src\testdata\http-req-simple.txt"
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\testdata\req_no_params.xml
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\testdata\req_out_of_order.xml
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\testdata\req_value_name.xml
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="rpctest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=rpctest - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "rpctest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "rpctest.mak" CFG="rpctest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "rpctest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "rpctest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "rpctest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release\rpctest"
+# PROP Intermediate_Dir "Release\rpctest"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\rpctest.exe"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copy test files
+PostBuild_Cmds=if not exist ..\Bin\data md ..\Bin\data copy ..\src\test\data\*.* ..\Bin\data
+# End Special Build Tool
+
+!ELSEIF "$(CFG)" == "rpctest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug\rpctest"
+# PROP Intermediate_Dir "Debug\rpctest"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../.." /I ".." /I "../include" /I "../lib/util/include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib Ws2_32.lib Wininet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\rpctestD.exe" /pdbtype:sept
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=Copy test files
+PostBuild_Cmds=if not exist ..\Bin\data md ..\Bin\data copy ..\src\test\data\*.* ..\Bin\data
+# End Special Build Tool
+
+!ENDIF
+
+# Begin Target
+
+# Name "rpctest - Win32 Release"
+# Name "rpctest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\src\test\abyss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\cgi.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\client.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\casprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\method_registry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\parse_xml.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\serialize.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\serialize_value.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\server_abyss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\test.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\token.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\value.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\xml_data.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\src\test\client.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\parse_xml.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\serialize.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\serialize_value.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\server_abyss.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\test.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\value.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\test\xml_data.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# Begin Group "TestFiles"
+
+# PROP Default_Filter ""
+# Begin Source File
+
+SOURCE="..\src\testdata\http-req-simple.txt"
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\testdata\req_no_params.xml
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\testdata\req_out_of_order.xml
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\testdata\req_value_name.xml
+# End Source File
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/transport_config_win32.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/transport_config_win32.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/transport_config_win32.h Mon May 26 12:59:57 2008
@@ -1,26 +1,13 @@
+/* Win32 version of transport_config.h.
+
+ For other platforms, this is generated automatically, but for Windows,
+ someone generates it manually. Nonetheless, we keep it looking as much
+ as possible like the automatically generated one to make it easier to
+ maintain (e.g. you can compare the two and see why something builds
+ differently for Windows that for some other platform).
+*/
#define MUST_BUILD_WININET_CLIENT 1
#define MUST_BUILD_CURL_CLIENT 0
#define MUST_BUILD_LIBWWW_CLIENT 0
-static const char * const XMLRPC_DEFAULT_TRANSPORT = "wininet";
-
-/*
-Set to zero if you do not wish to build the http.sys
-based XMLRPC-C Server
-*/
-#define MUST_BUILD_HTTP_SYS_SERVER 1
-
-/*
-We use pragma statements to tell the linker what we need to link with.
-Since Curl requires Winsock, Winmm, and libcurl, and no other
-project does, if we are building curl support we tell the linker
-what libs we need to add.
-*/
-#if MUST_BUILD_CURL_CLIENT > 0
-#ifdef _DEBUG
-#pragma comment( lib, "../lib/libcurld.lib" )
-#else
-#pragma comment( lib, "../lib/libcurl.lib" )
-#endif
-#pragma comment( lib, "Winmm.lib" )
-#pragma comment( lib, "Ws2_32.lib" )
-#endif
\ No newline at end of file
+static const char * const XMLRPC_DEFAULT_TRANSPORT =
+"wininet";
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsp Mon May 26 12:59:57 2008
@@ -1,258 +1,469 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Static Library" 0x0104
-
-CFG=xmlrpc - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc - Win32 Release" (based on "Win32 (x86) Static Library")
-!MESSAGE "xmlrpc - Win32 Debug" (based on "Win32 (x86) Static Library")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release\xmlrpc"
-# PROP Intermediate_Dir "Release\xmlrpc"
-# PROP Target_Dir ""
-MTL=midl.exe
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "../lib/" /I "../lib/curl_transport" /I "../lib/util/include" /I "../include" /I "../" /I "../lib/expat/xmlparse" /I "../lib/w3c-libwww-5.3.2/Library/src" /I "../lib/abyss/src" /I "../lib/wininet_transport" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /FR /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\lib\xmlrpc.lib"
-
-!ELSEIF "$(CFG)" == "xmlrpc - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug\xmlrpc"
-# PROP Intermediate_Dir "Debug\xmlrpc"
-# PROP Target_Dir ""
-MTL=midl.exe
-LINK32=link.exe -lib
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../lib/" /I "../lib/curl_transport" /I "../lib/util/include" /I "../include" /I "../" /I "../lib/expat/xmlparse" /I "../lib/w3c-libwww-5.3.2/Library/src" /I "../lib/abyss/src" /I "../lib/wininet_transport" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LIB32=link.exe -lib
-# ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\lib\xmlrpcD.lib"
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc - Win32 Release"
-# Name "xmlrpc - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;cc"
-# Begin Source File
-
-SOURCE=..\lib\util\casprintf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\util\pthreadx_win32.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_array.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_authcookie.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_base64.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_builddecomp.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_client.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\curl_transport\xmlrpc_curl_transport.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_datetime.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_expat.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_libxml2.c
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_parse.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_registry.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_serialize.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_server_abyss.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_server_w32httpsys.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_struct.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_strutil.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_support.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\src\xmlrpc_utf8.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\wininet_transport\xmlrpc_wininet_transport.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\abyss.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\base.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\util\include\bool.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\client.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\client_int.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\util\include\mallocvar.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\util\include\pthreadx.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\server.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\server_abyss.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\server_cgi.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\server_w32httpsys.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\transport.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\transport_config.h
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\transport_int.h"
-# End Source File
-# Begin Source File
-
-SOURCE="..\include\xmlrpc-c\xmlparser.h"
-# End Source File
-# Begin Source File
-
-SOURCE=..\xmlrpc_config.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\curl_transport\xmlrpc_curl_transport.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\wininet_transport\xmlrpc_wininet_transport.h
-# End Source File
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmlrpc - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc.mak" CFG="xmlrpc - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmlrpc - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release\xmlrpc"
+# PROP Intermediate_Dir "Release\xmlrpc"
+# PROP Target_Dir ""
+LINK32=link.exe -lib
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "../lib" /I "../lib/util/include" /I "../include" /I ".." /I "../lib/expat/xmlparse" /I "../lib/abyss/src" /I "../lib/wininet_transport" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\lib\xmlrpc.lib"
+
+!ELSEIF "$(CFG)" == "xmlrpc - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug\xmlrpc"
+# PROP Intermediate_Dir "Debug\xmlrpc"
+# PROP Target_Dir ""
+LINK32=link.exe -lib
+MTL=midl.exe
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "../lib" /I "../lib/util/include" /I "../include" /I ".." /I "../lib/expat/xmlparse" /I "../lib/abyss/src" /I "../lib/wininet_transport" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "ABYSS_WIN32" /D "CURL_STATICLIB" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\lib\xmlrpcD.lib"
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc - Win32 Release"
+# Name "xmlrpc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;cc"
+# Begin Source File
+
+SOURCE=..\lib\libutil\asprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\error.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\make_printable.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\memblock.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\method.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\pthreadx_win32.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\parse_value.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\registry.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\resource.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\select.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\sleep.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\system_method.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\trace.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\version.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\libutil\utf8.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\double.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_array.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_authcookie.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_build.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_client.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_client_global.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_server_info.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\curl_transport\xmlrpc_curl_transport.c
+
+!IF "$(CFG)" == "xmlrpc - Win32 Release"
+
+# ADD CPP /I "." /I "..\..\curl\include"
+# PROP Exclude_From_Build 1
+
+!ELSEIF "$(CFG)" == "xmlrpc - Win32 Debug"
+
+# ADD CPP /I "." /I "..\..\curl\include"
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_data.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_datetime.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_decompose.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_expat.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_libxml2.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_serialize.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_server_abyss.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_server_w32httpsys.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_string.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_struct.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\wininet_transport\xmlrpc_wininet_transport.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\http.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\abyss.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\abyss_info.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\abyss_winsock.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\base.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\base_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\bool.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\c_util.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\c_util.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\casprintf.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\channel.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\chanswitch.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\client.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\client_global.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\client_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\config.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\conn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\date.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\file.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\girmath.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\inline.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\linklist.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\mallocvar.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\double.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\method.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\pthreadx.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\parse_value.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\registry.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\server.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\server.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\server_abyss.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\server_cgi.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\server_w32httpsys.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\sleep_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket_win.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\include\stdargx.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\string_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\system_method.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\thread.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\time_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\token.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\transport.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\transport_config.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\transport_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\util_int.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\xml_rpc_alloc.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmlparse\xmlparse.h
+# End Source File
+# Begin Source File
+
+SOURCE="..\include\xmlrpc-c\xmlparser.h"
+# End Source File
+# Begin Source File
+
+SOURCE=..\xmlrpc_config.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\curl_transport\xmlrpc_curl_transport.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\wininet_transport\xmlrpc_wininet_transport.h
+# End Source File
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsw
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsw (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc.dsw Mon May 26 12:59:57 2008
@@ -1,194 +1,242 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "cpptest"=".\cpptest.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "gennmtab"="..\lib\expat\gennmtab\gennmtab.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "query_meerkat"=".\query_meerkat.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "rpctest"=".\rpctest.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlparse"="..\lib\expat\xmlparse\xmlparse.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmltok
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc"=".\xmlrpc.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlparse
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc_sample_add_asynch_client"=".\xmlrpc_sample_add_asynch_client.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc_sample_add_server"=".\xmlrpc_sample_add_server.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc_sample_add_server_w32httpsys"=".\xmlrpc_sample_add_server_w32httpsys.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc_sample_add_sync_client"=".\xmlrpc_sample_add_sync_client.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmlrpc_sample_auth_client"=".\xmlrpc_sample_auth_client.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name xmlrpc
- End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "xmltok"="..\lib\expat\xmltok\xmltok.dsp" - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
- Begin Project Dependency
- Project_Dep_Name gennmtab
- End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "abyss"=".\abyss.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "cpptest"=".\cpptest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name xmlrpccpp
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name abyss
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "gennmtab"=".\gennmtab.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "rpctest"=".\rpctest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name abyss
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlhttpsys"=".\xmlhttpsys.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "xmlparse"=".\xmlparse.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmltok
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc"=".\xmlrpc.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlparse
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name abyss
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpccpp"=".\xmlrpccpp.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlparse
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name abyss
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc_sample_add_asynch_client"=".\xmlrpc_sample_add_asynch_client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc_sample_add_server"=".\xmlrpc_sample_add_server.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name abyss
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc_sample_add_server_w32httpsys"=".\xmlrpc_sample_add_server_w32httpsys.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlhttpsys
+ End Project Dependency
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc_sample_add_sync_client"=".\xmlrpc_sample_add_sync_client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmlrpc_sample_auth_client"=".\xmlrpc_sample_auth_client.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name xmlrpc
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "xmltok"=".\xmltok.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name gennmtab
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp Mon May 26 12:59:57 2008
@@ -1,102 +1,102 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_asynch_client" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlrpc_sample_add_asynch_client - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_asynch_client.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_asynch_client.mak" CFG="xmlrpc_sample_add_asynch_client - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc_sample_add_asynch_client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlrpc_sample_add_asynch_client - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc_sample_add_asynch_client"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc_sample_add_asynch_client - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release\xmlrpc_sample_add_asynch_client"
-# PROP Intermediate_Dir "Release\xmlrpc_sample_add_asynch_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\lib\xmlrpc.lib WinInet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_asynch_client.exe"
-
-!ELSEIF "$(CFG)" == "xmlrpc_sample_add_asynch_client - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug\xmlrpc_sample_add_asynch_client"
-# PROP Intermediate_Dir "Debug\xmlrpc_sample_add_asynch_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\lib\xmlrpcD.lib WinInet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_asynch_clientD.exe" /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc_sample_add_asynch_client - Win32 Release"
-# Name "xmlrpc_sample_add_asynch_client - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\xmlrpc_asynch_client.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_asynch_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_sample_add_asynch_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_asynch_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_asynch_client.mak" CFG="xmlrpc_sample_add_asynch_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc_sample_add_asynch_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_sample_add_asynch_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc_sample_add_asynch_client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release\xmlrpc_sample_add_asynch_client"
+# PROP Intermediate_Dir "Release\xmlrpc_sample_add_asynch_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c /D "CURL_STATICLIB"
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\lib\xmlrpc.lib WinInet.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_asynch_client.exe"
+
+!ELSEIF "$(CFG)" == "xmlrpc_sample_add_asynch_client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug\xmlrpc_sample_add_asynch_client"
+# PROP Intermediate_Dir "Debug\xmlrpc_sample_add_asynch_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c /D "CURL_STATICLIB"
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\lib\xmlrpcD.lib WinInet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_asynch_clientD.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc_sample_add_asynch_client - Win32 Release"
+# Name "xmlrpc_sample_add_asynch_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\xmlrpc_asynch_client.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp Mon May 26 12:59:57 2008
@@ -1,140 +1,103 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_server" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlrpc_sample_add_server - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_server.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_server.mak" CFG="xmlrpc_sample_add_server - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc_sample_add_server - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlrpc_sample_add_server - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc_sample_add_server"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc_sample_add_server - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\Release\xmlrpc_sample_add_server"
-# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_server"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpc.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_server.exe"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "xmlrpc_sample_add_server - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\Debug\xmlrpc_sample_add_server"
-# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_server"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\\" /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpcD.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_serverD.exe" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc_sample_add_server - Win32 Release"
-# Name "xmlrpc_sample_add_server - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\conf.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\conn.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\data.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\file.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\http.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\server.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\socket.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\thread.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\lib\abyss\src\trace.c
-# End Source File
-# Begin Source File
-
-SOURCE=..\examples\xmlrpc_sample_add_server.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_sample_add_server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_server.mak" CFG="xmlrpc_sample_add_server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc_sample_add_server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_sample_add_server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc_sample_add_server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release\xmlrpc_sample_add_server"
+# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_server"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpc.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_server.exe"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "xmlrpc_sample_add_server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug\xmlrpc_sample_add_server"
+# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_server"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /GZ /c
+# SUBTRACT CPP /Fr
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpcD.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_serverD.exe" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc_sample_add_server - Win32 Release"
+# Name "xmlrpc_sample_add_server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\xmlrpc_sample_add_server.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp Mon May 26 12:59:57 2008
@@ -1,104 +1,102 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_server_w32httpsys" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlrpc_sample_add_server_w32httpsys - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_server_w32httpsys.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_server_w32httpsys.mak" CFG="xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc_sample_add_server_w32httpsys - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlrpc_sample_add_server_w32httpsys - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc_sample_add_server_w32httpsys"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc_sample_add_server_w32httpsys - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\Release\xmlrpc_sample_add_server_w32httpsys"
-# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_server_w32httpsys"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpc.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_server_w32httpsys.exe"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\Debug\xmlrpc_sample_add_server_w32httpsys"
-# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_server_w32httpsys"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /I "..\\" /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpcD.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_server_w32httpsysD.exe" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc_sample_add_server_w32httpsys - Win32 Release"
-# Name "xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\xmlrpc_sample_add_server_w32httpsys.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_server_w32httpsys" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_sample_add_server_w32httpsys - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_server_w32httpsys.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_server_w32httpsys.mak" CFG="xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc_sample_add_server_w32httpsys - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_sample_add_server_w32httpsys - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc_sample_add_server_w32httpsys - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release\xmlrpc_sample_add_server_w32httpsys"
+# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_server_w32httpsys"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpc.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_server_w32httpsys.exe"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug\xmlrpc_sample_add_server_w32httpsys"
+# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_server_w32httpsys"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ABYSS_WIN32" /D "_THREAD" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib ..\lib\xmlrpcD.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_server_w32httpsysD.exe" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc_sample_add_server_w32httpsys - Win32 Release"
+# Name "xmlrpc_sample_add_server_w32httpsys - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\xmlrpc_sample_add_server_w32httpsys.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp Mon May 26 12:59:57 2008
@@ -1,104 +1,103 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_sync_client" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlrpc_sample_add_sync_client - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_sync_client.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_add_sync_client.mak" CFG="xmlrpc_sample_add_sync_client - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc_sample_add_sync_client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlrpc_sample_add_sync_client - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc_sample_add_sync_client"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc_sample_add_sync_client - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\Release\xmlrpc_sample_add_sync_client"
-# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_sync_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_sync_client.exe"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "xmlrpc_sample_add_sync_client - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\Debug\xmlrpc_sample_add_sync_client"
-# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_sync_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_sync_clientD.exe" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc_sample_add_sync_client - Win32 Release"
-# Name "xmlrpc_sample_add_sync_client - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\xmlrpc_sample_add_client.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc_sample_add_sync_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_sample_add_sync_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_sync_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_add_sync_client.mak" CFG="xmlrpc_sample_add_sync_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc_sample_add_sync_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_sample_add_sync_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc_sample_add_sync_client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release\xmlrpc_sample_add_sync_client"
+# PROP Intermediate_Dir ".\Release\xmlrpc_sample_add_sync_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c /D "CURL_STATICLIB"
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_add_sync_client.exe"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "xmlrpc_sample_add_sync_client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug\xmlrpc_sample_add_sync_client"
+# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_add_sync_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c /D "CURL_STATICLIB"
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_add_sync_clientD.exe" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc_sample_add_sync_client - Win32 Release"
+# Name "xmlrpc_sample_add_sync_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\xmlrpc_sample_add_client.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
+
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp Mon May 26 12:59:57 2008
@@ -1,104 +1,102 @@
-# Microsoft Developer Studio Project File - Name="xmlrpc_sample_auth_client" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=xmlrpc_sample_auth_client - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_auth_client.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "xmlrpc_sample_auth_client.mak" CFG="xmlrpc_sample_auth_client - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "xmlrpc_sample_auth_client - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "xmlrpc_sample_auth_client - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "xmlrpc_sample_auth_client"
-# PROP Scc_LocalPath ".."
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "xmlrpc_sample_auth_client - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir ".\Release\xmlrpc_sample_auth_client"
-# PROP Intermediate_Dir ".\Release\xmlrpc_sample_auth_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_auth_client.exe"
-# SUBTRACT LINK32 /pdb:none
-
-!ELSEIF "$(CFG)" == "xmlrpc_sample_auth_client - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir ".\Debug\xmlrpc_sample_auth_client"
-# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_auth_client"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\\" /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_auth_clientD.exe" /pdbtype:sept
-# SUBTRACT LINK32 /pdb:none
-
-!ENDIF
-
-# Begin Target
-
-# Name "xmlrpc_sample_auth_client - Win32 Release"
-# Name "xmlrpc_sample_auth_client - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=..\examples\auth_client.c
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
+# Microsoft Developer Studio Project File - Name="xmlrpc_sample_auth_client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_sample_auth_client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_auth_client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "xmlrpc_sample_auth_client.mak" CFG="xmlrpc_sample_auth_client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "xmlrpc_sample_auth_client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_sample_auth_client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "xmlrpc_sample_auth_client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release\xmlrpc_sample_auth_client"
+# PROP Intermediate_Dir ".\Release\xmlrpc_sample_auth_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c /D "CURL_STATICLIB"
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\lib\xmlrpc.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /machine:I386 /out:"..\bin\xmlrpc_sample_auth_client.exe"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "xmlrpc_sample_auth_client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug\xmlrpc_sample_auth_client"
+# PROP Intermediate_Dir ".\Debug\xmlrpc_sample_auth_client"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".." /I "../include" /I "../lib/util/include" /I "../.." /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c /D "CURL_STATICLIB"
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\lib\xmlrpcD.lib kernel32.lib user32.lib gdi32.lib WinInet.lib /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\xmlrpc_sample_auth_clientD.exe" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "xmlrpc_sample_auth_client - Win32 Release"
+# Name "xmlrpc_sample_auth_client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\examples\auth_client.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h Mon May 26 12:59:57 2008
@@ -1,130 +1,158 @@
-#pragma once
+/* Win32 version of xmlrpc_config.h.
-/* From xmlrpc_amconfig.h */
-
-/* Define to `unsigned' if <sys/types.h> doesn't define. */
-/* #undef size_t */
-
-/* Define if you have the setgroups function. */
-/* #undef HAVE_SETGROUPS */
-
-/* #undef HAVE_ASPRINTF */
-
-/* Define if you have the wcsncmp function. */
-#define HAVE_WCSNCMP 1
-
-/* Define if you have the <stdarg.h> header file. */
-#define HAVE_STDARG_H 1
-
-/* Define if you have the <sys/filio.h> header file. */
-/* #undef HAVE_SYS_FILIO_H */
-
-/* Define if you have the <sys/ioctl.h> header file. */
-/* #undef HAVE_SYS_IOCTL_H 1 */
-
-/* Define if you have the <wchar.h> header file. */
-#define HAVE_WCHAR_H 1
-
-/* Define if you have the socket library (-lsocket). */
-/* #undef HAVE_LIBSOCKET */
-
-/* Name of package */
-#define PACKAGE "xmlrpc-c"
-
-
-/* Win32 version of xmlrpc_config.h
+ For other platforms, this is generated automatically, but for Windows,
+ someone generates it manually. Nonetheless, we keep it looking as much
+ as possible like the automatically generated one to make it easier to
+ maintain (e.g. you can compare the two and see why something builds
+ differently for Windows than for some other platform).
+
+ The purpose of this file is to define stuff particular to the build
+ environment being used to build Xmlrpc-c. Xmlrpc-c source files can
+ #include this file and have build-environment-independent source code.
+
+ A major goal of this file is to reduce conditional compilation in
+ the other source files as much as possible. Even more, we want to avoid
+ having to generate source code particular to a build environment
+ except in this file.
+
+ This file is NOT meant to be used by any code outside of the
+ Xmlrpc-c source tree. There is a similar file that gets installed
+ as <xmlrpc-c/config.h> that performs the same function for Xmlrpc-c
+ interface header files that get compiled as part of a user's program.
Logical macros are 0 or 1 instead of the more traditional defined and
undefined. That's so we can distinguish when compiling code between
"false" and some problem with the code.
*/
-/* Define if va_list is actually an array. */
-#define VA_LIST_IS_ARRAY 0
-
-/* Define if we're using a copy of libwww with built-in SSL support. */
-#define HAVE_LIBWWW_SSL 0
+#ifndef XMLRPC_CONFIG_H_INCLUDED
+#define XMLRPC_CONFIG_H_INCLUDED
-/* Used to mark unused variables under GCC... */
-#define ATTR_UNUSED
+/* From xmlrpc_amconfig.h */
-/* Define this if your C library provides reasonably complete and correct Unicode wchar_t support. */
-#define HAVE_UNICODE_WCHAR 1
-
-#define DIRECTORY_SEPARATOR "\\"
+#define HAVE__STRICMP 1
+/* Name of package */
+#define PACKAGE "xmlrpc-c"
+/*----------------------------------*/
-
-/* Windows-specific includes. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if !defined (vsnprintf)
- #define vsnprintf _vsnprintf
-#endif
-#if !defined (snprintf)
- #define snprintf _snprintf
-#endif
-#if !defined (popen)
- #define popen _popen
+#ifndef HAVE_SETGROUPS
+#define HAVE_SETGROUPS 0
#endif
-
-
-#include <time.h>
-#include <WINSOCK.h>
-#include <direct.h> /* for _chdir() */
-
-/* We are linking against the multithreaded versions
- of the Microsoft runtimes - this makes gmtime
- equiv to gmtime_r in that Windows gmtime is threadsafe
-*/
-#if !defined (gmtime_r)
-static struct tm* gmtime_r(const time_t *timep, struct tm* result)
-{
- struct tm *local;
-
- local = gmtime(timep);
- memcpy(result,local,sizeof(struct tm));
- return result;
-}
-
+#ifndef HAVE_ASPRINTF
+#define HAVE_ASPRINTF 0
#endif
-
-#ifndef socklen_t
-typedef unsigned int socklen_t;
+#ifndef HAVE_SETENV
+#define HAVE_SETENV 0
#endif
-
-/* inttypes.h */
-#ifndef int8_t
-typedef signed char int8_t;
+#ifndef HAVE_PSELECT
+#define HAVE_PSELECT 0
#endif
-#ifndef uint8_t
-typedef unsigned char uint8_t;
+#ifndef HAVE_WCSNCMP
+#define HAVE_WCSNCMP 1
#endif
-#ifndef int16_t
-typedef signed short int16_t;
+#ifndef HAVE_GETTIMEOFDAY
+#define HAVE_GETTIMEOFDAY 0
#endif
-#ifndef uint16_t
-typedef unsigned short uint16_t;
+#ifndef HAVE_LOCALTIME_R
+#define HAVE_LOCALTIME_R 0
#endif
-#ifndef int32_t
-typedef signed int int32_t;
+#ifndef HAVE_GMTIME_R
+#define HAVE_GMTIME_R 0
#endif
-#ifndef uint32_t
-typedef unsigned int uint32_t;
+#ifndef HAVE_STRCASECMP
+#define HAVE_STRCASECMP 0
#endif
-#ifndef int64_t
-typedef __int64 int64_t;
+#ifndef HAVE_STRICMP
+#define HAVE_STRICMP 0
#endif
-#ifndef uint64_t
-typedef unsigned __int64 uint64_t;
+#ifndef HAVE__STRICMP
+#define HAVE__STRICMP 0
#endif
-#define __inline__ __inline
+#define HAVE_WCHAR_H 1
+#define HAVE_SYS_FILIO_H 0
+#define HAVE_SYS_IOCTL_H 0
+
+#define VA_LIST_IS_ARRAY 0
+
+#define HAVE_LIBWWW_SSL 0
+
+/* Used to mark an unused function parameter */
+#define ATTR_UNUSED
+
+#define DIRECTORY_SEPARATOR "\\"
+
+#define HAVE_UNICODE_WCHAR 1
+
+/* Xmlrpc-c code uses __inline__ to declare functions that should
+ be compiled as inline code. GNU C recognizes the __inline__ keyword.
+ Others recognize 'inline' or '__inline' or nothing at all to say
+ a function should be inlined.
+
+ We could make 'configure' simply do a trial compile to figure out
+ which one, but for now, this approximation is easier:
+*/
+#if (!defined(__GNUC__))
+ #if (!defined(__inline__))
+ #if (defined(__sgi) || defined(_AIX) || defined(_MSC_VER))
+ #define __inline__ __inline
+ #else
+ #define __inline__
+ #endif
+ #endif
+#endif
+
+/* MSVCRT means we're using the Microsoft Visual C++ runtime library */
+
+#ifdef _MSC_VER
+/* The compiler is Microsoft Visual C++. */
+ #define MSVCRT _MSC_VER
+#else
+ #define MSVCRT 0
+#endif
+
+#if MSVCRT
+ /* The MSVC runtime library _does_ have a 'struct timeval', but it is
+ part of the Winsock interface (along with select(), which is probably
+ its intended use), so isn't intended for use for general timekeeping.
+ */
+ #define HAVE_TIMEVAL 0
+ #define HAVE_TIMESPEC 0
+#else
+ #define HAVE_TIMEVAL 1
+ /* timespec is Posix.1b. If we need to work on a non-Posix.1b non-Windows
+ system, we'll have to figure out how to make Configure determine this.
+ */
+ #define HAVE_TIMESPEC 1
+#endif
+
+#if MSVCRT
+ #define XMLRPC_VSNPRINTF _vsnprintf
+#else
+ #define XMLRPC_VSNPRINTF vsnprintf
+#endif
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+/* Starting with MSVC 8, the runtime library defines various POSIX functions
+ such as strdup() whose names violate the ISO C standard (the standard
+ says the strXXX names are reserved for the standard), but warns you of
+ the standards violation. That warning is 4996, along with other warnings
+ that tell you you're using a function that Microsoft thinks you
+ shouldn't.
+
+ Well, POSIX is more important than that element of ISO C, so we disable
+ that warning.
+
+ FYI, msvcrt also defines _strdup(), etc, which doesn't violate the
+ naming standard. But since other environments don't define _strdup(),
+ we can't use it in portable code.
+*/
+#pragma warning(disable:4996)
+#endif
-#define HAVE_SETENV 1
-__inline BOOL setenv(const char* name, const char* value, int i)
-{
- return (SetEnvironmentVariable(name, value) != 0) ? TRUE : FALSE;
-}
+#define snprintf _snprintf
+#define popen _popen
+#define strtoll _strtoui64
+#define strtoull _strtoui64
+#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/configure.in Mon May 26 12:59:57 2008
@@ -1,30 +1,21 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(include/xmlrpc-c/base.h)
-AC_CONFIG_HEADERS(xmlrpc_amconfig.h)
+AM_CONFIG_HEADER(xmlrpc_amconfig.h)
dnl =======================================================================
dnl Define PACKAGE, VERSION, @PACKAGE@, @VERSION@
dnl =======================================================================
-dnl Increment the package version for each release.
-AM_INIT_AUTOMAKE(xmlrpc-c, 1.03.13)
-
-dnl This version number needs to be changed in several *different* tricky
-dnl ways for each release. Please read the libtool documentation very
-dnl closely before touching this or making a release!
-VERSION_INFO="-version-info 7:0:4"
-AC_SUBST(VERSION_INFO)
-
-dnl Get our host type.
+dnl "x.xx" is supposed to be a version number, but is meaningless here.
+dnl The real version number is in Makefile.version.
+AM_INIT_AUTOMAKE(xmlrpc-c, x.xx)
+
+dnl Define @build@, @build_cpu@, @build_vendor@, @build_os,
+dnl @host, @host_cpu@, @host_vender, and @host_os@ substitutions.
+dnl "host" means the target system -- the one for which we are building.
+dnl "build" means the system that will do the building.
AC_CANONICAL_HOST
-XMLRPC_HOST_TYPE=$host
-AC_SUBST(XMLRPC_HOST_TYPE)
-
-dnl We need this to compensate for an incompatibility between autoconf
-dnl and our libtool. autoconf generates an invalid ltconfig command
-dnl otherwise.
-test -z "$target" && target=NONE
dnl =======================================================================
dnl Decide What To Build
@@ -95,11 +86,6 @@
AC_SUBST(MUST_BUILD_LIBWWW_CLIENT)
-if test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
- AC_MSG_NOTICE([We are not building any client XML transport, therefore we will not build the client library at all.])
-fi
-
-
dnl Set up the appropriate Makefile substitutions.
LIBXMLRPC_CLIENT_LA=libxmlrpc_client.la
@@ -203,34 +189,6 @@
AC_SUBST(XMLRPCCPP_H)
AC_SUBST(XML_RPC_API2CPP_SUBDIR)
-dnl =======================================================================
-dnl Decide what to do about Unicode.
-dnl =======================================================================
-
-dnl Check to see if we should build our Unicode stuff.
-AC_MSG_CHECKING(whether to build Unicode support)
-AC_ARG_ENABLE(unicode,
- [ --disable-unicode Don't build Unicode and wchar_t capability], ,
-enable_unicode=yes)
-AC_MSG_RESULT($enable_unicode)
-
-dnl Do all the work...
-if test x"$enable_unicode" != xno; then
- FEATURE_LIST="unicode $FEATURE_LIST"
- HAVE_UNICODE_WCHAR_DEFINE=1
-
- dnl Unicode function needed by test suites.
- AC_CHECK_FUNCS(wcsncmp)
-
- AC_CHECK_HEADERS(wchar.h, , [
- AC_MSG_ERROR(wchar.h is required to build this library)
- ])
-
-else
- HAVE_UNICODE_WCHAR_DEFINE=0
-fi
-
-AC_SUBST(HAVE_UNICODE_WCHAR_DEFINE)
AC_SUBST(FEATURE_LIST)
@@ -241,7 +199,6 @@
AC_PROG_CC
AC_PROG_CXX
-AC_PROG_INSTALL
dnl =======================================================================
@@ -255,6 +212,18 @@
# require too much testing.)
AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
+# Above sets LIBS, which is not all that useful because we don't want
+# to include every library in every link. It also sets
+# ac_cv_lib_socket_socket, which we use to pass more specific information
+# to the configuration files.
+
+if test x"$ac_cv_lib_socket_socket" = xyes; then
+ LSOCKET=-lsocket
+else
+ LSOCKET=
+fi
+AC_SUBST(LSOCKET)
+
# For some reason, we don't seem to need this on Solaris. If you do
# need it, go ahead and try it.
# AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
@@ -266,13 +235,48 @@
AC_STDC_HEADERS
+dnl We don't use AM_CONFIG_HEADER to define HAVE_WCHAR_H, etc. because
+dnl the following is more straightforward and easier to understand,
+dnl especially for a newcomer. Furthermore, AM_CONFIG_HEADER represents
+dnl false as undefined, whereas our scheme represents it as 0. undefined
+dnl is a poor choice because it often means just that you neglected to
+dnl choose a value for some reason.
+
+dnl defines ac_cv_header_wchar_h, etc:
+AC_CHECK_HEADERS(wchar.h)
+
+if test x"$ac_cv_header_wchar_h" = xyes; then
+ HAVE_WCHAR_H_DEFINE=1
+else
+ HAVE_WCHAR_H_DEFINE=0
+fi
+AC_SUBST(HAVE_WCHAR_H_DEFINE)
+
+# Needed by Abyss on Solaris:
+
+AC_CHECK_HEADERS(sys/filio.h)
+if test x"$ac_cv_header_sys_filio_h" = xyes; then
+ HAVE_SYS_FILIO_H_DEFINE=1
+else
+ HAVE_SYS_FILIO_H_DEFINE=0
+fi
+AC_SUBST(HAVE_SYS_FILIO_H_DEFINE)
+
+# Needed by Abyss on Solaris:
+
+AC_CHECK_HEADERS(sys/ioctl.h)
+if test x"$ac_cv_header_sys_ioctl_h" = xyes; then
+ HAVE_SYS_IOCTL_H_DEFINE=1
+else
+ HAVE_SYS_IOCTL_H_DEFINE=0
+fi
+AC_SUBST(HAVE_SYS_IOCTL_H_DEFINE)
+
+
AC_CHECK_HEADERS(stdarg.h, , [
AC_MSG_ERROR(stdarg.h is required to build this library)
])
-# I/O headers, needed by Abyss on Solaris.
-AC_CHECK_HEADERS(sys/filio.h sys/ioctl.h)
-
dnl =======================================================================
dnl Checks for typedefs, structures, and compiler characteristics.
@@ -296,13 +300,12 @@
fi
AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
-dnl See if the compiler supports __attribute__ gracefully.
-AC_MSG_CHECKING(whether compiler supports __attribute__)
+AC_MSG_CHECKING(whether compiler has __attribute__)
AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
-compiler_supports_attribute=yes,
-compiler_supports_attribute=no)
-AC_MSG_RESULT($compiler_supports_attribute)
-if test x"$compiler_supports_attribute" = xyes; then
+compiler_has_attribute=yes,
+compiler_has_attribute=no)
+AC_MSG_RESULT($compiler_has_attribute)
+if test x"$compiler_has_attribute" = xyes; then
ATTR_UNUSED="__attribute__((__unused__))"
else
ATTR_UNUSED=
@@ -318,13 +321,28 @@
AC_MSG_ERROR(your C library does not provide vsnprintf)
])
-dnl CygWin looks like Unix, but doesn't provide setgroups.
+dnl Unicode function needed by test suites.
+AC_CHECK_FUNCS(wcsncmp)
+
+dnl CygWin doesn't provide setgroups.
AC_CHECK_FUNCS(setgroups)
AC_CHECK_FUNCS(asprintf)
AC_CHECK_FUNCS(setenv)
+dnl uclib doesn't have pselect
+AC_CHECK_FUNCS(pselect)
+
+dnl Windows doesn't have gettimeofday, localtime_r, or gmtime_r
+AC_CHECK_FUNCS(gettimeofday)
+AC_CHECK_FUNCS(localtime_r)
+AC_CHECK_FUNCS(gmtime_r)
+
+dnl Windows doesn't have strcasecmp;
+AC_CHECK_FUNCS(strcasecmp)
+AC_CHECK_FUNCS(stricmp)
+AC_CHECK_FUNCS(_stricmp)
dnl =======================================================================
dnl Checks for operating system features.
@@ -339,8 +357,6 @@
dnl =======================================================================
dnl ABYSS Configuration
dnl =======================================================================
-dnl Abyss doesn't pay any attention to xmlrpc_config.h, so we need to
-dnl pass it some flags on the command-line.
AC_MSG_CHECKING(whether to use Abyss pthread function)
AC_ARG_ENABLE(abyss-threads,
@@ -353,9 +369,7 @@
if test x"$enable_abyss_threads" != xno; then
CFLAGS="$CFLAGS -D_THREAD"
- LIBABYSS_LDADD="-lpthread"
fi
-AC_SUBST(LIBABYSS_LDADD)
dnl =======================================================================
@@ -435,7 +449,7 @@
dnl Finding w3c-libwww
dnl =======================================================================
dnl Once upon a time, we used a patched copy of libwww that needed to
-dnl co-exist with the system copy of libwww. We have some vestigal support
+dnl co-exist with the system copy of libwww. We have some vestigal function
dnl for keeping track of libwww's rpath, although this is no longer really
dnl necessary.
@@ -540,7 +554,7 @@
dnl Oh, such massive brain damage! Because there may be another copy
dnl of curl in the default dynamic loader search path, we need to
- dnl adjust the search patch manually. Just gag me with a backquote, OK?
+ dnl adjust the search path manually. Just gag me with a backquote, OK?
AC_MSG_CHECKING(for curl library directory)
dnl Yawn. We're using the regular boring version.
CURL_LIBDIR="`$CURL_CONFIG --prefix`/lib"
@@ -581,39 +595,15 @@
enable_libxml2_backend=no)
AC_MSG_CHECKING(whether to build the libxml2 backend)
AC_MSG_RESULT($enable_libxml2_backend)
-ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend
-AC_SUBST(ENABLE_LIBXML2_BACKEND)
-
-dnl If we're using the libxml2 backend, look for pkg-config
-if test x"$enable_libxml2_backend" != xno; then
- AC_MSG_CHECKING(for pkg-config)
- AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
- if test x$PKG_CONFIG = xno; then
- AC_MSG_ERROR([*** pkg-config not found. See http://www.freedesktop.org/software/pkgconfig/]
- fi
-
-dnl Set up the appropriate Makefile substitutions
- LIBXML2_CFLAGS=`pkg-config --cflags libxml-2.0`
- AC_SUBST(LIBXML2_CFLAGS)
- CFLAGS="$CFLAGS $LIBXML2_CFLAGS"
-
- LIBXML2_LIBS=`pkg-config --libs libxml-2.0`
- AC_SUBST(LIBXML2_LIBS)
- EXTRA_XML_LIBS="$LIBXML2_LIBS"
-else
- EXTRA_XML_LIBS="-lxmlrpc_xmlparse -lxmlrpc_xmltok"
+if test $enable_libxml2_backend = yes; then
+ AC_CHECK_PROG(have_xml2_config, xml2-config, yes, no)
+ if test $have_xml2_config = no; then
+ AC_MSG_ERROR([You specified --enable-libxml2_backend, but don't appear to have libxml2 installed (no working xml2-config in your command search path), so we cannot not build for libxml2])
+ fi
fi
-
-AC_SUBST(EXTRA_XML_LIBS)
-
-AC_MSG_CHECKING(whether to test with Electric Fence)
-AC_ARG_ENABLE(efence,
- [ --enable-efence Enable malloc/free debugging with Bruce Perens\'
- Electric Fence library (test suites only).])
-AC_MSG_RESULT($enable_efence)
-ENABLE_EFENCE=$enable_efence
-AC_SUBST(ENABLE_EFENCE)
+ENABLE_LIBXML2_BACKEND=$enable_libxml2_backend
+AC_SUBST(ENABLE_LIBXML2_BACKEND)
dnl =======================================================================
dnl Compiler information
@@ -634,57 +624,30 @@
AC_SUBST(BUILDDIR)
+dnl =======================================================================
+dnl Output our results.
+dnl =======================================================================
-AC_DEFUN([AX_COMPILER_VENDOR],
-[
-AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
- [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
- # note: don't check for gcc first since some other compilers define __GNUC__
- for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
- vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
-#if !($vencpp)
- thisisanerror;
-#endif
-])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
- done
- ])
-])
+dnl Note that AM_CONFIG_HEADER at the top of this file outputs another
+dnl result: xmlrpc_amconfig.h .
-AX_COMPILER_VENDOR
+AC_OUTPUT( \
+ Makefile.srcdir \
+ config.mk \
+ xmlrpc_config.h \
+ )
-# Enable 64 bit build
-AC_ARG_ENABLE(64,
-[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"])
-if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then
- if test "${enable_64}" = "yes"; then
- COMPILER_CFLAGS=-m64
- COMPILER_CXXFLAGS=-m64
- fi
+if test ! -f GNUmakefile; then
+ ln -s "${srcdir}/GNUmakefile" .
+fi
+if test ! -f Makefile; then
+ ln -s "${srcdir}/Makefile" .
fi
-AC_SUBST(COMPILER_CFLAGS)
-AC_SUBST(COMPILER_CXXFLAGS)
-
-dnl =======================================================================
-dnl Libtool
-dnl =======================================================================
-AM_PROG_LIBTOOL
+if test "$MUST_BUILD_WININET_CLIENT $MUST_BUILD_CURL_CLIENT $MUST_BUILD_LIBWWW_CLIENT" = "no no no"; then
+ AC_MSG_NOTICE([\n\n==>We are not building any client XML transport (see earlier messages explaining why), therefore WE WILL NOT BUILD THE CLIENT LIBRARY.])
+fi
-dnl =======================================================================
-dnl Output our results.
-dnl =======================================================================
-AC_OUTPUT(xmlrpc-c-config \
- xmlrpc-c-config.test \
- Makefile.config \
- xmlrpc_config.h \
- lib/expat/Makefile \
- lib/expat/xmlparse/Makefile \
- lib/expat/xmlwf/Makefile \
- lib/expat/sample/Makefile \
- )
-chmod +x xmlrpc-c-config
-chmod +x xmlrpc-c-config.test
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/COPYING
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/COPYING (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/COPYING Mon May 26 12:59:57 2008
@@ -2,7 +2,7 @@
(and do other things with it which are controlled by copyright law)
under a few simple conditions.
-Each source files describes the copyright license for that particular
+Each source file describes the copyright license for that particular
file. This file summarizes the licenses for your convenience.
All the code written specifically for Xmlrpc-c, which is most
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/HISTORY
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/HISTORY (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/HISTORY Mon May 26 12:59:57 2008
@@ -1,5 +1,5 @@
-(There is a detailed release-by-release change history after the
-following overview).
+For a release-by-release change history, see
+<http://xmlrpc-c.sourceforge.net/change.html>.
XML-RPC For C/C++ was created by Eric Kidd in 2000, when XML-RPC was
new and vital. Its development was funded in significant part by
@@ -22,7 +22,7 @@
consequently became rather stable and interest in Xmlrpc-c levelled
off.
-This dark age of Xmlrpc-c lasted until November 2004, when Bryan Henderson
+This dark age of Xmlrpc-c lasted until October 2004, when Bryan Henderson
set out to find an RPC mechanism to use in one of his projects. Bryan
found XML-RPC and then Xmlrpc-c. He decided that the two were almost right
for his needs, but he needed some small extensions.
@@ -59,395 +59,3 @@
each of his releases consisted of a single source code tarball, and
that tarball was not signed. Bryan removed some redundant sources of
information from the package and the web site.
-
-
-DETAILED RELEASE HISTORY:
-
-
-(BJH means Bryan Henderson <bryanh(a)giraffe-data.com>)
-(SAB means Steven A. Bone <sbone(a)pobox.com>)
-
-1.03.14 - 06.04.15
-
- *BJH: Fix int/size_t mismatch in xmlrpc_server_abyss.c (manifests on 64
- bit systems).
-
-1.03.13 - 06.04.05
-
- *BJH: Fix build on system with no wchar_t.
-
- *BJH: Abyss XML-RPC server accepts (ignores) parameters after
- "text/xml" in Content-type header from client.
-
-1.03.12 - 06.03.20
-
- *BJH: Fix build of transport_config.h
-
- *BJH: Remove tantalizing but broken RPM spec file.
-
- *BJH: Remove casprintf.o from link of 'xmlrpc', 'xmlrpc_transport', because
- it conflicts with the version in libxmlrpc_client.
-
- *BJH: Change order of libraries in linking 'xml-rpc-api2cpp' to fix
- undefined reference error.
-
-1.03.11 - 06.01.25
-
- *Mike Goddard: in Xmlrpc-c-config, allow libwww-client as synonym
- for client, for backward compatibility.
-
- *Daniel Dlab: Correct INTERNET_FLAG_IGNORE_CERT_DATE_INVALID to
- ERROR_INTERNET_SEC_CERT_DATE_INVALID in Wininet transport.
-
- *BJH: Fix memory leak in C++ client result value - one leak per RPC.
-
- *BJH: Fix memory leak in C++ client - one leak per RPC.
-
- *BJH: Fix signature in xmlrpc_sample_add_server C++ example program.
-
- *BJH: Fix memory leak in xmlrpc_server_abyss_set_handler().
-
- *BJH: Fix memory leak in server method registry -- one leak for each
- RPC.
-
- *BJH: Fix memory leak in wide character constructor functions.
-
-1.03.10 - December 18, 2005
-
- *BJH: Change default minimum on paramList::getDouble() from DBL_MIN
- to -DBL_MAX.
-
-1.03.09 - December 7, 2005
-
- * BJH: Fix size_t/int type mismatch in xmlrpc_server_abyss.c.
-
- * BJH: meerkat-app-list example program: remove NUL character from
- time period parameter.
-
-1.03.08 - November 23, 2005
-
- * BJH: Fix use of uninitialized 'name' member in Abyss ServerCreate().
-
- * BJH: Install client_simple.hpp interface header file.
-
- * BJH: Fix bogus NULL default value for string argument in
- serverAbyss constructor. Use null string instead
-
- * BJH: Remove 'cpptest' from default make.
-
- * Mike West:
- Don't include tools/xmlrpc and tools/xmlrpc_transport
- in the build if client library configured out.
-
-1.03.07 - October 22, 2005
-
- * BJH: Remove curl_global_cleanup() so that multiple simultaneous
- Curl client XML transports per process are essentially
- possible and they don't interfere with other process use of
- Curl.
-
- * BJH: Serialize access to synchronous Curl session in Curl client
- XML transport (to avoid crashes with multiple threads).
-
- * BJH: When installing legacy header symlinks, remove old names first.
-
-1.03.06 - October 6, 2005
-
- * BJH: Fix use of pthread_mutex_t in girmem.hpp so it can be used in
- a Windows program.
-
- * BJH: Don't include xml-rpc-api2cpp in the build with --disable-cpp.
-
- * BJH: Fix bug in tools build, where it tries to link libxml2 instead
- of expat.
-
- * BJH: Add missing xmlrpc_config.h so lib/abyss/src/socket.h will
- compile on Solaris.
-
-1.03.05 - September 24, 2005
-
- * BJH: Change int to long in XMLRPC_STRUCTSIZE to correct 64 bit
- compile error.
-
- * BJH: Add virtual destructor for client to quiet compiler warning.
-
- * BJH: Don't try to build Abyss example programs if Abyss libraries not
- built.
-
- * BJH: Include <sys/filio.h> if it exists (i.e. Solaris).
-
- * BJH: Include <stdlib.h> instead of <malloc.h>, which doesn't exist
- in some environments.
-
-1.03.04 - September 9, 2005
-
- * BJH: Make Abyss work with short writes to sockets. Thanks
- Alistair John Strachan <s0348365(a)sms.ed.ac.uk>.
-
- * BJH: Remove unused SSPRINTF definition that won't compile on AIX
- because it has variable arguments.
-
- * BJH: Fix Curl transport bug: arbitrary values for SSL verify options.
-
-1.03.03 - August 4, 2005
-
- * SAB: Fix for Windows what broke between 1.02 and 1.03.
-
- * SAB: Fix incorrect result of xmlrpc_read_string_w() (wrong-size memcpy()).
-
- * BJH: Fix various things that don't compile on AIX.
-
- * BJH: Fix bug: doesn't install libxmlrpc_abyss.
-
- * BJH: Fix missing -l options in xmlrpc-c-config --client
-
-1.03.02 - July 20, 2005
-
- * BJH: Fix for bug in which Abyss doesn't build with either thread or
- fork capability. (Add -D_UNIX and -D_THREAD compile options).
-
-1.03.01 - July 9, 2005
-
- * BJH: Fix for libxml2, no curl builds. make clean cleans test directory
-
-1.03 - June 26, 2005
-
- * BJH: new C++ libraries designed for pure C++ applications
- (Application never sees the underlying C structures or reference
- counts).
-
- * BJH: Make Curl do cookies (session only) and persistent connections.
- This is only for calls through the synchronous interface, and the
- synchronous interface is no longer thread safe -- you can have only
- one thread making calls through it.
-
- * BJH: Add Curl SSL_NO_VERIFYPEER, SSL_NO_VERIFYHOST control.
-
- * BJH: Add User-Agent to Curl transport, Xmlrpc program.
-
- * BJH: libwww transport does not do the weird handling of the "auth"
- cookie. It used to have a global cookie (one cookie shared by all
- servers) called "auth", which it maintained in an environment
- variable.
-
- * BJH: interface header files renamed from xmlrpc_xxx to xmlrpc-c/xxx
- (old names installed a symbolic links for backward compatibility).
-
- * BJH: libxmlrpc_server_abyss: Add ability to set the /RPC2 handler
- without also setting default handler, and to set handlers for files
- other than /RPC2.
-
- * BJH: libxmlrpc_server_abyss: Eliminate global variable for registry
- handle.
-
- * BJH: Abyss: allow user's request handlers to have context
- (Add URIHandler2 type).
-
- * BJH: Add xmlrpc_datetime_new_sec(), xmlrpc_read_datetime_sec().
-
- * BJH: Builds on AIX - new __inline definition, uint32_t instead of uint32,
- et al.
-
- * BJH: Don't build client library if not building any client XML
- transport.
-
- * BJH: Fix bug: xmlrpc_serialize_base64_data() doesn't free working
- storage.
-
- * BJH: Fix mysterious disablement of forking Abyss (ServerRunForked()).
-
- * BJH: Fix bug: 'make install' doesn't install libxmlrpc_xmltok.
-
- * BJH: Renamed CGI stuff, add non-builtin-registry style of CGI server.
-
- * BJH: Break up 'rpctest', rename to 'test'.
-
-1.02 - April 4, 2005
-
- * SAB: Win32 http.sys server: Add new project and sample as
- an alternative to Abyss on current Win32 platforms. Does
- basic authentication and SSL. Requires recent Platform SDK to
- build.
-
- * BJH: Add xmlrpc_int_new(), xmlrpc_read_int(), etc.,
- xmlrpc_decompose_value()
-
- * BJH: Add nil (<nil/>, XMLRPC_TYPE_NIL) capability.
-
- * SAB: WinInet Transport: Add Ignore Invalid SSL certs option.
-
- * BJH: Add 'network_interface' option to Curl transport.
-
- * BJH: Add basic authentication to 'xmlrpc' program.
-
- * BJH: Add 'xmlrpc_transport' tool.
-
- * SAB: Improve use of libCurl in Win32. Add documentation
- and alter some project and configuration files.
-
- * BJH: Add transport-specific options.
-
- * BJH: Use GNUmakefile to catch non-GNU make
-
- * BJH: Fix usage message in xmlrpc-c-config.
-
- * BJH: Curl transport: check for failure of Winsock startup.
-
- * BJH: Fix memory leak in Curl - not freeing curlTransaction.
-
- * SAB: WinInet Transport: Fix bad authentication header.
-
-
-1.01 - January 8, 2005
-
- * SAB: Windows works again; new build strategy.
-
- * BJH: Abyss: Add ConnCreate2() with foreground capability.
-
- * BJH: Abyss: Add ServerRunOnce2() with foreground capability.
-
- * BJH: Abyss: Fix ServerRunOnce().
-
- * BJH: Add xmlrpc_server_abyss().
-
- * BJH: Abyss pthreads is default
-
- * BJH: Clean up client transport multiplexor
-
- * BJH: Separate out server registry stuff into new libxml_server.
-
- * BJH: Examples/Makefile uses new xmlrpc-c-config.test so as to be a
- better example.
-
- * BJH: Fail when structure format specifier does not end in
- "*" instead of just asserting that it does.
-
- * BJH: Fail when structure format specifier is not closed by "}"
- instead of just asserting that it is.
-
- * BJH: Add xmlrpc_array_read_item().
-
-1.00 - October 25, 2004
- * New modular client XML transport structure. Curl and Wininet transports
- (in addition to existing libwww).
- * Bryan Henderson: create Makefile.config; make examples/ directory use
- static make file.
- * Bryan Henderson: replace Makefile.am with already built Makefile.in.
- * Peter Astrand: make it compile with Gcc 3.1.1.
- * Joe Shaw: Can use libxml2 instead of libexpat.
- * Bernhard Herzog: const fixes
- * Stephen Blackheath: ./configure support for building Abyss
- with pthreads.
- * Jeff Dubrule: Removed C++ comments from expat.
- * Patrick Boykin: Facility to copy xmlrpc_server_info structs.
-
-0.9.10 - Eric Kidd <eric.kidd(a)pobox.com> - 30 June 2001
-
- * Man pages!
- * Debian packages!
-
- * Jeff Stewart: NT CGI fixes.
- * Andy Maloney: Win32 xmlrpc_win32_config.h fixes.
- * Mike Bytnar: Solaris build fixes. Thanks!
-
- * No more 'CVS' directories lurking in the dist tarball.
- * Disabled rpath stuff so we comply with Debian policy.
- * wchar_t code can now be disabled.
- * New interop server.
- * Parts of an interop client.
- * Lots of interop fixes.
- * Other stuff.
-
-0.9.9 - Eric Kidd <eric.kidd(a)pobox.com> - 03 April 2001
-
- * xml-rpc-api2cpp now generates usable proxy classes.
- * Luke Howard: Default method capability.
- * Abstract XML parser API (but you'll need to edit makefiles to use it).
- * Implemented a configurable size limit for XML data off the network.
-
- * Ability to build and parse XML-RPC values using wchar_t strings.
- * Basic UTF-8 handling: Refuse to process invalid UTF-8 from network,
- print warnings when sending invalid UTF-8 *to* network.
- * Highly robust UTF-8 validator, decoder, encoder.
-
- * Modularized the build system--build only what you need.
- * Integrated Electric Fence into build system (optional).
-
- * Fixed all recent, reproducible bugs in CVS. These were generally
- Windows build bugs.
- * Andy Maloney: Build fixes for Windows.
- * Mike Bytnar: Build fixes for Solaris.
- * RedHat 7 warning fixes.
-
-0.9.8 - Eric Kidd <eric.kidd(a)pobox.com> - 19 February 2001
-
- * J. Alan Eldridge, Rosimildo daSIlva: Build fixes.
- * Send 'encoding="UTF-8"' in XML prologue.
-
-0.9.7 - Eric Kidd <eric.kidd(a)pobox.com> - 14 February 2001
-
- * SECURITY: Configurable nesting limits (see advisory 1) to prevent
- denial-of-service attacks and stack overflow.
- * Win32 build fixes from Alex Olugbile.
- * Function name fix from Luke Howard.
-
-0.9.6w - Eric Kidd <eric.kidd(a)pobox.com> - 02 February 2001
-
- * Merged Win32 VC/C++ changes from Alex and Ian.
- * Merged Win32 Cygwin changes from Rosimildo daSilva
-
-0.9.6 - Eric Kidd <eric.kidd(a)pobox.com> - 30 January 2001
-
- * Fixed lots of gcc warnings.
- * Added a new 'xmlrpc_server_info' class, which allows you to
- set options on a per-server basis.
- * HTTP Basic authentication.
- * Added internal implementation of system.multicall, lots of brutal test
- cases, and stubs for other system.* commands.
- * Added APIs for accessing CGI and Abyss method registries.
- * Implemented system.listMethods, system.methodHelp, system.methodSignature.
- * Fixed stupid bug in parsing of "(ss*)"-style array descriptions
- where there were no extra elements.
- * Added highly experimental hacked copy of mod_gzip into the
- tools/turbocharger directory. This version does gzip *and* deflate!
- * Added xml-rpc-api2txt, since XML-RPC doesn't have any IDL language.
- * Merged in Ilya Goldberg's libwww/SSL setup code.
-
-0.9.5 - Eric Kidd <eric.kidd(a)pobox.com> - 20 January 2001
-
- * Bug fix: Make sure CGI-based servers send correct content-length.
-
-0.9.4 - Eric Kidd <eric.kidd(a)pobox.com> - 18 January 2001
-
- * Services for CGI-based servers.
-
-0.9.3 - Eric Kidd <eric.kidd(a)pobox.com> - 14 January 2001
-
- * Works with Libwww 5.2.8, even when linked against expat.
- * Added xmlrpc_value_type and XmlRpcValue::getType functions.
- * Miscellaneous API tweaks to discourage writing of incorrect programs.
- Should not affect any correct programs.
-
-0.9.2 - Eric Kidd <eric.kidd(a)pobox.com> - 12 January 2001
-
- * Improved error messages.
- * Refuse to link against libwww if it was built with expat.
-
-0.9.1 - Eric Kidd <eric.kidd(a)pobox.com> - 9 January 2001
-
- * Integrated Rick Blair's fix to speed up libwww client.
- * Added informative URLs to Meerkat example programs.
- * Hid the implementation details of xmlrpc_value, just to keep
- people honest. (No more dangerous allocation on the stack!)
- * Minor C++ code cleanup after buying modern C++ books.
- * Documentation improvements.
-
-Some other contributions of unknown date:
-
- Adrian Likins made lots of good, real-world suggestions for improvement.
-
- Ian MacLean made patches from Alex's Windows port.
-
- Brian Quinlan of the Active State company made lots of cool patches,
- including preliminary wchar_t capability.
-
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/TODO
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/TODO (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/doc/TODO Mon May 26 12:59:57 2008
@@ -7,16 +7,8 @@
FUNCTIONAL CHANGES
------------------
-Make xmlrpc_server_abyss() catch a SIGTERM and terminate cleanly.
-
-Make a system.shutdown XML-RPC method to send SIGTERM to its server.
-Don't know what kind of security.
-
-Provide an interface for Abyss servers where the user accepts the TCP
-connection and passes to Xmlrpc-c the open socket. This would be
-useful for inetd servers, among others.
-
-Document the xmlrpc-c/server_abyss.hpp interface.
+Put details in the manual for the xmlrpc-c/server_abyss.hpp interface:
+libxmlrpc_server_abyss++.html.
Implement pluggable XML transports on the server side like on the
client side.
@@ -24,9 +16,6 @@
Create a non-XML non-HTTP efficient transport, client and server.
The tools/binmode-rpc-kit/ directory might be useful. Consider XDR.
-Make clients and servers reentrant (this requires getting or making
-reentrant HTTP libraries).
-
Change the argument order of asynchronous response callbacks to be
more consistent with the xmlrpc_client_call_asynch function. Also
take a look at the server method callback.
@@ -37,9 +26,8 @@
This will break binary and source API compatibility in a very minor
way.
-Make a Perl interface to Xmlrpc-c libraries. This would be better than the
-existing Perl RPC::XML modules because the latter are Perl all the way down
-to the sockets and are thus very slow.
+Expand the Perl interface to Xmlrpc-c libraries to do server functions.
+Maybe match some other features of RPC::XML.
Don't use xmlrpc_value for things that aren't part of an XML-RPC call or
response. It's confusing. In particular, we use an xmlrpc_value
@@ -49,12 +37,16 @@
Don't use XML-RPC fault codes internally. It's confusing. Plus, there's
no need for fault codes at all. Just use the string descriptions.
+Add a function to deregister a method from a method registry.
+
+Add a "registry" type that works via a filesystem directory. There is
+a .so file for each method with its code, and probably a configuration
+file. Make it dynamically updatable.
+
IMPLEMENTATION CHANGES
----------------------
-Replace dynamically created make files with static ones based on GNU make.
-
Use function pointers to access cleanup code in xmlrpc_DECREF?
Or even better: Should we create some kind of class-like system to declare
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/Makefile Mon May 26 12:59:57 2008
@@ -5,14 +5,15 @@
# these programs depend.
-ifeq ($(SRCDIR)x,x)
+ifeq ($(SRCDIR),)
SRCDIR = $(CURDIR)/..
-BUILDDIR = $(SRCDIR)
+BLDDIR = $(SRCDIR)
endif
+SUBDIR = examples
-default: all
+include $(BLDDIR)/config.mk
-include $(BUILDDIR)/Makefile.config
+default: all
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
LDFLAGS = $(LADD)
@@ -20,19 +21,25 @@
# If this were a real application, working from an installed copy of
# Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'. It would be
# found in the user's PATH.
-XMLRPC_C_CONFIG = $(BUILDDIR)/xmlrpc-c-config.test
+XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test
CLIENTPROGS = \
auth_client \
- query-meerkat \
synch_client \
xmlrpc_sample_add_client \
xmlrpc_asynch_client \
+ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
+ CLIENTPROGS += interrupted_client
+endif
+
SERVERPROGS_CGI = \
xmlrpc_sample_add_server.cgi
SERVERPROGS_ABYSS = \
+ interrupted_server \
+ xmlrpc_inetd_server \
+ xmlrpc_socket_server \
xmlrpc_loop_server \
xmlrpc_sample_add_server \
xmlrpc_server_validatee \
@@ -54,7 +61,7 @@
PROGS += $(SERVERPROGS_CGI)
endif
-INCLUDES = $(shell $(XMLRPC_C_CONFIG) client abyss-server --cflags)
+INCLUDES = -I. $(shell $(XMLRPC_C_CONFIG) client abyss-server --cflags)
LDADD_CLIENT = \
$(shell $(XMLRPC_C_CONFIG) client --ldadd)
@@ -75,8 +82,12 @@
endif
.PHONY: cpp/all
-cpp/all:
- $(MAKE) -C $(dir $@) $(notdir $@)
+cpp/all: $(BLDDIR)/examples/cpp
+ $(MAKE) -C cpp -f $(SRCDIR)/examples/cpp/Makefile all
+
+# When building in separate tree, directory won't exist yet
+$(BLDDIR)/examples/cpp:
+ mkdir $@
$(CLIENTPROGS):%:%.o
$(CCLD) -o $@ $(LDFLAGS) $^ $(LDADD_CLIENT)
@@ -90,17 +101,25 @@
gen_sample_add_xml:%:%.o
$(CCLD) -o $@ $(LDFLAGS) $^ $(LDADD_BASE)
-%.o:%.c
+OBJECTS = $(patsubst %,%.o,$(patsubst %.cgi,%_cgi,$(PROGS)))
+
+$(OBJECTS):%.o:%.c
$(CC) -c $(INCLUDES) $(CFLAGS) $<
-*.c: config.h xmlrpc_amconfig.h
+# config.h and xmlrpc_amconfig.h just describe the build environment.
+# We use them so that the example programs will build in users'
+# various environments. If you're copying these examples, you can
+# just remove these headers from the programs and hardcode whatever is
+# right for your build environment.
+
+$(OBJECTS): config.h xmlrpc_amconfig.h
config.h:
- $(LN_S) $(BUILDDIR)/xmlrpc_config.h $@
+ $(LN_S) $(BLDDIR)/xmlrpc_config.h $@
xmlrpc_amconfig.h:
- $(LN_S) $(BUILDDIR)/$@ .
+ $(LN_S) $(BLDDIR)/$@ .
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
.PHONY: clean
clean: clean-common
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/auth_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/auth_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/auth_client.c Mon May 26 12:59:57 2008
@@ -20,22 +20,26 @@
#define VERSION "1.0"
#define SERVER_URL "http://localhost:8080/RPC2"
-static void die_if_fault_occurred (xmlrpc_env *env)
-{
- if (env->fault_occurred) {
+
+
+static void
+die_if_fault_occurred(xmlrpc_env * const envP) {
+ if (envP->fault_occurred) {
fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
- env->fault_string, env->fault_code);
+ envP->fault_string, envP->fault_code);
exit(1);
}
}
+
+
int
main(int const argc,
const char ** const argv ATTR_UNUSED) {
xmlrpc_env env;
- xmlrpc_server_info * server;
- xmlrpc_value * result;
+ xmlrpc_server_info * serverP;
+ xmlrpc_value * resultP;
xmlrpc_int sum;
if (argc-1 > 0) {
@@ -48,29 +52,29 @@
xmlrpc_env_init(&env);
/* Make a new object to represent our XML-RPC server. */
- server = xmlrpc_server_info_new(&env, SERVER_URL);
+ serverP = xmlrpc_server_info_new(&env, SERVER_URL);
die_if_fault_occurred(&env);
/* Set up our authentication information. */
- xmlrpc_server_info_set_basic_auth(&env, server, "jrandom", "secret");
+ xmlrpc_server_info_set_basic_auth(&env, serverP, "jrandom", "secret");
die_if_fault_occurred(&env);
- result =
+ resultP =
xmlrpc_client_call_server(
- &env, server, "sample.add", "(ii)",
+ &env, serverP, "sample.add", "(ii)",
(xmlrpc_int32) 5, (xmlrpc_int32) 7);
die_if_fault_occurred(&env);
/* Dispose of our server object. */
- xmlrpc_server_info_free(server);
+ xmlrpc_server_info_free(serverP);
/* Get the authentication information and print it out. */
- xmlrpc_read_int(&env, result, &sum);
+ xmlrpc_read_int(&env, resultP, &sum);
die_if_fault_occurred(&env);
- printf("The sum is %d\n", sum);
+ printf("The sum is %d\n", sum);
/* Dispose of our result value. */
- xmlrpc_DECREF(result);
+ xmlrpc_DECREF(resultP);
/* Shut down our XML-RPC client library. */
xmlrpc_env_clean(&env);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/Makefile Mon May 26 12:59:57 2008
@@ -5,14 +5,15 @@
# these programs depend.
-ifeq ($(SRCDIR)x,x)
+ifeq ($(SRCDIR),)
SRCDIR = $(CURDIR)/../..
-BUILDDIR = $(SRCDIR)
+BLDDIR = $(SRCDIR)
endif
+SUBDIR=examples/cpp
-default: all
+include $(BLDDIR)/config.mk
-include $(BUILDDIR)/Makefile.config
+default: all
CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
LDFLAGS = $(LADD)
@@ -20,18 +21,18 @@
# If this were a real application, working from an installed copy of
# Xmlrpc-c, XMLRPC_C_CONFIG would just be 'xmlrpc-c-config'. It would be
# found in the user's PATH.
-XMLRPC_C_CONFIG = $(BUILDDIR)/xmlrpc-c-config.test
+XMLRPC_C_CONFIG = $(BLDDIR)/xmlrpc-c-config.test
SERVERPROGS_ABYSS = \
+ xmlrpc_inetd_server \
+ xmlrpc_loop_server \
xmlrpc_sample_add_server \
-LEGACY_CLIENTPROGS = \
- meerkat-app-list
-
CLIENTPROGS = \
xmlrpc_sample_add_client \
sample_add_client_complex \
+ asynch_client \
# Build up PROGS:
PROGS =
@@ -41,10 +42,16 @@
endif
ifeq ($(MUST_BUILD_CLIENT),yes)
- PROGS += $(CLIENTPROGS) $(LEGACY_CLIENTPROGS)
+ PROGS += $(CLIENTPROGS)
endif
-INCLUDES = $(shell $(XMLRPC_C_CONFIG) c++2 client abyss-server --cflags)
+PROGS += pstream_inetd_server
+
+ifeq ($(MUST_BUILD_CLIENT),yes)
+ PROGS += pstream_client
+endif
+
+INCLUDES = -I. $(shell $(XMLRPC_C_CONFIG) c++2 client abyss-server --cflags)
LDADD_SERVER_ABYSS = \
$(shell $(XMLRPC_C_CONFIG) c++2 abyss-server --ldadd)
@@ -55,31 +62,42 @@
LDADD_BASE = \
$(shell $(XMLRPC_C_CONFIG) c++2 --ldadd)
-LDADD_LEGACY_CLIENT = \
- $(shell $(XMLRPC_C_CONFIG) c++ client --ldadd)
-
all: $(PROGS)
$(SERVERPROGS_ABYSS):%:%.o
$(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_SERVER_ABYSS)
-$(LEGACY_CLIENTPROGS):%:%.o
- $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_LEGACY_CLIENT)
-
$(CLIENTPROGS):%:%.o
$(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_CLIENT)
-%.o:%.cpp
+
+LDADD_PSTREAM_CLIENT = \
+ $(shell $(XMLRPC_C_CONFIG) c++2 client --ldadd)
+
+pstream_client:%:%.o
+ $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_PSTREAM_CLIENT)
+
+LDADD_PSTREAM_SERVER = \
+ $(shell $(XMLRPC_C_CONFIG) c++2 pstream-server --ldadd)
+
+pstream_inetd_server:%:%.o
+ $(CXXLD) -o $@ $(LDFLAGS) $^ $(LDADD_PSTREAM_SERVER)
+
+OBJECTS = $(PROGS:%=%.o)
+
+$(OBJECTS):%.o:%.cpp
$(CXX) -c $(INCLUDES) $(CXXFLAGS) $<
-*.c: config.h xmlrpc_amconfig.h
+# See example/Makefile for an explanation of config.h and xmlrpc_amconfig.h
+
+$(OBJECTS): config.h xmlrpc_amconfig.h
config.h:
- $(LN_S) $(BUILDDIR)/xmlrpc_config.h $@
+ $(LN_S) $(BLDDIR)/xmlrpc_config.h $@
xmlrpc_amconfig.h:
- $(LN_S) $(BUILDDIR)/$@ .
+ $(LN_S) $(BLDDIR)/$@ .
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
.PHONY: clean
clean: clean-common
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp Mon May 26 12:59:57 2008
@@ -14,12 +14,13 @@
facility. It is for demonstration purposes.
=============================================================================*/
+#include <cassert>
+#include <cstdlib>
#include <string>
#include <iostream>
#include <xmlrpc-c/girerr.hpp>
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/client.hpp>
-#include <cassert>
using namespace std;
@@ -32,7 +33,11 @@
}
try {
- xmlrpc_c::clientXmlTransport_curl myTransport;
+ xmlrpc_c::clientXmlTransport_curl myTransport(
+ xmlrpc_c::clientXmlTransport_curl::constrOpt()
+ .no_ssl_verifyhost(true)
+ .user_agent("sample_add/1.0"));
+
xmlrpc_c::client_xml myClient(&myTransport);
string const methodName("sample.add");
@@ -47,8 +52,6 @@
xmlrpc_c::carriageParm_curl0 myCarriageParm(serverUrl);
- xmlrpc_c::value result;
-
myRpcP->call(&myClient, &myCarriageParm);
assert(myRpcP->isFinished());
@@ -58,8 +61,8 @@
cout << "Result of RPC (sum of 5 and 7): " << sum << endl;
- } catch (girerr::error const error) {
- cerr << "Client threw error: " << error.what() << endl;
+ } catch (exception const& e) {
+ cerr << "Client threw error: " << e.what() << endl;
} catch (...) {
cerr << "Client threw unexpected error." << endl;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp Mon May 26 12:59:57 2008
@@ -1,3 +1,4 @@
+#include <cstdlib>
#include <string>
#include <iostream>
#include <xmlrpc-c/girerr.hpp>
@@ -28,8 +29,8 @@
cout << "Result of RPC (sum of 5 and 7): " << sum << endl;
- } catch (girerr::error const error) {
- cerr << "Client threw error: " << error.what() << endl;
+ } catch (exception const& e) {
+ cerr << "Client threw error: " << e.what() << endl;
} catch (...) {
cerr << "Client threw unexpected error." << endl;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp Mon May 26 12:59:57 2008
@@ -1,4 +1,11 @@
#include <cassert>
+#include <stdexcept>
+#include <iostream>
+#ifdef WIN32
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/registry.hpp>
@@ -6,6 +13,13 @@
using namespace std;
+#ifdef WIN32
+ #define SLEEP(seconds) SleepEx(seconds * 1000);
+#else
+ #define SLEEP(seconds) sleep(seconds);
+#endif
+
+
class sampleAddMethod : public xmlrpc_c::method {
public:
sampleAddMethod() {
@@ -26,6 +40,11 @@
paramList.verifyEnd(2);
*retvalP = xmlrpc_c::value_int(addend + adder);
+
+ // Sometimes, make it look hard (so client can see what it's like
+ // to do an RPC that takes a while).
+ if (adder == 1)
+ SLEEP(2);
}
};
@@ -35,21 +54,24 @@
main(int const,
const char ** const) {
- xmlrpc_c::registry myRegistry;
-
- xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
-
- myRegistry.addMethod("sample.add", sampleAddMethodP);
+ try {
+ xmlrpc_c::registry myRegistry;
- xmlrpc_c::serverAbyss myAbyssServer(
- myRegistry,
- 8080, // TCP port on which to listen
- "/tmp/xmlrpc_log" // Log file
- );
-
- myAbyssServer.run();
- // xmlrpc_c::serverAbyss.run() never returns
- assert(false);
+ xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
+ myRegistry.addMethod("sample.add", sampleAddMethodP);
+
+ xmlrpc_c::serverAbyss myAbyssServer(
+ myRegistry,
+ 8080, // TCP port on which to listen
+ "/tmp/xmlrpc_log" // Log file
+ );
+
+ myAbyssServer.run();
+ // xmlrpc_c::serverAbyss.run() never returns
+ assert(false);
+ } catch (exception const& e) {
+ cerr << "Something failed. " << e.what() << endl;
+ }
return 0;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/gen_sample_add_xml.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/gen_sample_add_xml.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/gen_sample_add_xml.c Mon May 26 12:59:57 2008
@@ -16,10 +16,10 @@
#include "config.h"
static void
-die_if_fault_occurred (xmlrpc_env *env) {
- if (env->fault_occurred) {
+die_if_fault_occurred(xmlrpc_env * const envP) {
+ if (envP->fault_occurred) {
fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
- env->fault_string, env->fault_code);
+ envP->fault_string, envP->fault_code);
exit(1);
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/synch_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/synch_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/synch_client.c Mon May 26 12:59:57 2008
@@ -11,11 +11,11 @@
#define NAME "XML-RPC C Test Client synch_client"
#define VERSION "1.0"
-static void die_if_fault_occurred (xmlrpc_env *env)
-{
- if (env->fault_occurred) {
+static void
+die_if_fault_occurred(xmlrpc_env * const envP) {
+ if (envP->fault_occurred) {
fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
- env->fault_string, env->fault_code);
+ envP->fault_string, envP->fault_code);
exit(1);
}
}
@@ -28,7 +28,7 @@
xmlrpc_env env;
xmlrpc_value * resultP;
- const char * state_name;
+ const char * stateName;
if (argc-1 > 0) {
fprintf(stderr, "No arguments");
@@ -48,10 +48,10 @@
die_if_fault_occurred(&env);
/* Get our state name and print it out. */
- xmlrpc_read_string(&env, resultP, &state_name);
+ xmlrpc_read_string(&env, resultP, &stateName);
die_if_fault_occurred(&env);
- printf("%s\n", state_name);
- free((char*)state_name);
+ printf("%s\n", stateName);
+ free((char*)stateName);
/* Dispose of our result value. */
xmlrpc_DECREF(resultP);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c Mon May 26 12:59:57 2008
@@ -3,6 +3,10 @@
simpler synchronous client xmlprc_sample_add_client.c, except that
it adds 3 different pairs of numbers with the summation RPCs going on
simultaneously.
+
+ Use this with xmlrpc_sample_add_server. Note that that server
+ intentionally takes extra time to add 1 to anything, so you can see
+ our 5+1 RPC finish after our 5+0 and 5+2 RPCs.
*/
#include <stdlib.h>
@@ -17,10 +21,10 @@
#define VERSION "1.0"
static void
-die_if_fault_occurred (xmlrpc_env *env) {
- if (env->fault_occurred) {
+die_if_fault_occurred(xmlrpc_env * const envP) {
+ if (envP->fault_occurred) {
fprintf(stderr, "Something failed. %s (XML-RPC fault code %d)\n",
- env->fault_string, env->fault_code);
+ envP->fault_string, envP->fault_code);
exit(1);
}
}
@@ -28,13 +32,13 @@
static void
-handle_sample_add_response(const char * const server_url,
- const char * const method_name,
- xmlrpc_value * const param_array,
+handle_sample_add_response(const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED,
xmlrpc_env * const faultP,
xmlrpc_value * const resultP) {
-
+
xmlrpc_env env;
xmlrpc_int addend, adder;
@@ -44,14 +48,14 @@
/* Our first four arguments provide helpful context. Let's grab the
addends from our parameter array.
*/
- xmlrpc_decompose_value(&env, param_array, "(ii)", &addend, &adder);
+ xmlrpc_decompose_value(&env, paramArrayP, "(ii)", &addend, &adder);
die_if_fault_occurred(&env);
printf("RPC with method '%s' at URL '%s' to add %d and %d "
- "has completed\n", method_name, server_url, addend, adder);
+ "has completed\n", methodName, serverUrl, addend, adder);
if (faultP->fault_occurred)
- printf("The RPC failed. %s", faultP->fault_string);
+ printf("The RPC failed. %s\n", faultP->fault_string);
else {
xmlrpc_int sum;
@@ -68,10 +72,11 @@
main(int const argc,
const char ** const argv ATTR_UNUSED) {
- char * const url = "http://localhost:8080/RPC2";
- char * const methodName = "sample.add";
+ const char * const serverUrl = "http://localhost:8080/RPC2";
+ const char * const methodName = "sample.add";
xmlrpc_env env;
+ xmlrpc_client * clientP;
xmlrpc_int adder;
if (argc-1 > 0) {
@@ -82,17 +87,21 @@
/* Initialize our error environment variable */
xmlrpc_env_init(&env);
- /* Create the Xmlrpc-c client object */
- xmlrpc_client_init2(&env, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION, NULL, 0);
+ /* Required before any use of Xmlrpc-c client library: */
+ xmlrpc_client_setup_global_const(&env);
+ die_if_fault_occurred(&env);
+
+ xmlrpc_client_create(&env, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION, NULL, 0,
+ &clientP);
die_if_fault_occurred(&env);
for (adder = 0; adder < 3; ++adder) {
printf("Making XMLRPC call to server url '%s' method '%s' "
"to request the sum "
- "of 5 and %d...\n", url, methodName, adder);
+ "of 5 and %d...\n", serverUrl, methodName, adder);
/* request the remote procedure call */
- xmlrpc_client_call_asynch(url, methodName,
+ xmlrpc_client_start_rpcf(&env, clientP, serverUrl, methodName,
handle_sample_add_response, NULL,
"(ii)", (xmlrpc_int32) 5, adder);
die_if_fault_occurred(&env);
@@ -100,13 +109,15 @@
printf("RPCs all requested. Waiting for & handling responses...\n");
- /* The following is what calls handle_sample_add_response() (3 times) */
- xmlrpc_client_event_loop_finish_asynch();
+ /* Wait for all RPCs to be done. With some transports, this is also
+ what causes them to go.
+ */
+ xmlrpc_client_event_loop_finish(clientP);
printf("All RPCs finished.\n");
- /* Destroy the Xmlrpc-c client object */
- xmlrpc_client_cleanup();
+ xmlrpc_client_destroy(clientP);
+ xmlrpc_client_teardown_global_const();
return 0;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_loop_server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_loop_server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_loop_server.c Mon May 26 12:59:57 2008
@@ -9,6 +9,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/abyss.h>
#include <xmlrpc-c/server.h>
@@ -29,12 +32,33 @@
obviously don't want to die just because a client didn't complete
an RPC, so we ignore SIGPIPE.
*/
+#ifndef WIN32
struct sigaction mysigaction;
sigemptyset(&mysigaction.sa_mask);
mysigaction.sa_flags = 0;
mysigaction.sa_handler = SIG_IGN;
sigaction(SIGPIPE, &mysigaction, NULL);
+#endif
+}
+
+
+
+static void
+printPeerIpAddr(TSession * const abyssSessionP) {
+
+ struct abyss_unix_chaninfo * channelInfoP;
+ struct sockaddr_in * sockAddrInP;
+ unsigned char * ipAddr; /* 4 byte array */
+
+ SessionGetChannelInfo(abyssSessionP, (void*)&channelInfoP);
+
+ sockAddrInP = (struct sockaddr_in *) &channelInfoP->peerAddr;
+
+ ipAddr = (unsigned char *)&sockAddrInP->sin_addr.s_addr;
+
+ printf("RPC is from IP address %u.%u.%u.%u\n",
+ ipAddr[0], ipAddr[1], ipAddr[2], ipAddr[3]);
}
@@ -42,10 +66,13 @@
static xmlrpc_value *
sample_add(xmlrpc_env * const envP,
xmlrpc_value * const paramArrayP,
- void * const userData ATTR_UNUSED) {
+ void * const serverInfo ATTR_UNUSED,
+ void * const channelInfo) {
xmlrpc_int x, y, z;
+ printPeerIpAddr(channelInfo);
+
/* Parse our argument array. */
xmlrpc_decompose_value(envP, paramArrayP, "(ii)", &x, &y);
if (envP->fault_occurred)
@@ -60,6 +87,32 @@
+static xmlrpc_server_shutdown_fn requestShutdown;
+
+static void
+requestShutdown(xmlrpc_env * const faultP,
+ void * const context,
+ const char * const comment,
+ void * const callInfo) {
+
+ /* You make this run by executing the system method
+ 'system.shutdown'. This function is registered in the method
+ registry as the thing to call for that.
+ */
+ int * const terminationRequestedP = context;
+ TSession * const abyssSessionP = callInfo;
+
+ xmlrpc_env_init(faultP);
+
+ fprintf(stderr, "Termination requested: %s\n", comment);
+
+ printPeerIpAddr(abyssSessionP);
+
+ *terminationRequestedP = 1;
+}
+
+
+
int
main(int const argc,
const char ** const argv) {
@@ -67,6 +120,8 @@
TServer abyssServer;
xmlrpc_registry * registryP;
xmlrpc_env env;
+ int terminationRequested; /* A boolean value */
+ const char * error;
if (argc-1 != 1) {
fprintf(stderr, "You must specify 1 argument: The TCP port number "
@@ -74,34 +129,42 @@
"You specified %d.\n", argc-1);
exit(1);
}
+
+ AbyssInit(&error);
xmlrpc_env_init(&env);
registryP = xmlrpc_registry_new(&env);
- xmlrpc_registry_add_method(
- &env, registryP, NULL, "sample.add", &sample_add, NULL);
+ xmlrpc_registry_add_method2(
+ &env, registryP, "sample.add", &sample_add, NULL, NULL, NULL);
- MIMETypeInit();
+ xmlrpc_registry_set_shutdown(registryP,
+ &requestShutdown, &terminationRequested);
- ServerCreate(&abyssServer, "XmlRpcServer", atoi(argv[1]),
- NULL, NULL);
+ ServerCreate(&abyssServer, "XmlRpcServer", atoi(argv[1]), NULL, NULL);
- xmlrpc_server_abyss_set_handlers(&abyssServer, registryP);
+ xmlrpc_server_abyss_set_handlers2(&abyssServer, "/RPC2", registryP);
ServerInit(&abyssServer);
setupSignalHandlers();
- while (1) {
+ terminationRequested = 0;
+
+ while (!terminationRequested) {
printf("Waiting for next RPC...\n");
- ServerRunOnce2(&abyssServer, ABYSS_FOREGROUND);
+ ServerRunOnce(&abyssServer);
/* This waits for the next connection, accepts it, reads the
HTTP POST request, executes the indicated RPC, and closes
the connection.
*/
}
+ ServerFree(&abyssServer);
+
+ AbyssTerm();
+
return 0;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c Mon May 26 12:59:57 2008
@@ -16,10 +16,10 @@
#define VERSION "1.0"
static void
-die_if_fault_occurred (xmlrpc_env *env) {
- if (env->fault_occurred) {
+die_if_fault_occurred (xmlrpc_env * const envP) {
+ if (envP->fault_occurred) {
fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
- env->fault_string, env->fault_code);
+ envP->fault_string, envP->fault_code);
exit(1);
}
}
@@ -31,10 +31,10 @@
const char ** const argv ATTR_UNUSED) {
xmlrpc_env env;
- xmlrpc_value *result;
+ xmlrpc_value * resultP;
xmlrpc_int32 sum;
- char * const serverUrl = "http://localhost:8080/RPC2";
- char * const methodName = "sample.add";
+ const char * const serverUrl = "http://localhost:8080/RPC2";
+ const char * const methodName = "sample.add";
if (argc-1 > 0) {
fprintf(stderr, "This program has no arguments\n");
@@ -53,17 +53,17 @@
"of 5 and 7...\n", serverUrl, methodName);
/* Make the remote procedure call */
- result = xmlrpc_client_call(&env, serverUrl, methodName,
- "(ii)", (xmlrpc_int32) 5, (xmlrpc_int32) 7);
+ resultP = xmlrpc_client_call(&env, serverUrl, methodName,
+ "(ii)", (xmlrpc_int32) 5, (xmlrpc_int32) 7);
die_if_fault_occurred(&env);
/* Get our sum and print it out. */
- xmlrpc_read_int(&env, result, &sum);
+ xmlrpc_read_int(&env, resultP, &sum);
die_if_fault_occurred(&env);
- printf("The sum is %d\n", sum);
+ printf("The sum is %d\n", sum);
/* Dispose of our result value. */
- xmlrpc_DECREF(result);
+ xmlrpc_DECREF(resultP);
/* Clean up our error-handling environment. */
xmlrpc_env_clean(&env);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c Mon May 26 12:59:57 2008
@@ -2,6 +2,11 @@
#include <stdlib.h>
#include <stdio.h>
+#ifdef WIN32
+# include <windows.h>
+#else
+# include <unistd.h>
+#endif
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/server.h>
@@ -9,23 +14,38 @@
#include "config.h" /* information about this build environment */
+
+#ifdef WIN32
+ #define SLEEP(seconds) SleepEx(seconds * 1000, 1);
+#else
+ #define SLEEP(seconds) sleep(seconds);
+#endif
+
+
static xmlrpc_value *
-sample_add(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
- void * const user_data ATTR_UNUSED) {
+sample_add(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
+ void * const serverInfo ATTR_UNUSED,
+ void * const channelInfo ATTR_UNUSED) {
xmlrpc_int32 x, y, z;
/* Parse our argument array. */
- xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
- if (env->fault_occurred)
+ xmlrpc_decompose_value(envP, paramArrayP, "(ii)", &x, &y);
+ if (envP->fault_occurred)
return NULL;
/* Add our two numbers. */
z = x + y;
+ /* Sometimes, make it look hard (so client can see what it's like
+ to do an RPC that takes a while).
+ */
+ if (y == 1)
+ SLEEP(3);
+
/* Return our result. */
- return xmlrpc_build_value(env, "i", z);
+ return xmlrpc_build_value(envP, "i", z);
}
@@ -41,7 +61,8 @@
if (argc-1 != 1) {
fprintf(stderr, "You must specify 1 argument: The TCP port "
"number on which the server will accept connections "
- "for RPCs. You specified %d arguments.\n", argc-1);
+ "for RPCs (8080 is a common choice). "
+ "You specified %d arguments.\n", argc-1);
exit(1);
}
@@ -49,17 +70,17 @@
registryP = xmlrpc_registry_new(&env);
- xmlrpc_registry_add_method(
- &env, registryP, NULL, "sample.add", &sample_add, NULL);
+ xmlrpc_registry_add_method2(
+ &env, registryP, "sample.add", &sample_add, NULL, NULL, NULL);
/* In the modern form of the Abyss API, we supply parameters in memory
like a normal API. We select the modern form by setting
config_file_name to NULL:
*/
serverparm.config_file_name = NULL;
- serverparm.registryP = registryP;
- serverparm.port_number = atoi(argv[1]);
- serverparm.log_file_name = "/tmp/xmlrpc_log";
+ serverparm.registryP = registryP;
+ serverparm.port_number = atoi(argv[1]);
+ serverparm.log_file_name = "/tmp/xmlrpc_log";
printf("Running XML-RPC server...\n");
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c Mon May 26 12:59:57 2008
@@ -10,22 +10,22 @@
#include "config.h" /* information about this build environment */
static xmlrpc_value *
-sample_add(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
+sample_add(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
xmlrpc_int32 x, y, z;
/* Parse our argument array. */
- xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
- if (env->fault_occurred)
+ xmlrpc_decompose_value(envP, paramArrayP, "(ii)", &x, &y);
+ if (envP->fault_occurred)
return NULL;
/* Add our two numbers. */
z = x + y;
/* Return our result. */
- return xmlrpc_build_value(env, "i", z);
+ return xmlrpc_build_value(envP, "i", z);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c Mon May 26 12:59:57 2008
@@ -167,8 +167,8 @@
serverparm.portNum=8080;
//if this is set, we will use the authorization function
- serverparm.authfn=NULL;
- //serverparm.authfn=&handleAuthorization;
+ //serverparm.authfn=NULL;
+ serverparm.authfn=&handleAuthorization;
//set the logging level and log file
serverparm.logLevel=2;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c Mon May 26 12:59:57 2008
@@ -51,9 +51,9 @@
#include "config.h" /* information about this build environment */
-#define RETURN_IF_FAULT(env) \
+#define RETURN_IF_FAULT(envP) \
do { \
- if ((env)->fault_occurred) \
+ if ((envP)->fault_occurred) \
return NULL; \
} while (0)
@@ -65,20 +65,19 @@
static xmlrpc_value *
array_of_structs(xmlrpc_env * const envP,
- xmlrpc_value * const param_array,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
- xmlrpc_value * array;
+ xmlrpc_value * arrayP;
xmlrpc_value * retval;
- /* Parse our argument array. */
- xmlrpc_decompose_value(envP, param_array, "(A)", &array);
+ xmlrpc_decompose_value(envP, paramArrayP, "(A)", &arrayP);
if (envP->fault_occurred)
retval = NULL;
else {
/* Add up all the struct elements named "curly". */
size_t size;
- size = xmlrpc_array_size(envP, array);
+ size = xmlrpc_array_size(envP, arrayP);
if (envP->fault_occurred)
retval = NULL;
else {
@@ -86,18 +85,20 @@
unsigned int i;
sum = 0;
for (i = 0; i < size && !envP->fault_occurred; ++i) {
- xmlrpc_value * strct;
- strct = xmlrpc_array_get_item(envP, array, i);
+ xmlrpc_value * strctP;
+ strctP = xmlrpc_array_get_item(envP, arrayP, i);
if (!envP->fault_occurred) {
xmlrpc_int32 curly;
- xmlrpc_decompose_value(envP, strct, "{s:i,*}",
+ xmlrpc_decompose_value(envP, strctP, "{s:i,*}",
"curly", &curly);
if (!envP->fault_occurred)
sum += curly;
}
}
- xmlrpc_DECREF(array);
- if (!envP->fault_occurred)
+ xmlrpc_DECREF(arrayP);
+ if (envP->fault_occurred)
+ retval = NULL;
+ else
retval = xmlrpc_build_value(envP, "i", sum);
}
}
@@ -111,30 +112,31 @@
*/
static xmlrpc_value *
-count_entities(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
+count_entities(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
- const char *str;
+
+ const char * str;
size_t len, i;
xmlrpc_int32 left, right, amp, apos, quote;
- xmlrpc_decompose_value(env, param_array, "(s#)", &str, &len);
- RETURN_IF_FAULT(env);
+ xmlrpc_decompose_value(envP, paramArrayP, "(s#)", &str, &len);
+ RETURN_IF_FAULT(envP);
left = right = amp = apos = quote = 0;
- for (i = 0; i < len; i++) {
+ for (i = 0; i < len; ++i) {
switch (str[i]) {
- case '<': left++; break;
- case '>': right++; break;
- case '&': amp++; break;
- case '\'': apos++; break;
- case '\"': quote++; break;
+ case '<': ++left; break;
+ case '>': ++right; break;
+ case '&': ++amp; break;
+ case '\'': ++apos; break;
+ case '\"': ++quote; break;
default: break;
}
}
free((void*)str);
- return xmlrpc_build_value(env, "{s:i,s:i,s:i,s:i,s:i}",
+ return xmlrpc_build_value(envP, "{s:i,s:i,s:i,s:i,s:i}",
"ctLeftAngleBrackets", left,
"ctRightAngleBrackets", right,
"ctAmpersands", amp,
@@ -150,43 +152,46 @@
*/
static xmlrpc_value *
-easy_struct(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
+easy_struct(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
xmlrpc_int32 larry, moe, curly;
/* Parse our argument array and get the stooges. */
- xmlrpc_decompose_value(env, param_array, "({s:i,s:i,s:i,*})",
+ xmlrpc_decompose_value(envP, paramArrayP, "({s:i,s:i,s:i,*})",
"larry", &larry,
"moe", &moe,
"curly", &curly);
- RETURN_IF_FAULT(env);
+ RETURN_IF_FAULT(envP);
/* Return our result. */
- return xmlrpc_build_value(env, "i", larry + moe + curly);
+ return xmlrpc_build_value(envP, "i", larry + moe + curly);
}
+
/*=========================================================================
** validator1.echoStructTest
**=========================================================================
*/
static xmlrpc_value *
-echo_struct(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
+echo_struct(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
- xmlrpc_value *s;
+
+ xmlrpc_value * sP;
/* Parse our argument array. */
- xmlrpc_decompose_value(env, param_array, "(S)", &s);
- RETURN_IF_FAULT(env);
+ xmlrpc_decompose_value(envP, paramArrayP, "(S)", &sP);
+ RETURN_IF_FAULT(envP);
- return s; /* We transfer our reference on 's' to Caller */
+ return sP; /* We transfer our reference on '*sP' to Caller */
}
+
/*=========================================================================
** validator1.manyTypesTest
**=========================================================================
@@ -203,6 +208,7 @@
}
+
/*=========================================================================
** validator1.moderateSizeArrayCheck
**=========================================================================
@@ -214,7 +220,7 @@
size_t const str1_len,
const char * const str2,
size_t const str2_len,
- xmlrpc_value ** const resultP) {
+ xmlrpc_value ** const resultPP) {
/* Concatenate the two strings. */
@@ -227,8 +233,8 @@
} else {
memcpy(buffer, str1, str1_len);
memcpy(&buffer[str1_len], str2, str2_len);
- *resultP = xmlrpc_build_value(envP, "s#",
- buffer, str1_len + str2_len);
+ *resultPP = xmlrpc_build_value(envP, "s#",
+ buffer, str1_len + str2_len);
free(buffer);
}
}
@@ -236,31 +242,34 @@
static xmlrpc_value *
-moderate_array(xmlrpc_env * const envP,
- xmlrpc_value * const param_array,
+moderate_array(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
- xmlrpc_value *array, *item, *result;
- int size;
- const char * str1;
- const char * str2;
- size_t str1_len, str2_len;
xmlrpc_value * retval;
+ xmlrpc_value * arrayP;
/* Parse our argument array. */
- xmlrpc_decompose_value(envP, param_array, "(A)", &array);
+ xmlrpc_decompose_value(envP, paramArrayP, "(A)", &arrayP);
if (!envP->fault_occurred) {
- size = xmlrpc_array_size(envP, array);
+ int const size = xmlrpc_array_size(envP, arrayP);
if (!envP->fault_occurred) {
/* Get our first string. */
- item = xmlrpc_array_get_item(envP, array, 0);
+ xmlrpc_value * const firstItemP =
+ xmlrpc_array_get_item(envP, arrayP, 0);
if (!envP->fault_occurred) {
- xmlrpc_read_string_lp(envP, item, &str1_len, &str1);
+ const char * str1;
+ size_t str1_len;
+ xmlrpc_read_string_lp(envP, firstItemP, &str1_len, &str1);
if (!envP->fault_occurred) {
/* Get our last string. */
- item = xmlrpc_array_get_item(envP, array, size - 1);
+ xmlrpc_value * const lastItemP =
+ xmlrpc_array_get_item(envP, arrayP, size - 1);
if (!envP->fault_occurred) {
- xmlrpc_read_string_lp(envP, item, &str2_len, &str2);
+ const char * str2;
+ size_t str2_len;
+ xmlrpc_read_string_lp(envP, lastItemP,
+ &str2_len, &str2);
if (!envP->fault_occurred) {
concatenate(envP, str1, str1_len, str2, str2_len,
&retval);
@@ -271,12 +280,13 @@
}
}
}
- xmlrpc_DECREF(array);
+ xmlrpc_DECREF(arrayP);
}
- return result;
+ return retval;
}
+
/*=========================================================================
** validator1.nestedStructTest
**=========================================================================
@@ -284,15 +294,17 @@
static xmlrpc_value *
nested_struct(xmlrpc_env * const envP,
- xmlrpc_value * const param_array,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
xmlrpc_value * yearsP;
xmlrpc_value * retval;
/* Parse our argument array. */
- xmlrpc_decompose_value(envP, param_array, "(S)", &yearsP);
- if (!envP->fault_occurred) {
+ xmlrpc_decompose_value(envP, paramArrayP, "(S)", &yearsP);
+ if (envP->fault_occurred)
+ retval = NULL;
+ else {
/* Get values of larry, moe and curly for 2000-04-01. */
xmlrpc_int32 larry, moe, curly;
xmlrpc_decompose_value(envP, yearsP,
@@ -301,36 +313,41 @@
"larry", &larry,
"moe", &moe,
"curly", &curly);
- if (!envP->fault_occurred)
+ if (envP->fault_occurred)
+ retval = NULL;
+ else
retval = xmlrpc_build_value(envP, "i", larry + moe + curly);
+
xmlrpc_DECREF(yearsP);
}
return retval;
}
+
/*=========================================================================
** validator1.simpleStructReturnTest
**=========================================================================
*/
static xmlrpc_value *
-struct_return(xmlrpc_env * const env,
- xmlrpc_value * const param_array,
+struct_return(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
void * const user_data ATTR_UNUSED) {
xmlrpc_int32 i;
- xmlrpc_decompose_value(env, param_array, "(i)", &i);
- RETURN_IF_FAULT(env);
+ xmlrpc_decompose_value(envP, paramArrayP, "(i)", &i);
+ RETURN_IF_FAULT(envP);
- return xmlrpc_build_value(env, "{s:i,s:i,s:i}",
+ return xmlrpc_build_value(envP, "{s:i,s:i,s:i}",
"times10", (xmlrpc_int32) i * 10,
"times100", (xmlrpc_int32) i * 100,
"times1000", (xmlrpc_int32) i * 1000);
}
+
/*=========================================================================
** main
**=========================================================================
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/Makefile Mon May 26 12:59:57 2008
@@ -1,60 +1,146 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ SRCDIR := $(call updir,$(CURDIR))
+ BLDDIR := $(SRCDIR)
endif
-SUBDIR = src
-BUILDDIR = $(SRCDIR)
-VPATH = .:$(SRCDIR)
+SUBDIR := include
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
+
+default: all
+
+all: xmlrpc-c/config.h
+
+xmlrpc-c/config.h: $(BLDDIR)/$(SUBDIR)/xmlrpc-c
+ >$@
+ @echo "Lots of echoes to '$@' suppressed here ..."
+ @echo '#ifndef XMLRPC_C_CONFIG_H_INCLUDED' >>$@
+ @echo '#define XMLRPC_C_CONFIG_H_INCLUDED' >>$@
+ @echo '' >>$@
+ @echo '/* This file, part of XML-RPC For C/C++, is meant to ' >>$@
+ @echo ' define characteristics of this particular installation '>>$@
+ @echo ' that the other <xmlrpc-c/...> header files need in ' >>$@
+ @echo ' order to compile correctly when #included in Xmlrpc-c' >>$@
+ @echo ' user code.' >>$@
+ @echo '' >>$@
+ @echo ' Those header files #include this one.' >>$@
+ @echo '' >>$@
+ @echo ' This file was created by a make rule.' >>$@
+ @echo '*/' >>$@
+ @echo '#define XMLRPC_HAVE_WCHAR $(HAVE_WCHAR_H_DEFINE)' >>$@
+ @echo '#ifdef WIN32' >>$@
+ @echo ' /* SOCKET is a type defined by <winsock.h>. Anyone who' >>$@
+ @echo ' uses XMLRPC_SOCKET on a WIN32 system must #include' >>$@
+ @echo ' <winsock.h>' >>$@
+ @echo ' */' >>$@
+ @echo ' #define XMLRPC_SOCKET SOCKET' >>$@
+ @echo ' #define XMLRPC_HAVE_TIMEVAL 0' >>$@
+ @echo ' #define XMLRPC_HAVE_TIMESPEC 0' >>$@
+ @echo '#else' >>$@
+ @echo ' #define XMLRPC_SOCKET int' >>$@
+ @echo ' #define XMLRPC_HAVE_TIMEVAL 1' >>$@
+ @echo ' #define XMLRPC_HAVE_TIMESPEC 1' >>$@
+ @echo '#endif' >>$@
+ @echo '' >>$@
+ @echo '#if defined(_MSC_VER)' >>$@
+ @echo ' /* Newer MSVC has long long, but MSVC 6 does not */' >>$@
+ @echo ' #define XMLRPC_INT64 __int64' >>$@
+ @echo ' #define XMLRPC_INT32 __int32' >>$@
+ @echo '#else' >>$@
+ @echo ' #define XMLRPC_INT64 long long' >>$@
+ @echo ' #define XMLRPC_INT32 int' >>$@
+ @echo '#endif' >>$@
+ @echo '#endif' >>$@
+
+$(BLDDIR)/$(SUBDIR)/xmlrpc-c:
+ mkdir $@
+
+COMPAT_LINK_CMDS = \
+ $(LN_S) xmlrpc-c/oldxmlrpc.h xmlrpc.h; \
+ $(LN_S) xmlrpc-c/server.h xmlrpc_server.h; \
+ $(LN_S) xmlrpc-c/server_abyss.h xmlrpc_server_abyss.h; \
+ $(LN_S) xmlrpc-c/server_w32httpsys.h xmlrpc_server_w32httpsys.h; \
HEADERS_TO_INSTALL = \
- xmlrpc-c/oldxmlrpc.h \
+ xmlrpc-c/config.h \
+ xmlrpc-c/inttypes.h \
+ xmlrpc-c/c_util.h \
+ xmlrpc-c/util.h \
xmlrpc-c/base.h \
xmlrpc-c/abyss.h \
+ xmlrpc-c/abyss_unixsock.h \
+ xmlrpc-c/abyss_winsock.h \
xmlrpc-c/server.h \
xmlrpc-c/server_abyss.h \
xmlrpc-c/server_w32httpsys.h \
+ xmlrpc-c/oldxmlrpc.h \
ifeq ($(ENABLE_CPLUSPLUS),yes)
HEADERS_TO_INSTALL += \
xmlrpc-c/oldcppwrapper.hpp \
+ xmlrpc-c/girerr.hpp \
+ xmlrpc-c/girmem.hpp \
xmlrpc-c/base.hpp \
xmlrpc-c/timeout.hpp \
xmlrpc-c/xml.hpp \
xmlrpc-c/registry.hpp \
- xmlrpc-c/server_abyss.hpp\
- xmlrpc-c/girerr.hpp\
- xmlrpc-c/girmem.hpp\
+ xmlrpc-c/server_abyss.hpp \
+ xmlrpc-c/packetsocket.hpp \
+ xmlrpc-c/server_pstream.hpp \
+ COMPAT_LINK_CMDS += $(LN_S) xmlrpc-c/oldcppwrapper.hpp XmlRpcCpp.h;
endif
-
-
HEADERINST_PREFIX = /xmlrpc-c
ifeq ($(MUST_BUILD_CLIENT),yes)
HEADERS_TO_INSTALL += \
xmlrpc-c/client.h \
xmlrpc-c/transport.h \
+ xmlrpc-c/client_global.h \
+
+ COMPAT_LINK_CMDS += $(LN_S) xmlrpc-c/client.h xmlrpc_client.h;
ifeq ($(ENABLE_CPLUSPLUS),yes)
- HEADERS_TO_INSTALL += xmlrpc-c/client.hpp xmlrpc-c/client_simple.hpp
+ HEADERS_TO_INSTALL += \
+ xmlrpc-c/client.hpp \
+ xmlrpc-c/client_transport.hpp \
+ xmlrpc-c/client_simple.hpp \
+
endif
endif
ifeq ($(ENABLE_CGI_SERVER),yes)
HEADERS_TO_INSTALL += xmlrpc-c/server_cgi.h
+ COMPAT_LINK_CMDS += $(LN_S) xmlrpc-c/server_cgi.h xmlrpc_cgi.h;
endif
default: all
all:
+.PHONY: install-compat-hdr
+install-compat-hdr:
+# Install old names of header files for backward compatibility
+ cd $(DESTDIR)$(HEADERINST_DIR); \
+ rm -f xmlrpc.h xmlrpc_client.h xmlrpc_server.h xmlrpc_cgi.h \
+ xmlrpc_server_abyss.h xmlrpc_server_w32httpsys.h \
+ XmlRpcCpp.h; \
+ $(COMPAT_LINK_CMDS)
+
.PHONY: install
-install: install-common
+install: install-common install-compat-hdr
.PHONY: clean distclean dep
clean:
distclean:
+ rm -f xmlrpc-c/config.h
+
+.PHONY: check
+check:
+
+.PHONY: dep
dep:
-include $(SRCDIR)/Makefile.common
+OMIT_CONFIG_H_RULE = Y
+
+include $(SRCDIR)/common.mk
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/abyss.h Mon May 26 12:59:57 2008
@@ -11,711 +11,504 @@
Copyright information is at the end of the file.
****************************************************************************/
-#ifndef _ABYSS_H_
-#define _ABYSS_H_
+#ifndef XMLRPC_ABYSS_H_INCLUDED
+#define XMLRPC_ABYSS_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
-#ifdef ABYSS_WIN32
-#include "xmlrpc_config.h"
-#else
-#include <inttypes.h>
-#endif
-/*********************************************************************
-** Paths and so on...
-*********************************************************************/
-
-#ifdef ABYSS_WIN32
-#define DEFAULT_ROOT "c:\\abyss"
-#define DEFAULT_DOCS DEFAULT_ROOT"\\htdocs"
-#define DEFAULT_CONF_FILE DEFAULT_ROOT"\\conf\\abyss.conf"
-#define DEFAULT_LOG_FILE DEFAULT_ROOT"\\log\\abyss.log"
-#else
-#ifdef __rtems__
-#define DEFAULT_ROOT "/abyss"
-#else
-#define DEFAULT_ROOT "/usr/local/abyss"
-#endif
-#define DEFAULT_DOCS DEFAULT_ROOT"/htdocs"
-#define DEFAULT_CONF_FILE DEFAULT_ROOT"/conf/abyss.conf"
-#define DEFAULT_LOG_FILE DEFAULT_ROOT"/log/abyss.log"
-#endif
-
-/*********************************************************************
-** Maximum numer of simultaneous connections
-*********************************************************************/
-
-#define MAX_CONN 4000
-
-/*********************************************************************
-** Server Info Definitions
-*********************************************************************/
-
-#define SERVER_VERSION "0.3"
-#define SERVER_HVERSION "ABYSS/0.3"
-#define SERVER_HTML_INFO \
- "<p><HR><b><i><a href=\"http:\057\057abyss.linuxave.net\">" \
- "ABYSS Web Server</a></i></b> version "SERVER_VERSION"<br>" \
- "© <a href=\"mailto:mmoez@bigfoot.com\">Moez Mahfoudh</a> - 2000</p>"
-#define SERVER_PLAIN_INFO \
- CRLF "----------------------------------------" \
- "----------------------------------------" \
- CRLF "ABYSS Web Server version "SERVER_VERSION CRLF"(C) Moez Mahfoudh - 2000"
-
-/*********************************************************************
-** General purpose definitions
-*********************************************************************/
-
-#ifdef ABYSS_WIN32
-#define strcasecmp(a,b) stricmp((a),(b))
-#else
-#define ioctlsocket(a,b,c) ioctl((a),(b),(c))
-#endif /* ABYSS_WIN32 */
-
-#ifndef NULL
-#define NULL ((void *)0)
-#endif /* NULL */
+#include <sys/types.h>
-#ifndef TRUE
-#define TRUE 1
-#endif /* TRUE */
+#include <xmlrpc-c/inttypes.h>
-#ifndef FALSE
-#define FALSE 0
-#endif /* FALSE */
-
-#ifdef ABYSS_WIN32
-#define LBR "\n"
-#else
-#define LBR "\n"
-#endif /* ABYSS_WIN32 */
+/****************************************************************************
+ STUFF FOR THE OUTER CONTROL PROGRAM TO USE
+****************************************************************************/
typedef int abyss_bool;
-/*********************************************************************
-** Buffer
-*********************************************************************/
-
-typedef struct
-{
- void *data;
- uint32_t size;
- uint32_t staticid;
-} TBuffer;
-
-abyss_bool BufferAlloc(TBuffer *buf,uint32_t memsize);
-abyss_bool BufferRealloc(TBuffer *buf,uint32_t memsize);
-void BufferFree(TBuffer *buf);
-
-
-/*********************************************************************
-** String
-*********************************************************************/
+/****************************************************************************
+ GLOBAL (STATIC) PROGRAM STUFF
+****************************************************************************/
-typedef struct
-{
- TBuffer buffer;
- uint32_t size;
-} TString;
-
-abyss_bool StringAlloc(TString *s);
-abyss_bool StringConcat(TString *s,char *s2);
-abyss_bool StringBlockConcat(TString *s,char *s2,char **ref);
-void StringFree(TString *s);
-char *StringData(TString *s);
+void
+AbyssInit(const char ** const errorP);
+void
+AbyssTerm(void);
/*********************************************************************
-** List
+** MIMEType
*********************************************************************/
-typedef struct {
- void **item;
- uint16_t size;
- uint16_t maxsize;
- abyss_bool autofree;
-} TList;
+typedef struct MIMEType MIMEType;
-void
-ListInit(TList * const listP);
+MIMEType *
+MIMETypeCreate(void);
void
-ListInitAutoFree(TList * const listP);
+MIMETypeDestroy(MIMEType * const MIMETypeP);
void
-ListFree(TList * const listP);
+MIMETypeInit(void);
void
-ListFreeItems(TList * const listP);
+MIMETypeTerm(void);
abyss_bool
-ListAdd(TList * const listP,
- void * const str);
-
-void
-ListRemove(TList * const listP);
-
-abyss_bool
-ListAddFromString(TList * const listP,
- char * const c);
+MIMETypeAdd2(MIMEType * const MIMETypeP,
+ const char * const type,
+ const char * const ext);
abyss_bool
-ListFindString(TList * const listP,
- char * const str,
- uint16_t * const indexP);
+MIMETypeAdd(const char * const type,
+ const char * const ext);
-/*********************************************************************
-** Table
-*********************************************************************/
-
-typedef struct
-{
- char *name,*value;
- uint16_t hash;
-} TTableItem;
-
-typedef struct
-{
- TTableItem *item;
- uint16_t size,maxsize;
-} TTable;
-
-void TableInit(TTable *t);
-void TableFree(TTable *t);
-abyss_bool TableAdd(TTable *t,char *name,char *value);
-abyss_bool TableAddReplace(TTable *t,char *name,char *value);
-abyss_bool TableFindIndex(TTable *t,char *name,uint16_t *index);
-char *TableFind(TTable *t,char *name);
+enum abyss_foreback {ABYSS_FOREGROUND, ABYSS_BACKGROUND};
+#define HAVE_CHANSWITCH
-/*********************************************************************
-** Thread
-*********************************************************************/
+typedef struct _TChanSwitch TChanSwitch;
+typedef struct _TChannel TChannel;
+typedef struct _TSocket TSocket;
-#ifdef ABYSS_WIN32
-#include <windows.h>
-#define THREAD_ENTRYTYPE WINAPI
-#else
-#define THREAD_ENTRYTYPE
-#include <pthread.h>
-#endif /* ABYSS_WIN32 */
-
-typedef uint32_t (THREAD_ENTRYTYPE *TThreadProc)(void *);
-#ifdef ABYSS_WIN32
-typedef HANDLE TThread;
+#ifdef WIN32
+ #include <xmlrpc-c/abyss_winsock.h>
#else
-typedef pthread_t TThread;
-typedef void* (*PTHREAD_START_ROUTINE)(void *);
-#endif /* ABYSS_WIN32 */
-
-abyss_bool ThreadCreate(TThread *t,TThreadProc func,void *arg);
-abyss_bool ThreadRun(TThread *t);
-abyss_bool ThreadStop(TThread *t);
-abyss_bool ThreadKill(TThread *t);
-void ThreadWait(uint32_t ms);
-void ThreadExit( TThread *t, int ret_value );
-void ThreadClose( TThread *t );
+ #include <xmlrpc-c/abyss_unixsock.h>
+#endif
-/*********************************************************************
-** Mutex
-*********************************************************************/
+void
+ChanSwitchInit(const char ** const errorP);
-#ifdef ABYSS_WIN32
-typedef HANDLE TMutex;
-#else
-typedef pthread_mutex_t TMutex;
-#endif /* ABYSS_WIN32 */
+void
+ChanSwitchTerm(void);
-abyss_bool MutexCreate(TMutex *m);
-abyss_bool MutexLock(TMutex *m);
-abyss_bool MutexUnlock(TMutex *m);
-abyss_bool MutexTryLock(TMutex *m);
-void MutexFree(TMutex *m);
+/* If you're wondering where the constructors for TChanSwitch,
+ TChannel, and TSocket are: They're implementation-specific, so look
+ in abyss_unixsock.h, etc.
+*/
+void
+ChanSwitchDestroy(TChanSwitch * const chanSwitchP);
-/*********************************************************************
-** Pool
-*********************************************************************/
+void
+ChannelInit(const char ** const errorP);
-typedef struct _TPoolZone
-{
- char *pos,*maxpos;
- struct _TPoolZone *next,*prev;
-/* char data[0]; */
- char data[1];
-} TPoolZone;
-
-typedef struct
-{
- TPoolZone *firstzone,*currentzone;
- uint32_t zonesize;
- TMutex mutex;
-} TPool;
+void
+ChannelTerm(void);
-abyss_bool PoolCreate(TPool *p,uint32_t zonesize);
-void PoolFree(TPool *p);
+void
+ChannelDestroy(TChannel * const channelP);
-void *PoolAlloc(TPool *p,uint32_t size);
-char *PoolStrdup(TPool *p,char *s);
+void
+SocketDestroy(TSocket * const socketP);
-/*********************************************************************
-** Socket
-*********************************************************************/
+typedef struct {
+ /* Before Xmlrpc-c 1.04, the internal server representation,
+ struct _TServer, was exposed to users and was the only way to
+ set certain parameters of the server. Now, use the (new)
+ ServerSet...() functions. Use the HAVE_ macros to determine
+ which method you have to use.
+ */
+ struct _TServer * srvP;
+} TServer;
-#ifdef ABYSS_WIN32
-#include <winsock.h>
-#else
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <netinet/tcp.h>
-#include <netdb.h>
-#include <arpa/inet.h>
-#include <errno.h>
-#include <unistd.h>
+typedef struct _TSession TSession;
-#ifdef HAVE_SYS_FILIO_H
-#include <sys/filio.h>
-#endif
-#ifdef HAVE_SYS_IOCTL_H
-#include <sys/ioctl.h>
-#endif
-
-#endif /* ABYSS_WIN32 */
+abyss_bool
+ServerCreate(TServer * const serverP,
+ const char * const name,
+ xmlrpc_uint16_t const port,
+ const char * const filespath,
+ const char * const logfilename);
-#define TIME_INFINITE 0xffffffff
+void
+ServerCreateSwitch(TServer * const serverP,
+ TChanSwitch * const chanSwitchP,
+ const char ** const errorP);
-#ifdef ABYSS_WIN32
-typedef SOCKET TSocket;
-#else
-typedef uint32_t TSocket;
-#endif /* ABYSS_WIN32 */
+abyss_bool
+ServerCreateSocket(TServer * const serverP,
+ const char * const name,
+ TOsSocket const socketFd,
+ const char * const filespath,
+ const char * const logfilename);
-typedef struct in_addr TIPAddr;
+#define HAVE_SERVER_CREATE_SOCKET_2
+void
+ServerCreateSocket2(TServer * const serverP,
+ TSocket * const socketP,
+ const char ** const errorP);
-#define IPB1(x) (((unsigned char *)(&x))[0])
-#define IPB2(x) (((unsigned char *)(&x))[1])
-#define IPB3(x) (((unsigned char *)(&x))[2])
-#define IPB4(x) (((unsigned char *)(&x))[3])
+abyss_bool
+ServerCreateNoAccept(TServer * const serverP,
+ const char * const name,
+ const char * const filespath,
+ const char * const logfilename);
-abyss_bool SocketInit(void);
+void
+ServerFree(TServer * const serverP);
-abyss_bool SocketCreate(TSocket *s);
-abyss_bool SocketClose(TSocket *s);
+void
+ServerSetName(TServer * const serverP,
+ const char * const name);
-int SocketWrite(TSocket *s, char *buffer, uint32_t len);
-uint32_t SocketRead(TSocket *s, char *buffer, uint32_t len);
-uint32_t SocketPeek(TSocket *s, char *buffer, uint32_t len);
+void
+ServerSetFilesPath(TServer * const serverP,
+ const char * const filesPath);
-abyss_bool SocketConnect(TSocket *s, TIPAddr *addr, uint16_t port);
-abyss_bool SocketBind(TSocket *s, TIPAddr *addr, uint16_t port);
+void
+ServerSetLogFileName(TServer * const serverP,
+ const char * const logFileName);
-abyss_bool SocketListen(TSocket *s, uint32_t backlog);
-abyss_bool SocketAccept(TSocket *s, TSocket *ns,TIPAddr *ip);
+#define HAVE_SERVER_SET_KEEPALIVE_TIMEOUT 1
+void
+ServerSetKeepaliveTimeout(TServer * const serverP,
+ xmlrpc_uint32_t const keepaliveTimeout);
-uint32_t SocketError(void);
+#define HAVE_SERVER_SET_KEEPALIVE_MAX_CONN 1
+void
+ServerSetKeepaliveMaxConn(TServer * const serverP,
+ xmlrpc_uint32_t const keepaliveMaxConn);
-uint32_t SocketWait(TSocket *s,abyss_bool rd,abyss_bool wr,uint32_t timems);
+#define HAVE_SERVER_SET_TIMEOUT 1
+void
+ServerSetTimeout(TServer * const serverP,
+ xmlrpc_uint32_t const timeout);
-abyss_bool SocketBlocking(TSocket *s, abyss_bool b);
-uint32_t SocketAvailableReadBytes(TSocket *s);
+#define HAVE_SERVER_SET_ADVERTISE 1
+void
+ServerSetAdvertise(TServer * const serverP,
+ abyss_bool const advertise);
+#define HAVE_SERVER_SET_MIME_TYPE 1
+void
+ServerSetMimeType(TServer * const serverP,
+ MIMEType * const MIMETypeP);
-/*********************************************************************
-** File
-*********************************************************************/
+void
+ServerInit(TServer * const serverP);
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <limits.h>
+void
+ServerRun(TServer * const serverP);
-#ifndef NAME_MAX
-#define NAME_MAX 1024
-#endif
+void
+ServerRunOnce(TServer * const serverP);
-#ifdef ABYSS_WIN32
-#ifndef __BORLANDC__
-#define O_APPEND _O_APPEND
-#define O_CREAT _O_CREAT
-#define O_EXCL _O_EXCL
-#define O_RDONLY _O_RDONLY
-#define O_RDWR _O_RDWR
-#define O_TRUNC _O_TRUNC
-#define O_WRONLY _O_WRONLY
-#define O_TEXT _O_TEXT
-#define O_BINARY _O_BINARY
-#endif
+/* ServerRunOnce2() is obsolete. See user's guide. */
+void
+ServerRunOnce2(TServer * const serverP,
+ enum abyss_foreback const foregroundBackground);
-#define A_HIDDEN _A_HIDDEN
-#define A_NORMAL _A_NORMAL
-#define A_RDONLY _A_RDONLY
-#define A_SUBDIR _A_SUBDIR
-#else
-#define A_SUBDIR 1
-#define O_BINARY 0
-#define O_TEXT 0
-#endif /* ABYSS_WIN32 */
-
-#ifdef ABYSS_WIN32
-
-#ifndef __BORLANDC__
-typedef struct _stati64 TFileStat;
-typedef struct _finddata_t TFileInfo;
-typedef long TFileFind;
+void
+ServerRunChannel(TServer * const serverP,
+ TChannel * const channelP,
+ void * const channelInfoP,
+ const char ** const errorP);
-#else
+#define HAVE_SERVER_RUN_CONN_2
+void
+ServerRunConn2(TServer * const serverP,
+ TSocket * const connectedSocketP,
+ const char ** const errorP);
-typedef struct stat TFileStat;
-typedef struct finddata_t
-{
- char name[NAME_MAX+1];
- int attrib;
- uint64_t size;
- time_t time_write;
- WIN32_FIND_DATA data;
-} TFileInfo;
-typedef HANDLE TFileFind;
-#endif
+void
+ServerRunConn(TServer * const serverP,
+ TOsSocket const connectedSocket);
-#else
+void
+ServerDaemonize(TServer * const serverP);
-#include <unistd.h>
-#include <dirent.h>
+void
+ServerTerminate(TServer * const serverP);
-typedef struct stat TFileStat;
+void
+ServerResetTerminate(TServer * const serverP);
-typedef struct finddata_t
-{
- char name[NAME_MAX+1];
- int attrib;
- uint64_t size;
- time_t time_write;
-} TFileInfo;
-
-typedef struct
-{
- char path[NAME_MAX+1];
- DIR *handle;
-} TFileFind;
+void
+ServerUseSigchld(TServer * const serverP);
+#ifndef WIN32
+void
+ServerHandleSigchld(pid_t const pid);
#endif
-typedef int TFile;
-
-abyss_bool FileOpen(TFile *f, const char *name,uint32_t attrib);
-abyss_bool FileOpenCreate(TFile *f, const char *name, uint32_t attrib);
-abyss_bool FileClose(TFile *f);
+typedef abyss_bool (*URIHandler) (TSession *); /* deprecated */
-abyss_bool FileWrite(TFile *f, void *buffer, uint32_t len);
-int32_t FileRead(TFile *f, void *buffer, uint32_t len);
+struct URIHandler2;
-abyss_bool FileSeek(TFile *f, uint64_t pos, uint32_t attrib);
-uint64_t FileSize(TFile *f);
+typedef void (*initHandlerFn)(struct URIHandler2 *,
+ abyss_bool *);
-abyss_bool FileStat(char *filename,TFileStat *filestat);
+typedef void (*termHandlerFn)(void *);
-abyss_bool FileFindFirst(TFileFind *filefind,char *path,TFileInfo *fileinfo);
-abyss_bool FileFindNext(TFileFind *filefind,TFileInfo *fileinfo);
-void FileFindClose(TFileFind *filefind);
+typedef void (*handleReq2Fn)(struct URIHandler2 *,
+ TSession *,
+ abyss_bool *);
-/*********************************************************************
-** Server (1/2)
-*********************************************************************/
+typedef struct URIHandler2 {
+ initHandlerFn init;
+ termHandlerFn term;
+ handleReq2Fn handleReq2;
+ URIHandler handleReq1; /* deprecated */
+ void * userdata;
+} URIHandler2;
-typedef struct _TServer
-{
- TSocket listensock;
- TFile logfile;
- TMutex logmutex;
- char *name;
- char *filespath;
- uint16_t port;
- uint32_t keepalivetimeout,keepalivemaxconn,timeout;
- TList handlers;
- TList defaultfilenames;
- void *defaulthandler;
- abyss_bool advertise;
-#ifndef _WIN32
- uid_t uid;
- gid_t gid;
- TFile pidfile;
-#endif
- int running;
-} TServer;
+void
+ServerAddHandler2(TServer * const srvP,
+ URIHandler2 * const handlerP,
+ abyss_bool * const successP);
+abyss_bool
+ServerAddHandler(TServer * const srvP,
+ URIHandler const handler);
-/*********************************************************************
-** Conn
-*********************************************************************/
+typedef abyss_bool (*THandlerDflt) (TSession *);
-#define BUFFER_SIZE 4096
+/* Note: 'handler' used to be URIHandler; THandlerDflt is a newer name
+ for the same type
+*/
-typedef struct _TConn
-{
- TServer *server;
- uint32_t buffersize,bufferpos;
- uint32_t inbytes,outbytes;
- TSocket socket;
- TIPAddr peerip;
- abyss_bool hasOwnThread;
- TThread thread;
- abyss_bool connected;
- abyss_bool inUse;
- const char * trace;
- void (*job)(struct _TConn *);
- char buffer[BUFFER_SIZE];
-} TConn;
+void
+ServerDefaultHandler(TServer * const srvP,
+ THandlerDflt const handler);
-TConn *ConnAlloc(void);
-void ConnFree(TConn *c);
+/* ConfReadServerFile() is inappropriately named; it was a mistake.
+ But then, so is having this function at all. The config file is
+ inappropriate for an API.
+*/
-enum abyss_foreback {ABYSS_FOREGROUND, ABYSS_BACKGROUND};
+abyss_bool
+ConfReadServerFile(const char * const filename,
+ TServer * const srvP);
-abyss_bool ConnCreate(TConn *c, TSocket *s, void (*func)(TConn *));
-abyss_bool ConnCreate2(TConn * const connectionP,
- TServer * const serverP,
- TSocket const connectedSocket,
- TIPAddr const peerIpAddr,
- void ( * func)(TConn *),
- enum abyss_foreback const foregroundBackground);
-abyss_bool ConnProcess(TConn *c);
-abyss_bool ConnKill(TConn *c);
-void ConnClose(TConn *c);
-
-abyss_bool ConnWrite(TConn *c,void *buffer,uint32_t size);
-abyss_bool ConnRead(TConn *c, uint32_t timems);
-void ConnReadInit(TConn *c);
-abyss_bool ConnReadLine(TConn *c,char **z,uint32_t timems);
+void
+LogWrite(TServer * const srvP,
+ const char * const c);
-abyss_bool ConnWriteFromFile(TConn *c,TFile *file,uint64_t start,uint64_t end,
- void *buffer,uint32_t buffersize,uint32_t rate);
+/****************************************************************************
+ STUFF FOR HTTP REQUEST HANDLERS TO USE
+****************************************************************************/
+typedef enum {
+ m_unknown, m_get, m_put, m_head, m_post, m_delete, m_trace, m_options
+} TMethod;
-/*********************************************************************
-** Range
-*********************************************************************/
+typedef struct {
+ TMethod method;
+ const char * uri;
+ /* This is NOT the URI. It is the pathname part of the URI.
+ We really should fix that and put the pathname in another
+ member. If the URI does not contain a pathname, this is "*".
+ */
+ const char * query;
+ /* The query part of the URI (stuff after '?'). NULL if none. */
+ const char * host;
+ /* NOT the value of the host: header. Rather, the name of the
+ target host (could be part of the host: value; could be from the
+ URI). No port number. NULL if request does not specify a host
+ name.
+ */
+ const char * from;
+ const char * useragent;
+ const char * referer;
+ const char * requestline;
+ const char * user;
+ /* Requesting user (from authorization: header). NULL if
+ request doesn't specify or handler has not authenticated it.
+ */
+ xmlrpc_uint16_t port;
+ /* The port number from the URI, or default 80 if the URI doesn't
+ specify a port.
+ */
+ abyss_bool keepalive;
+} TRequestInfo;
-abyss_bool RangeDecode(char *str,uint64_t filesize,uint64_t *start,uint64_t *end);
+abyss_bool
+SessionRefillBuffer(TSession * const sessionP);
-/*********************************************************************
-** Date
-*********************************************************************/
+size_t
+SessionReadDataAvail(TSession * const sessionP);
-#include <time.h>
+void
+SessionGetReadData(TSession * const sessionP,
+ size_t const max,
+ const char ** const outStartP,
+ size_t * const outLenP);
-typedef struct tm TDate;
+void
+SessionGetRequestInfo(TSession * const sessionP,
+ const TRequestInfo ** const requestInfoPP);
-abyss_bool DateToString(TDate *tm,char *s);
-abyss_bool DateToLogString(TDate *tm,char *s);
+void
+SessionGetChannelInfo(TSession * const sessionP,
+ void ** const channelInfoPP);
-abyss_bool DateDecode(char *s,TDate *tm);
+void *
+SessionGetDefaultHandlerCtx(TSession * const sessionP);
-int32_t DateCompare(TDate *d1,TDate *d2);
+char *
+RequestHeaderValue(TSession * const sessionP,
+ const char * const name);
-abyss_bool DateFromGMT(TDate *d,time_t t);
-abyss_bool DateFromLocal(TDate *d,time_t t);
+abyss_bool
+ResponseAddField(TSession * const sessionP,
+ const char * const name,
+ const char * const value);
-abyss_bool DateInit(void);
+void
+ResponseWriteStart(TSession * const sessionP);
-/*********************************************************************
-** Base64
-*********************************************************************/
+/* For backward compatibility: */
+#define ResponseWrite ResponseWriteStart
-void Base64Encode(char *s,char *d);
+abyss_bool
+ResponseWriteBody(TSession * const sessionP,
+ const char * const data,
+ xmlrpc_uint32_t const len);
-/*********************************************************************
-** Session
-*********************************************************************/
+abyss_bool
+ResponseWriteEnd(TSession * const sessionP);
-typedef enum
-{
- m_unknown,m_get,m_put,m_head,m_post,m_delete,m_trace,m_options
-} TMethod;
+abyss_bool
+ResponseChunked(TSession * const sessionP);
-typedef struct
-{
- TMethod method;
- uint32_t nbfileds;
- char *uri;
- char *query;
- char *host;
- char *from;
- char *useragent;
- char *referer;
- char *requestline;
- char *user;
- uint16_t port;
- TList cookies;
- TList ranges;
-
- uint16_t status;
- TString header;
-
- abyss_bool keepalive,cankeepalive;
- abyss_bool done;
-
- TServer *server;
- TConn *conn;
+xmlrpc_uint16_t
+ResponseStatusFromErrno(int const errnoArg);
- uint8_t versionminor,versionmajor;
+void
+ResponseStatus(TSession * const sessionP,
+ xmlrpc_uint16_t const code);
- TTable request_headers,response_headers;
+void
+ResponseStatusErrno(TSession * const sessionP);
- TDate date;
+abyss_bool
+ResponseContentType(TSession * const serverP,
+ const char * const type);
- abyss_bool chunkedwrite,chunkedwritemode;
-} TSession;
+abyss_bool
+ResponseContentLength(TSession * const sessionP,
+ xmlrpc_uint64_t const len);
-/*********************************************************************
-** Request
-*********************************************************************/
+void
+ResponseError2(TSession * const sessionP,
+ const char * const explanation);
-#define CR '\r'
-#define LF '\n'
-#define CRLF "\r\n"
+void
+ResponseError(TSession * const sessionP);
-abyss_bool RequestValidURI(TSession *r);
-abyss_bool RequestValidURIPath(TSession *r);
-abyss_bool RequestUnescapeURI(TSession *r);
+const char *
+MIMETypeFromExt(const char * const ext);
-char *RequestHeaderValue(TSession *r,char *name);
+const char *
+MIMETypeFromExt2(MIMEType * const MIMETypeP,
+ const char * const ext);
-abyss_bool RequestRead(TSession *r);
-void RequestInit(TSession *r,TConn *c);
-void RequestFree(TSession *r);
+const char *
+MIMETypeFromFileName2(MIMEType * const MIMETypeP,
+ const char * const fileName);
-abyss_bool RequestAuth(TSession *r,char *credential,char *user,char *pass);
+const char *
+MIMETypeFromFileName(const char * const fileName);
-/*********************************************************************
-** Response
-*********************************************************************/
+const char *
+MIMETypeGuessFromFile2(MIMEType * const MIMETypeP,
+ const char * const fileName);
-abyss_bool ResponseAddField(TSession *r,char *name,char *value);
-void ResponseWrite(TSession *r);
+const char *
+MIMETypeGuessFromFile(const char * const filename);
-abyss_bool ResponseChunked(TSession *s);
-void ResponseStatus(TSession *r,uint16_t code);
-void ResponseStatusErrno(TSession *r);
+/****************************************************************************
+ STUFF THAT PROBABLY DOESN'T BELONG IN THIS FILE BECAUSE IT IS INTERNAL
-abyss_bool ResponseContentType(TSession *r,char *type);
-abyss_bool ResponseContentLength(TSession *r,uint64_t len);
+ Some day, we sort this out.
+****************************************************************************/
-void ResponseError(TSession *r);
+#define CR '\r'
+#define LF '\n'
+#define CRLF "\r\n"
/*********************************************************************
-** HTTP
+** Paths and so on...
*********************************************************************/
-char *HTTPReasonByStatus(uint16_t status);
-
-int32_t HTTPRead(TSession *s,char *buffer,uint32_t len);
-
-abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len);
-abyss_bool HTTPWriteEnd(TSession *s);
+#ifdef WIN32
+#define DEFAULT_ROOT "c:\\abyss"
+#define DEFAULT_DOCS DEFAULT_ROOT"\\htdocs"
+#define DEFAULT_CONF_FILE DEFAULT_ROOT"\\conf\\abyss.conf"
+#define DEFAULT_LOG_FILE DEFAULT_ROOT"\\log\\abyss.log"
+#else
+#ifdef __rtems__
+#define DEFAULT_ROOT "/abyss"
+#else
+#define DEFAULT_ROOT "/usr/local/abyss"
+#endif
+#define DEFAULT_DOCS DEFAULT_ROOT"/htdocs"
+#define DEFAULT_CONF_FILE DEFAULT_ROOT"/conf/abyss.conf"
+#define DEFAULT_LOG_FILE DEFAULT_ROOT"/log/abyss.log"
+#endif
/*********************************************************************
-** Server (2/2)
+** Maximum number of simultaneous connections
*********************************************************************/
-abyss_bool ServerCreate(TServer *srv,
- const char *name,
- uint16_t port,
- const char *filespath,
- const char *logfilename);
-
-void ServerFree(TServer *srv);
-
-int ServerInit(TServer *srv);
-void ServerRun(TServer *srv);
-void ServerRunOnce(TServer *srv);
-void ServerRunOnce2(TServer * const srv,
- enum abyss_foreback const foregroundBackground);
-
-typedef abyss_bool (*URIHandler) (TSession *); /* deprecated */
-
-struct URIHandler2;
-
-typedef void (*initHandlerFn)(struct URIHandler2 *,
- abyss_bool *);
-
-typedef void (*termHandlerFn)(struct URIHandler2 *);
-
-typedef void (*handleReq2Fn)(struct URIHandler2 *,
- TSession *,
- abyss_bool *);
-
-typedef struct URIHandler2 {
- initHandlerFn init;
- termHandlerFn term;
- handleReq2Fn handleReq2;
- URIHandler handleReq1; /* deprecated */
- void * userdata;
-} URIHandler2;
-
-void
-ServerAddHandler2(TServer * const srvP,
- URIHandler2 * const handlerP,
- abyss_bool * const successP);
-
-abyss_bool
-ServerAddHandler(TServer * const srvP,
- URIHandler const handler);
-
-void
-ServerDefaultHandler(TServer * const srvP,
- URIHandler const handler);
-
-abyss_bool LogOpen(TServer *srv, const char *filename);
-void LogWrite(TServer *srv,char *c);
-void LogClose(TServer *srv);
-
+#define MAX_CONN 16
/*********************************************************************
-** MIMEType
+** General purpose definitions
*********************************************************************/
-void MIMETypeInit(void);
-abyss_bool MIMETypeAdd(char *type,char *ext);
-char *MIMETypeFromExt(char *ext);
-char *MIMETypeFromFileName(char *filename);
-char *MIMETypeGuessFromFile(char *filename);
+#ifndef NULL
+#define NULL ((void *)0)
+#endif /* NULL */
+
+#ifndef TRUE
+#define TRUE 1
+#endif /* TRUE */
+#ifndef FALSE
+#define FALSE 0
+#endif /* FALSE */
/*********************************************************************
-** Conf
+** Range
*********************************************************************/
-abyss_bool ConfReadMIMETypes(char *filename);
-abyss_bool ConfReadServerFile(const char *filename,TServer *srv);
+abyss_bool
+RangeDecode(char * const str,
+ xmlrpc_uint64_t const filesize,
+ xmlrpc_uint64_t * const start,
+ xmlrpc_uint64_t * const end);
+abyss_bool DateInit(void);
/*********************************************************************
-** Trace
+** Base64
*********************************************************************/
-void TraceMsg(char *fmt,...);
-void TraceExit(char *fmt,...);
-
+void
+Base64Encode(const char * const chars,
+ char * const base64);
/*********************************************************************
** Session
*********************************************************************/
-abyss_bool SessionLog(TSession *s);
+abyss_bool SessionLog(TSession * const s);
#ifdef __cplusplus
}
+
+
#endif
/*****************************************************************************
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.h Mon May 26 12:59:57 2008
@@ -6,8 +6,11 @@
#include <stddef.h>
#include <stdarg.h>
#include <time.h>
+#include <xmlrpc-c/util.h>
+#include <xmlrpc-c/config.h>
+ /* Defines XMLRPC_HAVE_WCHAR, XMLRPC_INT64 */
-#ifdef HAVE_UNICODE_WCHAR
+#if XMLRPC_HAVE_WCHAR
#include <wchar.h>
#endif
@@ -17,16 +20,26 @@
/*=========================================================================
-** Typedefs
-**=========================================================================
-** We define names for these types, because they may change from platform
-** to platform.
+** Version of libxmlrpc
+**=======================================================================*/
+extern unsigned int const xmlrpc_version_major;
+extern unsigned int const xmlrpc_version_minor;
+extern unsigned int const xmlrpc_version_point;
+
+/*=========================================================================
+** C types equivalent to XML-RPC types
+**=======================================================================*/
+
+/* We define names for these types, because they may change from platform
+ to platform.
*/
typedef signed int xmlrpc_int;
/* An integer of the type defined by XML-RPC <int>; i.e. 32 bit */
-typedef signed int xmlrpc_int32;
- /* An integer of the type defined by XML-RPC <int4>; i.e. 32 bit */
+typedef XMLRPC_INT32 xmlrpc_int32;
+ /* An integer of the type defined by XML-RPC <i4>; i.e. 32 bit */
+typedef XMLRPC_INT64 xmlrpc_int64;
+ /* An integer of the type defined by "XML-RPC" <i8>; i.e. 64 bit */
typedef int xmlrpc_bool;
/* A boolean (of the type defined by XML-RPC <boolean>, but there's
really only one kind)
@@ -38,296 +51,19 @@
for mathematical completeness.
*/
-#define XMLRPC_INT32_MAX (2147483647)
-#define XMLRPC_INT32_MIN (-XMLRPC_INT32_MAX - 1)
-
-
-
-/*=========================================================================
-** C struct size computations
-**=======================================================================*/
-
-/* Use XMLRPC_STRUCT_MEMBER_SIZE() to determine how big a structure is
- up to and including a specified member. E.g. if you have
- struct mystruct {int red; int green; int blue};, then
- XMLRPC_STRUCT_MEMBER_SIZE(mystruct, green) is (8).
-*/
-
-#define _XMLRPC_STRUCT_MEMBER_OFFSET(TYPE, MBRNAME) \
- ((unsigned long)(char*)&((TYPE *)0)->MBRNAME)
-#define _XMLRPC_STRUCT_MEMBER_SIZE(TYPE, MBRNAME) \
- sizeof(((TYPE *)0)->MBRNAME)
-#define XMLRPC_STRUCTSIZE(TYPE, MBRNAME) \
- (_XMLRPC_STRUCT_MEMBER_OFFSET(TYPE, MBRNAME) + \
- _XMLRPC_STRUCT_MEMBER_SIZE(TYPE, MBRNAME))
-
-/*=========================================================================
-** Assertions and Debugging
-**=========================================================================
-** Note that an assertion is _not_ a directive to check a condition and
-** crash if it isn't true. It is an assertion that the condition _is_
-** true. This assertion helps people to read the code. The program
-** may also check the assertion as it runs, and if it conflicts with reality,
-** recognize that the program is incorrect and abort it. In practice,
-** it does this checking when the program was compiled without the NDEBUG
-** macro defined.
-*/
-
-#ifndef NDEBUG
-
-#define XMLRPC_ASSERT(cond) \
- do \
- if (!(cond)) \
- xmlrpc_assertion_failed(__FILE__, __LINE__); \
- while (0)
-
-#else
-#define XMLRPC_ASSERT(cond) (0)
-#endif
-
-extern void xmlrpc_assertion_failed (char* file, int line);
-
-/* Validate a pointer. */
-#define XMLRPC_ASSERT_PTR_OK(ptr) \
- XMLRPC_ASSERT((ptr) != NULL)
-
-/* We only call this if something truly drastic happens. */
-#define XMLRPC_FATAL_ERROR(msg) xmlrpc_fatal_error(__FILE__, __LINE__, (msg))
-
-extern void xmlrpc_fatal_error (char* file, int line, char* msg);
-
-
-/*=========================================================================
-** Strings
-**=======================================================================*/
-
-/* Traditional C strings are char *, because they come from a time before
- there was 'const'. Now, const char * makes a lot more sense. Also,
- in modern times, we tend to dynamically allocate memory for strings.
- We need this free function accordingly. Ordinary free() doesn't check
- the type, and can generate a warning due to the 'const'.
+/* xmlrpc_socket is just for backward compatibility, in case someone decided
+ to use this in user code. New code should use the native type for a
+ socket (e.g. int or SOCKET). (We stopped using this because for winsock
+ users, we would have to #include <winsock.h> in every file that
+ #includes <xmlrpc-c/base.h> and we don't want that).
*/
-void
-xmlrpc_strfree(const char * const string);
-
-
+typedef int xmlrpc_socket;
-/*=========================================================================
-** xmlrpc_env
-**=========================================================================
-** XML-RPC represents runtime errors as <fault> elements. These contain
-** <faultCode> and <faultString> elements.
-**
-** Since we need as much thread-safety as possible, we borrow an idea from
-** CORBA--we store exception information in an "environment" object.
-** You'll pass this to many different functions, and it will get filled
-** out appropriately.
-**
-** For example:
-**
-** xmlrpc_env env;
-**
-** xmlrpc_env_init(&env);
-**
-** xmlrpc_do_something(&env);
-** if (env.fault_occurred)
-** report_error_appropriately();
-**
-** xmlrpc_env_clean(&env);
-*/
-
-#define XMLRPC_INTERNAL_ERROR (-500)
-#define XMLRPC_TYPE_ERROR (-501)
-#define XMLRPC_INDEX_ERROR (-502)
-#define XMLRPC_PARSE_ERROR (-503)
-#define XMLRPC_NETWORK_ERROR (-504)
-#define XMLRPC_TIMEOUT_ERROR (-505)
-#define XMLRPC_NO_SUCH_METHOD_ERROR (-506)
-#define XMLRPC_REQUEST_REFUSED_ERROR (-507)
-#define XMLRPC_INTROSPECTION_DISABLED_ERROR (-508)
-#define XMLRPC_LIMIT_EXCEEDED_ERROR (-509)
-#define XMLRPC_INVALID_UTF8_ERROR (-510)
-
-typedef struct _xmlrpc_env {
- int fault_occurred;
- xmlrpc_int32 fault_code;
- char* fault_string;
-} xmlrpc_env;
-
-/* Initialize and destroy the contents of the provided xmlrpc_env object.
-** These functions will never fail. */
-void xmlrpc_env_init (xmlrpc_env* env);
-void xmlrpc_env_clean (xmlrpc_env* env);
-
-/* Fill out an xmlrpc_fault with the specified values, and set the
-** fault_occurred flag. This function will make a private copy of 'string',
-** so you retain responsibility for your copy. */
-void
-xmlrpc_env_set_fault(xmlrpc_env * const env,
- int const faultCode,
- const char * const faultDescription);
-
-/* The same as the above, but using a printf-style format string. */
-void
-xmlrpc_env_set_fault_formatted (xmlrpc_env * const envP,
- int const code,
- const char * const format,
- ...);
-
-/* This one infers XMLRPC_INTERNAL_ERROR and has a shorter name.
- So a call takes up less source code space.
-*/
-void
-xmlrpc_faultf(xmlrpc_env * const envP,
- const char * const format,
- ...);
-
-/* A simple debugging assertion. */
-#define XMLRPC_ASSERT_ENV_OK(env) \
- XMLRPC_ASSERT((env) != NULL && !(env)->fault_occurred)
-
-/* This version must *not* interpret 'str' as a format string, to avoid
-** several evil attacks. */
-#define XMLRPC_FAIL(env,code,str) \
- do { xmlrpc_env_set_fault((env),(code),(str)); goto cleanup; } while (0)
-
-#define XMLRPC_FAIL1(env,code,str,arg1) \
- do { \
- xmlrpc_env_set_fault_formatted((env),(code),(str),(arg1)); \
- goto cleanup; \
- } while (0)
-
-#define XMLRPC_FAIL2(env,code,str,arg1,arg2) \
- do { \
- xmlrpc_env_set_fault_formatted((env),(code),(str),(arg1),(arg2)); \
- goto cleanup; \
- } while (0)
-
-#define XMLRPC_FAIL3(env,code,str,arg1,arg2,arg3) \
- do { \
- xmlrpc_env_set_fault_formatted((env),(code), \
- (str),(arg1),(arg2),(arg3)); \
- goto cleanup; \
- } while (0)
-
-#define XMLRPC_FAIL_IF_NULL(ptr,env,code,str) \
- do { \
- if ((ptr) == NULL) \
- XMLRPC_FAIL((env),(code),(str)); \
- } while (0)
-
-#define XMLRPC_FAIL_IF_FAULT(env) \
- do { if ((env)->fault_occurred) goto cleanup; } while (0)
-
-
-/*=========================================================================
-** Resource Limits
-**=========================================================================
-** To discourage denial-of-service attacks, we provide several adjustable
-** resource limits. These functions are *not* re-entrant.
-*/
-
-/* Limit IDs. There will be more of these as time goes on. */
-#define XMLRPC_NESTING_LIMIT_ID (0)
-#define XMLRPC_XML_SIZE_LIMIT_ID (1)
-#define XMLRPC_LAST_LIMIT_ID (XMLRPC_XML_SIZE_LIMIT_ID)
-
-/* By default, deserialized data may be no more than 64 levels deep. */
-#define XMLRPC_NESTING_LIMIT_DEFAULT (64)
-
-/* By default, XML data from the network may be no larger than 512K.
-** Some client and server modules may fail to enforce this properly. */
-#define XMLRPC_XML_SIZE_LIMIT_DEFAULT (512*1024)
-
-/* Set a specific limit to the specified value. */
-extern void xmlrpc_limit_set (int limit_id, size_t value);
-
-/* Get the value of a specified limit. */
-extern size_t xmlrpc_limit_get (int limit_id);
-
-
-/*=========================================================================
-** xmlrpc_mem_block
-**=========================================================================
-** A resizable chunk of memory. This is mostly used internally, but it is
-** also used by the public API in a few places.
-** The struct fields are private!
-*/
-
-typedef struct _xmlrpc_mem_block {
- size_t _size;
- size_t _allocated;
- void* _block;
-} xmlrpc_mem_block;
-
-/* Allocate a new xmlrpc_mem_block. */
-xmlrpc_mem_block* xmlrpc_mem_block_new (xmlrpc_env* env, size_t size);
-
-/* Destroy an existing xmlrpc_mem_block, and everything it contains. */
-void xmlrpc_mem_block_free (xmlrpc_mem_block* block);
-
-/* Initialize the contents of the provided xmlrpc_mem_block. */
-void xmlrpc_mem_block_init
- (xmlrpc_env* env, xmlrpc_mem_block* block, size_t size);
-
-/* Deallocate the contents of the provided xmlrpc_mem_block, but not the
-** block itself. */
-void xmlrpc_mem_block_clean (xmlrpc_mem_block* block);
-
-/* Get the size and contents of the xmlrpc_mem_block. */
-size_t
-xmlrpc_mem_block_size(const xmlrpc_mem_block * const block);
-
-void *
-xmlrpc_mem_block_contents(const xmlrpc_mem_block * const block);
-
-/* Resize an xmlrpc_mem_block, preserving as much of the contents as
-** possible. */
-void xmlrpc_mem_block_resize
- (xmlrpc_env* env, xmlrpc_mem_block* block, size_t size);
-
-/* Append data to an existing xmlrpc_mem_block. */
-void xmlrpc_mem_block_append
- (xmlrpc_env* env, xmlrpc_mem_block* block, const void *data, size_t len);
-
-#define XMLRPC_MEMBLOCK_NEW(type,env,size) \
- xmlrpc_mem_block_new((env), sizeof(type) * (size))
-#define XMLRPC_MEMBLOCK_FREE(type,block) \
- xmlrpc_mem_block_free(block)
-#define XMLRPC_MEMBLOCK_INIT(type,env,block,size) \
- xmlrpc_mem_block_init((env), (block), sizeof(type) * (size))
-#define XMLRPC_MEMBLOCK_CLEAN(type,block) \
- xmlrpc_mem_block_clean(block)
-#define XMLRPC_MEMBLOCK_SIZE(type,block) \
- (xmlrpc_mem_block_size(block) / sizeof(type))
-#define XMLRPC_MEMBLOCK_CONTENTS(type,block) \
- ((type*) xmlrpc_mem_block_contents(block))
-#define XMLRPC_MEMBLOCK_RESIZE(type,env,block,size) \
- xmlrpc_mem_block_resize(env, block, sizeof(type) * (size))
-#define XMLRPC_MEMBLOCK_APPEND(type,env,block,data,size) \
- xmlrpc_mem_block_append(env, block, data, sizeof(type) * (size))
-
-/* Here are some backward compatibility definitions. These longer names
- used to be the only ones and typed memory blocks were considered
- special.
-*/
-#define XMLRPC_TYPED_MEM_BLOCK_NEW(type,env,size) \
- XMLRPC_MEMBLOCK_NEW(type,env,size)
-#define XMLRPC_TYPED_MEM_BLOCK_FREE(type,block) \
- XMLRPC_MEMBLOCK_FREE(type,block)
-#define XMLRPC_TYPED_MEM_BLOCK_INIT(type,env,block,size) \
- XMLRPC_MEMBLOCK_INIT(type,env,block,size)
-#define XMLRPC_TYPED_MEM_BLOCK_CLEAN(type,block) \
- XMLRPC_MEMBLOCK_CLEAN(type,block)
-#define XMLRPC_TYPED_MEM_BLOCK_SIZE(type,block) \
- XMLRPC_MEMBLOCK_SIZE(type,block)
-#define XMLRPC_TYPED_MEM_BLOCK_CONTENTS(type,block) \
- XMLRPC_MEMBLOCK_CONTENTS(type,block)
-#define XMLRPC_TYPED_MEM_BLOCK_RESIZE(type,env,block,size) \
- XMLRPC_MEMBLOCK_RESIZE(type,env,block,size)
-#define XMLRPC_TYPED_MEM_BLOCK_APPEND(type,env,block,data,size) \
- XMLRPC_MEMBLOCK_APPEND(type,env,block,data,size)
+#define XMLRPC_INT32_MAX 0x7fffffff
+#define XMLRPC_INT32_MIN (-XMLRPC_INT32_MAX - 1)
+#define XMLRPC_INT64_MAX 0x7fffffffffffffffll
+#define XMLRPC_INT64_MIN (-XMLRPC_INT64_MAX - 1)
/*=========================================================================
@@ -337,22 +73,28 @@
*/
typedef enum {
- XMLRPC_TYPE_INT = 0,
- XMLRPC_TYPE_BOOL = 1,
- XMLRPC_TYPE_DOUBLE = 2,
- XMLRPC_TYPE_DATETIME = 3,
- XMLRPC_TYPE_STRING = 4,
- XMLRPC_TYPE_BASE64 = 5,
- XMLRPC_TYPE_ARRAY = 6,
- XMLRPC_TYPE_STRUCT = 7,
- XMLRPC_TYPE_C_PTR = 8,
- XMLRPC_TYPE_NIL = 9,
+ XMLRPC_TYPE_INT = 0,
+ XMLRPC_TYPE_BOOL = 1,
+ XMLRPC_TYPE_DOUBLE = 2,
+ XMLRPC_TYPE_DATETIME = 3,
+ XMLRPC_TYPE_STRING = 4,
+ XMLRPC_TYPE_BASE64 = 5,
+ XMLRPC_TYPE_ARRAY = 6,
+ XMLRPC_TYPE_STRUCT = 7,
+ XMLRPC_TYPE_C_PTR = 8,
+ XMLRPC_TYPE_NIL = 9,
+ XMLRPC_TYPE_I8 = 10,
XMLRPC_TYPE_DEAD = 0xDEAD
} xmlrpc_type;
+#define XMLRPC_HAVE_I8 1
+
/* These are *always* allocated on the heap. No exceptions. */
typedef struct _xmlrpc_value xmlrpc_value;
+const char *
+xmlrpc_type_name(xmlrpc_type const type);
+
void
xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP);
@@ -360,19 +102,23 @@
xmlrpc_abort_if_array_bad(val)
/* Increment the reference count of an xmlrpc_value. */
-extern void xmlrpc_INCREF (xmlrpc_value* value);
+extern void xmlrpc_INCREF (xmlrpc_value* const value);
/* Decrement the reference count of an xmlrpc_value. If there
** are no more references, free it. */
-extern void xmlrpc_DECREF (xmlrpc_value* value);
+extern void xmlrpc_DECREF (xmlrpc_value* const value);
/* Get the type of an XML-RPC value. */
-extern xmlrpc_type xmlrpc_value_type (xmlrpc_value* value);
+extern xmlrpc_type xmlrpc_value_type (xmlrpc_value* const value);
xmlrpc_value *
xmlrpc_int_new(xmlrpc_env * const envP,
int const intValue);
+xmlrpc_value *
+xmlrpc_i8_new(xmlrpc_env * const envP,
+ xmlrpc_int64 const value);
+
void
xmlrpc_read_int(xmlrpc_env * const envP,
const xmlrpc_value * const valueP,
@@ -423,6 +169,25 @@
size_t const length,
const char * const stringValue);
+xmlrpc_value *
+xmlrpc_string_new_va(xmlrpc_env * const envP,
+ const char * const format,
+ va_list args);
+
+xmlrpc_value *
+xmlrpc_string_new_f(xmlrpc_env * const envP,
+ const char * const format,
+ ...);
+
+xmlrpc_value *
+xmlrpc_string_new_lp_cr(xmlrpc_env * const envP,
+ size_t const length,
+ const char * const value);
+
+xmlrpc_value *
+xmlrpc_string_new_cr(xmlrpc_env * const envP,
+ const char * const value);
+
void
xmlrpc_read_string(xmlrpc_env * const envP,
const xmlrpc_value * const valueP,
@@ -430,12 +195,23 @@
void
+xmlrpc_read_string_crlf(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ const char ** const stringValueP);
+
+void
+xmlrpc_read_string_lp_crlf(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ size_t * const lengthP,
+ const char ** const stringValueP);
+
+void
xmlrpc_read_string_lp(xmlrpc_env * const envP,
const xmlrpc_value * const valueP,
size_t * const lengthP,
const char ** const stringValueP);
-#ifdef HAVE_UNICODE_WCHAR
+#if XMLRPC_HAVE_WCHAR
xmlrpc_value *
xmlrpc_string_w_new(xmlrpc_env * const envP,
const wchar_t * const stringValue);
@@ -451,11 +227,32 @@
const wchar_t ** const stringValueP);
void
+xmlrpc_read_string_w_crlf(xmlrpc_env * const envP,
+ xmlrpc_value * const valueP,
+ const wchar_t ** const stringValueP);
+
+void
xmlrpc_read_string_w_lp(xmlrpc_env * const envP,
xmlrpc_value * const valueP,
size_t * const lengthP,
const wchar_t ** const stringValueP);
-#endif
+
+void
+xmlrpc_read_string_w_lp_crlf(xmlrpc_env * const envP,
+ xmlrpc_value * const valueP,
+ size_t * const lengthP,
+ const wchar_t ** const stringValueP);
+
+xmlrpc_value *
+xmlrpc_string_w_new_lp_cr(xmlrpc_env * const envP,
+ size_t const length,
+ const wchar_t * const value);
+
+xmlrpc_value *
+xmlrpc_string_w_new_cr(xmlrpc_env * const envP,
+ const wchar_t * const value);
+
+#endif /* XMLRPC_HAVE_WCHAR */
xmlrpc_value *
xmlrpc_base64_new(xmlrpc_env * const envP,
@@ -485,9 +282,9 @@
/* Append an item to an XML-RPC array.
** Sets XMLRPC_TYPE_ERROR if 'array' is not an array. */
extern void
-xmlrpc_array_append_item (xmlrpc_env * envP,
- xmlrpc_value * arrayP,
- xmlrpc_value * valueP);
+xmlrpc_array_append_item (xmlrpc_env * const envP,
+ xmlrpc_value * const arrayP,
+ xmlrpc_value * const valueP);
void
xmlrpc_array_read_item(xmlrpc_env * const envP,
@@ -515,18 +312,8 @@
xmlrpc_value* value);
*/
-void
-xmlrpc_read_nil(xmlrpc_env * const envP,
- xmlrpc_value * const valueP);
-
-
-void
-xmlrpc_read_cptr(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- void ** const ptrValueP);
-
xmlrpc_value *
-xmlrpc_struct_new(xmlrpc_env * env);
+xmlrpc_struct_new(xmlrpc_env * const env);
/* Return the number of key/value pairs in a struct.
** Sets XMLRPC_TYPE_ERROR if 'strct' is not a struct. */
@@ -574,17 +361,17 @@
xmlrpc_value ** const valuePP);
void
+xmlrpc_struct_read_value(xmlrpc_env * const envP,
+ xmlrpc_value * const structP,
+ const char * const key,
+ xmlrpc_value ** const valuePP);
+
+void
xmlrpc_struct_read_value_v(xmlrpc_env * const envP,
xmlrpc_value * const structP,
xmlrpc_value * const keyP,
xmlrpc_value ** const valuePP);
-void
-xmlrpc_struct_read_value(xmlrpc_env * const envP,
- xmlrpc_value * const strctP,
- const char * const key,
- xmlrpc_value ** const valuePP);
-
/* The "get_value" functions are deprecated. Use the "find_value"
and "read_value" functions instead.
*/
@@ -650,11 +437,27 @@
Deprecated. Use xmlrpc_struct_read_member() instead.
*/
void
-xmlrpc_struct_get_key_and_value(xmlrpc_env * env,
- xmlrpc_value * strct,
- int index,
- xmlrpc_value ** out_keyval,
- xmlrpc_value ** out_value);
+xmlrpc_struct_get_key_and_value(xmlrpc_env * const env,
+ xmlrpc_value * const strct,
+ int const index,
+ xmlrpc_value ** const out_keyval,
+ xmlrpc_value ** const out_value);
+
+void
+xmlrpc_read_cptr(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ void ** const ptrValueP);
+
+void
+xmlrpc_read_nil(xmlrpc_env * const envP,
+ xmlrpc_value * const valueP);
+
+
+void
+xmlrpc_read_i8(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ xmlrpc_int64 * const intValueP);
+
xmlrpc_value *
xmlrpc_cptr_new(xmlrpc_env * const envP,
@@ -675,7 +478,7 @@
void
xmlrpc_build_value_va(xmlrpc_env * const env,
const char * const format,
- va_list args,
+ va_list const args,
xmlrpc_value ** const valPP,
const char ** const tailP);
@@ -689,7 +492,7 @@
xmlrpc_decompose_value_va(xmlrpc_env * const envP,
xmlrpc_value * const value,
const char * const format,
- va_list args);
+ va_list const args);
/* xmlrpc_parse_value... is the same as xmlrpc_decompose_value... except
that it doesn't do proper memory management -- it returns xmlrpc_value's
@@ -709,44 +512,67 @@
xmlrpc_parse_value_va(xmlrpc_env * const envP,
xmlrpc_value * const value,
const char * const format,
- va_list args);
+ va_list const args);
/*=========================================================================
** Encoding XML
**=======================================================================*/
-/* Serialize an XML value without any XML header. This is primarily used
-** for testing purposes. */
+typedef enum xmlrpc_dialect {
+ xmlrpc_dialect_i8,
+ xmlrpc_dialect_apache
+} xmlrpc_dialect;
+
+void
+xmlrpc_serialize_value2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect);
+
void
-xmlrpc_serialize_value(xmlrpc_env * env,
- xmlrpc_mem_block * output,
- xmlrpc_value * value);
+xmlrpc_serialize_value(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP);
+
+void
+xmlrpc_serialize_params2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect);
-/* Serialize a list of parameters without any XML header. This is
-** primarily used for testing purposes. */
void
-xmlrpc_serialize_params(xmlrpc_env * env,
- xmlrpc_mem_block * output,
- xmlrpc_value * param_array);
+xmlrpc_serialize_params(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const paramArrayP);
-/* Serialize an XML-RPC call. */
void
-xmlrpc_serialize_call (xmlrpc_env * const env,
- xmlrpc_mem_block * const output,
- const char * const method_name,
- xmlrpc_value * const param_array);
+xmlrpc_serialize_call2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect);
-/* Serialize an XML-RPC return value. */
-extern void
-xmlrpc_serialize_response(xmlrpc_env * env,
- xmlrpc_mem_block * output,
- xmlrpc_value * value);
+void
+xmlrpc_serialize_call(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP);
-/* Serialize an XML-RPC fault (as specified by 'fault'). */
-extern void
-xmlrpc_serialize_fault(xmlrpc_env * env,
- xmlrpc_mem_block * output,
- xmlrpc_env * fault);
+void
+xmlrpc_serialize_response2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect);
+
+void
+xmlrpc_serialize_response(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP);
+
+void
+xmlrpc_serialize_fault(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const xmlrpc_env * const faultP);
/*=========================================================================
@@ -764,13 +590,21 @@
const char ** const out_method_name,
xmlrpc_value ** const out_param_array);
-/* Parse an XML-RPC response. If a fault occurs (or was received over the
-** wire), return NULL and set up 'env'. The calling is responsible for
-** calling xmlrpc_DECREF on the return value (if it isn't NULL). */
-xmlrpc_value *
-xmlrpc_parse_response(xmlrpc_env * env,
- const char * xml_data,
- size_t xml_len);
+void
+xmlrpc_parse_response2(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen,
+ xmlrpc_value ** const resultPP,
+ int * const faultCodeP,
+ const char ** const faultStringP);
+
+
+/* xmlrpc_parse_response() is for backward compatibility */
+
+xmlrpc_value *
+xmlrpc_parse_response(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen);
/*=========================================================================
@@ -802,42 +636,6 @@
/*=========================================================================
-** UTF-8 Encoding and Decoding
-**=========================================================================
-** We need a correct, reliable and secure UTF-8 decoder. This decoder
-** raises a fault if it encounters invalid UTF-8.
-**
-** Note that ANSI C does not precisely define the representation used
-** by wchar_t--it may be UCS-2, UTF-16, UCS-4, or something from outer
-** space. If your platform does something especially bizarre, you may
-** need to reimplement these routines.
-*/
-
-#ifdef HAVE_UNICODE_WCHAR
-
-/* Ensure that a string contains valid, legally-encoded UTF-8 data.
-** (Incorrectly-encoded UTF-8 strings are often used to bypass security
-** checks.) */
-void
-xmlrpc_validate_utf8 (xmlrpc_env * const env,
- const char * const utf8_data,
- size_t const utf8_len);
-
-/* Decode a UTF-8 string. */
-xmlrpc_mem_block *
-xmlrpc_utf8_to_wcs(xmlrpc_env * env,
- char * utf8_data,
- size_t utf8_len);
-
-/* Encode a UTF-8 string. */
-xmlrpc_mem_block *
-xmlrpc_wcs_to_utf8(xmlrpc_env * env,
- wchar_t * wcs_data,
- size_t wcs_len);
-
-#endif /* HAVE_UNICODE_WCHAR */
-
-/*=========================================================================
** Authorization Cookie Handling
**=========================================================================
** Routines to get and set values for authorizing via authorization
@@ -847,12 +645,44 @@
** a cookie replacement of basic authentication.)
**/
-extern void xmlrpc_authcookie_set(xmlrpc_env * env,
- const char * username,
- const char * password);
+extern void xmlrpc_authcookie_set(xmlrpc_env * const env,
+ const char * const username,
+ const char * const password);
char *xmlrpc_authcookie(void);
+/*=========================================================================
+ Resource Limits
+
+ Ideally, there would be enough resource limits to ensure that
+ XML-RPC partners cannot cause libxmlrpc objects and routines to use
+ more resource than is available for them (either by accident or
+ malice). We have a long way to go to get there.
+
+=========================================================================*/
+/* These functions are _not_ re-entrant and the limits are per-process
+ (i.e. their values live in static global variables).
+*/
+
+/* Limit IDs. There will be more of these as time goes on. */
+#define XMLRPC_NESTING_LIMIT_ID (0)
+#define XMLRPC_XML_SIZE_LIMIT_ID (1)
+#define XMLRPC_LAST_LIMIT_ID (XMLRPC_XML_SIZE_LIMIT_ID)
+
+/* By default, deserialized data may be no more than 64 levels deep. */
+#define XMLRPC_NESTING_LIMIT_DEFAULT (64)
+
+/* By default, XML data from the network may be no larger than 512K.
+** Some client and server modules may fail to enforce this properly. */
+#define XMLRPC_XML_SIZE_LIMIT_DEFAULT (512*1024)
+
+/* Set a specific limit to the specified value. */
+extern void xmlrpc_limit_set (int const limit_id, size_t const value);
+
+/* Get the value of a specified limit. */
+extern size_t xmlrpc_limit_get (int const limit_id);
+
+
#ifdef __cplusplus
}
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base.hpp Mon May 26 12:59:57 2008
@@ -1,5 +1,5 @@
-#ifndef XMLRPC_HPP_INCLUDED
-#define XMLRPC_HPP_INCLUDED
+#ifndef XMLRPC_BASE_HPP_INCLUDED
+#define XMLRPC_BASE_HPP_INCLUDED
#include <climits>
#include <cfloat>
@@ -8,7 +8,7 @@
#include <map>
#include <string>
-#include "xmlrpc-c/base.h"
+#include <xmlrpc-c/base.h>
namespace xmlrpc_c {
@@ -36,6 +36,7 @@
TYPE_STRUCT = 7,
TYPE_C_PTR = 8,
TYPE_NIL = 9,
+ TYPE_I8 = 10,
TYPE_DEAD = 0xDEAD
};
@@ -44,6 +45,9 @@
xmlrpc_c::value&
operator=(xmlrpc_c::value const&);
+ bool
+ isInstantiated() const;
+
// The following are not meant to be public to users, but just to
// other Xmlrpc-c library modules. If we ever go to a pure C++
// implementation, not based on C xmlrpc_value objects, this shouldn't
@@ -54,7 +58,7 @@
void
addToCStruct(xmlrpc_value * const structP,
- std::string const key) const;
+ std::string const key) const;
xmlrpc_value *
cValue() const;
@@ -63,7 +67,7 @@
void
instantiate(xmlrpc_value * const valueP);
- // Work only on a placeholder object created by the no-argument
+ // Works only on a placeholder object created by the no-argument
// constructor.
xmlrpc_value * cValueP;
@@ -96,10 +100,18 @@
class value_string : public value {
public:
- value_string(std::string const& cvalue);
+ enum nlCode {nlCode_all, nlCode_lf};
+
+ value_string(std::string const& cppvalue,
+ nlCode const nlCode);
+
+ value_string(std::string const& cppvalue);
value_string(xmlrpc_c::value const baseValue);
+ std::string
+ crlfValue() const;
+
operator std::string() const;
};
@@ -120,8 +132,12 @@
public:
value_datetime(std::string const cvalue);
value_datetime(time_t const cvalue);
+#if XMLRPC_HAVE_TIMEVAL
value_datetime(struct timeval const& cvalue);
+#endif
+#if XMLRPC_HAVE_TIMESPEC
value_datetime(struct timespec const& cvalue);
+#endif
value_datetime(xmlrpc_c::value const baseValue);
@@ -147,15 +163,6 @@
-class value_nil : public value {
-public:
- value_nil();
-
- value_nil(xmlrpc_c::value const baseValue);
-};
-
-
-
class value_struct : public value {
public:
value_struct(std::map<std::string, xmlrpc_c::value> const& cvalue);
@@ -182,6 +189,26 @@
+class value_nil : public value {
+public:
+ value_nil();
+
+ value_nil(xmlrpc_c::value const baseValue);
+};
+
+
+
+class value_i8 : public value {
+public:
+ value_i8(xmlrpc_int64 const cvalue);
+
+ value_i8(xmlrpc_c::value const baseValue);
+
+ operator xmlrpc_int64() const;
+};
+
+
+
class fault {
/*----------------------------------------------------------------------------
This is an XML-RPC fault.
@@ -255,9 +282,12 @@
public:
paramList(unsigned int const paramCount = 0);
- void
+ paramList&
add(xmlrpc_c::value const param);
+ paramList&
+ addx(xmlrpc_c::value const param);
+
unsigned int
size() const;
@@ -300,6 +330,11 @@
void
getNil(unsigned int const paramNumber) const;
+ xmlrpc_int64
+ getI8(unsigned int const paramNumber,
+ xmlrpc_int64 const minimum = XMLRPC_INT64_MIN,
+ xmlrpc_int64 const maximum = XMLRPC_INT64_MAX) const;
+
void
verifyEnd(unsigned int const paramNumber) const;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base_int.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base_int.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/base_int.h Mon May 26 12:59:57 2008
@@ -1,5 +1,5 @@
/*============================================================================
- xmlrpc_client_int.h
+ base_int.h
==============================================================================
This header file defines the interface between modules inside
xmlrpc-c.
@@ -11,12 +11,19 @@
============================================================================*/
-#ifndef XMLRPC_INT_H_INCLUDED
-#define XMLRPC_INT_H_INCLUDED
+#ifndef XMLRPC_C_BASE_INT_H_INCLUDED
+#define XMLRPC_C_BASE_INT_H_INCLUDED
+
+#include "xmlrpc_config.h"
+#include "bool.h"
+#include "int.h"
+
+#include <xmlrpc-c/base.h>
+#include <xmlrpc-c/util_int.h>
#ifdef __cplusplus
extern "C" {
-#endif /* __cplusplus */
+#endif
struct _xmlrpc_value {
@@ -26,20 +33,37 @@
/* Certain data types store their data directly in the xmlrpc_value. */
union {
xmlrpc_int32 i;
+ xmlrpc_int64 i8;
xmlrpc_bool b;
double d;
/* time_t t */
- void *c_ptr;
+ void * c_ptr;
} _value;
/* Other data types use a memory block.
- For a string, this is the characters of the string in UTF-8, plus
- a NUL added to the end.
+ For a string, this is the characters of the lines of the string
+ in UTF-8, with lines delimited by either CR, LF, or CRLF, plus
+ a NUL added to the end. The characters of the lines may be any
+ character representable in UTF-8, even the ones that are not
+ legal XML (XML doesn't allow ASCII control characters except
+ tab, CR, LF). But note that a line can't contain CR or LF
+ because that would form a line delimiter. To disambiguate:
+ CRLF together is always one line delimiter.
+
+ This format for string is quite convenient because it is also
+ the format of that part of an XML document which is the
+ contents of a <string> element (except of course that for the
+ non-XML characters, we have to stretch the definition of XML).
+
+ For base64, this is bytes of the byte string, directly.
+
+ For datetime, this is in the same format as the contents of
+ a <dateTime.iso8601> XML element. That really ought to be changed
+ to time_t some day.
*/
xmlrpc_mem_block _block;
-#ifdef HAVE_UNICODE_WCHAR
xmlrpc_mem_block *_wcs_block;
/* This is a copy of the string value in _block, but in UTF-16
instead of UTF-8. This member is not always present. If NULL,
@@ -49,8 +73,10 @@
redundant with _block.
This member is always NULL when the data type is not string.
+
+ This member is always NULL on a system that does not have
+ Unicode wchar functions.
*/
-#endif
};
#define XMLRPC_ASSERT_VALUE_OK(val) \
@@ -65,9 +91,9 @@
typedef struct {
- unsigned char key_hash;
- xmlrpc_value *key;
- xmlrpc_value *value;
+ uint32_t keyHash;
+ xmlrpc_value * key;
+ xmlrpc_value * value;
} _struct_member;
@@ -78,38 +104,20 @@
const char *
xmlrpc_typeName(xmlrpc_type const type);
-
-struct _xmlrpc_registry {
- int _introspection_enabled;
- xmlrpc_value *_methods;
- xmlrpc_value *_default_method;
- xmlrpc_value *_preinvoke_method;
-};
-
-
-/* When we deallocate a pointer in a struct, we often replace it with
-** this and throw in a few assertions here and there. */
-#define XMLRPC_BAD_POINTER ((void*) 0xDEADBEEF)
-
-
void
xmlrpc_traceXml(const char * const label,
const char * const xml,
unsigned int const xmlLength);
void
+xmlrpc_destroyString(xmlrpc_value * const stringP);
+
+void
xmlrpc_destroyStruct(xmlrpc_value * const structP);
void
xmlrpc_destroyArrayContents(xmlrpc_value * const arrayP);
-const char *
-xmlrpc_makePrintable(const char * const input);
-
-const char *
-xmlrpc_makePrintableChar(char const input);
-
-
/*----------------------------------------------------------------------------
The following are for use by the legacy xmlrpc_parse_value(). They don't
do proper memory management, so they aren't appropriate for general use,
@@ -138,7 +146,7 @@
size_t * const lengthP,
const char ** const stringValueP);
-#ifdef HAVE_UNICODE_WCHAR
+#if XMLRPC_HAVE_WCHAR
void
xmlrpc_read_string_w_old(xmlrpc_env * const envP,
xmlrpc_value * const valueP,
@@ -185,6 +193,6 @@
#ifdef __cplusplus
}
-#endif /* __cplusplus */
+#endif
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.h Mon May 26 12:59:57 2008
@@ -16,33 +16,61 @@
extern "C" {
#endif /* __cplusplus */
-/*=========================================================================
-** Initialization and Shutdown
-**=========================================================================
-** These routines initialize and terminate the XML-RPC client. If you're
-** already using libwww on your own, you can pass
-** XMLRPC_CLIENT_SKIP_LIBWWW_INIT to avoid initializing it twice.
+struct xmlrpc_client;
+struct xmlrpc_client_transport;
+struct xmlrpc_client_transport_ops;
+#ifndef __cplusplus
+typedef struct xmlrpc_client xmlrpc_client;
+typedef struct xmlrpc_client_transport xmlrpc_client_transport;
+typedef struct xmlrpc_client_transport_ops xmlrpc_client_transport_ops;
+#endif
+
+/* libxmlrpc_client typically does _not_ actually include all of the
+ XML transports declared here by xmlrpc_*_transport_ops.
+
+ Use 'xmlrpc-c-config --features' to determine which features are
+ installed.
*/
-#define XMLRPC_CLIENT_NO_FLAGS (0)
-#define XMLRPC_CLIENT_SKIP_LIBWWW_INIT (1)
+/* Before Xmlrpc-c 1.13 (December 2007), we declared struct
+ xmlrpc_xportparms, as a sort of "base class." The struct was never
+ complete -- you just cast pointer to it it to pointers to other
+ types. It turned out not to be really helpful and casts are ugly,
+ so now we just use void * as a base class pointer.
+*/
-extern void
-xmlrpc_client_init(int const flags,
- const char * const appname,
- const char * const appversion);
-
-struct xmlrpc_xportparms;
- /* This is a "base class". The struct is never complete; you're
- supposed to cast between struct xmlrpc_xportparms * and
- "struct xmlrpc_..._xportparms *" in order to use it.
- */
+extern struct xmlrpc_client_transport_ops xmlrpc_libwww_transport_ops;
+extern struct xmlrpc_client_transport_ops xmlrpc_wininet_transport_ops;
+extern struct xmlrpc_client_transport_ops xmlrpc_curl_transport_ops;
+
+enum xmlrpc_sslversion {
+ XMLRPC_SSLVERSION_DEFAULT,
+ XMLRPC_SSLVERSION_TLSv1,
+ XMLRPC_SSLVERSION_SSLv2,
+ XMLRPC_SSLVERSION_SSLv3
+};
struct xmlrpc_curl_xportparms {
+ /* This is designed so that zero values are always the defaults. */
const char * network_interface;
xmlrpc_bool no_ssl_verifypeer;
xmlrpc_bool no_ssl_verifyhost;
const char * user_agent;
+ const char * ssl_cert;
+ const char * sslcerttype;
+ const char * sslcertpasswd;
+ const char * sslkey;
+ const char * sslkeytype;
+ const char * sslkeypasswd;
+ const char * sslengine;
+ xmlrpc_bool sslengine_default;
+ enum xmlrpc_sslversion sslversion;
+ const char * cainfo;
+ const char * capath;
+ const char * randomfile;
+ const char * egdsocket;
+ const char * ssl_cipher_list;
+ unsigned int timeout;
};
@@ -61,10 +89,17 @@
/* XMLRPC_WXPSIZE(xyz) is analogous to XMLRPC_CPSIZE, below */
struct xmlrpc_clientparms {
+ /* (transport, transportparmsP, transportparm_size) and
+ (transportOpsP, transportP) are mutually exclusive.
+ */
const char * transport;
- struct xmlrpc_xportparms * transportparmsP;
- /* Cast a "struct ..._xportparms *" to fit here */
+ const void * transportparmsP;
+ /* This should be type "const struct ..._xportparms *" */
size_t transportparm_size;
+
+ const struct xmlrpc_client_transport_ops * transportOpsP;
+ xmlrpc_client_transport * transportP;
+ xmlrpc_dialect dialect;
};
#define XMLRPC_CPSIZE(mbrname) \
@@ -77,24 +112,9 @@
not the caller is new enough to have supplied a certain parameter.
*/
-void
-xmlrpc_client_init2(xmlrpc_env * const env,
- int const flags,
- const char * const appname,
- const char * const appversion,
- const struct xmlrpc_clientparms * const clientparms,
- unsigned int const parm_size);
-
-extern void
-xmlrpc_client_cleanup(void);
-
const char *
xmlrpc_client_get_default_transport(xmlrpc_env * const env);
-/*=========================================================================
-** Required for both internal and external development.
-**=========================================================================
-*/
/* A callback function to handle the response to an asynchronous call.
** If 'fault->fault_occurred' is true, then response will be NULL. All
** arguments except 'user_data' will be deallocated internally; please do
@@ -112,32 +132,39 @@
/*=========================================================================
-** xmlrpc_server_info
-**=========================================================================
-** We normally refer to servers by URL. But sometimes we need to do extra
-** setup for particular servers. In that case, we can create an
-** xmlrpc_server_info object, configure it in various ways, and call the
-** remote server.
-**
-** (This interface is also designed to discourage further multiplication
-** of xmlrpc_client_call APIs. We have enough of those already. Please
-** add future options and flags using xmlrpc_server_info.)
-*/
+ xmlrpc_server_info
+===========================================================================
+ We normally refer to servers by URL. But sometimes we need to do extra
+ setup for particular servers. In that case, we can create an
+ xmlrpc_server_info object, configure it in various ways, and call the
+ remote server.
+
+ (This interface is also designed to discourage further multiplication
+ of xmlrpc_client_call APIs. We have enough of those already. Please
+ add future options and flags using xmlrpc_server_info.)
+=========================================================================*/
typedef struct _xmlrpc_server_info xmlrpc_server_info;
/* Create a new server info record, pointing to the specified server. */
xmlrpc_server_info *
-xmlrpc_server_info_new(xmlrpc_env * const env,
- const char * const server_url);
+xmlrpc_server_info_new(xmlrpc_env * const envP,
+ const char * const serverUrl);
/* Create a new server info record, with a copy of the old server. */
extern xmlrpc_server_info *
-xmlrpc_server_info_copy(xmlrpc_env *env, xmlrpc_server_info *src_server);
+xmlrpc_server_info_copy(xmlrpc_env * const envP,
+ xmlrpc_server_info * const srcP);
+
+void
+xmlrpc_server_info_free(xmlrpc_server_info * const serverP);
-/* Delete a server info record. */
-extern void
-xmlrpc_server_info_free (xmlrpc_server_info *server);
+
+void
+xmlrpc_server_info_set_user(xmlrpc_env * const envP,
+ xmlrpc_server_info * const serverInfoP,
+ const char * const username,
+ const char * const password);
void
xmlrpc_server_info_set_basic_auth(xmlrpc_env * const envP,
@@ -145,118 +172,116 @@
const char * const username,
const char * const password);
+void
+xmlrpc_server_info_allow_auth_basic(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
-/*=========================================================================
-** xmlrpc_client_call
-**=========================================================================
-** A synchronous XML-RPC client. Do not attempt to call any of these
-** functions from inside an asynchronous callback!
-*/
+void
+xmlrpc_server_info_disallow_auth_basic(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
-xmlrpc_value *
-xmlrpc_client_call(xmlrpc_env * const envP,
- const char * const server_url,
- const char * const method_name,
- const char * const format,
- ...);
-
-xmlrpc_value *
-xmlrpc_client_call_params(xmlrpc_env * const envP,
- const char * const serverUrl,
- const char * const methodName,
- xmlrpc_value * const paramArrayP);
-
-xmlrpc_value *
-xmlrpc_client_call_server(xmlrpc_env * const envP,
- const xmlrpc_server_info * const server,
- const char * const method_name,
- const char * const format,
- ...);
+void
+xmlrpc_server_info_allow_auth_digest(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
-xmlrpc_value *
-xmlrpc_client_call_server_params(
- xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- const char * const method_name,
- xmlrpc_value * const paramArrayP);
+void
+xmlrpc_server_info_disallow_auth_digest(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
+
+void
+xmlrpc_server_info_allow_auth_negotiate(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
+
+void
+xmlrpc_server_info_disallow_auth_negotiate(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
+
+void
+xmlrpc_server_info_allow_auth_ntlm(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
+
+void
+xmlrpc_server_info_disallow_auth_ntlm(xmlrpc_env * const envP,
+ xmlrpc_server_info * const sP);
+
+extern unsigned int const xmlrpc_client_version_major;
+extern unsigned int const xmlrpc_client_version_minor;
+extern unsigned int const xmlrpc_client_version_point;
+
+void
+xmlrpc_client_setup_global_const(xmlrpc_env * const envP);
+
+void
+xmlrpc_client_teardown_global_const(void);
+
+void
+xmlrpc_client_create(xmlrpc_env * const envP,
+ int const flags,
+ const char * const appname,
+ const char * const appversion,
+ const struct xmlrpc_clientparms * const clientparmsP,
+ unsigned int const parmSize,
+ xmlrpc_client ** const clientPP);
+
+void
+xmlrpc_client_destroy(xmlrpc_client * const clientP);
void
-xmlrpc_client_transport_call(
+xmlrpc_client_transport_call2(
xmlrpc_env * const envP,
- void * const reserved, /* for client handle */
+ xmlrpc_client * const clientP,
const xmlrpc_server_info * const serverP,
xmlrpc_mem_block * const callXmlP,
xmlrpc_mem_block ** const respXmlPP);
+void
+xmlrpc_client_call2(xmlrpc_env * const envP,
+ struct xmlrpc_client * const clientP,
+ const xmlrpc_server_info * const serverInfoP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_value ** const resultPP);
-/*=========================================================================
-** xmlrpc_client_call_asynch
-**=========================================================================
-** An asynchronous XML-RPC client.
-*/
+void
+xmlrpc_client_call2f(xmlrpc_env * const envP,
+ xmlrpc_client * const clientP,
+ const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_value ** const resultPP,
+ const char * const format,
+ ...);
-/* Make an asynchronous XML-RPC call. We make internal copies of all
-** arguments except user_data, so you can deallocate them safely as soon
-** as you return. Errors will be passed to the callback. You will need
-** to run the event loop somehow; see below.
-** WARNING: If an error occurs while building the argument, the
-** response handler will be called with a NULL param_array. */
void
-xmlrpc_client_call_asynch(const char * const server_url,
- const char * const method_name,
- xmlrpc_response_handler callback,
- void * const user_data,
- const char * const format,
- ...);
+xmlrpc_client_event_loop_finish(xmlrpc_client * const clientP);
-/* As above, but use an xmlrpc_server_info object. The server object can be
-** safely destroyed as soon as this function returns. */
void
-xmlrpc_client_call_server_asynch(xmlrpc_server_info * const server,
- const char * const method_name,
- xmlrpc_response_handler callback,
- void * const user_data,
- const char * const format,
- ...);
+xmlrpc_client_event_loop_finish_timeout(xmlrpc_client * const clientP,
+ unsigned long const milliseconds);
-/* As above, but the parameter list is supplied as an xmlrpc_value
-** containing an array.
-*/
void
-xmlrpc_client_call_asynch_params(const char * const server_url,
- const char * const method_name,
- xmlrpc_response_handler callback,
- void * const user_data,
- xmlrpc_value * const paramArrayP);
-
-/* As above, but use an xmlrpc_server_info object. The server object can be
-** safely destroyed as soon as this function returns. */
-void
-xmlrpc_client_call_server_asynch_params(
- xmlrpc_server_info * const server,
- const char * const method_name,
- xmlrpc_response_handler callback,
- void * const user_data,
- xmlrpc_value * const paramArrayP);
-
-/*=========================================================================
-** Event Loop Interface
-**=========================================================================
-** These functions can be used to run the XML-RPC event loop. If you
-** don't like these, you can also run the libwww event loop directly.
-*/
-
-/* Finish all outstanding asynchronous calls. Alternatively, the loop
-** will exit if someone calls xmlrpc_client_event_loop_end. */
-extern void
-xmlrpc_client_event_loop_finish_asynch(void);
+xmlrpc_client_start_rpc(xmlrpc_env * const envP,
+ struct xmlrpc_client * const clientP,
+ xmlrpc_server_info * const serverInfoP,
+ const char * const methodName,
+ xmlrpc_value * const argP,
+ xmlrpc_response_handler responseHandler,
+ void * const userData);
+void
+xmlrpc_client_start_rpcf(xmlrpc_env * const envP,
+ xmlrpc_client * const clientP,
+ const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_response_handler callback,
+ void * const userData,
+ const char * const format,
+ ...);
-/* Finish all outstanding asynchronous calls. */
-extern void
-xmlrpc_client_event_loop_finish_asynch_timeout(unsigned long milliseconds);
-
+void
+xmlrpc_client_set_interrupt(xmlrpc_client * const clientP,
+ int * const interruptP);
+#include <xmlrpc-c/client_global.h>
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
**
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client.hpp Mon May 26 12:59:57 2008
@@ -2,33 +2,17 @@
#define CLIENT_HPP_INCLUDED
#include <string>
+#include <vector>
+#include <memory>
#include <xmlrpc-c/girerr.hpp>
#include <xmlrpc-c/girmem.hpp>
#include <xmlrpc-c/base.hpp>
#include <xmlrpc-c/timeout.hpp>
-#include <xmlrpc-c/client.h>
+#include <xmlrpc-c/client_transport.hpp>
namespace xmlrpc_c {
-
-class carriageParm {
-/*----------------------------------------------------------------------------
- The parameter to a client for an individual RPC. It tells specifics
- of how to carry the call to the server and the response back. For
- example, it may identify the server. It may identify communication
- protocols to use. It may indicate permission and accounting
- information.
-
- This is a base class; the carriage parameter is specific to the
- class of client. For example, an HTTP-based client would have a
- URL and HTTP basic authentication info as parameter.
------------------------------------------------------------------------------*/
-protected:
- virtual ~carriageParm();
- carriageParm();
-};
-
class clientTransactionPtr;
class clientTransaction : public girmem::autoObject {
@@ -50,13 +34,18 @@
public:
clientTransactionPtr();
+
+ clientTransactionPtr(clientTransaction * const transP);
+
virtual ~clientTransactionPtr();
virtual xmlrpc_c::clientTransaction *
operator->() const;
};
-class client {
+class clientPtr;
+
+class client : public girmem::autoObject {
/*----------------------------------------------------------------------------
A generic client -- a means of performing an RPC. This is so generic
that it can be used for clients that are not XML-RPC.
@@ -64,196 +53,91 @@
This is a base class. Derived classes define things such as that
XML and HTTP get used to perform the RPC.
-----------------------------------------------------------------------------*/
+ friend class clientTransactionPtr;
+
public:
virtual ~client();
virtual void
- call(carriageParm * const carriageParmP,
- std::string const methodName,
- xmlrpc_c::paramList const& paramList,
- xmlrpc_c::rpcOutcome * const outcomeP) = 0;
+ call(xmlrpc_c::carriageParm * const carriageParmP,
+ std::string const& methodName,
+ xmlrpc_c::paramList const& paramList,
+ xmlrpc_c::rpcOutcome * const outcomeP) = 0;
virtual void
start(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const methodName,
+ std::string const& methodName,
xmlrpc_c::paramList const& paramList,
xmlrpc_c::clientTransactionPtr const& tranP);
-};
-
-class connection {
-/*----------------------------------------------------------------------------
- A nexus of a particular client and a particular server, along with
- carriage parameters for performing RPCs between the two.
-
- This is a minor convenience for client programs that always talk to
- the same server the same way.
-
- Use this as a parameter to rpc.call().
------------------------------------------------------------------------------*/
-public:
- connection(xmlrpc_c::client * const clientP,
- xmlrpc_c::carriageParm * const carriageParmP);
-
- ~connection();
-
- xmlrpc_c::client * clientP;
- xmlrpc_c::carriageParm * carriageParmP;
-};
-
-class carriageParm_http0 : public carriageParm {
-
-public:
- carriageParm_http0(std::string const serverUrl);
-
- ~carriageParm_http0();
-
- void
- setBasicAuth(std::string const userid,
- std::string const password);
-
- xmlrpc_server_info * c_serverInfoP;
-
-protected:
- // Only a derived class is allowed to create an object with no
- // server URL, and the derived class expected to follow it up
- // with an instantiate() to establish the server URL.
-
- carriageParm_http0();
void
- instantiate(std::string const serverUrl);
+ finishAsync(xmlrpc_c::timeout const timeout);
+
+ virtual void
+ setInterrupt(int *);
};
-class carriageParm_curl0 : public xmlrpc_c::carriageParm_http0 {
-
+class clientPtr : public girmem::autoObjectPtr {
public:
- carriageParm_curl0(std::string const serverUrl);
-
-};
+ clientPtr();
-class carriageParm_libwww0 : public xmlrpc_c::carriageParm_http0 {
+ explicit clientPtr(xmlrpc_c::client * const clientP);
-public:
- carriageParm_libwww0(std::string const serverUrl);
+ xmlrpc_c::client *
+ operator->() const;
+ xmlrpc_c::client *
+ get() const;
};
-class carriageParm_wininet0 : public xmlrpc_c::carriageParm_http0 {
-
+class serverAccessor : public girmem::autoObject {
+
public:
- carriageParm_wininet0(std::string const serverUrl);
+ serverAccessor(xmlrpc_c::clientPtr const clientP,
+ xmlrpc_c::carriageParmPtr const carriageParmP);
-};
-
-class xmlTransactionPtr;
-
-class xmlTransaction : public girmem::autoObject {
-
- friend class xmlTransactionPtr;
-
-public:
- virtual void
- finish(std::string const& responseXml) const;
-
- virtual void
- finishErr(girerr::error const& error) const;
+ void
+ call(std::string const& methodName,
+ xmlrpc_c::paramList const& paramList,
+ xmlrpc_c::rpcOutcome * const outcomeP) const;
-protected:
- xmlTransaction();
+private:
+ xmlrpc_c::clientPtr const clientP;
+ xmlrpc_c::carriageParmPtr const carriageParmP;
};
-class xmlTransactionPtr : public girmem::autoObjectPtr {
+class serverAccessorPtr : public girmem::autoObjectPtr {
public:
- xmlTransactionPtr();
-
- xmlrpc_c::xmlTransaction *
- operator->() const;
-};
-
-class clientXmlTransport {
-/*----------------------------------------------------------------------------
- An object which transports XML to and from an XML-RPC server for an
- XML-RPC client.
+ serverAccessorPtr();
- This is a base class. Derived classes define methods to perform the
- transportation in particular ways.
------------------------------------------------------------------------------*/
-public:
- virtual ~clientXmlTransport();
+ explicit
+ serverAccessorPtr(xmlrpc_c::serverAccessor * const serverAccessorP);
- virtual void
- call(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const& callXml,
- std::string * const responseXmlP) = 0;
-
- virtual void
- start(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const& callXml,
- xmlrpc_c::xmlTransactionPtr const& xmlTranP);
-
- virtual void
- finishAsync(xmlrpc_c::timeout const timeout);
+ xmlrpc_c::serverAccessor *
+ operator->() const;
- static void
- asyncComplete(
- struct xmlrpc_call_info * const callInfoP,
- xmlrpc_mem_block * const responseXmlMP,
- xmlrpc_env const transportEnv);
+ xmlrpc_c::serverAccessor *
+ get() const;
};
-class clientXmlTransport_http : public xmlrpc_c::clientXmlTransport {
+class connection {
/*----------------------------------------------------------------------------
- A base class for client XML transports that use the simple, classic
- C HTTP transports.
------------------------------------------------------------------------------*/
-public:
- virtual ~clientXmlTransport_http();
-
- void
- call(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const& callXml,
- std::string * const responseXmlP);
-
- void
- start(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const& callXml,
- xmlrpc_c::xmlTransactionPtr const& xmlTranP);
-
- virtual void
- finishAsync(xmlrpc_c::timeout const timeout);
-
-protected:
- clientXmlTransport_http() {} // ensure no one can create
- struct xmlrpc_client_transport * c_transportP;
- const struct xmlrpc_client_transport_ops * c_transportOpsP;
-};
-
-class clientXmlTransport_curl : public xmlrpc_c::clientXmlTransport_http {
-
-public:
- clientXmlTransport_curl(std::string const networkInterface = "",
- bool const noSslVerifyPeer = false,
- bool const noSslVerifyHost = false,
- std::string const userAgent = "");
+ A nexus of a particular client and a particular server, along with
+ carriage parameters for performing RPCs between the two.
- ~clientXmlTransport_curl();
-};
+ This is a minor convenience for client programs that always talk to
+ the same server the same way.
-class clientXmlTransport_libwww : public xmlrpc_c::clientXmlTransport_http {
-
+ Use this as a parameter to rpc.call().
+-----------------------------------------------------------------------------*/
public:
- clientXmlTransport_libwww(std::string const appname = "",
- std::string const appversion = "");
-
- ~clientXmlTransport_libwww();
-};
-
-class clientXmlTransport_wininet : public xmlrpc_c::clientXmlTransport_http {
+ connection(xmlrpc_c::client * const clientP,
+ xmlrpc_c::carriageParm * const carriageParmP);
-public:
- clientXmlTransport_wininet(bool const allowInvalidSslCerts = false);
+ ~connection();
- ~clientXmlTransport_wininet();
+ xmlrpc_c::client * clientP;
+ xmlrpc_c::carriageParm * carriageParmP;
};
class client_xml : public xmlrpc_c::client {
@@ -264,23 +148,36 @@
public:
client_xml(xmlrpc_c::clientXmlTransport * const transportP);
+ client_xml(xmlrpc_c::clientXmlTransport * const transportP,
+ xmlrpc_dialect const dialect);
+
+ client_xml(xmlrpc_c::clientXmlTransportPtr const transportP);
+
+ client_xml(xmlrpc_c::clientXmlTransportPtr const transportP,
+ xmlrpc_dialect const dialect);
+
+ ~client_xml();
+
void
call(carriageParm * const carriageParmP,
- std::string const methodName,
+ std::string const& methodName,
xmlrpc_c::paramList const& paramList,
xmlrpc_c::rpcOutcome * const outcomeP);
void
start(xmlrpc_c::carriageParm * const carriageParmP,
- std::string const methodName,
+ std::string const& methodName,
xmlrpc_c::paramList const& paramList,
xmlrpc_c::clientTransactionPtr const& tranP);
void
finishAsync(xmlrpc_c::timeout const timeout);
+ virtual void
+ setInterrupt(int * interruptP);
+
private:
- xmlrpc_c::clientXmlTransport * transportP;
+ struct client_xml_impl * implP;
};
class xmlTransaction_client : public xmlrpc_c::xmlTransaction {
@@ -363,32 +260,20 @@
xmlrpc_c::fault
getFault() const;
-protected:
rpc(std::string const methodName,
xmlrpc_c::paramList const& paramList);
virtual ~rpc();
private:
- enum state {
- STATE_UNFINISHED, // RPC is running or not started yet
- STATE_ERROR, // We couldn't execute the RPC
- STATE_FAILED, // RPC executed successfully, but failed per XML-RPC
- STATE_SUCCEEDED // RPC is done, no exception
- };
- enum state state;
- girerr::error * errorP; // Defined only in STATE_ERROR
- xmlrpc_c::rpcOutcome outcome;
- // Defined only in STATE_FAILED and STATE_SUCCEEDED
- std::string methodName;
- xmlrpc_c::paramList paramList;
+ struct rpc_impl * implP;
};
class rpcPtr : public clientTransactionPtr {
public:
rpcPtr();
- rpcPtr(xmlrpc_c::rpc * const rpcP);
+ explicit rpcPtr(xmlrpc_c::rpc * const rpcP);
rpcPtr(std::string const methodName,
xmlrpc_c::paramList const& paramList);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_int.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_int.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_int.h Mon May 26 12:59:57 2008
@@ -14,24 +14,43 @@
#ifndef XMLRPC_CLIENT_INT_H_INCLUDED
#define XMLRPC_CLIENT_INT_H_INCLUDED
+#include "xmlrpc-c/util.h"
+
#ifdef __cplusplus
extern "C" {
-#endif /* __cplusplus */
+#endif
struct _xmlrpc_server_info {
- char *_server_url;
- char *_http_basic_auth;
-};
-
-/* Create a new server info record, with a copy of the old server. */
-extern xmlrpc_server_info *
-xmlrpc_server_info_copy(xmlrpc_env *env, xmlrpc_server_info *aserver);
+ const char * serverUrl;
+ struct {
+ bool basic;
+ bool digest;
+ bool gssnegotiate;
+ bool ntlm;
+ } allowedAuth;
+ const char * userNamePw;
+ /* The username/password value for HTTP, i.e. in
+ "user:password" form
+
+ This can be NULL to indicate "none", but only if 'allowedAuth'
+ doesn't allow any form of authentication.
+ */
+ const char * basicAuthHdrValue;
+ /* A complete value for an HTTP Authorization: header that
+ requests HTTP basic authentication. This exists whether
+ or not 'allowedAuth' allows basic authentication, and is
+ completely redundant with 'userNamePw'. It exists mainly
+ for historical reasons, and may also save some computation
+ when the same xmrpc_server_info is used for multiple
+ HTTP connections.
+ This is NULL exactly when 'userNamePw' is NULL.
+ */
+};
/*=========================================================================
** Transport Implementation functions.
-**=========================================================================
-*/
+**========================================================================= */
#include "xmlrpc-c/transport.h"
/* The generalized event loop. This uses the above flags. For more details,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp Mon May 26 12:59:57 2008
@@ -14,8 +14,6 @@
public:
clientSimple();
- ~clientSimple();
-
void
call(std::string const serverUrl,
std::string const methodName,
@@ -35,8 +33,7 @@
xmlrpc_c::value * const resultP);
private:
- xmlrpc_c::client * clientP;
- xmlrpc_c::clientXmlTransport * transportP;
+ xmlrpc_c::clientPtr clientP;
};
} // namespace
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp Mon May 26 12:59:57 2008
@@ -21,6 +21,11 @@
std::string _what;
};
+// throwf() always throws a girerr::error .
+
+void
+throwf(const char * const format, ...);
+
} // namespace
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp Mon May 26 12:59:57 2008
@@ -19,6 +19,7 @@
# include <pthread.h>
typedef pthread_mutex_t girmem_lock;
#else
+# include <windows.h>
typedef CRITICAL_SECTION girmem_lock;
#endif
@@ -51,14 +52,20 @@
~autoObjectPtr();
void
- instantiate(girmem::autoObject * const objectP);
-
+ point(girmem::autoObject * const objectP);
+
+ void
+ unpoint();
+
autoObjectPtr
operator=(girmem::autoObjectPtr const& objectPtr);
girmem::autoObject *
operator->() const;
+ girmem::autoObject *
+ get() const;
+
protected:
girmem::autoObject * objectP;
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp Mon May 26 12:59:57 2008
@@ -25,6 +25,7 @@
// -Bryan 2005.03.12.
+#include <cstdlib>
#include <string>
#include <xmlrpc-c/base.h>
#include <xmlrpc-c/client.h>
@@ -87,7 +88,7 @@
XmlRpcEnv (void) { xmlrpc_env_init(&mEnv); }
~XmlRpcEnv (void) { xmlrpc_env_clean(&mEnv); }
- bool faultOccurred (void) const { return mEnv.fault_occurred; };
+ bool faultOccurred (void) const {return (mEnv.fault_occurred != 0);};
bool hasFaultOccurred (void) const { return faultOccurred(); };
/* hasFaultOccurred() is for backward compatibility.
faultOccurred() is a superior name for this.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp Mon May 26 12:59:57 2008
@@ -32,15 +32,6 @@
std::string signature() const { return _signature; };
std::string help() const { return _help; };
- // self() is a strange concession to the fact that we interface with
- // C code. C code needs a regular pointer to this method, but our
- // C++ interface carefully prevents one from making such a pointer,
- // since it would be an uncounted reference. So users of self() must
- // make sure that the reference it returns is always subordinate to a
- // methodPtr reference.
-
- xmlrpc_c::method * self();
-
protected:
std::string _signature;
std::string _help;
@@ -95,8 +86,6 @@
execute(std::string const& methodName,
xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const resultP) = 0;
-
- xmlrpc_c::defaultMethod * self(); // analogous to 'method' class
};
class defaultMethodPtr : public girmem::autoObjectPtr {
@@ -108,9 +97,14 @@
xmlrpc_c::defaultMethod *
operator->() const;
+
+ xmlrpc_c::defaultMethod *
+ get() const;
};
-class registry {
+
+
+class registry : public girmem::autoObject {
/*----------------------------------------------------------------------------
An Xmlrpc-c server method registry. An Xmlrpc-c server transport
(e.g. an HTTP server) uses this object to process an incoming
@@ -131,6 +125,20 @@
void
disableIntrospection();
+
+ class shutdown {
+ public:
+ virtual ~shutdown() = 0;
+ virtual void
+ doit(std::string const& comment,
+ void * const callInfo) const = 0;
+ };
+
+ void
+ setShutdown(const shutdown * const shutdownP);
+
+ void
+ setDialect(xmlrpc_dialect const dialect);
void
processCall(std::string const& body,
@@ -145,23 +153,37 @@
private:
xmlrpc_registry * c_registryP;
- /* Pointer to the C registry object we use to implement this
- object.
- */
+ // Pointer to the C registry object we use to implement this
+ // object.
std::list<xmlrpc_c::methodPtr> methodList;
- /* This is a list of all the method objects (actually, pointers
- to them). But since the real registry is the C registry object,
- all this list is for is to maintain references to the objects
- to which the C registry points so that they continue to exist.
- */
+ // This is a list of all the method objects (actually, pointers
+ // to them). But since the real registry is the C registry object,
+ // all this list is for is to maintain references to the objects
+ // to which the C registry points so that they continue to exist.
+
xmlrpc_c::defaultMethodPtr defaultMethodP;
- /* The real identifier of the default method is the C registry
- object; this member exists only to maintain a reference to the
- object to which the C registry points so that it will continue
- to exist.
- */
+ // The real identifier of the default method is the C registry
+ // object; this member exists only to maintain a reference to the
+ // object to which the C registry points so that it will continue
+ // to exist.
};
+
+
+class registryPtr : public girmem::autoObjectPtr {
+
+public:
+ registryPtr();
+
+ registryPtr(xmlrpc_c::registry * const registryP);
+
+ xmlrpc_c::registry *
+ operator->() const;
+
+ xmlrpc_c::registry *
+ get() const;
+};
+
} // namespace
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server.h Mon May 26 12:59:57 2008
@@ -9,145 +9,121 @@
extern "C" {
#endif
-/*=========================================================================
-** XML-RPC Server Method Registry
-**=========================================================================
-** A method registry maintains a list of functions, and handles
-** dispatching. To build an XML-RPC server, just add an XML-RPC protocol
-** driver.
-**
-** Methods are C functions which take some combination of the following
-** parameters. All pointers except user_data belong to the library, and
-** must not be freed by the callback or used after the callback returns.
-**
-** env: An XML-RPC error-handling environment. No faults will be
-** set when the function is called. If an error occurs,
-** set an appropriate fault and return NULL. (If a fault is
-** set, the NULL return value will be enforced!)
-** host: The 'Host:' header passed by the XML-RPC client, or NULL,
-** if no 'Host:' header has been provided.
-** method_name: The name used to call this method.
-** user_data: The user_data used to register this method.
-** param_array: The parameters passed to this function, stored in an
-** XML-RPC array. You are *not* responsible for calling
-** xmlrpc_DECREF on this array.
-**
-** Return value: If no fault has been set, the function must return a
-** valid xmlrpc_value. This will be serialized, returned
-** to the caller, and xmlrpc_DECREF'd.
-*/
-
-/* A function to call before invoking a method for doing things like access
-** control or sanity checks. If a fault is set from this function, the
-** method will not be called and the fault will be returned. */
+typedef struct xmlrpc_registry xmlrpc_registry;
+
typedef void
-(*xmlrpc_preinvoke_method)(xmlrpc_env * env,
- const char * method_name,
- xmlrpc_value * param_array,
- void * user_data);
+(*xmlrpc_preinvoke_method)(xmlrpc_env * const envP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ void * const userData);
-/* An ordinary method. */
typedef xmlrpc_value *
-(*xmlrpc_method)(xmlrpc_env * env,
- xmlrpc_value * param_array,
- void * user_data);
+(*xmlrpc_method1)(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
+ void * const serverInfo);
-/* A default method to call if no method can be found. */
typedef xmlrpc_value *
-(*xmlrpc_default_method)(xmlrpc_env * env,
- const char * host,
- const char * method_name,
- xmlrpc_value * param_array,
- void * user_data);
+(*xmlrpc_method2)(xmlrpc_env * const envP,
+ xmlrpc_value * const paramArrayP,
+ void * const serverInfo,
+ void * const callInfo);
-/* Our registry structure. This has no public members. */
-typedef struct _xmlrpc_registry xmlrpc_registry;
+typedef xmlrpc_method1 xmlrpc_method; /* backward compatibility */
+
+typedef xmlrpc_value *
+(*xmlrpc_default_method)(xmlrpc_env * const envP,
+ const char * const callInfoP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ void * const serverInfo);
+
+extern unsigned int const xmlrpc_server_version_major;
+extern unsigned int const xmlrpc_server_version_minor;
+extern unsigned int const xmlrpc_server_version_point;
-/* Create a new method registry. */
xmlrpc_registry *
-xmlrpc_registry_new(xmlrpc_env * env);
+xmlrpc_registry_new(xmlrpc_env * const envP);
-/* Delete a method registry. */
void
-xmlrpc_registry_free(xmlrpc_registry * registry);
+xmlrpc_registry_free(xmlrpc_registry * const registryP);
-/* Disable introspection. The xmlrpc_registry has introspection
-** capability built-in. If you want to make nosy people work harder,
-** you can turn this off. */
void
-xmlrpc_registry_disable_introspection(xmlrpc_registry * registry);
+xmlrpc_registry_disable_introspection(xmlrpc_registry * const registryP);
-/* Register a method. The host parameter must be NULL (for now). You
-** are responsible for owning and managing user_data. The registry
-** will make internal copies of any other pointers it needs to
-** keep around. */
void
-xmlrpc_registry_add_method(xmlrpc_env * env,
- xmlrpc_registry * registry,
- const char * host,
- const char * method_name,
- xmlrpc_method method,
- void * user_data);
+xmlrpc_registry_add_method(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ const char * const host,
+ const char * const methodName,
+ xmlrpc_method const method,
+ void * const serverInfo);
+
+void
+xmlrpc_registry_add_method_w_doc(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ const char * const host,
+ const char * const methodName,
+ xmlrpc_method const method,
+ void * const serverInfo,
+ const char * const signatureString,
+ const char * const help);
+
+void
+xmlrpc_registry_add_method2(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ const char * const methodName,
+ xmlrpc_method2 method,
+ const char * const signatureString,
+ const char * const help,
+ void * const serverInfo);
+
+void
+xmlrpc_registry_set_default_method(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ xmlrpc_default_method const handler,
+ void * const userData);
+
+void
+xmlrpc_registry_set_preinvoke_method(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ xmlrpc_preinvoke_method const method,
+ void * const userData);
+
+
+typedef void xmlrpc_server_shutdown_fn(xmlrpc_env * const envP,
+ void * const context,
+ const char * const comment,
+ void * const callInfo);
+
+void
+xmlrpc_registry_set_shutdown(xmlrpc_registry * const registryP,
+ xmlrpc_server_shutdown_fn * const shutdownFn,
+ void * const context);
+
+void
+xmlrpc_registry_set_dialect(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ xmlrpc_dialect const dialect);
+
+/*----------------------------------------------------------------------------
+ Lower interface -- services to be used by an HTTP request handler
+-----------------------------------------------------------------------------*/
+
+void
+xmlrpc_registry_process_call2(xmlrpc_env * const envP,
+ xmlrpc_registry * const registryP,
+ const char * const xmlData,
+ size_t const xmlLen,
+ void * const callInfo,
+ xmlrpc_mem_block ** const outputPP);
-/* As above, but allow the user to supply introspection information.
-**
-** Signatures use their own little description language. It consists
-** of one-letter type code (similar to the ones used in xmlrpc_parse_value)
-** for the result, a colon, and zero or more one-letter type codes for
-** the parameters. For example:
-** i:ibdsAS86
-** If a function has more than one possible prototype, separate them with
-** commas:
-** i:,i:s,i:ii
-** If the function signature can't be represented using this language,
-** pass a single question mark:
-** ?
-** Help strings are ASCII text, and may contain HTML markup. */
-void
-xmlrpc_registry_add_method_w_doc(xmlrpc_env * env,
- xmlrpc_registry * registry,
- const char * host,
- const char * method_name,
- xmlrpc_method method,
- void * user_data,
- const char * signature,
- const char * help);
-
-/* Given a registry, a host name, and XML data; parse the <methodCall>,
-** find the appropriate method, call it, serialize the response, and
-** return it as an xmlrpc_mem_block. Most errors will be serialized
-** as <fault> responses. If a *really* bad error occurs, set a fault and
-** return NULL. (Actually, we currently give up with a fatal error,
-** but that should change eventually.)
-** The caller is responsible for destroying the memory block. */
xmlrpc_mem_block *
xmlrpc_registry_process_call(xmlrpc_env * const envP,
xmlrpc_registry * const registryP,
const char * const host,
- const char * const xml_data,
- size_t const xml_len);
-
-/* Define a default method for the specified registry. This will be invoked
-** if no other method matches. The user_data pointer is property of the
-** application, and will not be freed or manipulated by the registry. */
-void
-xmlrpc_registry_set_default_method(xmlrpc_env * env,
- xmlrpc_registry * registry,
- xmlrpc_default_method handler,
- void * user_data);
-
-/* Define a preinvoke method for the specified registry. This function will
-** be called before any method (either the default or a registered one) is
-** invoked. Applications can use this to do things like access control or
-** sanity checks. The user_data pointer is property of the application,
-** and will not be freed or manipulated by the registry. */
-void
-xmlrpc_registry_set_preinvoke_method(xmlrpc_env * env,
- xmlrpc_registry * registry,
- xmlrpc_preinvoke_method method,
- void * user_data);
+ const char * const xmlData,
+ size_t const xmlLen);
-
#ifdef __cplusplus
}
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h Mon May 26 12:59:57 2008
@@ -1,33 +1,43 @@
+/*============================================================================
+ server_abyss.h
+==============================================================================
+ This declares the user interface to libxmlrpc_server_abyss, which
+ provides facilities for running an XML-RPC server based on the Xmlrpc-c
+ Abyss HTTP server.
+============================================================================*/
+
/* Copyright and license information is at the end of the file */
#ifndef XMLRPC_SERVER_ABYSS_H_INCLUDED
#define XMLRPC_SERVER_ABYSS_H_INCLUDED
-#include "xmlrpc-c/server.h"
+#ifdef WIN32
+#include <winsock.h> /* For XMLRPC_SOCKET (= SOCKET) */
+#endif
+
+#include <xmlrpc-c/config.h> /* For XMLRPC_SOCKET */
+#include <xmlrpc-c/abyss.h>
+#include <xmlrpc-c/server.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-struct _TServer;
-
-/*=========================================================================
-** XML-RPC Server (based on Abyss)
-**=========================================================================
-** A simple XML-RPC server based on the Abyss web server. If errors
-** occur during server setup, the server will exit. In general, if you
-** want to use this API, you'll need to be familiar with Abyss.
-**
-** There are two ways to use Abyss:
-** 1) You can use the handy wrapper functions.
-** 2) You can set up Abyss yourself, and install the appropriate
-** handlers manually.
-*/
-
#define XMLRPC_SERVER_ABYSS_NO_FLAGS (0)
+/*=========================================================================
+** Global Initialization/Termination.
+**
+** These are not thread-safe. You call them at the beginning and end
+** of your program, when it is only one thread.
+**=======================================================================*/
+
+void
+xmlrpc_server_abyss_global_init(xmlrpc_env * const envP);
+void
+xmlrpc_server_abyss_global_term(void);
/*=========================================================================
** Basic Abyss Server Functions
@@ -53,7 +63,11 @@
unsigned int keepalive_max_conn;
unsigned int timeout;
xmlrpc_bool dont_advertise;
-
+ xmlrpc_bool socket_bound;
+ XMLRPC_SOCKET socket_handle;
+ const char * uri_path;
+ xmlrpc_bool chunk_response;
+ xmlrpc_bool enable_shutdown;
} xmlrpc_server_abyss_parms;
@@ -62,23 +76,81 @@
/* XMLRPC_APSIZE(xyz) is the minimum size a struct xmlrpc_server_abyss_parms
must be to include the 'xyz' member. This is essential to forward and
- backward compatbility, as new members will be added to the end of the
+ backward compatibility, as new members will be added to the end of the
struct in future releases. This is how the callee knows whether or
not the caller is new enough to have supplied a certain parameter.
*/
+/*=========================================================================
+** Simple server with Abyss under the covers
+**=======================================================================*/
+
void
xmlrpc_server_abyss(xmlrpc_env * const envP,
const xmlrpc_server_abyss_parms * const parms,
unsigned int const parm_size);
+/*=========================================================================
+** Object-oriented XML-RPC server with Abyss under the covers
+**=======================================================================*/
+
+typedef struct xmlrpc_server_abyss xmlrpc_server_abyss_t;
+
+void
+xmlrpc_server_abyss_create(xmlrpc_env * const envP,
+ const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ xmlrpc_server_abyss_t ** const serverPP);
+
+void
+xmlrpc_server_abyss_destroy(xmlrpc_server_abyss_t * const serverP);
+
+void
+xmlrpc_server_abyss_run_server(xmlrpc_env * const envP,
+ xmlrpc_server_abyss_t * const serverP);
+
+void
+xmlrpc_server_abyss_terminate(xmlrpc_env * const envP,
+ xmlrpc_server_abyss_t * const serverP);
+
+void
+xmlrpc_server_abyss_reset_terminate(xmlrpc_env * const envP,
+ xmlrpc_server_abyss_t * const serverP);
+
+void
+xmlrpc_server_abyss_use_sigchld(xmlrpc_server_abyss_t * const serverP);
+
+
+typedef struct xmlrpc_server_abyss_sig xmlrpc_server_abyss_sig;
+
+void
+xmlrpc_server_abyss_setup_sig(
+ xmlrpc_env * const envP,
+ xmlrpc_server_abyss_t * const serverP,
+ xmlrpc_server_abyss_sig ** const oldHandlersPP);
+
+void
+xmlrpc_server_abyss_restore_sig(
+ const xmlrpc_server_abyss_sig * const oldHandlersP);
+
+
+
+/*=========================================================================
+** Functions to make an XML-RPC server out of your own Abyss server
+**=======================================================================*/
+
+void
+xmlrpc_server_abyss_set_handlers2(TServer * const srvP,
+ const char * const filename,
+ xmlrpc_registry * const registryP);
+
void
-xmlrpc_server_abyss_set_handlers(struct _TServer * const srvP,
+xmlrpc_server_abyss_set_handlers(TServer * const serverP,
xmlrpc_registry * const registryP);
void
xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP,
- struct _TServer * const srvP,
+ TServer * const serverP,
const char * const filename,
xmlrpc_registry * const registryP);
@@ -109,8 +181,8 @@
** function.
**/
void
-xmlrpc_server_abyss_run_first(void (runfirst(void *)),
- void * const runfirstArg);
+xmlrpc_server_abyss_run_first(runfirstFn const runfirst,
+ void * const runfirstArg);
/*=========================================================================
** Method Registry
@@ -145,18 +217,18 @@
/* A quick & easy shorthand for adding a method. Depending on
** how you've configured your copy of Abyss, it's probably not safe to
** call this method after calling xmlrpc_server_abyss_run. */
-void xmlrpc_server_abyss_add_method (char *method_name,
- xmlrpc_method method,
- void *user_data);
+void xmlrpc_server_abyss_add_method (char * const method_name,
+ xmlrpc_method const method,
+ void * const user_data);
/* As above, but provide documentation (see xmlrpc_registry_add_method_w_doc
** for more information). You should really use this one. */
extern void
-xmlrpc_server_abyss_add_method_w_doc (char *method_name,
- xmlrpc_method method,
- void *user_data,
- char *signature,
- char *help);
+xmlrpc_server_abyss_add_method_w_doc (char * const method_name,
+ xmlrpc_method const method,
+ void * const user_data,
+ char * const signature,
+ char * const help);
/*=========================================================================
** Content Handlers
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp Mon May 26 12:59:57 2008
@@ -1,5 +1,11 @@
#ifndef SERVER_ABYSS_HPP_INCLUDED
#define SERVER_ABYSS_HPP_INCLUDED
+
+#ifdef WIN32
+#include <winsock.h> // For XMLRPC_SOCKET (= SOCKET)
+#endif
+
+#include "xmlrpc-c/config.h" // For XMLRPC_SOCKET
#include "xmlrpc-c/base.hpp"
#include "abyss.h"
@@ -8,6 +14,52 @@
class serverAbyss {
public:
+ class constrOpt {
+ public:
+ constrOpt();
+
+ constrOpt & registryPtr (xmlrpc_c::registryPtr const& arg);
+ constrOpt & registryP (const xmlrpc_c::registry * const& arg);
+ constrOpt & socketFd (XMLRPC_SOCKET const& arg);
+ constrOpt & portNumber (unsigned int const& arg);
+ constrOpt & logFileName (std::string const& arg);
+ constrOpt & keepaliveTimeout (unsigned int const& arg);
+ constrOpt & keepaliveMaxConn (unsigned int const& arg);
+ constrOpt & timeout (unsigned int const& arg);
+ constrOpt & dontAdvertise (bool const& arg);
+ constrOpt & uriPath (std::string const& arg);
+ constrOpt & chunkResponse (bool const& arg);
+
+ struct value {
+ xmlrpc_c::registryPtr registryPtr;
+ const xmlrpc_c::registry * registryP;
+ XMLRPC_SOCKET socketFd;
+ unsigned int portNumber;
+ std::string logFileName;
+ unsigned int keepaliveTimeout;
+ unsigned int keepaliveMaxConn;
+ unsigned int timeout;
+ bool dontAdvertise;
+ std::string uriPath;
+ bool chunkResponse;
+ } value;
+ struct {
+ bool registryPtr;
+ bool registryP;
+ bool socketFd;
+ bool portNumber;
+ bool logFileName;
+ bool keepaliveTimeout;
+ bool keepaliveMaxConn;
+ bool timeout;
+ bool dontAdvertise;
+ bool uriPath;
+ bool chunkResponse;
+ } present;
+ };
+
+ serverAbyss(constrOpt const& opt);
+
serverAbyss(
xmlrpc_c::registry const& registry,
unsigned int const portNumber = 8080,
@@ -15,32 +67,67 @@
unsigned int const keepaliveTimeout = 0,
unsigned int const keepaliveMaxConn = 0,
unsigned int const timeout = 0,
- bool const dontAdvertise = false
+ bool const dontAdvertise = false,
+ bool const socketBound = false,
+ XMLRPC_SOCKET const socketFd = 0
);
~serverAbyss();
- void run();
+ void
+ run();
+
+ void
+ runOnce();
+
+ void
+ runConn(int const socketFd);
+
+ void
+ terminate();
+ class shutdown : public xmlrpc_c::registry::shutdown {
+ public:
+ shutdown(xmlrpc_c::serverAbyss * const severAbyssP);
+ virtual ~shutdown();
+ void doit(std::string const& comment, void * const callInfo) const;
+ private:
+ xmlrpc_c::serverAbyss * const serverAbyssP;
+ };
+
private:
- // We rely on the creator to keep the registry object around as
- // long as the server object is, so that this pointer is valid.
- // We need to use some kind of automatic handle instead.
-
- const xmlrpc_c::registry * registryP;
-
- std::string configFileName;
- std::string logFileName;
- unsigned int portNumber;
- unsigned int keepaliveTimeout;
- unsigned int keepaliveMaxConn;
- unsigned int timeout;
- bool dontAdvertise;
+ // The user has the choice of supplying the registry by plain pointer
+ // (and managing the object's existence himself) or by autoObjectPtr
+ // (with automatic management). 'registryPtr' exists here only to
+ // maintain a reference count in the case that the user supplied an
+ // autoObjectPtr. The object doesn't reference the C++ registry
+ // object except during construction, because the C registry is the
+ // real registry.
+ xmlrpc_c::registryPtr registryPtr;
+
+ TServer cServer;
+
+ void
+ setAdditionalServerParms(constrOpt const& opt);
+
+ void
+ initialize(constrOpt const& opt);
};
void
server_abyss_set_handlers(TServer * const srvP,
- xmlrpc_c::registry const& registry);
+ xmlrpc_c::registry const& registry,
+ std::string const& uriPath = "/RPC2");
+
+void
+server_abyss_set_handlers(TServer * const srvP,
+ const xmlrpc_c::registry * const registryP,
+ std::string const& uriPath = "/RPC2");
+
+void
+server_abyss_set_handlers(TServer * const srvP,
+ xmlrpc_c::registryPtr const registryPtr,
+ std::string const& uriPath = "/RPC2");
} // namespace
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp Mon May 26 12:59:57 2008
@@ -8,9 +8,10 @@
timeout() : finite(false) {}
timeout(unsigned int const duration) : duration(duration) {}
+ // 'duration' is the timeout time in milliseconds
bool finite;
- unsigned int duration;
+ unsigned int duration; // in milliseconds
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/transport.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/transport.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/transport.h Mon May 26 12:59:57 2008
@@ -6,7 +6,8 @@
extern "C" {
#endif
-#include "xmlrpc-c/base.h"
+#include <xmlrpc-c/util.h>
+#include <xmlrpc-c/client.h>
struct xmlrpc_call_info;
@@ -16,12 +17,16 @@
** Transport function type declarations.
**=========================================================================
*/
+typedef void (*xmlrpc_transport_setup)(xmlrpc_env * const envP);
+
+typedef void (*xmlrpc_transport_teardown)(void);
+
typedef void (*xmlrpc_transport_create)(
xmlrpc_env * const envP,
int const flags,
const char * const appname,
const char * const appversion,
- const struct xmlrpc_xportparms * const transportparmsP,
+ const void * const transportparmsP,
size_t const transportparm_size,
struct xmlrpc_client_transport ** const handlePP);
@@ -58,14 +63,20 @@
xmlrpc_timeoutType const timeoutType,
xmlrpc_timeout const timeout);
+typedef void (*xmlrpc_transport_set_interrupt)(
+ struct xmlrpc_client_transport * const clientTransportP,
+ int * const interruptP);
struct xmlrpc_client_transport_ops {
+ xmlrpc_transport_setup setup_global_const;
+ xmlrpc_transport_teardown teardown_global_const;
xmlrpc_transport_create create;
xmlrpc_transport_destroy destroy;
xmlrpc_transport_send_request send_request;
xmlrpc_transport_call call;
xmlrpc_transport_finish_asynch finish_asynch;
+ xmlrpc_transport_set_interrupt set_interrupt;
};
#ifdef __cplusplus
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp Mon May 26 12:59:57 2008
@@ -13,6 +13,12 @@
std::string * const callXmlP);
void
+generateCall(std::string const& methodName,
+ xmlrpc_c::paramList const& paramList,
+ xmlrpc_dialect const dialect,
+ std::string * const callXmlP);
+
+void
parseSuccessfulResponse(std::string const& responseXml,
xmlrpc_c::value * const resultP);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h Mon May 26 12:59:57 2008
@@ -27,11 +27,12 @@
typedef struct _xml_element xml_element;
/* Destroy an xml_element. */
-void xml_element_free (xml_element *elem);
+void xml_element_free (xml_element * const elem);
/* Return a pointer to the element's name. Do not free this pointer!
** This pointer should point to standard ASCII or UTF-8 data. */
-char *xml_element_name (xml_element *elem);
+const char *
+xml_element_name(const xml_element * const elemP);
/* Return the xml_element's CDATA. Do not free this pointer!
** This pointer should point to standard ASCII or UTF-8 data.
@@ -46,8 +47,11 @@
char *xml_element_cdata (xml_element *elem);
/* Return the xml_element's child elements. Do not free this pointer! */
-size_t xml_element_children_size (xml_element *elem);
-xml_element **xml_element_children (xml_element *elem);
+size_t
+xml_element_children_size(const xml_element * const elemP);
+
+xml_element **
+xml_element_children(const xml_element * const elemP);
/*=========================================================================
@@ -58,7 +62,11 @@
** You are responsible for calling xml_element_free on the returned pointer.
*/
-xml_element *xml_parse (xmlrpc_env *env, const char *xml_data, int xml_len);
+void
+xml_parse(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen,
+ xml_element ** const resultPP);
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/Makefile Mon May 26 12:59:57 2008
@@ -1,11 +1,15 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/..
-endif
-SUBDIR = lib
-
-include $(SRCDIR)/Makefile.config
-
-SUBDIRS = util
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ SRCDIR := $(call updir,$(CURDIR))
+ BLDDIR := $(SRCDIR)
+endif
+SUBDIR := lib
+
+include $(BLDDIR)/config.mk
+
+# Build up SUBDIRS:
+SUBDIRS =
+SUBDIRS += util libutil
ifeq ($(ENABLE_ABYSS_SERVER),yes)
SUBDIRS += abyss
endif
@@ -18,36 +22,37 @@
ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
SUBDIRS += libwww_transport
endif
-ifneq ($(ENABLE_LIBXML2),yes)
+ifneq ($(ENABLE_LIBXML2_BACKEND),yes)
SUBDIRS += expat
endif
default: all
-.PHONY: all
+.PHONY: all clean distclean tags distdir install check dep
+
all: $(SUBDIRS:%=%/all)
-.PHONY: clean
+# Extra dependencies to make parallel make work in spite of all the submakes
+# (See top level make file for details)
+abyss/all curl_transport/all: $(BLDDIR)/version.h
+
clean: $(SUBDIRS:%=%/clean) clean-common
-.PHONY: distclean
distclean: $(SUBDIRS:%=%/distclean) distclean-common
-.PHONY: tags
tags: $(SUBDIRS:%=%/tags) TAGS
DISTFILES =
-.PHONY: distdir
distdir: distdir-common
-.PHONY: install
install: $(SUBDIRS:%=%/install)
-.PHONY: dep
+check:
+
dep: $(SUBDIRS:%=%/dep)
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/Makefile Mon May 26 12:59:57 2008
@@ -1,9 +1,12 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ LIBDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
-SUBDIR = lib/abyss
+SUBDIR := lib/abyss
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
SUBDIRS = src
@@ -32,7 +35,7 @@
.PHONY: dep
dep: $(SUBDIRS:%=%/dep)
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/Makefile Mon May 26 12:59:57 2008
@@ -1,52 +1,102 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ ABYSSDIR := $(call updir,$(CURDIR))
+ LIBDIR := $(call updir,$(ABYSSDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
-SUBDIR = lib/abyss/src
+SUBDIR := lib/abyss/src
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
+
+default: all
+
+TARGET_LIBRARY_NAMES := libxmlrpc_abyss
+
+STATIC_LIBRARIES_TO_INSTALL = libxmlrpc_abyss.a
+
+SHARED_LIBS_TO_BUILD := libxmlrpc_abyss
+SHARED_LIBS_TO_INSTALL := libxmlrpc_abyss
-CFLAGS = $(CFLAGS_COMMON)
-CFLAGS += -D_UNIX
-ifeq ($(ENABLE_ABYSS_THREADS),yes)
-CFLAGS += -D_THREAD
-endif
-CFLAGS +=
-CFLAGS += $(CFLAGS_PERSONAL) $(CADD)
-LIBLDFLAGS = $(LDFLAGS_VERSINFO) -rpath $(LIBINST_DIR)
ifeq ($(ENABLE_ABYSS_THREADS),yes)
-LIBLDFLAGS += -lpthread
+ THREAD_MODULE = thread_pthread
+else
+ THREAD_MODULE = thread_fork
endif
-LIBLDFLAGS += $(LADD)
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include
+TARGET_MODS = \
+ channel \
+ chanswitch \
+ conf \
+ conn \
+ data \
+ date \
+ file \
+ handler \
+ http \
+ init \
+ response \
+ server \
+ session \
+ socket \
+ socket_unix \
+ token \
+ $(THREAD_MODULE) \
+ trace \
+
+OMIT_ABYSS_LIB_RULE = Y
+MAJ=3
+ # Major number of shared libraries in this directory
+
+include $(SRCDIR)/common.mk
+
+CFLAGS = $(CFLAGS_COMMON) -D_UNIX $(CFLAGS_PERSONAL) $(CADD)
+
+INCLUDES = -Iblddir -Isrcdir -Isrcdir/include -Isrcdir/lib/util/include
+
+ABYSS_SHLIB = $(call shlibfn,libxmlrpc_abyss)
+#ABYSS_SHLIB is e.g. libxmlrpc_abyss.so.3.1
+ABYSS_SHLIBLE = $(call shliblefn,libxmlrpc_abyss)
+#ABYSS_SHLIBLE is e.g. libxmlrpc_abyss.so
+
+# LIBDEP is the shared libraries on which libxmlrpc_abyss depends.
+# The runtime loader should load these libraries when it loads libxmlrpc_abyss.
+
+LIBDEP = $(LIBXMLRPC_UTIL)
+
+ifneq ($(SHARED_LIB_TYPE),NONE)
+ TARGET_SHARED_LIBS := $(ABYSS_SHLIB) $(ABYSS_SHLIBLE)
+ endif
-LTLIBRARIES_TO_INSTALL = libxmlrpc_abyss.la
+# This 'common.mk' dependency makes sure the symlinks get built before
+# this make file is used for anything.
-default: all
+$(SRCDIR)/common.mk: srcdir blddir
.PHONY: all
-all: libxmlrpc_abyss.la
+all: libxmlrpc_abyss.a $(TARGET_SHARED_LIBS) $(TARGET_SHARED_LE_LIBS)
-ABYSS_OBJS = \
- conf.lo \
- data.lo \
- token.lo \
- trace.lo \
- file.lo \
- thread.lo \
- http.lo \
- socket.lo \
- server.lo \
- conn.lo \
-
-
-libxmlrpc_abyss.la: $(ABYSS_OBJS)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
-
-$(ABYSS_OBJS):%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) \
- $(CFLAGS) $<
+# Rule for this is in common.mk, courtesy of TARGET_SHARED_LIBRARIES:
+$(ABYSS_SHLIB): $(TARGET_MODS:%=%.osh) $(LIBDEP)
+$(ABYSS_SHLIB): LIBOBJECTS = $(TARGET_MODS:%=%.osh) $(LIBDEP)
+
+# Rule for this is in common.mk, courtesy of TARGET_STATIC_LIBRARIES:
+
+libxmlrpc_abyss.a: $(TARGET_MODS:%=%.o)
+libxmlrpc_abyss.a: LIBOBJECTS = $(TARGET_MODS:%=%.o)
+
+#-----------------------------------------------------------------------------
+# RULES TO COMPILE OBJECT MODULES FOR LIBRARIES
+#-----------------------------------------------------------------------------
+
+# Rules to compile object modules from which to build the static and shared
+# Abyss library are in common.mk, courtesy of TARGET_MODS.
+
+
+# Need this dependency for those who don't use Makefile.depend.
+# Without it, version.h doesn't get created.
+response.o response.osh handler.o handler.osh: version.h
.PHONY: clean
clean: clean-common
@@ -66,6 +116,4 @@
.PHONY: dep
dep: dep-common
-include $(SRCDIR)/Makefile.common
-
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conf.c Mon May 26 12:59:57 2008
@@ -36,7 +36,7 @@
#include <stdio.h>
#include <string.h>
-#if defined(ABYSS_WIN32) && !defined(__BORLANDC__)
+#if defined(WIN32) && !defined(__BORLANDC__)
#include <direct.h>
#endif
@@ -44,7 +44,15 @@
#include <pwd.h>
#endif
+#include "xmlrpc_config.h"
+#include "bool.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/abyss.h"
+#include "trace.h"
+#include "file.h"
+#include "server.h"
+#include "http.h"
+#include "handler.h"
/*********************************************************************
** Configuration Files Parsing Functions
@@ -52,46 +60,59 @@
-static abyss_bool
-ConfReadLine(TFile *f,char *buffer,uint32_t len) {
- abyss_bool r=TRUE;
- char c,*p,*z=buffer;
-
- while ((--len)>0)
- {
- if (FileRead(f,buffer,1)<1)
- {
- if (z==buffer)
- r=FALSE;
+static bool
+ConfReadLine(TFile * const fileP,
+ char * const buffer,
+ uint32_t const lenArg) {
+
+ bool r;
+ char c;
+ char * p;
+ char * z;
+ uint32_t len;
+
+ len = lenArg; /* initial value */
+ r = TRUE; /* initial value */
+ z = buffer; /* initial value */
+
+ while (--len > 0) {
+ int32_t bytesRead;
+
+ bytesRead = FileRead(fileP, z, 1);
+ if (bytesRead < 1) {
+ if (z == buffer)
+ r = FALSE;
break;
};
- if ((*buffer==CR) || (*buffer==LF) )
+ if (*z == CR || *z == LF)
break;
- buffer++;
- };
+ ++z;
+ }
- if (len==0)
- while (FileRead(f,&c,1)==1)
- if ((c==CR) || (c==LF))
+ if (len == 0)
+ while (FileRead(fileP, &c, 1) == 1)
+ if (c == CR || c == LF)
break;
- *buffer='\0';
+ *buffer = '\0';
/* Discard comments */
- p=strchr(z,'#');
+ p = strchr(z, '#');
if (p)
- *p='\0';
+ *p = '\0';
return r;
}
-static abyss_bool
-ConfNextToken(char **p) {
+
+
+static bool
+ConfNextToken(char ** const p) {
+
while (1)
- switch (**p)
- {
+ switch (**p) {
case '\t':
case ' ':
(*p)++;
@@ -130,213 +151,251 @@
};
}
-static abyss_bool
-ConfReadInt(char *p,int32_t *n,int32_t min,int32_t max) {
- char *e;
+static bool
+ConfReadInt(const char * const p,
+ int32_t * const n,
+ int32_t const min,
+ int32_t const max) {
+/*----------------------------------------------------------------------------
+ Convert string 'p' to integer *n.
+
+ If it isn't a valid integer or is not with the bounds [min, max],
+ return FALSE. Otherwise, return TRUE.
+-----------------------------------------------------------------------------*/
+ char * e;
- *n=strtol(p,&e,10);
+ *n = strtol(p, &e, 10);
- if (min!=max)
- return ((e!=p) && (*n>=min) && (*n<=max));
+ if (min != max)
+ return ((e != p) && (*n >= min) && (*n <= max));
else
- return (e!=p);
+ return (e != p);
}
-static abyss_bool
-ConfReadBool(char *p, abyss_bool *b) {
- if (strcasecmp(p,"yes")==0)
- {
- *b=TRUE;
- return TRUE;
- };
- if (strcasecmp(p,"no")==0)
- {
- *b=FALSE;
- return TRUE;
- };
- return FALSE;
+static bool
+ConfReadBool(const char * const token,
+ bool * const bP) {
+
+ bool succeeded;
+
+ if (xmlrpc_strcaseeq(token, "yes")) {
+ *bP = TRUE;
+ succeeded = TRUE;
+ } else if (xmlrpc_strcaseeq(token, "no")) {
+ *bP = FALSE;
+ succeeded = TRUE;
+ } else
+ succeeded = FALSE;
+
+ return succeeded;
}
/*********************************************************************
** MIME Types File
*********************************************************************/
-abyss_bool ConfReadMIMETypes(char *filename)
-{
- TFile f;
- char z[512],*p;
- char *mimetype,*ext;
-
- if (!FileOpen(&f,filename,O_RDONLY))
- return FALSE;
-
- while (ConfReadLine(&f,z,512))
- {
- p=z;
-
- if (ConfNextToken(&p)) {
- mimetype=ConfGetToken(&p);
- if (mimetype) {
- while (ConfNextToken(&p)) {
- ext=ConfGetToken(&p);
- if (ext)
- MIMETypeAdd(mimetype,ext);
- else
- break;
+static void
+readMIMETypesFile(const char * const filename,
+ MIMEType ** const MIMETypePP) {
+
+ bool success;
+ MIMEType * MIMETypeP;
+
+ MIMETypeP = MIMETypeCreate();
+ if (MIMETypeP) {
+ TFile * fileP;
+ bool fileOpened;
+
+ fileOpened = FileOpen(&fileP, filename, O_RDONLY);
+ if (fileOpened) {
+ char z[512];
+ while (ConfReadLine(fileP, z, 512)) {
+ char * p;
+ p = &z[0];
+
+ if (ConfNextToken(&p)) {
+ const char * mimetype = ConfGetToken(&p);
+ if (mimetype) {
+ while (ConfNextToken(&p)) {
+ const char * const ext = ConfGetToken(&p);
+ if (ext)
+ MIMETypeAdd2(MIMETypeP, mimetype, ext);
+ else
+ break;
+ }
+ }
}
}
- }
- };
+ FileClose(fileP);
+ success = TRUE;
+ } else
+ success = FALSE;
+ if (!success)
+ MIMETypeDestroy(MIMETypeP);
+ } else
+ success = FALSE;
- FileClose(&f);
- return TRUE;
+ if (success)
+ *MIMETypePP = MIMETypeP;
+ else
+ *MIMETypePP = NULL;
}
/*********************************************************************
** Server Configuration File
*********************************************************************/
-abyss_bool ConfReadServerFile(const char *filename,TServer *srv)
-{
- TFile f;
- char z[512],*p;
- char *option;
- int32_t n,line=0;
+static void
+chdirx(const char * const newdir,
+ bool * const successP) {
+
+#if defined(WIN32) && !defined(__BORLANDC__)
+ *successP = _chdir(newdir) == 0;
+#else
+ *successP = chdir(newdir) == 0;
+#endif
+}
+
+
+
+static void
+parseUser(const char * const p,
+ struct _TServer * const srvP) {
+#ifdef _UNIX
+ if (p[0] == '#') {
+ int32_t n;
+
+ if (!ConfReadInt(&p[1], &n, 0, 0))
+ TraceExit("Bad user number '%s'", p);
+ else
+ srvP->uid = n;
+ } else {
+ struct passwd * pwd;
+
+ if (!(pwd = getpwnam(p)))
+ TraceExit("Unknown user '%s'", p);
+
+ srvP->uid = pwd->pw_uid;
+ if ((int)srvP->gid==(-1))
+ srvP->gid = pwd->pw_gid;
+ };
+#else
+ TraceMsg("User option ignored");
+#endif /* _UNIX */
+}
+
+
+
+static void
+parsePidfile(const char * const p,
+ struct _TServer * const srvP) {
+#ifdef _UNIX
+ bool succeeded;
+ succeeded = FileOpenCreate(&srvP->pidfileP, p, O_TRUNC | O_WRONLY);
+ if (!succeeded) {
+ srvP->pidfileP = NULL;
+ TraceMsg("Bad PidFile value '%s'", p);
+ };
+#else
+ TraceMsg("PidFile option ignored");
+#endif /* _UNIX */
+}
+
+
+
+abyss_bool
+ConfReadServerFile(const char * const filename,
+ TServer * const serverP) {
+
+ struct _TServer * const srvP = serverP->srvP;
+ BIHandler * const handlerP = srvP->builtinHandlerP;
+
+ TFile * fileP;
+ char z[512];
+ char * p;
+ unsigned int lineNum;
TFileStat fs;
- if (!FileOpen(&f,filename,O_RDONLY))
+ if (!FileOpen(&fileP, filename, O_RDONLY))
return FALSE;
- while (ConfReadLine(&f,z,512))
- {
- line++;
- p=z;
+ lineNum = 0;
+
+ while (ConfReadLine(fileP, z, 512)) {
+ ++lineNum;
+ p = z;
if (ConfNextToken(&p)) {
- option=ConfGetToken(&p);
- if (option)
- {
+ const char * const option = ConfGetToken(&p);
+ if (option) {
ConfNextToken(&p);
- if (strcasecmp(option,"port")==0)
- {
- if (ConfReadInt(p,&n,1,65535))
- srv->port=n;
+ if (xmlrpc_strcaseeq(option, "port")) {
+ int32_t n;
+ if (ConfReadInt(p, &n, 1, 65535))
+ srvP->port = n;
else
- TraceExit("Invalid port '%s'",p);
- }
- else if (strcasecmp(option,"serverroot")==0)
- {
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- if (_chdir(p))
-#else
- if (chdir(p))
-#endif
+ TraceExit("Invalid port '%s'", p);
+ } else if (xmlrpc_strcaseeq(option, "serverroot")) {
+ bool success;
+ chdirx(p, &success);
+ if (!success)
TraceExit("Invalid server root '%s'",p);
- }
- else if (strcasecmp(option,"path")==0)
- {
- if (FileStat(p,&fs))
- if (fs.st_mode & S_IFDIR)
- {
- free(srv->filespath);
- srv->filespath=strdup(p);
+ } else if (xmlrpc_strcaseeq(option, "path")) {
+ if (FileStat(p, &fs))
+ if (fs.st_mode & S_IFDIR) {
+ HandlerSetFilesPath(handlerP, p);
continue;
- };
-
- TraceExit("Invalid path '%s'",p);
- }
- else if (strcasecmp(option,"default")==0)
- {
- char *filename;
+ }
+ TraceExit("Invalid path '%s'", p);
+ } else if (xmlrpc_strcaseeq(option, "default")) {
+ const char * filename;
- while ((filename=ConfGetToken(&p)))
- {
- ListAdd(&srv->defaultfilenames,strdup(filename));
+ while ((filename = ConfGetToken(&p))) {
+ HandlerAddDefaultFN(handlerP, filename);
if (!ConfNextToken(&p))
break;
- };
- }
- else if (strcasecmp(option,"keepalive")==0)
- {
- if (ConfReadInt(p,&n,1,65535))
- srv->keepalivemaxconn=n;
- else
- TraceExit("Invalid KeepAlive value '%s'",p);
- }
- else if (strcasecmp(option,"timeout")==0)
- {
- if (ConfReadInt(p,&n,1,3600))
- {
- srv->keepalivetimeout=n;
- /* Must see what to do with that */
- srv->timeout=n;
}
+ } else if (xmlrpc_strcaseeq(option, "keepalive")) {
+ int32_t n;
+ if (ConfReadInt(p, &n, 1, 65535))
+ srvP->keepalivemaxconn = n;
else
- TraceExit("Invalid TimeOut value '%s'",p);
- }
- else if (strcasecmp(option,"mimetypes")==0)
- {
- if (!ConfReadMIMETypes(p))
- TraceExit("Can't read MIME Types file '%s'",p);
- }
- else if (strcasecmp(option,"logfile")==0)
- {
- LogOpen(srv,p);
- }
- else if (strcasecmp(option,"user")==0)
- {
-#ifdef _UNIX
- if (*p=='#')
- {
- int32_t n;
-
- if (!ConfReadInt(p+1,&n,0,0))
- TraceExit("Bad user number '%s'",p);
- else
- srv->uid=n;
- }
+ TraceExit("Invalid KeepAlive value '%s'", p);
+ } else if (xmlrpc_strcaseeq(option, "timeout")) {
+ int32_t n;
+ if (ConfReadInt(p, &n, 1, 3600)) {
+ srvP->keepalivetimeout = n;
+ /* Must see what to do with that */
+ srvP->timeout = n;
+ } else
+ TraceExit("Invalid TimeOut value '%s'", p);
+ } else if (xmlrpc_strcaseeq(option, "mimetypes")) {
+ MIMEType * mimeTypeP;
+ readMIMETypesFile(p, &mimeTypeP);
+ if (!mimeTypeP)
+ TraceExit("Can't read MIME Types file '%s'", p);
else
- {
- struct passwd *pwd;
-
- if (!(pwd=getpwnam(p)))
- TraceExit("Unknown user '%s'",p);
-
- srv->uid=pwd->pw_uid;
- if ((int)srv->gid==(-1))
- srv->gid=pwd->pw_gid;
- };
-#else
- TraceMsg("User option ignored");
-#endif /* _UNIX */
- }
- else if (strcasecmp(option,"pidfile")==0)
- {
-#ifdef _UNIX
- if (!FileOpenCreate(&srv->pidfile,p,O_TRUNC | O_WRONLY))
- {
- srv->pidfile=-1;
- TraceMsg("Bad PidFile value '%s'",p);
- };
-#else
- TraceMsg("PidFile option ignored");
-#endif /* _UNIX */
- }
- else if (strcasecmp(option,"advertiseserver")==0)
- {
- if (!ConfReadBool(p,&srv->advertise))
+ HandlerSetMimeType(handlerP, mimeTypeP);
+ } else if (xmlrpc_strcaseeq(option,"logfile")) {
+ srvP->logfilename = strdup(p);
+ } else if (xmlrpc_strcaseeq(option,"user")) {
+ parseUser(p, srvP);
+ } else if (xmlrpc_strcaseeq(option, "pidfile")) {
+ parsePidfile(p, srvP);
+ } else if (xmlrpc_strcaseeq(option, "advertiseserver")) {
+ if (!ConfReadBool(p, &srvP->advertise))
TraceExit("Invalid boolean value "
"for AdvertiseServer option");
- }
- else
- TraceExit("Invalid option '%s' at line %d",option,line);
- };
+ } else
+ TraceExit("Invalid option '%s' at line %u",
+ option, lineNum);
+ }
}
- };
+ }
- FileClose(&f);
+ FileClose(fileP);
return TRUE;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/conn.c Mon May 26 12:59:57 2008
@@ -1,343 +1,525 @@
-/*******************************************************************************
-**
-** conn.c
-**
-** This file is part of the ABYSS Web server project.
-**
-** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-**
-*******************************************************************************/
+/* Copyright information is at the end of the file. */
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
+#include <assert.h>
+#include "bool.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/sleep_int.h"
#include "xmlrpc-c/abyss.h"
+#include "channel.h"
+#include "server.h"
+#include "thread.h"
+#include "file.h"
+
+#include "conn.h"
/*********************************************************************
** Conn
*********************************************************************/
-TConn *ConnAlloc()
-{
- return (TConn *)malloc(sizeof(TConn));
+static TThreadProc connJob;
+
+static void
+connJob(void * const userHandle) {
+/*----------------------------------------------------------------------------
+ This is the root function for a thread that processes a connection
+ (performs HTTP transactions).
+-----------------------------------------------------------------------------*/
+ TConn * const connectionP = userHandle;
+
+ (connectionP->job)(connectionP);
+
+ connectionP->finished = TRUE;
+ /* Note that if we are running in a forked process, setting
+ connectionP->finished has no effect, because it's just our own
+ copy of *connectionP. In this case, Parent must update his own
+ copy based on a SIGCHLD signal that the OS will generate right
+ after we exit.
+ */
+
+ //ThreadExit(0);
}
-void ConnFree(TConn *c)
-{
- free(c);
+
+
+static void
+connDone(TConn * const connectionP) {
+
+ /* In the forked case, this is designed to run in the parent
+ process after the child has terminated.
+ */
+ connectionP->finished = TRUE;
+
+ if (connectionP->done)
+ connectionP->done(connectionP);
}
-static uint32_t
-THREAD_ENTRYTYPE ConnJob(TConn *c) {
- c->connected=TRUE;
- (c->job)(c);
- c->connected=FALSE;
- ThreadExit( &c->thread, 0 );
- return 0;
-}
-
-abyss_bool ConnCreate2(TConn * const connectionP,
- TServer * const serverP,
- TSocket const connectedSocket,
- TIPAddr const peerIpAddr,
- void ( * func)(TConn *),
- enum abyss_foreback const foregroundBackground)
-{
- abyss_bool retval;
-
- connectionP->server = serverP;
- connectionP->socket = connectedSocket;
- connectionP->peerip = peerIpAddr;
- connectionP->buffersize = 0;
- connectionP->bufferpos = 0;
- connectionP->connected = TRUE;
- connectionP->job = func;
- connectionP->inbytes = 0;
- connectionP->outbytes = 0;
- connectionP->trace = getenv("ABYSS_TRACE_CONN");
+
+
+static TThreadDoneFn threadDone;
+
+static void
+threadDone(void * const userHandle) {
+
+ TConn * const connectionP = userHandle;
- switch (foregroundBackground)
- {
+ connDone(connectionP);
+}
+
+
+
+static void
+makeThread(TConn * const connectionP,
+ enum abyss_foreback const foregroundBackground,
+ bool const useSigchld,
+ const char ** const errorP) {
+
+ switch (foregroundBackground) {
case ABYSS_FOREGROUND:
connectionP->hasOwnThread = FALSE;
- retval = TRUE;
+ *errorP = NULL;
break;
- case ABYSS_BACKGROUND:
+ case ABYSS_BACKGROUND: {
+ const char * error;
connectionP->hasOwnThread = TRUE;
- retval = ThreadCreate(&connectionP->thread,
- (TThreadProc)ConnJob,
- connectionP);
- break;
- }
- return retval;
+ ThreadCreate(&connectionP->threadP, connectionP,
+ &connJob, &threadDone, useSigchld,
+ &error);
+ if (error) {
+ xmlrpc_asprintf(errorP, "Unable to create thread to "
+ "process connection. %s", error);
+ xmlrpc_strfree(error);
+ } else
+ *errorP = NULL;
+ } break;
+ } /* switch */
}
-abyss_bool ConnCreate(TConn *c, TSocket *s, void (*func)(TConn *))
-{
- return ConnCreate2(c, c->server, *s, c->peerip, func, ABYSS_BACKGROUND);
+
+
+void
+ConnCreate(TConn ** const connectionPP,
+ TServer * const serverP,
+ TChannel * const channelP,
+ void * const channelInfoP,
+ TThreadProc * const job,
+ TThreadDoneFn * const done,
+ enum abyss_foreback const foregroundBackground,
+ bool const useSigchld,
+ const char ** const errorP) {
+/*----------------------------------------------------------------------------
+ Create an HTTP connection.
+
+ A connection carries one or more HTTP transactions (request/response).
+
+ *channelP transports the requests and responses.
+
+ The connection handles those HTTP requests.
+
+ The connection handles the requests primarily by running the
+ function 'job' once. Some connections can do that autonomously, as
+ soon as the connection is created. Others don't until Caller
+ subsequently calls ConnProcess. Some connections complete the
+ processing before ConnProcess return, while others may run the
+ connection asynchronously to the creator, in the background, via a
+ TThread thread. 'foregroundBackground' determines which.
+
+ 'job' calls methods of the connection to get requests and send
+ responses.
+
+ Some time after the HTTP transactions are all done, 'done' gets
+ called in some context.
+
+ 'channelInfoP' == NULL means no channel info supplied.
+-----------------------------------------------------------------------------*/
+ TConn * connectionP;
+
+ MALLOCVAR(connectionP);
+
+ if (connectionP == NULL)
+ xmlrpc_asprintf(errorP, "Unable to allocate memory for a connection "
+ "descriptor.");
+ else {
+ connectionP->server = serverP;
+ connectionP->channelP = channelP;
+ connectionP->channelInfoP = channelInfoP;
+ connectionP->buffer[0] = '\0';
+ connectionP->buffersize = 0;
+ connectionP->bufferpos = 0;
+ connectionP->finished = FALSE;
+ connectionP->job = job;
+ connectionP->done = done;
+ connectionP->inbytes = 0;
+ connectionP->outbytes = 0;
+ connectionP->trace = getenv("ABYSS_TRACE_CONN");
+
+ makeThread(connectionP, foregroundBackground, useSigchld, errorP);
+ }
+ *connectionPP = connectionP;
}
-abyss_bool ConnProcess(TConn *c)
-{
- abyss_bool retval;
- if (c->hasOwnThread) {
+
+bool
+ConnProcess(TConn * const connectionP) {
+/*----------------------------------------------------------------------------
+ Drive the main processing of a connection -- run the connection's
+ "job" function, which should read HTTP requests from the connection
+ and send HTTP responses.
+
+ If we succeed, we guarantee the connection's "done" function will get
+ called some time after all processing is complete. It might be before
+ we return or some time after. If we fail, we guarantee the "done"
+ function will not be called.
+-----------------------------------------------------------------------------*/
+ bool retval;
+
+ if (connectionP->hasOwnThread) {
/* There's a background thread to handle this connection. Set
it running.
*/
- retval = ThreadRun(&(c->thread));
+ retval = ThreadRun(connectionP->threadP);
} else {
/* No background thread. We just handle it here while Caller waits. */
- (c->job)(c);
- c->connected=FALSE;
+ (connectionP->job)(connectionP);
+ connDone(connectionP);
retval = TRUE;
}
return retval;
}
-void ConnClose(TConn *c)
-{
- if (c->hasOwnThread)
- ThreadClose(&c->thread);
-}
-
-abyss_bool ConnKill(TConn *c)
-{
- c->connected=FALSE;
- return ThreadKill(&(c->thread));
-}
-
-void ConnReadInit(TConn *c)
-{
- if (c->buffersize>c->bufferpos)
- {
- c->buffersize-=c->bufferpos;
- memmove(c->buffer,c->buffer+c->bufferpos,c->buffersize);
- c->bufferpos=0;
- }
- else
- c->buffersize=c->bufferpos=0;
- c->inbytes=c->outbytes=0;
+
+void
+ConnWaitAndRelease(TConn * const connectionP) {
+ if (connectionP->hasOwnThread)
+ ThreadWaitAndRelease(connectionP->threadP);
+
+ free(connectionP);
+}
+
+
+
+bool
+ConnKill(TConn * const connectionP) {
+ connectionP->finished = TRUE;
+ return ThreadKill(connectionP->threadP);
+}
+
+
+
+void
+ConnReadInit(TConn * const connectionP) {
+
+ if (connectionP->buffersize > connectionP->bufferpos) {
+ connectionP->buffersize -= connectionP->bufferpos;
+ memmove(connectionP->buffer,
+ connectionP->buffer + connectionP->bufferpos,
+ connectionP->buffersize);
+ connectionP->bufferpos = 0;
+ } else
+ connectionP->buffersize = connectionP->bufferpos = 0;
+
+ connectionP->buffer[connectionP->buffersize] = '\0';
+
+ connectionP->inbytes = connectionP->outbytes = 0;
+}
+
+
+
+static size_t
+nextLineSize(const char * const string,
+ size_t const startPos,
+ size_t const stringSize) {
+/*----------------------------------------------------------------------------
+ Return the length of the line that starts at offset 'startPos' in the
+ string 'string', which is 'stringSize' characters long.
+
+ 'string' in not NUL-terminated.
+
+ A line begins at beginning of string or after a newline character and
+ runs through the next newline character or end of string. The line
+ includes the newline character at the end, if any.
+-----------------------------------------------------------------------------*/
+ size_t i;
+
+ for (i = startPos; i < stringSize && string[i] != '\n'; ++i);
+
+ if (i < stringSize)
+ ++i; /* Include the newline */
+
+ return i - startPos;
}
static void
-traceSocketRead(const char * const label,
- const char * const buffer,
- unsigned int const size) {
+traceBuffer(const char * const label,
+ const char * const buffer,
+ unsigned int const size) {
- unsigned int nonPrintableCount;
- unsigned int i;
-
- nonPrintableCount = 0; /* Initial value */
-
- for (i = 0; i < size; ++i) {
- if (!isprint(buffer[i]) && buffer[i] != '\n' && buffer[i] != '\r')
- ++nonPrintableCount;
+ size_t cursor; /* Index into buffer[] */
+
+ fprintf(stderr, "%s:\n\n", label);
+
+ for (cursor = 0; cursor < size; ) {
+ /* Print one line of buffer */
+
+ size_t const lineSize = nextLineSize(buffer, cursor, size);
+ const char * const printableLine =
+ xmlrpc_makePrintable_lp(&buffer[cursor], lineSize);
+
+ fprintf(stderr, "%s\n", printableLine);
+
+ cursor += lineSize;
+
+ xmlrpc_strfree(printableLine);
}
- if (nonPrintableCount > 0)
- fprintf(stderr, "%s contains %u nonprintable characters.\n",
- label, nonPrintableCount);
+ fprintf(stderr, "\n");
+}
+
+
+
+static void
+traceChannelRead(TConn * const connectionP,
+ unsigned int const size) {
+
+ if (connectionP->trace)
+ traceBuffer("READ FROM CHANNEL",
+ connectionP->buffer + connectionP->buffersize, size);
+}
+
+
+
+static void
+traceChannelWrite(TConn * const connectionP,
+ const char * const buffer,
+ unsigned int const size,
+ bool const failed) {
- fprintf(stderr, "%s:\n", label);
- fprintf(stderr, "%.*s\n", (int)size, buffer);
+ if (connectionP->trace) {
+ const char * const label =
+ failed ? "FAILED TO WRITE TO CHANNEL" : "WROTE TO CHANNEL";
+ traceBuffer(label, buffer, size);
+ }
}
-abyss_bool
-ConnRead(TConn * const c,
+static uint32_t
+bufferSpace(TConn * const connectionP) {
+
+ return BUFFER_SIZE - connectionP->buffersize;
+}
+
+
+
+bool
+ConnRead(TConn * const connectionP,
uint32_t const timeout) {
+/*----------------------------------------------------------------------------
+ Read some stuff on connection *connectionP from the channel.
- while (SocketWait(&(c->socket),TRUE,FALSE,timeout*1000) == 1) {
- uint32_t x;
- uint32_t y;
-
- x = SocketAvailableReadBytes(&c->socket);
+ Don't wait more than 'timeout' seconds for data to arrive. Fail if
+ nothing arrives within that time.
- /* Avoid lost connections */
- if (x <= 0)
- break;
-
- /* Avoid Buffer overflow and lost Connections */
- if (x + c->buffersize >= BUFFER_SIZE)
- x = BUFFER_SIZE-c->buffersize - 1;
-
- y = SocketRead(&c->socket, c->buffer + c->buffersize, x);
- if (y > 0) {
- if (c->trace)
- traceSocketRead("READ FROM SOCKET:",
- c->buffer + c->buffersize, y);
-
- c->inbytes += y;
- c->buffersize += y;
- c->buffer[c->buffersize] = '\0';
- return TRUE;
+ 'timeout' must be before the end of time.
+-----------------------------------------------------------------------------*/
+ time_t const deadline = time(NULL) + timeout;
+
+ bool cantGetData;
+ bool gotData;
+
+ cantGetData = FALSE;
+ gotData = FALSE;
+
+ while (!gotData && !cantGetData) {
+ int const timeLeft = (int)(deadline - time(NULL));
+
+ if (timeLeft <= 0)
+ cantGetData = TRUE;
+ else {
+ bool const waitForRead = TRUE;
+ bool const waitForWrite = FALSE;
+
+ bool readyForRead;
+ bool failed;
+
+ ChannelWait(connectionP->channelP, waitForRead, waitForWrite,
+ timeLeft * 1000, &readyForRead, NULL, &failed);
+
+ if (failed)
+ cantGetData = TRUE;
+ else {
+ uint32_t bytesRead;
+ bool readFailed;
+
+ ChannelRead(connectionP->channelP,
+ connectionP->buffer + connectionP->buffersize,
+ bufferSpace(connectionP) - 1,
+ &bytesRead, &readFailed);
+
+ if (readFailed)
+ cantGetData = TRUE;
+ else {
+ if (bytesRead > 0) {
+ traceChannelRead(connectionP, bytesRead);
+ connectionP->inbytes += bytesRead;
+ connectionP->buffersize += bytesRead;
+ connectionP->buffer[connectionP->buffersize] = '\0';
+ gotData = TRUE;
+ } else
+ /* Other end has disconnected */
+ cantGetData = TRUE;
+ }
+ }
}
- break;
}
- return FALSE;
+ if (gotData)
+ return TRUE;
+ else
+ return FALSE;
}
-abyss_bool ConnWrite(TConn *c,void *buffer,uint32_t size)
-{
- char *buf = buffer;
- int rc, off = 0;
-
- while (TRUE) {
- /* try sending data */
- if ((rc = SocketWrite(&(c->socket),&buf[off],size - off)) <= 0)
- return FALSE;
-
- /* increase count */
- off += rc;
-
- /* check we're not finished writing */
- if (off >= size)
- break;
- }
+bool
+ConnWrite(TConn * const connectionP,
+ const void * const buffer,
+ uint32_t const size) {
+
+ bool failed;
+
+ ChannelWrite(connectionP->channelP, buffer, size, &failed);
- c->outbytes+=size;
- return TRUE;
+ traceChannelWrite(connectionP, buffer, size, failed);
+
+ if (!failed)
+ connectionP->outbytes += size;
+
+ return !failed;
}
-abyss_bool ConnWriteFromFile(TConn *c,TFile *file,uint64_t start,uint64_t end,
- void *buffer,uint32_t buffersize,uint32_t rate)
-{
- uint64_t y,bytesread=0;
- uint32_t waittime;
- if (rate>0)
- {
- if (buffersize>rate)
- buffersize=rate;
- waittime=(1000*buffersize)/rate;
+bool
+ConnWriteFromFile(TConn * const connectionP,
+ const TFile * const fileP,
+ uint64_t const start,
+ uint64_t const last,
+ void * const buffer,
+ uint32_t const buffersize,
+ uint32_t const rate) {
+/*----------------------------------------------------------------------------
+ Write the contents of the file stream *fileP, from offset 'start'
+ up through 'last', to the HTTP connection *connectionP.
+
+ Meter the reading so as not to read more than 'rate' bytes per second.
+
+ Use the 'bufferSize' bytes at 'buffer' as an internal buffer for this.
+-----------------------------------------------------------------------------*/
+ bool retval;
+ uint32_t waittime;
+ bool success;
+ uint32_t readChunkSize;
+
+ if (rate > 0) {
+ readChunkSize = MIN(buffersize, rate); /* One second's worth */
+ waittime = (1000 * buffersize) / rate;
+ } else {
+ readChunkSize = buffersize;
+ waittime = 0;
}
- else
- waittime=0;
- if (!FileSeek(file,start,SEEK_SET))
- return FALSE;
+ success = FileSeek(fileP, start, SEEK_SET);
+ if (!success)
+ retval = FALSE;
+ else {
+ uint64_t const totalBytesToRead = last - start + 1;
+ uint64_t bytesread;
+
+ bytesread = 0; /* initial value */
+
+ while (bytesread < totalBytesToRead) {
+ uint64_t const bytesLeft = totalBytesToRead - bytesread;
+ uint64_t const bytesToRead64 = MIN(readChunkSize, bytesLeft);
+ uint32_t const bytesToRead = (uint32_t)bytesToRead64;
+
+ uint32_t bytesReadThisTime;
- while (bytesread<=end-start)
- {
- y=(end-start+1)-bytesread;
-
- if (y>buffersize)
- y=buffersize;
-
- y=FileRead(file,buffer,y);
- bytesread+=y;
-
- if (y>0)
- ConnWrite(c,buffer,y);
- else
- break;
-
- if (waittime)
- ThreadWait(waittime);
- };
-
- return (bytesread>end-start);
-}
-
-abyss_bool ConnReadLine(TConn *c,char **z,uint32_t timeout)
-{
- char *p,*t;
- abyss_bool first=TRUE;
- clock_t to,start;
-
- p=*z=c->buffer+c->bufferpos;
- start=clock();
-
- for (;;)
- {
- to=(clock()-start)/CLOCKS_PER_SEC;
- if (to>timeout)
- break;
-
- if (first)
- {
- if (c->bufferpos>=c->buffersize)
- if (!ConnRead(c,timeout-to))
- break;
+ assert(bytesToRead == bytesToRead64); /* readChunkSize is uint32 */
- first=FALSE;
- }
- else
- {
- if (!ConnRead(c,timeout-to))
+ bytesReadThisTime = FileRead(fileP, buffer, bytesToRead);
+ bytesread += bytesReadThisTime;
+
+ if (bytesReadThisTime > 0)
+ ConnWrite(connectionP, buffer, bytesReadThisTime);
+ else
break;
- };
+
+ if (waittime > 0)
+ xmlrpc_millisecond_sleep(waittime);
+ }
+ retval = (bytesread >= totalBytesToRead);
+ }
+ return retval;
+}
+
- t=strchr(p,LF);
- if (t)
- {
- if ((*p!=LF) && (*p!=CR))
- {
- if (!*(t+1))
- continue;
-
- p=t;
-
- if ((*(p+1)==' ') || (*(p+1)=='\t'))
- {
- if (p>*z)
- if (*(p-1)==CR)
- *(p-1)=' ';
-
- *(p++)=' ';
- continue;
- };
- } else {
- /* emk - 04 Jan 2001 - Bug fix to leave buffer
- ** pointing at start of body after reading blank
- ** line following header. */
- p=t;
- }
- c->bufferpos+=p+1-*z;
+TServer *
+ConnServer(TConn * const connectionP) {
+ return connectionP->server;
+}
- if (p>*z)
- if (*(p-1)==CR)
- p--;
- *p='\0';
- return TRUE;
- }
- };
- return FALSE;
+void
+ConnFormatClientAddr(TConn * const connectionP,
+ const char ** const clientAddrPP) {
+
+ ChannelFormatPeerInfo(connectionP->channelP, clientAddrPP);
}
+
+
+
+/*******************************************************************************
+**
+** conn.c
+**
+** This file is part of the ABYSS Web server project.
+**
+** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+******************************************************************************/
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/data.c Mon May 26 12:59:57 2008
@@ -36,25 +36,30 @@
#include <stdlib.h>
#include <string.h>
+#include "bool.h"
#include "mallocvar.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/abyss.h"
#include "token.h"
+#include "thread.h"
+
+#include "data.h"
-#define safe_free(it) if (it) {free(it);it=NULL;}
/*********************************************************************
** List
*********************************************************************/
-void ListInit(TList *sl)
+void ListInit(TList * const sl)
{
sl->item=NULL;
sl->size=sl->maxsize=0;
sl->autofree=FALSE;
}
-void ListInitAutoFree(TList *sl)
+void ListInitAutoFree(TList * const sl)
{
sl->item=NULL;
sl->size=sl->maxsize=0;
@@ -70,10 +75,10 @@
if (sl->autofree) {
unsigned int i;
for (i = sl->size; i > 0; --i)
- safe_free(sl->item[i-1]);
+ free(sl->item[i-1]);
}
- safe_free(sl->item);
+ free(sl->item);
}
sl->item = NULL;
sl->size = 0;
@@ -88,19 +93,19 @@
if (sl->item) {
unsigned int i;
for (i = sl->size; i > 0; --i)
- safe_free(sl->item[i-1]);
+ free(sl->item[i-1]);
}
}
-abyss_bool
+bool
ListAdd(TList * const sl,
void * const str) {
/*----------------------------------------------------------------------------
Add an item to the end of the list.
-----------------------------------------------------------------------------*/
- abyss_bool success;
+ bool success;
if (sl->size >= sl->maxsize) {
uint16_t newSize = sl->maxsize + 16;
@@ -137,43 +142,65 @@
-abyss_bool
-ListAddFromString(TList * const list,
- char * const stringArg) {
-
- char *t,*p;
- char * c;
-
- c = stringArg;
-
- if (c)
- while (1)
- {
- NextToken(&c);
+bool
+ListAddFromString(TList * const list,
+ const char * const stringArg) {
- while (*c==',')
- c++;
-
- if (!(t=GetToken(&c)))
- break;
-
- p=c-2;
+ bool retval;
+
+ if (!stringArg)
+ retval = TRUE;
+ else {
+ char * buffer;
+
+ buffer = strdup(stringArg);
+ if (!buffer)
+ retval = FALSE;
+ else {
+ bool endOfString;
+ bool error;
+ char * c;
+
+ for (c = &buffer[0], endOfString = FALSE, error = FALSE;
+ !endOfString && !error;
+ ) {
+ const char * t;
+ NextToken((const char **)&c);
+
+ while (*c == ',')
+ ++c;
+
+ t = GetToken(&c);
+ if (!t)
+ endOfString = TRUE;
+ else {
+ char * p;
+
+ for (p = c - 2; *p == ','; --p)
+ *p = '\0';
+
+ if (t[0] != '\0') {
+ bool added;
+ added = ListAdd(list, (void*)t);
+
+ if (!added)
+ error = TRUE;
+ }
+ }
+ }
+ retval = !error;
+ xmlrpc_strfree(buffer);
+ }
+ }
+ return retval;
+}
- while (*p==',')
- *(p--)='\0';
- if (*t)
- if (!ListAdd(list,t))
- return FALSE;
- };
- return TRUE;
-}
-
-abyss_bool
-ListFindString(TList * const sl,
- char * const str,
- uint16_t * const indexP)
+bool
+ListFindString(TList * const sl,
+ const char * const str,
+ uint16_t * const indexP)
{
uint16_t i;
@@ -192,8 +219,10 @@
** Buffer
*********************************************************************/
-abyss_bool BufferAlloc(TBuffer *buf,uint32_t memsize)
-{
+bool
+BufferAlloc(TBuffer * const buf,
+ xmlrpc_uint32_t const memsize) {
+
/* ************** Implement the static buffers ***/
buf->staticid=0;
buf->data=(void *)malloc(memsize);
@@ -209,21 +238,28 @@
};
}
-void BufferFree(TBuffer *buf)
-{
+
+
+void
+BufferFree(TBuffer * const buf) {
+
if (buf->staticid)
{
/* ************** Implement the static buffers ***/
}
else
- safe_free(buf->data);
+ free(buf->data);
buf->size=0;
buf->staticid=0;
}
-abyss_bool BufferRealloc(TBuffer *buf,uint32_t memsize)
-{
+
+
+bool
+BufferRealloc(TBuffer * const buf,
+ xmlrpc_uint32_t const memsize) {
+
if (buf->staticid)
{
TBuffer b;
@@ -260,56 +296,83 @@
** String
*********************************************************************/
-abyss_bool StringAlloc(TString *s)
-{
- s->size=0;
- if (BufferAlloc(&(s->buffer),256))
- {
- *(char *)(s->buffer.data)='\0';
+bool
+StringAlloc(TString * const stringP) {
+
+ bool succeeded;
+
+ stringP->size = 0;
+
+ succeeded = BufferAlloc(&stringP->buffer, 256);
+ if (succeeded) {
+ *(char *)(stringP->buffer.data) = '\0';
return TRUE;
- }
- else
+ } else
return FALSE;
}
-abyss_bool StringConcat(TString *s,char *s2)
-{
- uint32_t len=strlen(s2);
- if (len+s->size+1>s->buffer.size)
- if (!BufferRealloc(&(s->buffer),((len+s->size+1+256)/256)*256))
+
+bool
+StringConcat(TString * const stringP,
+ const char * const string2) {
+
+ uint32_t const len = strlen(string2);
+
+ if (len + stringP->size + 1 > stringP->buffer.size) {
+ bool succeeded;
+ succeeded = BufferRealloc(
+ &stringP->buffer,
+ ((len + stringP->size + 1 + 256) / 256) * 256);
+ if (!succeeded)
return FALSE;
-
- strcat((char *)(s->buffer.data),s2);
- s->size+=len;
+ }
+ strcat((char *)(stringP->buffer.data), string2);
+ stringP->size += len;
return TRUE;
}
-abyss_bool StringBlockConcat(TString *s,char *s2,char **ref)
-{
- uint32_t len=strlen(s2)+1;
- if (len+s->size>s->buffer.size)
- if (!BufferRealloc(&(s->buffer),((len+s->size+1+256)/256)*256))
+
+bool
+StringBlockConcat(TString * const stringP,
+ const char * const string2,
+ char ** const ref) {
+
+ uint32_t const len = strlen(string2) + 1;
+
+ if (len + stringP->size > stringP->buffer.size) {
+ bool succeeded;
+ succeeded = BufferRealloc(
+ &stringP->buffer,
+ ((len + stringP->size + 1 + 256) / 256) * 256);
+ if (!succeeded)
return FALSE;
-
- *ref=(char *)(s->buffer.data)+s->size;
- memcpy(*ref,s2,len);
- s->size+=len;
+ }
+ *ref = (char *)(stringP->buffer.data) + stringP->size;
+ memcpy(*ref, string2, len);
+ stringP->size += len;
+
return TRUE;
}
-void StringFree(TString *s)
-{
- s->size=0;
- BufferFree(&(s->buffer));
+
+
+void
+StringFree(TString * const stringP) {
+ stringP->size = 0;
+ BufferFree(&stringP->buffer);
}
-char *StringData(TString *s)
-{
- return (char *)(s->buffer.data);
+
+
+char *
+StringData(TString * const stringP) {
+ return (char *)stringP->buffer.data;
}
+
+
/*********************************************************************
** Hash
*********************************************************************/
@@ -334,13 +397,13 @@
** Table
*********************************************************************/
-void TableInit(TTable *t)
+void TableInit(TTable * const t)
{
t->item=NULL;
t->size=t->maxsize=0;
}
-void TableFree(TTable *t)
+void TableFree(TTable * const t)
{
uint16_t i;
@@ -349,18 +412,23 @@
if (t->size)
for (i=t->size;i>0;i--)
{
- safe_free(t->item[i-1].name);
- safe_free(t->item[i-1].value);
+ free(t->item[i-1].name);
+ free(t->item[i-1].value);
};
- safe_free(t->item);
+ free(t->item);
}
TableInit(t);
}
-abyss_bool TableFindIndex(TTable *t,char *name,uint16_t *index)
-{
+
+
+bool
+TableFindIndex(TTable * const t,
+ const char * const name,
+ uint16_t * const index) {
+
uint16_t i,hash=Hash16(name);
if ((t->item) && (t->size>0) && (*index<t->size))
@@ -377,18 +445,23 @@
return FALSE;
}
-abyss_bool TableAddReplace(TTable *t,char *name,char *value)
-{
+
+
+bool
+TableAddReplace(TTable * const t,
+ const char * const name,
+ const char * const value) {
+
uint16_t i=0;
if (TableFindIndex(t,name,&i))
{
- safe_free(t->item[i].value);
+ free(t->item[i].value);
if (value)
t->item[i].value=strdup(value);
else
{
- safe_free(t->item[i].name);
+ free(t->item[i].name);
if (--t->size>0)
t->item[i]=t->item[t->size];
};
@@ -401,8 +474,10 @@
-abyss_bool
-TableAdd(TTable *t,char *name,char *value) {
+bool
+TableAdd(TTable * const t,
+ const char * const name,
+ const char * const value) {
if (t->size>=t->maxsize) {
TTableItem *newitem;
@@ -427,8 +502,12 @@
return TRUE;
}
-char *TableFind(TTable *t,char *name)
-{
+
+
+char *
+TableFind(TTable * const t,
+ const char * const name) {
+
uint16_t i=0;
if (TableFindIndex(t,name,&i))
@@ -442,103 +521,159 @@
*********************************************************************/
static TPoolZone *
-PoolZoneAlloc(uint32_t zonesize) {
- TPoolZone *pz;
-
- pz=(TPoolZone *)malloc(zonesize+sizeof(TPoolZone));
- if (pz)
- {
- pz->pos=pz->data;
- pz->maxpos=pz->pos+zonesize;
- pz->next=pz->prev=NULL;
- };
+PoolZoneAlloc(uint32_t const zonesize) {
- return pz;
+ TPoolZone * poolZoneP;
+
+ MALLOCARRAY(poolZoneP, zonesize);
+ if (poolZoneP) {
+ poolZoneP->pos = &poolZoneP->data[0];
+ poolZoneP->maxpos = poolZoneP->pos + zonesize;
+ poolZoneP->next = NULL;
+ poolZoneP->prev = NULL;
+ }
+ return poolZoneP;
}
-abyss_bool PoolCreate(TPool *p,uint32_t zonesize)
-{
- p->zonesize=zonesize;
- if (MutexCreate(&p->mutex))
- if (!(p->firstzone=p->currentzone=PoolZoneAlloc(zonesize)))
- {
- MutexFree(&p->mutex);
- return FALSE;
- };
-
- return TRUE;
+
+
+static void
+PoolZoneFree(TPoolZone * const poolZoneP) {
+
+ free(poolZoneP);
}
-void *PoolAlloc(TPool *p,uint32_t size)
-{
- TPoolZone *pz,*npz;
- void *x;
- uint32_t zonesize;
- if (size==0)
- return NULL;
- if (!MutexLock(&p->mutex))
- return NULL;
+bool
+PoolCreate(TPool * const poolP,
+ uint32_t const zonesize) {
- pz=p->currentzone;
+ bool success;
+ bool mutexCreated;
- if (pz->pos+size<pz->maxpos)
- {
- x=pz->pos;
- pz->pos+=size;
- MutexUnlock(&p->mutex);
- return x;
- };
+ poolP->zonesize = zonesize;
- if (size>p->zonesize)
- zonesize=size;
- else
- zonesize=p->zonesize;
+ mutexCreated = MutexCreate(&poolP->mutexP);
+ if (mutexCreated) {
+ TPoolZone * const firstZoneP = PoolZoneAlloc(zonesize);
- npz=PoolZoneAlloc(zonesize);
- if (npz)
- {
- npz->prev=pz;
- npz->next=pz->next;
- pz->next=npz;
- p->currentzone=npz;
- x=npz->data;
- npz->pos=npz->data+size;
- }
- else
- x=NULL;
+ if (firstZoneP != NULL) {
+ poolP->firstzone = firstZoneP;
+ poolP->currentzone = firstZoneP;
+ success = TRUE;
+ } else
+ success = FALSE;
+ if (!success)
+ MutexDestroy(poolP->mutexP);
+ } else
+ success = FALSE;
- MutexUnlock(&p->mutex);
- return x;
+ return success;
}
-void PoolFree(TPool *p)
-{
- TPoolZone *pz,*npz;
- pz=p->firstzone;
- while (pz)
- {
- npz=pz->next;
- safe_free(pz);
- pz=npz;
- };
+void *
+PoolAlloc(TPool * const poolP,
+ uint32_t const size) {
+/*----------------------------------------------------------------------------
+ Allocate a block of size 'size' from pool 'poolP'.
+-----------------------------------------------------------------------------*/
+ void * retval;
+
+ if (size == 0)
+ retval = NULL;
+ else {
+ bool gotMutexLock;
+
+ gotMutexLock = MutexLock(poolP->mutexP);
+ if (!gotMutexLock)
+ retval = NULL;
+ else {
+ TPoolZone * const curPoolZoneP = poolP->currentzone;
+
+ if (curPoolZoneP->pos + size < curPoolZoneP->maxpos) {
+ retval = curPoolZoneP->pos;
+ curPoolZoneP->pos += size;
+ } else {
+ uint32_t const zonesize = MAX(size, poolP->zonesize);
+
+ TPoolZone * const newPoolZoneP = PoolZoneAlloc(zonesize);
+ if (newPoolZoneP) {
+ newPoolZoneP->prev = curPoolZoneP;
+ newPoolZoneP->next = curPoolZoneP->next;
+ curPoolZoneP->next = newPoolZoneP;
+ poolP->currentzone = newPoolZoneP;
+ retval= newPoolZoneP->data;
+ newPoolZoneP->pos = newPoolZoneP->data + size;
+ } else
+ retval = NULL;
+ }
+ MutexUnlock(poolP->mutexP);
+ }
+ }
+ return retval;
}
-char *PoolStrdup(TPool *p,char *s) {
+void
+PoolReturn(TPool * const poolP,
+ void * const blockP) {
+/*----------------------------------------------------------------------------
+ Return the block at 'blockP' to the pool 'poolP'. WE ASSUME THAT IS
+ THE MOST RECENTLY ALLOCATED AND NOT RETURNED BLOCK IN THE POOL.
+-----------------------------------------------------------------------------*/
+ TPoolZone * const curPoolZoneP = poolP->currentzone;
+
+ assert((char*)curPoolZoneP->data < (char*)blockP &&
+ (char*)blockP < (char*)curPoolZoneP->pos);
+
+ curPoolZoneP->pos = blockP;
+
+ if (curPoolZoneP->pos == curPoolZoneP->data) {
+ /* That emptied out the current zone. Free it and make the previous
+ zone current.
+ */
+
+ assert(curPoolZoneP->prev); /* entry condition */
+
+ curPoolZoneP->prev->next = NULL;
+
+ PoolZoneFree(curPoolZoneP);
+ }
+}
+
+
+
+void
+PoolFree(TPool * const poolP) {
+
+ TPoolZone * poolZoneP;
+ TPoolZone * nextPoolZoneP;
+
+ for (poolZoneP = poolP->firstzone; poolZoneP; poolZoneP = nextPoolZoneP) {
+ nextPoolZoneP = poolZoneP->next;
+ free(poolZoneP);
+ }
+ MutexDestroy(poolP->mutexP);
+}
- char *ns;
- if (s) {
- ns = PoolAlloc(p, strlen(s) + 1);
- if (ns)
- strcpy(ns, s);
- } else
- ns = NULL;
- return ns;
+const char *
+PoolStrdup(TPool * const poolP,
+ const char * const origString) {
+
+ char * newString;
+
+ if (origString == NULL)
+ newString = NULL;
+ else {
+ newString = PoolAlloc(poolP, strlen(origString) + 1);
+ if (newString != NULL)
+ strcpy(newString, origString);
+ }
+ return newString;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/file.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/file.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/file.c Mon May 26 12:59:57 2008
@@ -32,204 +32,382 @@
**
******************************************************************************/
+#include "xmlrpc_config.h"
+#include "mallocvar.h"
+
+#define _CRT_SECURE_NO_WARNINGS
+ /* Tell msvcrt not to warn about functions that are often misused and
+ cause security exposures.
+ */
+
+#define _FILE_OFFSET_BITS 64
+ /* Tell GNU libc to make off_t 64 bits and all the POSIX file functions
+ the versions that handle 64 bit file offsets.
+ */
+#define _LARGE_FILES
+ /* Same as above, but for AIX */
+
#include <string.h>
-#ifdef ABYSS_WIN32
-#include <io.h>
-#else
-/* Must check this
-#include <sys/io.h>
-*/
-#endif /* ABYSS_WIN32 */
-
-#ifndef ABYSS_WIN32
-#include <dirent.h>
-#endif /* ABYSS_WIN32 */
+#if MSVCRT
+ #include <io.h>
+ typedef __int64 readwriterc_t;
+#else
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <dirent.h>
+ #include <sys/stat.h>
+ typedef ssize_t readwriterc_t;
+#endif
+#include "bool.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/abyss.h"
+#include "file.h"
+
+bool const win32 =
+#ifdef WIN32
+TRUE;
+#else
+FALSE;
+#endif
+
+struct TFileFind {
+#ifdef WIN32
+ #if MSVCRT
+ intptr_t handle;
+ #else
+ HANDLE handle;
+ #endif
+#else
+ char path[NAME_MAX+1];
+ DIR * handle;
+#endif
+};
+
+
/*********************************************************************
** File
*********************************************************************/
-abyss_bool FileOpen(TFile *f, const char *name,uint32_t attrib)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return ((*f=_open(name,attrib))!=(-1));
-#else
- return ((*f=open(name,attrib))!=(-1));
-#endif
+static void
+createFileImage(TFile ** const filePP,
+ const char * const name,
+ uint32_t const attrib,
+ bool const createFile,
+ bool * const succeededP) {
+
+ TFile * fileP;
+
+ MALLOCVAR(fileP);
+ if (fileP == NULL)
+ *succeededP = FALSE;
+ else {
+ int rc;
+
+ if (createFile)
+ rc = open(name, attrib | O_CREAT, S_IWRITE | S_IREAD);
+ else
+ rc = open(name, attrib);
+
+ if (rc < 0)
+ *succeededP = FALSE;
+ else {
+ fileP->fd = rc;
+ *succeededP = TRUE;
+ }
+ if (!*succeededP)
+ free(fileP);
+ }
+ *filePP = fileP;
}
-abyss_bool FileOpenCreate(TFile *f, const char *name, uint32_t attrib)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return ((*f=_open(name,attrib | O_CREAT,_S_IWRITE | _S_IREAD))!=(-1));
-#else
- return ((*f=open(name,attrib | O_CREAT,S_IWRITE | S_IREAD))!=(-1));
-#endif
+
+
+bool
+FileOpen(TFile ** const filePP,
+ const char * const name,
+ uint32_t const attrib) {
+
+ bool succeeded;
+
+ createFileImage(filePP, name, attrib, FALSE, &succeeded);
+
+ return succeeded;
}
-abyss_bool FileWrite(TFile *f, void *buffer, uint32_t len)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_write(*f,buffer,len)==(int32_t)len);
-#else
- return (write(*f,buffer,len)==(int32_t)len);
-#endif
+
+
+bool
+FileOpenCreate(TFile ** const filePP,
+ const char * const name,
+ uint32_t const attrib) {
+
+ bool succeeded;
+
+ createFileImage(filePP, name, attrib, TRUE, &succeeded);
+
+ return succeeded;
}
-int32_t FileRead(TFile *f, void *buffer, uint32_t len)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_read(*f,buffer,len));
-#else
- return (read(*f,buffer,len));
-#endif
+
+
+bool
+FileWrite(const TFile * const fileP,
+ const void * const buffer,
+ uint32_t const len) {
+
+ readwriterc_t rc;
+
+ rc = write(fileP->fd, buffer, len);
+
+ return (rc > 0 && (uint32_t)rc == len);
+}
+
+
+
+int32_t
+FileRead(const TFile * const fileP,
+ void * const buffer,
+ uint32_t const len) {
+
+ return read(fileP->fd, buffer, len);
}
-abyss_bool FileSeek(TFile *f, uint64_t pos, uint32_t attrib)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_lseek(*f,pos,attrib)!=(-1));
+
+
+bool
+FileSeek(const TFile * const fileP,
+ uint64_t const pos,
+ uint32_t const attrib) {
+
+ int64_t rc;
+#if MSVCRT
+ rc = _lseeki64(fileP->fd, pos, attrib);
#else
- return (lseek(*f,pos,attrib)!=(-1));
+ rc = lseek(fileP->fd, pos, attrib);
#endif
+ return (rc >= 0);
}
-uint64_t FileSize(TFile *f)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_filelength(*f));
+
+
+uint64_t
+FileSize(const TFile * const fileP) {
+
+#if MSVCRT
+ return (_filelength(fileP->fd));
#else
struct stat fs;
- fstat(*f,&fs);
+ fstat(fileP->fd, &fs);
return (fs.st_size);
#endif
}
-abyss_bool FileClose(TFile *f)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_close(*f)!=(-1));
-#else
- return (close(*f)!=(-1));
-#endif
+
+
+bool
+FileClose(TFile * const fileP) {
+
+ int rc;
+
+ rc = close(fileP->fd);
+
+ if (rc >= 0)
+ free(fileP);
+
+ return (rc >= 0);
}
-abyss_bool FileStat(char *filename,TFileStat *filestat)
-{
-#if defined( ABYSS_WIN32 ) && !defined( __BORLANDC__ )
- return (_stati64(filename,filestat)!=(-1));
+
+
+bool
+FileStat(const char * const filename,
+ TFileStat * const filestat) {
+
+ int rc;
+
+#if MSVCRT
+ rc = _stati64(filename,filestat);
#else
- return (stat(filename,filestat)!=(-1));
+ rc = stat(filename,filestat);
#endif
+ return (rc >= 0);
}
-abyss_bool FileFindFirst(TFileFind *filefind,char *path,TFileInfo *fileinfo)
-{
-#ifdef ABYSS_WIN32
- abyss_bool ret;
- char *p=path+strlen(path);
- *p='\\';
- *(p+1)='*';
- *(p+2)='\0';
-#ifndef __BORLANDC__
- ret=(((*filefind)=_findfirst(path,fileinfo))!=(-1));
+
+static void
+fileFindFirstWin(TFileFind * const filefindP ATTR_UNUSED,
+ const char * const path,
+ TFileInfo * const fileinfo ATTR_UNUSED,
+ bool * const retP ATTR_UNUSED) {
+ const char * search;
+
+ xmlrpc_asprintf(&search, "%s\\*", path);
+
+#if MSVCRT
+ filefindP->handle = _findfirsti64(search, fileinfo);
+ *retP = filefindP->handle != -1;
#else
- *filefind = FindFirstFile( path, &fileinfo->data );
- ret = *filefind != NULL;
- if( ret )
- {
- LARGE_INTEGER li;
- li.LowPart = fileinfo->data.nFileSizeLow;
- li.HighPart = fileinfo->data.nFileSizeHigh;
- strcpy( fileinfo->name, fileinfo->data.cFileName );
- fileinfo->attrib = fileinfo->data.dwFileAttributes;
- fileinfo->size = li.QuadPart;
- fileinfo->time_write = fileinfo->data.ftLastWriteTime.dwLowDateTime;
- }
+#ifdef WIN32
+ filefindP->handle = FindFirstFile(search, &fileinfo->data);
+ *retP = filefindP->handle != INVALID_HANDLE_VALUE;
+ if (*retP) {
+ LARGE_INTEGER li;
+ li.LowPart = fileinfo->data.nFileSizeLow;
+ li.HighPart = fileinfo->data.nFileSizeHigh;
+ strcpy( fileinfo->name, fileinfo->data.cFileName );
+ fileinfo->attrib = fileinfo->data.dwFileAttributes;
+ fileinfo->size = li.QuadPart;
+ fileinfo->time_write = fileinfo->data.ftLastWriteTime.dwLowDateTime;
+ }
#endif
- *p='\0';
- return ret;
-#else
- strncpy(filefind->path,path,NAME_MAX);
- filefind->path[NAME_MAX]='\0';
- filefind->handle=opendir(path);
- if (filefind->handle)
- return FileFindNext(filefind,fileinfo);
+#endif
+ xmlrpc_strfree(search);
+}
- return FALSE;
+
+
+static void
+fileFindFirstPosix(TFileFind * const filefindP,
+ const char * const path,
+ TFileInfo * const fileinfo,
+ bool * const retP) {
+
+#if !MSVCRT
+ strncpy(filefindP->path, path, NAME_MAX);
+ filefindP->path[NAME_MAX] = '\0';
+ filefindP->handle = opendir(path);
+ if (filefindP->handle)
+ *retP = FileFindNext(filefindP, fileinfo);
+ else
+ *retP = FALSE;
#endif
}
+
+
+
+bool
+FileFindFirst(TFileFind ** const filefindPP,
+ const char * const path,
+ TFileInfo * const fileinfo) {
+
+ bool succeeded;
+
+ TFileFind * filefindP;
-abyss_bool FileFindNext(TFileFind *filefind,TFileInfo *fileinfo)
-{
-#ifdef ABYSS_WIN32
+ MALLOCVAR(filefindP);
-#ifndef __BORLANDC__
- return (_findnext(*filefind,fileinfo)!=(-1));
+ if (filefindP == NULL)
+ succeeded = FALSE;
+ else {
+ if (win32)
+ fileFindFirstWin(filefindP, path, fileinfo, &succeeded);
+ else
+ fileFindFirstPosix(filefindP, path, fileinfo, &succeeded);
+ if (!succeeded)
+ free(filefindP);
+ }
+ *filefindPP = filefindP;
+
+ return succeeded;
+}
+
+
+
+static void
+fileFindNextWin(TFileFind * const filefindP ATTR_UNUSED,
+ TFileInfo * const fileinfo ATTR_UNUSED,
+ bool * const retvalP ATTR_UNUSED) {
+
+#if MSVCRT
+ *retvalP = _findnexti64(filefindP->handle, fileinfo) != -1;
#else
- abyss_bool ret = FindNextFile( *filefind, &fileinfo->data );
- if( ret )
- {
- LARGE_INTEGER li;
- li.LowPart = fileinfo->data.nFileSizeLow;
- li.HighPart = fileinfo->data.nFileSizeHigh;
- strcpy( fileinfo->name, fileinfo->data.cFileName );
- fileinfo->attrib = fileinfo->data.dwFileAttributes;
- fileinfo->size = li.QuadPart;
- fileinfo->time_write = fileinfo->data.ftLastWriteTime.dwLowDateTime;
- }
- return ret;
+#ifdef WIN32
+ bool found;
+ found = FindNextFile(filefindP->handle, &fileinfo->data);
+ if (found) {
+ LARGE_INTEGER li;
+ li.LowPart = fileinfo->data.nFileSizeLow;
+ li.HighPart = fileinfo->data.nFileSizeHigh;
+ strcpy(fileinfo->name, fileinfo->data.cFileName);
+ fileinfo->attrib = fileinfo->data.dwFileAttributes;
+ fileinfo->size = li.QuadPart;
+ fileinfo->time_write = fileinfo->data.ftLastWriteTime.dwLowDateTime;
+ }
+ *retvalP = found;
+#endif
#endif
+}
-#else
- struct dirent *de;
- /****** Must be changed ***/
- char z[NAME_MAX+1];
- de=readdir(filefind->handle);
- if (de)
- {
+
+static void
+fileFindNextPosix(TFileFind * const filefindP,
+ TFileInfo * const fileinfoP,
+ bool * const retvalP) {
+
+#ifndef WIN32
+ struct dirent * deP;
+
+ deP = readdir(filefindP->handle);
+ if (deP) {
+ char z[NAME_MAX+1];
struct stat fs;
- strcpy(fileinfo->name,de->d_name);
- strcpy(z,filefind->path);
- strncat(z,"/",NAME_MAX);
- strncat(z,fileinfo->name,NAME_MAX);
- z[NAME_MAX]='\0';
+ strcpy(fileinfoP->name, deP->d_name);
+ strcpy(z, filefindP->path);
+ strncat(z, "/",NAME_MAX);
+ strncat(z, fileinfoP->name, NAME_MAX);
+ z[NAME_MAX] = '\0';
- stat(z,&fs);
+ stat(z, &fs);
if (fs.st_mode & S_IFDIR)
- fileinfo->attrib=A_SUBDIR;
+ fileinfoP->attrib = A_SUBDIR;
else
- fileinfo->attrib=0;
+ fileinfoP->attrib = 0;
- fileinfo->size=fs.st_size;
- fileinfo->time_write=fs.st_mtime;
+ fileinfoP->size = fs.st_size;
+ fileinfoP->time_write = fs.st_mtime;
- return TRUE;
- };
-
- return FALSE;
+ *retvalP = TRUE;
+ } else
+ *retvalP = FALSE;
#endif
}
-void FileFindClose(TFileFind *filefind)
-{
-#ifdef ABYSS_WIN32
-#ifndef __BORLANDC__
- _findclose(*filefind);
+
+bool
+FileFindNext(TFileFind * const filefindP,
+ TFileInfo * const fileinfo) {
+
+ bool retval;
+
+ if (win32)
+ fileFindNextWin(filefindP, fileinfo, &retval);
+ else
+ fileFindNextPosix(filefindP, fileinfo, &retval);
+
+ return retval;
+}
+
+
+
+void
+FileFindClose(TFileFind * const filefindP) {
+#ifdef WIN32
+#if MSVCRT
+ _findclose(filefindP->handle);
#else
- FindClose( *filefind );
+ FindClose(filefindP->handle);
#endif
-
#else
- closedir(filefind->handle);
+ closedir(filefindP->handle);
#endif
+ free(filefindP);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/http.c Mon May 26 12:59:57 2008
@@ -1,38 +1,7 @@
-/*******************************************************************************
-**
-** http.c
-**
-** This file is part of the ABYSS Web server project.
-**
-** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-**
-*******************************************************************************/
+/* Copyright information is at the end of the file */
#include <ctype.h>
+#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -40,8 +9,20 @@
#include <time.h>
#include "xmlrpc_config.h"
+#include "bool.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/util.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/abyss.h"
+
+#include "server.h"
+#include "session.h"
+#include "conn.h"
#include "token.h"
+#include "date.h"
+#include "data.h"
+
+#include "http.h"
/*********************************************************************
** Request Parser
@@ -51,446 +32,1057 @@
** Request
*********************************************************************/
-void RequestInit(TSession *r,TConn *c)
-{
- time_t t;
-
- time(&t);
- r->date=*gmtime(&t);
-
- r->keepalive=r->cankeepalive=FALSE;
- r->query=NULL;
- r->host=NULL;
- r->from=NULL;
- r->useragent=NULL;
- r->referer=NULL;
- r->user=NULL;
- r->port=80;
- r->versionmajor=0;
- r->versionminor=9;
- r->server=c->server;
- r->conn=c;
-
- r->done=FALSE;
-
- r->chunkedwrite=r->chunkedwritemode=FALSE;
-
- r->requestline=NULL;
-
- ListInit(&r->cookies);
- ListInit(&r->ranges);
- TableInit(&r->request_headers);
- TableInit(&r->response_headers);
-
- r->status=0;
-
- StringAlloc(&(r->header));
-}
-
-void RequestFree(TSession *r)
-{
- if (r->requestline)
- free(r->requestline);
-
- if (r->user)
- free(r->user);
-
- ListFree(&r->cookies);
- ListFree(&r->ranges);
- TableFree(&r->request_headers);
- TableFree(&r->response_headers);
- StringFree(&(r->header));
+static void
+initRequestInfo(TRequestInfo * const requestInfoP,
+ httpVersion const httpVersion,
+ const char * const requestLine,
+ TMethod const httpMethod,
+ const char * const host,
+ unsigned int const port,
+ const char * const path,
+ const char * const query) {
+/*----------------------------------------------------------------------------
+ Set up the request info structure. For information that is
+ controlled by headers, use the defaults -- I.e. the value that
+ applies if the request contains no applicable header.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_PTR_OK(requestLine);
+ XMLRPC_ASSERT_PTR_OK(path);
+
+ requestInfoP->requestline = strdup(requestLine);
+ requestInfoP->method = httpMethod;
+ requestInfoP->host = xmlrpc_strdupnull(host);
+ requestInfoP->port = port;
+ requestInfoP->uri = strdup(path);
+ requestInfoP->query = xmlrpc_strdupnull(query);
+ requestInfoP->from = NULL;
+ requestInfoP->useragent = NULL;
+ requestInfoP->referer = NULL;
+ requestInfoP->user = NULL;
+
+ if (httpVersion.major > 1 ||
+ (httpVersion.major == 1 && httpVersion.minor >= 1))
+ requestInfoP->keepalive = TRUE;
+ else
+ requestInfoP->keepalive = FALSE;
}
static void
-readFirstLineOfRequest(TSession * const r,
- char ** const lineP,
- abyss_bool * const errorP) {
+freeRequestInfo(TRequestInfo * const requestInfoP) {
- *errorP = FALSE;
+ xmlrpc_strfreenull(requestInfoP->host);
- /* Ignore CRLFs in the beginning of the request (RFC2068-P30) */
- do {
- abyss_bool success;
- success = ConnReadLine(r->conn, lineP, r->server->timeout);
- if (!success) {
- /* Request Timeout */
- ResponseStatus(r, 408);
- *errorP = TRUE;
- }
- } while ((*lineP)[0] == '\0' && !*errorP);
+ xmlrpc_strfreenull(requestInfoP->user);
+
+ xmlrpc_strfree(requestInfoP->uri);
+
+ xmlrpc_strfree(requestInfoP->requestline);
}
-static void
-processFirstLineOfRequest(TSession * const r,
- char * const line1,
- abyss_bool * const moreLinesP,
- abyss_bool * const errorP) {
-
+void
+RequestInit(TSession * const sessionP,
+ TConn * const connectionP) {
+
+ sessionP->validRequest = false; /* Don't have valid request yet */
+
+ time(&sessionP->date);
+
+ sessionP->conn = connectionP;
+
+ sessionP->responseStarted = FALSE;
+
+ sessionP->chunkedwrite = FALSE;
+ sessionP->chunkedwritemode = FALSE;
+
+ sessionP->continueRequired = FALSE;
+
+ ListInit(&sessionP->cookies);
+ ListInit(&sessionP->ranges);
+ TableInit(&sessionP->request_headers);
+ TableInit(&sessionP->response_headers);
+
+ sessionP->status = 0; /* No status from handler yet */
+
+ StringAlloc(&(sessionP->header));
+}
+
+
+
+void
+RequestFree(TSession * const sessionP) {
+
+ if (sessionP->validRequest)
+ freeRequestInfo(&sessionP->requestInfo);
+
+ ListFree(&sessionP->cookies);
+ ListFree(&sessionP->ranges);
+ TableFree(&sessionP->request_headers);
+ TableFree(&sessionP->response_headers);
+ StringFree(&(sessionP->header));
+}
+
+
+
+static char *
+firstLfPos(TConn * const connectionP,
+ char * const lineStart) {
+/*----------------------------------------------------------------------------
+ Return a pointer in the connection's receive buffer to the first
+ LF (linefeed aka newline) character in the buffer at or after 'lineStart'.
+
+ If there is no LF in the buffer at or after 'lineStart', return NULL.
+-----------------------------------------------------------------------------*/
+ const char * const bufferEnd =
+ connectionP->buffer + connectionP->buffersize;
+
char * p;
- char * t;
- p = line1;
+ for (p = lineStart; p < bufferEnd && *p != LF; ++p);
- /* Jump over spaces */
- NextToken(&p);
+ if (p < bufferEnd)
+ return p;
+ else
+ return NULL;
+}
- r->requestline = strdup(p);
-
- t = GetToken(&p);
- if (!t) {
- /* Bad request */
- ResponseStatus(r,400);
- *errorP = TRUE;
- } else {
- if (strcmp(t, "GET") == 0)
- r->method = m_get;
- else if (strcmp(p, "PUT") == 0)
- r->method = m_put;
- else if (strcmp(t, "OPTIONS") == 0)
- r->method = m_options;
- else if (strcmp(p, "DELETE") == 0)
- r->method = m_delete;
- else if (strcmp(t, "POST") == 0)
- r->method = m_post;
- else if (strcmp(p, "TRACE") == 0)
- r->method = m_trace;
- else if (strcmp(t, "HEAD") == 0)
- r->method = m_head;
- else
- r->method = m_unknown;
-
- /* URI and Query Decoding */
- NextToken(&p);
-
- t=GetToken(&p);
- if (!t)
- *errorP = TRUE;
+
+
+static void
+getLineInBuffer(TConn * const connectionP,
+ char * const lineStart,
+ time_t const deadline,
+ char ** const lineEndP,
+ bool * const errorP) {
+/*----------------------------------------------------------------------------
+ Get a line into the connection's read buffer, starting at position
+ 'lineStart', if there isn't one already there. 'lineStart' is either
+ within the buffer or just after it.
+
+ Read the channel until we get a full line, except fail if we don't get
+ one by 'deadline'.
+-----------------------------------------------------------------------------*/
+ bool error;
+ char * lfPos;
+
+ assert(lineStart <= connectionP->buffer + connectionP->buffersize);
+
+ error = FALSE; /* initial value */
+ lfPos = NULL; /* initial value */
+
+ while (!error && !lfPos) {
+ int const timeLeft = (int)(deadline - time(NULL));
+ assert(timeLeft == deadline - time(NULL));
+ if (timeLeft <= 0)
+ error = TRUE;
else {
- r->uri=t;
-
- RequestUnescapeURI(r);
-
- t=strchr(t,'?');
- if (t) {
- *t = '\0';
- r->query = t+1;
- }
-
- NextToken(&p);
-
- /* HTTP Version Decoding */
+ lfPos = firstLfPos(connectionP, lineStart);
+ if (!lfPos)
+ error = !ConnRead(connectionP, timeLeft);
+ }
+ }
+ *errorP = error;
+ *lineEndP = lfPos + 1;
+}
+
+
+
+static bool
+isContinuationLine(const char * const line) {
+
+ return (line[0] == ' ' || line[0] == '\t');
+}
+
+
+
+static bool
+isEmptyLine(const char * const line) {
+
+ return (line[0] == '\n' || (line[0] == '\r' && line[1] == '\n'));
+}
+
+
+
+static void
+convertLineEnd(char * const lineStart,
+ char * const prevLineStart,
+ char const newVal) {
+/*----------------------------------------------------------------------------
+ Assuming a line begins at 'lineStart' and the line before it (the
+ "previous line") begins at 'prevLineStart', replace the line
+ delimiter at the end of the previous line with the character 'newVal'.
+
+ The line delimiter is either CRLF or LF. In the CRLF case, we replace
+ both CR and LF with 'newVal'.
+-----------------------------------------------------------------------------*/
+ assert(lineStart >= prevLineStart + 1);
+ *(lineStart-1) = newVal;
+ if (prevLineStart + 1 < lineStart &&
+ *(lineStart-2) == CR)
+ *(lineStart-2) = newVal;
+}
+
+
+
+static void
+getRestOfHeader(TConn * const connectionP,
+ char * const lineEnd,
+ time_t const deadline,
+ const char ** const headerEndP,
+ bool * const errorP) {
+/*----------------------------------------------------------------------------
+ Given that the read buffer for connection *connectionP contains (at
+ its current read position) the first line of an HTTP header, which
+ ends at position 'lineEnd', find the rest of it.
+
+ Some or all of the rest of the header may be in the buffer already;
+ we read more from the connection as necessary, but not if it takes past
+ 'deadline'. In the latter case, we fail.
+
+ We return the location of the end of the whole header as *headerEndP.
+ We do not remove the header from the buffer, but we do modify the
+ buffer so as to join the multiple lines of the header into a single
+ line, and to NUL-terminate the header.
+-----------------------------------------------------------------------------*/
+ char * const headerStart = connectionP->buffer + connectionP->bufferpos;
+
+ char * headerEnd;
+ /* End of the header lines we've seen at so far */
+ bool gotWholeHeader;
+ bool error;
+
+ headerEnd = lineEnd; /* initial value - end of 1st line */
- t = GetToken(&p);
- if (t) {
- uint32_t vmin, vmaj;
- if (sscanf(t, "HTTP/%d.%d", &vmaj, &vmin) != 2) {
- /* Bad request */
- ResponseStatus(r, 400);
- *errorP = TRUE;
- } else {
- r->versionmajor = vmaj;
- r->versionminor = vmin;
- *errorP = FALSE;
- }
- *moreLinesP = TRUE;
+ for (gotWholeHeader = FALSE, error = FALSE;
+ !gotWholeHeader && !error;) {
+
+ char * nextLineEnd;
+
+ /* Note that we are guaranteed, assuming the HTTP stream is
+ valid, that there is at least one more line in it. Worst
+ case, it's the empty line that marks the end of the headers.
+ */
+ getLineInBuffer(connectionP, headerEnd, deadline,
+ &nextLineEnd, &error);
+ if (!error) {
+ if (isContinuationLine(headerEnd)) {
+ /* Join previous line to this one */
+ convertLineEnd(headerEnd, headerStart, ' ');
+ /* Add this line to the header */
+ headerEnd = nextLineEnd;
} else {
- /* There is not HTTP version, so this is a single
- line request.
- */
- *errorP = FALSE;
- *moreLinesP = FALSE;
+ gotWholeHeader = TRUE;
+ *headerEndP = headerEnd;
+
+ /* NUL-terminate the whole header */
+ convertLineEnd(headerEnd, headerStart, '\0');
}
}
}
+ *errorP = error;
}
-abyss_bool
-RequestRead(TSession * const r) {
- char *n,*t,*p;
- abyss_bool ret;
- abyss_bool error;
- char * line1;
- abyss_bool moreLines;
+static void
+readHeader(TConn * const connectionP,
+ time_t const deadline,
+ bool * const endOfHeadersP,
+ char ** const headerP,
+ bool * const errorP) {
+/*----------------------------------------------------------------------------
+ Read an HTTP header, or the end of headers empty line, on connection
+ *connectionP.
+
+ An HTTP header is basically a line, except that if a line starts
+ with white space, it's a continuation of the previous line. A line
+ is delimited by either LF or CRLF.
+
+ The first line of an HTTP header is never empty; an empty line signals
+ the end of the HTTP headers and beginning of the HTTP body. We call
+ that empty line the EOH mark.
+
+ We assume the connection is positioned to a header or EOH mark.
+
+ In the course of reading, we read at least one character past the
+ line delimiter at the end of the header or EOH mark; we may read
+ much more. But we leave everything after the header or EOH (and
+ its line delimiter) in the internal buffer, with the buffer pointer
+ pointing to it.
+
+ We use stuff already in the internal buffer (perhaps left by a
+ previous call to this subroutine) before reading any more from from
+ the channel.
+
+ We return as *headerP the next header as an ASCIIZ string, with no
+ line delimiter. That string is stored in the "unused" portion of
+ the connection's internal buffer. Iff there is no next header, we
+ return *endOfHeadersP == true and nothing meaningful as *headerP.
+-----------------------------------------------------------------------------*/
+ char * const bufferStart = connectionP->buffer + connectionP->bufferpos;
+
+ bool error;
+ char * lineEnd;
+
+ getLineInBuffer(connectionP, bufferStart, deadline, &lineEnd, &error);
+
+ if (!error) {
+ if (isContinuationLine(bufferStart))
+ error = TRUE;
+ else if (isEmptyLine(bufferStart)) {
+ /* Consume the EOH mark from the buffer */
+ connectionP->bufferpos = lineEnd - connectionP->buffer;
+ *endOfHeadersP = TRUE;
+ } else {
+ /* We have the first line of a header; there may be more. */
+
+ const char * headerEnd;
+
+ *endOfHeadersP = FALSE;
+
+ getRestOfHeader(connectionP, lineEnd, deadline,
+ &headerEnd, &error);
+
+ if (!error) {
+ *headerP = bufferStart;
+
+ /* Consume the header from the buffer (but be careful --
+ you can't reuse that part of the buffer because the
+ string we will return is in it!
+ */
+ connectionP->bufferpos = headerEnd - connectionP->buffer;
+ }
+ }
+ }
+ *errorP = error;
+}
- readFirstLineOfRequest(r, &line1, &error);
- if (error)
- return FALSE;
+
+
+static void
+skipToNonemptyLine(TConn * const connectionP,
+ time_t const deadline,
+ bool * const errorP) {
+
+ char * const bufferStart = connectionP->buffer + connectionP->bufferpos;
+
+ bool gotNonEmptyLine;
+ bool error;
+ char * lineStart;
- processFirstLineOfRequest(r, line1, &moreLines, &error);
- if (error)
- return FALSE;
- if (!moreLines)
- return TRUE;
+ lineStart = bufferStart; /* initial value */
+ gotNonEmptyLine = FALSE; /* initial value */
+ error = FALSE; /* initial value */
+
+ while (!gotNonEmptyLine && !error) {
+ char * lineEnd;
+
+ getLineInBuffer(connectionP, lineStart, deadline, &lineEnd, &error);
+
+ if (!error) {
+ if (!isEmptyLine(lineStart))
+ gotNonEmptyLine = TRUE;
+ else
+ lineStart = lineEnd;
+ }
+ }
+ if (!error) {
+ /* Consume all the empty lines; advance buffer pointer to first
+ non-empty line.
+ */
+ connectionP->bufferpos = lineStart - connectionP->buffer;
+ }
+ *errorP = error;
+}
- /* Headers decoding */
- ret = TRUE;
- for (;;)
- {
- if (!ConnReadLine(r->conn,&p,r->server->timeout))
- {
- /* Request Timeout */
- ResponseStatus(r,408);
- return FALSE;
- };
-
- /* We have reached the empty line so all the request was read */
- if (!*p)
- return TRUE;
- NextToken(&p);
-
- if (!(n=GetToken(&p)))
- {
- /* Bad Request */
- ResponseStatus(r,400);
- return FALSE;
- };
+static void
+readRequestHeader(TSession * const sessionP,
+ time_t const deadline,
+ char ** const requestLineP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Read the HTTP request header (aka request header field) from
+ session 'sessionP'. We read through the session's internal buffer;
+ i.e. we may get data that was previously read from the network, or
+ we may read more from the network.
+
+ We assume the connection is presently positioned to the beginning of
+ the HTTP document. We leave it positioned after the request header.
+
+ We ignore any empty lines at the beginning of the stream, per
+ RFC2616 Section 4.1.
+
+ Fail if we can't get the header before 'deadline'.
+
+ Return as *requestLineP the request header read. This ASCIIZ string is
+ in the session's internal buffer.
+
+ Return as *httpErrorCodeP the HTTP error code that describes how we
+ are not able to read the request header, or 0 if we can.
+ If we can't, *requestLineP is meaningless.
+-----------------------------------------------------------------------------*/
+ char * line;
+ bool error;
+ bool endOfHeaders;
- /* Valid Field name ? */
- if (n[strlen(n)-1]!=':')
- {
- /* Bad Request */
- ResponseStatus(r,400);
- return FALSE;
- };
+ skipToNonemptyLine(sessionP->conn, deadline, &error);
- n[strlen(n)-1]='\0';
+ if (!error)
+ readHeader(sessionP->conn, deadline, &endOfHeaders, &line, &error);
- NextToken(&p);
+ /* End of headers is delimited by an empty line, and we skipped all
+ the empty lines above, so we could not have encountered EOH:
+ */
+ assert(!endOfHeaders);
- t=n;
- while (*t)
- {
- *t=tolower(*t);
- t++;
- };
+ if (error)
+ *httpErrorCodeP = 408; /* Request Timeout */
+ else {
+ *httpErrorCodeP = 0;
+ *requestLineP = line;
+ }
+}
- t=p;
- TableAdd(&r->request_headers,n,t);
- if (strcmp(n,"connection")==0)
- {
- /* must handle the jigsaw TE,keepalive */
- if (strcasecmp(t,"keep-alive")==0)
- r->keepalive=TRUE;
+static void
+unescapeUri(char * const uri,
+ bool * const errorP) {
+
+ char * x;
+ char * y;
+
+ x = y = uri;
+
+ *errorP = FALSE;
+
+ while (*x && !*errorP) {
+ switch (*x) {
+ case '%': {
+ char c;
+ ++x;
+ c = tolower(*x++);
+ if ((c >= '0') && (c <= '9'))
+ c -= '0';
+ else if ((c >= 'a') && (c <= 'f'))
+ c -= 'a' - 10;
else
- r->keepalive=FALSE;
- }
- else if (strcmp(n,"host")==0)
- r->host=t;
- else if (strcmp(n,"from")==0)
- r->from=t;
- else if (strcmp(n,"user-agent")==0)
- r->useragent=t;
- else if (strcmp(n,"referer")==0)
- r->referer=t;
- else if (strcmp(n,"range")==0)
- {
- if (strncmp(t,"bytes=",6)==0)
- if (!ListAddFromString(&(r->ranges),t+6))
- {
- /* Bad Request */
- ResponseStatus(r,400);
- return FALSE;
- };
+ *errorP = TRUE;
+
+ if (!*errorP) {
+ char d;
+ d = tolower(*x++);
+ if ((d >= '0') && (d <= '9'))
+ d -= '0';
+ else if ((d >= 'a') && (d <= 'f'))
+ d -= 'a' - 10;
+ else
+ *errorP = TRUE;
+
+ if (!*errorP)
+ *y++ = ((c << 4) | d);
+ }
+ } break;
+
+ default:
+ *y++ = *x++;
+ break;
}
- else if (strcmp(n,"cookies")==0)
- {
- if (!ListAddFromString(&(r->cookies),t))
- {
- /* Bad Request */
- ResponseStatus(r,400);
- return FALSE;
- };
- };
- };
+ }
+ *y = '\0';
}
-char *RequestHeaderValue(TSession *r,char *name)
-{
- return (TableFind(&r->request_headers,name));
+
+
+static void
+parseHostPort(const char * const hostport,
+ const char ** const hostP,
+ unsigned short * const portP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Parse a 'hostport', a string in the form www.acme.com:8080 .
+
+ Return the host name part (www.acme.com) as *hostP (in newly
+ malloced storage), and the port part (8080) as *portP.
+
+ Default the port to 80 if 'hostport' doesn't have the port part.
+-----------------------------------------------------------------------------*/
+ char * buffer;
+ char * colonPos;
+
+ buffer = strdup(hostport);
+
+ colonPos = strchr(buffer, ':');
+ if (colonPos) {
+ const char * p;
+ uint32_t port;
+
+ *colonPos = '\0'; /* Split hostport at the colon */
+
+ for (p = colonPos + 1, port = 0;
+ isdigit(*p) && port < 65535;
+ (port = port * 10 + (*p - '0')), ++p);
+
+ if (*p || port == 0)
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ *hostP = strdup(buffer);
+ *portP = port;
+ *httpErrorCodeP = 0;
+ }
+ } else {
+ *hostP = strdup(buffer);
+ *portP = 80;
+ *httpErrorCodeP = 0;
+ }
+ free(buffer);
}
-abyss_bool RequestUnescapeURI(TSession *r)
-{
- char *x,*y,c,d;
- x=y=r->uri;
- while (1)
- switch (*x)
+static void
+parseRequestUri(char * const requestUri,
+ const char ** const hostP,
+ unsigned short * const portP,
+ const char ** const pathP,
+ const char ** const queryP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Parse the request URI (in the request line
+ "GET http://www.myserver.com:8080/myfile.cgi?parm HTTP/1.1",
+ "http://www.myserver.com:8080/myfile.cgi?parm" is the request URI).
+
+ Return as *hostP the "www.myserver.com" in the above example. If
+ that part of the URI doesn't exist, return *hostP == NULL.
+
+ Return as *portP the 8080 in the above example. If it doesn't exist,
+ return 80.
+
+ Return as *pathP the "/myfile.cgi" in the above example. If it
+ doesn't exist, return "*".
+
+ Return as *queryP the "parm" in the above example. If it doesn't
+ exist, return *queryP == NULL.
+
+ Return strings in newly malloc'ed storage.
+
+ Return as *httpErrorCodeP the HTTP error code that describes how the
+ URI is invalid, or 0 if it is valid. If it's invalid, other return
+ values are meaningless.
+
+ This destroys 'requestUri'. We should fix that.
+-----------------------------------------------------------------------------*/
+ bool error;
+
+ unescapeUri(requestUri, &error);
+
+ if (error)
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ char * requestUriNoQuery;
+ /* The request URI with any query (the stuff marked by a question
+ mark at the end of a request URI) chopped off.
+ */
{
- case '\0':
- *y='\0';
- return TRUE;
-
- case '%':
- x++;
- c=tolower(*x++);
- if ((c>='0') && (c<='9'))
- c-='0';
- else if ((c>='a') && (c<='f'))
- c-='a'-10;
- else
- return FALSE;
+ /* Split requestUri at the question mark */
+ char * const qmark = strchr(requestUri, '?');
+
+ if (qmark) {
+ *qmark = '\0';
+ *queryP = strdup(qmark + 1);
+ } else
+ *queryP = NULL;
- d=tolower(*x++);
- if ((d>='0') && (d<='9'))
- d-='0';
- else if ((d>='a') && (d<='f'))
- d-='a'-10;
- else
- return FALSE;
+ requestUriNoQuery = requestUri;
+ }
- *y++=((c << 4) | d);
- break;
+ if (requestUriNoQuery[0] == '/') {
+ *hostP = NULL;
+ *pathP = strdup(requestUriNoQuery);
+ *portP = 80;
+ *httpErrorCodeP = 0;
+ } else {
+ if (!xmlrpc_strneq(requestUriNoQuery, "http://", 7))
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ char * const hostportpath = &requestUriNoQuery[7];
+ char * const slashPos = strchr(hostportpath, '/');
+
+ const char * host;
+ const char * path;
+ unsigned short port;
+
+ char * hostport;
+
+ if (slashPos) {
+ char * p;
+ path = strdup(slashPos);
+
+ /* Nul-terminate the host name. To make space for
+ it, slide the whole name back one character.
+ This moves it into the space now occupied by
+ the end of "http://", which we don't need.
+ */
+ for (p = hostportpath; *p != '/'; ++p)
+ *(p-1) = *p;
+ *(p-1) = '\0';
+
+ hostport = hostportpath - 1;
+ *httpErrorCodeP = 0;
+ } else {
+ path = strdup("*");
+ hostport = hostportpath;
+ *httpErrorCodeP = 0;
+ }
+ if (!*httpErrorCodeP)
+ parseHostPort(hostport, &host, &port, httpErrorCodeP);
+ if (*httpErrorCodeP)
+ xmlrpc_strfree(path);
+
+ *hostP = host;
+ *portP = port;
+ *pathP = path;
+ }
+ }
+ }
+}
- default:
- *y++=*x++;
- break;
- };
-};
+static void
+parseRequestLine(char * const requestLine,
+ TMethod * const httpMethodP,
+ httpVersion * const httpVersionP,
+ const char ** const hostP,
+ unsigned short * const portP,
+ const char ** const pathP,
+ const char ** const queryP,
+ bool * const moreLinesP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Modifies *requestLine!
+-----------------------------------------------------------------------------*/
+ const char * httpMethodName;
+ char * p;
-abyss_bool
-RequestValidURI(TSession *r) {
+ p = requestLine;
- char *p;
+ /* Jump over spaces */
+ NextToken((const char **)&p);
- if (!r->uri)
- return FALSE;
+ httpMethodName = GetToken(&p);
+ if (!httpMethodName)
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ char * requestUri;
+
+ if (xmlrpc_streq(httpMethodName, "GET"))
+ *httpMethodP = m_get;
+ else if (xmlrpc_streq(httpMethodName, "PUT"))
+ *httpMethodP = m_put;
+ else if (xmlrpc_streq(httpMethodName, "OPTIONS"))
+ *httpMethodP = m_options;
+ else if (xmlrpc_streq(httpMethodName, "DELETE"))
+ *httpMethodP = m_delete;
+ else if (xmlrpc_streq(httpMethodName, "POST"))
+ *httpMethodP = m_post;
+ else if (xmlrpc_streq(httpMethodName, "TRACE"))
+ *httpMethodP = m_trace;
+ else if (xmlrpc_streq(httpMethodName, "HEAD"))
+ *httpMethodP = m_head;
+ else
+ *httpMethodP = m_unknown;
+
+ /* URI and Query Decoding */
+ NextToken((const char **)&p);
- if (*(r->uri)!='/') {
- if (strncmp(r->uri,"http://",7)!=0)
- return FALSE;
+ requestUri = GetToken(&p);
+ if (!requestUri)
+ *httpErrorCodeP = 400; /* Bad Request */
else {
- r->uri+=7;
- r->host=r->uri;
- p=strchr(r->uri,'/');
-
- if (!p) {
- r->uri="*";
- return TRUE;
- };
-
- r->uri=p;
- p=r->host;
-
- while (*p!='/') {
- *(p-1)=*p;
- p++;
- };
+ const char * host;
+ unsigned short port;
+ const char * path;
+ const char * query;
+
+ parseRequestUri(requestUri, &host, &port, &path, &query,
+ httpErrorCodeP);
- --p;
- *p='\0';
+ if (!*httpErrorCodeP) {
+ const char * httpVersion;
- --r->host;
- };
+ NextToken((const char **)&p);
+
+ /* HTTP Version Decoding */
+
+ httpVersion = GetToken(&p);
+ if (httpVersion) {
+ uint32_t vmin, vmaj;
+ if (sscanf(httpVersion, "HTTP/%d.%d", &vmaj, &vmin) != 2)
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ httpVersionP->major = vmaj;
+ httpVersionP->minor = vmin;
+ *httpErrorCodeP = 0; /* no error */
+ }
+ *moreLinesP = TRUE;
+ } else {
+ /* There is no HTTP version, so this is a single
+ line request.
+ */
+ *httpErrorCodeP = 0; /* no error */
+ *moreLinesP = FALSE;
+ }
+ if (*httpErrorCodeP) {
+ xmlrpc_strfree(host);
+ xmlrpc_strfree(path);
+ xmlrpc_strfree(query);
+ }
+ *hostP = host;
+ *portP = port;
+ *pathP = path;
+ *queryP = query;
+ }
+ }
+ }
+}
+
+
+
+static void
+strtolower(char * const s) {
+
+ char * t;
+
+ t = &s[0];
+ while (*t) {
+ *t = tolower(*t);
+ ++t;
}
+}
+
- /* Host and Port Decoding */
- if (r->host) {
- p=strchr(r->host,':');
- if (p) {
- uint32_t port=0;
-
- *p='\0';
- p++;
- while (isdigit(*p) && (port<65535)) {
- port=port*10+(*p)-'0';
- ++p;
- };
+
+static void
+getFieldNameToken(char ** const pP,
+ char ** const fieldNameP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Assuming that *pP points to the place in an HTTP header where the field
+ name belongs, return the field name and advance *pP past that token.
+
+ The field name is the lower case representation of the value of the
+ field name token.
+-----------------------------------------------------------------------------*/
+ char * fieldName;
+
+ NextToken((const char **)pP);
+
+ fieldName = GetToken(pP);
+ if (!fieldName)
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ if (fieldName[strlen(fieldName)-1] != ':')
+ /* Not a valid field name */
+ *httpErrorCodeP = 400; /* Bad Request */
+ else {
+ fieldName[strlen(fieldName)-1] = '\0'; /* remove trailing colon */
+
+ strtolower(fieldName);
- r->port=port;
+ *httpErrorCodeP = 0; /* no error */
+ *fieldNameP = fieldName;
+ }
+ }
+}
+
+
+
+static void
+processHeader(const char * const fieldName,
+ char * const fieldValue,
+ TSession * const sessionP,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ We may modify *fieldValue, and we put pointers to *fieldValue and
+ *fieldName into *sessionP.
+
+ We must fix this some day. *sessionP should point to individual
+ malloc'ed strings.
+-----------------------------------------------------------------------------*/
+ *httpErrorCodeP = 0; /* initial assumption */
+
+ if (xmlrpc_streq(fieldName, "connection")) {
+ if (xmlrpc_strcaseeq(fieldValue, "keep-alive"))
+ sessionP->requestInfo.keepalive = TRUE;
+ else
+ sessionP->requestInfo.keepalive = FALSE;
+ } else if (xmlrpc_streq(fieldName, "host")) {
+ if (sessionP->requestInfo.host) {
+ xmlrpc_strfree(sessionP->requestInfo.host);
+ sessionP->requestInfo.host = NULL;
+ }
+ parseHostPort(fieldValue, &sessionP->requestInfo.host,
+ &sessionP->requestInfo.port, httpErrorCodeP);
+ } else if (xmlrpc_streq(fieldName, "from"))
+ sessionP->requestInfo.from = fieldValue;
+ else if (xmlrpc_streq(fieldName, "user-agent"))
+ sessionP->requestInfo.useragent = fieldValue;
+ else if (xmlrpc_streq(fieldName, "referer"))
+ sessionP->requestInfo.referer = fieldValue;
+ else if (xmlrpc_streq(fieldName, "range")) {
+ if (xmlrpc_strneq(fieldValue, "bytes=", 6)) {
+ bool succeeded;
+ succeeded = ListAddFromString(&sessionP->ranges, &fieldValue[6]);
+ *httpErrorCodeP = succeeded ? 0 : 400;
+ }
+ } else if (xmlrpc_streq(fieldName, "cookies")) {
+ bool succeeded;
+ succeeded = ListAddFromString(&sessionP->cookies, fieldValue);
+ *httpErrorCodeP = succeeded ? 0 : 400;
+ } else if (xmlrpc_streq(fieldName, "expect")) {
+ if (xmlrpc_strcaseeq(fieldValue, "100-continue"))
+ sessionP->continueRequired = TRUE;
+ }
+}
+
- if (*p || port==0)
- return FALSE;
- };
+
+static void
+readAndProcessHeaders(TSession * const sessionP,
+ time_t const deadline,
+ uint16_t * const httpErrorCodeP) {
+/*----------------------------------------------------------------------------
+ Read all the HTTP headers from the session *sessionP, which has at
+ least one header coming. Update *sessionP to reflect the
+ information in the headers.
+
+ If we find an error in the headers or while trying to read them, we
+ return an appropriate HTTP error code as *httpErrorCodeP. Otherwise,
+ we return *httpErrorCodeP = 0.
+-----------------------------------------------------------------------------*/
+ bool endOfHeaders;
+
+ assert(!sessionP->validRequest);
+ /* Calling us doesn't make sense if there is already a valid request */
+
+ *httpErrorCodeP = 0; /* initial assumption */
+ endOfHeaders = false; /* Caller assures us there is at least one header */
+
+ while (!endOfHeaders && !*httpErrorCodeP) {
+ char * header;
+ bool error;
+ readHeader(sessionP->conn, deadline, &endOfHeaders, &header, &error);
+ if (error)
+ *httpErrorCodeP = 408; /* Request Timeout */
+ else {
+ if (!endOfHeaders) {
+ char * p;
+ char * fieldName;
+
+ p = &header[0];
+ getFieldNameToken(&p, &fieldName, httpErrorCodeP);
+ if (!*httpErrorCodeP) {
+ char * fieldValue;
+
+ NextToken((const char **)&p);
+
+ fieldValue = p;
+
+ TableAdd(&sessionP->request_headers,
+ fieldName, fieldValue);
+
+ processHeader(fieldName, fieldValue, sessionP,
+ httpErrorCodeP);
+ }
+ }
+ }
}
- if (strcmp(r->uri,"*")==0)
- return (r->method!=m_options);
+}
+
+
+
+void
+RequestRead(TSession * const sessionP,
+ uint32_t const timeout) {
+/*----------------------------------------------------------------------------
+ Read the headers of a new HTTP request (assuming nothing has yet been
+ read on the session).
+
+ Update *sessionP with the information from the headers.
+
+ Leave the connection positioned to the body of the request, ready
+ to be read by an HTTP request handler (via SessionRefillBuffer() and
+ SessionGetReadData()).
+-----------------------------------------------------------------------------*/
+ time_t const deadline = time(NULL) + timeout;
+
+ uint16_t httpErrorCode; /* zero for no error */
+ char * requestLine; /* In connection;s internal buffer */
+
+ readRequestHeader(sessionP, deadline, &requestLine, &httpErrorCode);
+ if (!httpErrorCode) {
+ TMethod httpMethod;
+ const char * host;
+ const char * path;
+ const char * query;
+ unsigned short port;
+ bool moreHeaders;
+
+ parseRequestLine(requestLine, &httpMethod, &sessionP->version,
+ &host, &port, &path, &query,
+ &moreHeaders, &httpErrorCode);
+
+ if (!httpErrorCode) {
+ initRequestInfo(&sessionP->requestInfo, sessionP->version,
+ requestLine,
+ httpMethod, host, port, path, query);
+
+ if (moreHeaders)
+ readAndProcessHeaders(sessionP, deadline, &httpErrorCode);
+
+ if (httpErrorCode == 0)
+ sessionP->validRequest = true;
+
+ xmlrpc_strfreenull(host);
+ xmlrpc_strfree(path);
+ xmlrpc_strfreenull(query);
+ }
+ }
+ if (httpErrorCode)
+ ResponseStatus(sessionP, httpErrorCode);
+}
+
+
+
+char *
+RequestHeaderValue(TSession * const sessionP,
+ const char * const name) {
+
+ return (TableFind(&sessionP->request_headers, name));
+}
+
+
+
+bool
+RequestValidURI(TSession * const sessionP) {
+
+ if (!sessionP->requestInfo.uri)
+ return FALSE;
+
+ if (xmlrpc_streq(sessionP->requestInfo.uri, "*"))
+ return (sessionP->requestInfo.method != m_options);
- if (strchr(r->uri,'*'))
+ if (strchr(sessionP->requestInfo.uri, '*'))
return FALSE;
return TRUE;
}
-abyss_bool RequestValidURIPath(TSession *r)
-{
- uint32_t i=0;
- char *p=r->uri;
- if (*p=='/')
- {
- i=1;
+bool
+RequestValidURIPath(TSession * const sessionP) {
+
+ uint32_t i;
+ const char * p;
+
+ p = sessionP->requestInfo.uri;
+
+ i = 0;
+
+ if (*p == '/') {
+ i = 1;
while (*p)
- if (*(p++)=='/')
- {
- if (*p=='/')
+ if (*(p++) == '/') {
+ if (*p == '/')
break;
- else if ((strncmp(p,"./",2)==0) || (strcmp(p,".")==0))
- p++;
- else if ((strncmp(p,"../",2)==0) || (strcmp(p,"..")==0))
- {
- p+=2;
- i--;
- if (i==0)
+ else if ((strncmp(p,"./",2) == 0) || (strcmp(p, ".") == 0))
+ ++p;
+ else if ((strncmp(p, "../", 2) == 0) ||
+ (strcmp(p, "..") == 0)) {
+ p += 2;
+ --i;
+ if (i == 0)
break;
}
/* Prevent accessing hidden files (starting with .) */
- else if (*p=='.')
+ else if (*p == '.')
return FALSE;
else
if (*p)
- i++;
- };
- };
-
- return ((*p==0) && (i>0));
+ ++i;
+ }
+ }
+ return (*p == 0 && i > 0);
}
-abyss_bool
-RequestAuth(TSession *r,char *credential,char *user,char *pass) {
+bool
+RequestAuth(TSession * const sessionP,
+ const char * const credential,
+ const char * const user,
+ const char * const pass) {
+/*----------------------------------------------------------------------------
+ Authenticate requester, in a very simplistic fashion.
+
+ If the request specifies basic authentication (via Authorization
+ header) with username 'user', password 'pass', then return TRUE.
+ Else, return FALSE and set up an authorization failure response
+ (HTTP response status 401) that says user must supply an identity
+ in the 'credential' domain.
+
+ When we return TRUE, we also set the username in the request info
+ to 'user' so that a future SessionGetRequestInfo can get it.
+-----------------------------------------------------------------------------*/
+ bool authorized;
+ char * authHdrPtr;
+
+ authHdrPtr = RequestHeaderValue(sessionP, "authorization");
+ if (authHdrPtr) {
+ const char * authType;
+ NextToken((const char **)&authHdrPtr);
+ GetTokenConst(&authHdrPtr, &authType);
+ authType = GetToken(&authHdrPtr);
+ if (authType) {
+ if (xmlrpc_strcaseeq(authType, "basic")) {
+ const char * userPass;
+ char userPassEncoded[80];
+
+ NextToken((const char **)&authHdrPtr);
+
+ xmlrpc_asprintf(&userPass, "%s:%s", user, pass);
+ Base64Encode(userPass, userPassEncoded);
+ xmlrpc_strfree(userPass);
+
+ if (xmlrpc_streq(authHdrPtr, userPassEncoded)) {
+ sessionP->requestInfo.user = strdup(user);
+ authorized = TRUE;
+ } else
+ authorized = FALSE;
+ } else
+ authorized = FALSE;
+ } else
+ authorized = FALSE;
+ } else
+ authorized = FALSE;
+
+ if (!authorized) {
+ const char * hdrValue;
+ xmlrpc_asprintf(&hdrValue, "Basic realm=\"%s\"", credential);
+ ResponseAddField(sessionP, "WWW-Authenticate", hdrValue);
- char *p,*x;
- char z[80],t[80];
+ xmlrpc_strfree(hdrValue);
- p=RequestHeaderValue(r,"authorization");
- if (p) {
- NextToken(&p);
- x=GetToken(&p);
- if (x) {
- if (strcasecmp(x,"basic")==0) {
- NextToken(&p);
- sprintf(z,"%s:%s",user,pass);
- Base64Encode(z,t);
-
- if (strcmp(p,t)==0) {
- r->user=strdup(user);
- return TRUE;
- };
- };
- }
- };
-
- sprintf(z,"Basic realm=\"%s\"",credential);
- ResponseAddField(r,"WWW-Authenticate",z);
- ResponseStatus(r,401);
- return FALSE;
+ ResponseStatus(sessionP, 401);
+ }
+ return authorized;
}
@@ -499,10 +1091,17 @@
** Range
*********************************************************************/
-abyss_bool RangeDecode(char *str,uint64_t filesize,uint64_t *start,uint64_t *end)
-{
+abyss_bool
+RangeDecode(char * const strArg,
+ xmlrpc_uint64_t const filesize,
+ xmlrpc_uint64_t * const start,
+ xmlrpc_uint64_t * const end) {
+
+ char *str;
char *ss;
+ str = strArg; /* initial value */
+
*start=0;
*end=filesize-1;
@@ -534,13 +1133,15 @@
** HTTP
*********************************************************************/
-char *HTTPReasonByStatus(uint16_t code)
-{
- static struct _HTTPReasons {
+const char *
+HTTPReasonByStatus(uint16_t const code) {
+
+ struct _HTTPReasons {
uint16_t status;
- char *reason;
- } *r,reasons[] =
- {
+ const char * reason;
+ };
+
+ static struct _HTTPReasons const reasons[] = {
{ 100,"Continue" },
{ 101,"Switching Protocols" },
{ 200,"OK" },
@@ -580,14 +1181,15 @@
{ 505,"HTTP Version Not Supported" },
{ 000, NULL }
};
+ const struct _HTTPReasons * reasonP;
- r=reasons;
+ reasonP = &reasons[0];
- while (r->status<=code)
- if (r->status==code)
- return (r->reason);
+ while (reasonP->status <= code)
+ if (reasonP->status == code)
+ return reasonP->reason;
else
- r++;
+ ++reasonP;
return "No Reason";
}
@@ -595,494 +1197,111 @@
int32_t
-HTTPRead(TSession * const s ATTR_UNUSED,
- char * const buffer ATTR_UNUSED,
- uint32_t const len ATTR_UNUSED) {
+HTTPRead(TSession * const s ATTR_UNUSED,
+ const char * const buffer ATTR_UNUSED,
+ uint32_t const len ATTR_UNUSED) {
return 0;
}
-abyss_bool HTTPWrite(TSession *s,char *buffer,uint32_t len)
-{
- if (s->chunkedwrite && s->chunkedwritemode)
- {
- char t[16];
-
- if (ConnWrite(s->conn,t,sprintf(t,"%x"CRLF,len)))
- if (ConnWrite(s->conn,buffer,len))
- return ConnWrite(s->conn,CRLF,2);
-
- return FALSE;
- }
-
- return ConnWrite(s->conn,buffer,len);
-}
-
-abyss_bool HTTPWriteEnd(TSession *s)
-{
- if (!s->chunkedwritemode)
- return TRUE;
-
- if (s->chunkedwrite)
- {
- /* May be one day trailer dumping will be added */
- s->chunkedwritemode=FALSE;
- return ConnWrite(s->conn,"0"CRLF CRLF,5);
- }
-
- s->keepalive=FALSE;
- return TRUE;
-}
-
-/*********************************************************************
-** Response
-*********************************************************************/
-
-void ResponseError(TSession *r)
-{
- char *reason=HTTPReasonByStatus(r->status);
- char z[500];
-
- ResponseAddField(r,"Content-type","text/html");
-
- ResponseWrite(r);
-
- sprintf(z,"<HTML><HEAD><TITLE>Error %d</TITLE></HEAD>"
- "<BODY><H1>Error %d</H1><P>%s</P>" SERVER_HTML_INFO
- "</BODY></HTML>",
- r->status,r->status,reason);
-
- ConnWrite(r->conn,z,strlen(z));
-}
-
-abyss_bool ResponseChunked(TSession *r)
-{
- /* This is only a hope, things will be real only after a call of
- ResponseWrite
- */
- r->chunkedwrite=(r->versionmajor>=1) && (r->versionminor>=1);
- r->chunkedwritemode=TRUE;
-
- return TRUE;
-}
-
-void ResponseStatus(TSession *r,uint16_t code)
-{
- r->status=code;
-}
-
-void ResponseStatusErrno(TSession *r)
-{
- uint16_t code;
-
- switch (errno)
- {
- case EACCES:
- code=403;
- break;
- case ENOENT:
- code=404;
- break;
- default:
- code=500;
- };
-
- ResponseStatus(r,code);
-}
-
-abyss_bool ResponseAddField(TSession *r,char *name,char *value)
-{
- return TableAdd(&r->response_headers,name,value);
-}
-
-void ResponseWrite(TSession *r)
-{
- abyss_bool connclose=TRUE;
- char z[64];
- TTableItem *ti;
- uint16_t i;
- char *reason;
-
- /* if status == 0 then this is an error */
- if (r->status==0)
- r->status=500;
-
- /* the request was treated */
- r->done=TRUE;
-
- reason=HTTPReasonByStatus(r->status);
- sprintf(z,"HTTP/1.1 %d ",r->status);
- ConnWrite(r->conn,z,strlen(z));
- ConnWrite(r->conn,reason,strlen(reason));
- ConnWrite(r->conn,CRLF,2);
-
- /* generation of the connection field */
- if ((r->status<400) && (r->keepalive) && (r->cankeepalive))
- connclose=FALSE;
-
- ResponseAddField(r,"Connection",
- (connclose?"close":"Keep-Alive"));
-
- if (!connclose)
- {
- sprintf(z,"timeout=%u, max=%u",r->server->keepalivetimeout
- ,r->server->keepalivemaxconn);
-
- ResponseAddField(r,"Keep-Alive",z);
-
- if (r->chunkedwrite && r->chunkedwritemode)
- {
- if (!ResponseAddField(r,"Transfer-Encoding","chunked"))
- {
- r->chunkedwrite=FALSE;
- r->keepalive=FALSE;
- };
- };
- }
- else
- {
- r->keepalive=FALSE;
- r->chunkedwrite=FALSE;
- };
-
- /* generation of the date field */
- if ((r->status>=200) && DateToString(&r->date,z))
- ResponseAddField(r,"Date",z);
-
- /* Generation of the server field */
- if (r->server->advertise)
- ResponseAddField(r,"Server",SERVER_HVERSION);
-
- /* send all the fields */
- for (i=0;i<r->response_headers.size;i++)
- {
- ti=&r->response_headers.item[i];
- ConnWrite(r->conn,ti->name,strlen(ti->name));
- ConnWrite(r->conn,": ",2);
- ConnWrite(r->conn,ti->value,strlen(ti->value));
- ConnWrite(r->conn,CRLF,2);
- };
-
- ConnWrite(r->conn,CRLF,2);
-}
-
-abyss_bool ResponseContentType(TSession *r,char *type)
-{
- return ResponseAddField(r,"Content-type",type);
-}
-
-abyss_bool ResponseContentLength(TSession *r,uint64_t len)
-{
- char z[32];
-
- sprintf(z,"%llu",len);
- return ResponseAddField(r,"Content-length",z);
-}
-
-
-/*********************************************************************
-** MIMEType
-*********************************************************************/
-
-TList _MIMETypes,_MIMEExt;
-TPool _MIMEPool;
-
-void MIMETypeInit()
-{
- ListInit(&_MIMETypes);
- ListInit(&_MIMEExt);
- PoolCreate(&_MIMEPool,1024);
-}
-
-abyss_bool MIMETypeAdd(char *type,char *ext)
-{
- uint16_t index;
-
- if (ListFindString(&_MIMETypes,type,&index))
- type=_MIMETypes.item[index];
- else
- if (!(type=PoolStrdup(&_MIMEPool,type)))
- return FALSE;
-
- if (ListFindString(&_MIMEExt,ext,&index))
- _MIMETypes.item[index]=type;
- else {
- ext=PoolStrdup(&_MIMEPool,ext);
- if (ext)
- return (ListAdd(&_MIMETypes,type) && ListAdd(&_MIMEExt,ext));
- else
- return FALSE;
- }
- return TRUE;
-}
-
-char *MIMETypeFromExt(char *ext)
-{
- uint16_t extindex;
-
- if (!ListFindString(&_MIMEExt,ext,&extindex))
- return NULL;
- else
- return _MIMETypes.item[extindex];
-}
-
-char *MIMETypeFromFileName(char *filename)
-{
- char *p=filename+strlen(filename),*z=NULL;
-
- while ((*p!='.') && (p>=filename) && ((*p)!='/'))
- p--;
-
- if (*p=='.')
- z=MIMETypeFromExt(p+1);
-
- if (z)
- return z;
- else
- return "application/octet-stream";
-}
-
-char *MIMETypeGuessFromFile(char *filename)
-{
- char *p=filename+strlen(filename),*z=NULL;
- TFile file;
-
- while ((*p!='.') && (p>=filename) && ((*p)!='/'))
- p--;
-
- if (*p=='.')
- z=MIMETypeFromExt(p+1);
-
- if (z)
- return z;
-
- if (FileOpen(&file,filename,O_BINARY | O_RDONLY))
- {
- uint8_t buffer[80],c;
- int32_t len,i,n=0;
-
- i=len=FileRead(&file,buffer,80);
-
- while (i>0)
- {
- i--;
- c=buffer[i];
- if ((c>=' ') || (isspace(c)) || (c==26))
- n++;
- };
-
- if (n==len)
- z="text/plain";
-
- FileClose(&file);
- };
-
- if (z)
- return z;
- else
- return "application/octet-stream";
-}
-
-/*********************************************************************
-** Date
-*********************************************************************/
-
-static char *_DateDay[7]=
-{
- "Sun","Mon","Tue","Wed","Thu","Fri","Sat"
-};
-
-static char *_DateMonth[12]=
-{
- "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
-};
-
-static int32_t _DateTimeBias=0;
-static char _DateTimeBiasStr[6]="";
-
-abyss_bool DateToString(TDate *tm,char *s)
-{
- if (mktime(tm)==(time_t)(-1))
- {
- *s='\0';
- return FALSE;
- };
-
- sprintf(s,"%s, %02d %s %04d %02d:%02d:%02d GMT",_DateDay[tm->tm_wday],tm->tm_mday,
- _DateMonth[tm->tm_mon],tm->tm_year+1900,tm->tm_hour,tm->tm_min,tm->tm_sec);
+bool
+HTTPWriteBodyChunk(TSession * const sessionP,
+ const char * const buffer,
+ uint32_t const len) {
+
+ bool succeeded;
+
+ if (sessionP->chunkedwrite && sessionP->chunkedwritemode) {
+ char chunkHeader[16];
+
+ sprintf(chunkHeader, "%x\r\n", len);
+
+ succeeded =
+ ConnWrite(sessionP->conn, chunkHeader, strlen(chunkHeader));
+ if (succeeded) {
+ succeeded = ConnWrite(sessionP->conn, buffer, len);
+ if (succeeded)
+ succeeded = ConnWrite(sessionP->conn, "\r\n", 2);
+ }
+ } else
+ succeeded = ConnWrite(sessionP->conn, buffer, len);
- return TRUE;
+ return succeeded;
}
-abyss_bool DateToLogString(TDate *tm,char *s)
-{
- time_t t;
- TDate d;
-
- if ((t=mktime(tm))!=(time_t)(-1))
- if (DateFromLocal(&d,t))
- {
- sprintf(s,"%02d/%s/%04d:%02d:%02d:%02d %s",d.tm_mday,_DateMonth[d.tm_mon],
- d.tm_year+1900,d.tm_hour,d.tm_min,d.tm_sec,_DateTimeBiasStr);
-
- return TRUE;
- };
- *s='\0';
- return FALSE;
-}
-abyss_bool DateDecode(char *s,TDate *tm)
-{
- uint32_t n=0;
-
- /* Ignore spaces, day name and spaces */
- while ((*s==' ') || (*s=='\t'))
- s++;
-
- while ((*s!=' ') && (*s!='\t'))
- s++;
-
- while ((*s==' ') || (*s=='\t'))
- s++;
-
- /* try to recognize the date format */
- if (sscanf(s,"%*s %d %d:%d:%d %d%*s",&tm->tm_mday,&tm->tm_hour,&tm->tm_min,
- &tm->tm_sec,&tm->tm_year)!=5)
- if (sscanf(s,"%d %n%*s %d %d:%d:%d GMT%*s",&tm->tm_mday,&n,&tm->tm_year,
- &tm->tm_hour,&tm->tm_min,&tm->tm_sec)!=5)
- if (sscanf(s,"%d-%n%*[A-Za-z]-%d %d:%d:%d GMT%*s",&tm->tm_mday,&n,&tm->tm_year,
- &tm->tm_hour,&tm->tm_min,&tm->tm_sec)!=5)
- return FALSE;
-
- /* s points now to the month string */
- s+=n;
- for (n=0;n<12;n++)
- {
- char *p=_DateMonth[n];
+bool
+HTTPWriteEndChunk(TSession * const sessionP) {
- if (tolower(*p++)==tolower(*s))
- if (*p++==tolower(s[1]))
- if (*p==tolower(s[2]))
- break;
- };
+ bool retval;
- if (n==12)
- return FALSE;
-
- tm->tm_mon=n;
-
- /* finish the work */
- if (tm->tm_year>1900)
- tm->tm_year-=1900;
- else
- if (tm->tm_year<70)
- tm->tm_year+=100;
-
- tm->tm_isdst=0;
+ if (sessionP->chunkedwritemode && sessionP->chunkedwrite) {
+ /* May be one day trailer dumping will be added */
+ sessionP->chunkedwritemode = FALSE;
+ retval = ConnWrite(sessionP->conn, "0\r\n\r\n", 5);
+ } else
+ retval = TRUE;
- return (mktime(tm)!=(time_t)(-1));
+ return retval;
}
-int32_t DateCompare(TDate *d1,TDate *d2)
-{
- int32_t x;
- if ((x=d1->tm_year-d2->tm_year)==0)
- if ((x=d1->tm_mon-d2->tm_mon)==0)
- if ((x=d1->tm_mday-d2->tm_mday)==0)
- if ((x=d1->tm_hour-d2->tm_hour)==0)
- if ((x=d1->tm_min-d2->tm_min)==0)
- x=d1->tm_sec-d2->tm_sec;
- return x;
+bool
+HTTPKeepalive(TSession * const sessionP) {
+/*----------------------------------------------------------------------------
+ Return value: the connection should be kept alive after the session
+ *sessionP is over.
+-----------------------------------------------------------------------------*/
+ return (sessionP->requestInfo.keepalive &&
+ !sessionP->serverDeniesKeepalive &&
+ sessionP->status < 400);
}
-abyss_bool
-DateFromGMT(TDate *d,time_t t) {
- TDate *dx;
+bool
+HTTPWriteContinue(TSession * const sessionP) {
- dx=gmtime(&t);
- if (dx) {
- *d=*dx;
- return TRUE;
- };
+ char const continueStatus[] = "HTTP/1.1 100 continue\r\n\r\n";
+ /* This is a status line plus an end-of-headers empty line */
- return FALSE;
+ return ConnWrite(sessionP->conn, continueStatus, strlen(continueStatus));
}
-abyss_bool DateFromLocal(TDate *d,time_t t)
-{
- return DateFromGMT(d,t+_DateTimeBias*2);
-}
-
-
-
-abyss_bool
-DateInit() {
- time_t t;
- TDate gmt,local,*d;
-
- time(&t);
- if (DateFromGMT(&gmt,t)) {
- d=localtime(&t);
- if (d) {
- local=*d;
- _DateTimeBias =
- (local.tm_sec-gmt.tm_sec)+(local.tm_min-gmt.tm_min)*60
- +(local.tm_hour-gmt.tm_hour)*3600;
- sprintf(_DateTimeBiasStr, "%+03d%02d",
- _DateTimeBias/3600,(_DateTimeBias % 3600)/60);
- return TRUE;
- };
- }
- return FALSE;
-}
-
-/*********************************************************************
-** Base64
-*********************************************************************/
-
-void Base64Encode(char *s,char *d)
-{
- /* Conversion table. */
- static char tbl[64] = {
- 'A','B','C','D','E','F','G','H',
- 'I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','W','X',
- 'Y','Z','a','b','c','d','e','f',
- 'g','h','i','j','k','l','m','n',
- 'o','p','q','r','s','t','u','v',
- 'w','x','y','z','0','1','2','3',
- '4','5','6','7','8','9','+','/'
- };
-
- uint32_t i,length=strlen(s);
- char *p=d;
-
- /* Transform the 3x8 bits to 4x6 bits, as required by base64. */
- for (i = 0; i < length; i += 3)
- {
- *p++ = tbl[s[0] >> 2];
- *p++ = tbl[((s[0] & 3) << 4) + (s[1] >> 4)];
- *p++ = tbl[((s[1] & 0xf) << 2) + (s[2] >> 6)];
- *p++ = tbl[s[2] & 0x3f];
- s += 3;
- }
-
- /* Pad the result if necessary... */
- if (i == length + 1)
- *(p - 1) = '=';
- else if (i == length + 2)
- *(p - 1) = *(p - 2) = '=';
-
- /* ...and zero-terminate it. */
- *p = '\0';
-}
-
+/******************************************************************************
+**
+** http.c
+**
+** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+******************************************************************************/
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/main.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/main.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/main.c Mon May 26 12:59:57 2008
@@ -37,13 +37,9 @@
#include <time.h>
#include <fcntl.h>
-#ifdef ABYSS_WIN32
+#ifdef WIN32
#include <io.h>
-#else
-/* Must check this
-#include <sys/io.h>
-*/
-#endif /* ABYSS_WIN32 */
+#endif /* WIN32 */
#ifdef _UNIX
#include <sys/signal.h>
@@ -60,7 +56,7 @@
ResponseContentType(r,"text/html");
- ResponseWrite(r);
+ ResponseWriteStart(r);
HTTPWrite(r,"<HTML><BODY>",12);
@@ -76,6 +72,8 @@
char z[50];
time_t ltime;
TDate date;
+ const char * dateString;
+ const char * answer;
if (strcmp(r->uri,"/time")!=0)
return FALSE;
@@ -83,14 +81,17 @@
if (!RequestAuth(r,"Mot de passe","moez","hello"))
return TRUE;
- time( <ime );
- DateFromGMT(&date,ltime);
-
+ time(<ime);
+ DateFromGMT(&date, ltime);
- strcpy(z,"The time is ");
- DateToString(&date,z+strlen(z));
+ DateToString(&date, &dateString);
- Answer(r,200,z);
+ xmlrpc_asprintf(&answer, "The time is %s", dateString);
+
+ Answer(r, 200, answer);
+
+ xmlrpc_strfree(dateString);
+ xmlrpc_strfree(answer);
return TRUE;
}
@@ -142,49 +143,52 @@
TraceExit("Signal %d received. Exiting...\n",sig);
}
-static void sigchld(int sig)
-{
- pid_t pid;
- int status;
- /* Reap defunct children until there aren't any more. */
- for (;;)
- {
- pid = waitpid( (pid_t) -1, &status, WNOHANG );
- /* none left */
- if (pid==0)
- break;
+static void
+sigchld(int const signalClass) {
- if (pid<0)
- {
- /* because of ptrace */
- if (errno==EINTR)
- continue;
+ bool childrenLeft;
+ bool error;
- break;
+ childrenLeft = true;
+ error = false;
+
+ /* Reap defunct children until there aren't any more. */
+ while (childrenLeft && !error) {
+ int status;
+ pid_t rc;
+ rc = waitpid((pid_t) -1, &status, WNOHANG);
+
+ if (rc == 0)
+ childrenLeft = false;
+ else if (rc < 0) {
+ /* because of ptrace */
+ if (errno == EINTR) {
+ /* ptrace causes this */
+ } else
+ error = true;
+ } else {
+ /* We reaped a child. */
+ pid_t const pid = rc;
+ ThreadHandleSigchld(pid);
}
}
}
#endif _UNIX
-void copyright()
-{
- printf("ABYSS Web Server version "SERVER_VERSION"\n(C) Moez Mahfoudh - 2000\n\n");
-}
-void help(char *name)
-{
- copyright();
- printf("Usage: %s [-h] [-c configuration file]\n\n",name);
-}
int main(int argc,char **argv)
{
+ const char * const name = argv[0];
TServer srv;
- char *p,*conffile=DEFAULT_CONF_FILE;
- abyss_bool err=FALSE;
- char *name=argv[0];
+ char * p;
+ const char * conffile;
+ bool err;
+
+ conffile = DEFAULT_CONF_FILE; /* initial value */
+ err = FALSE; /* initial value */
while (p=*(++argv))
{
@@ -199,9 +203,6 @@
else
err=TRUE;
break;
- case 'h':
- help(name);
- exit(0);
default:
err=TRUE;
}
@@ -217,11 +218,6 @@
exit(1);
};
-#ifdef ABYSS_WIN32
- copyright();
- printf("\nPress Ctrl+C to stop the server\n");
-#endif
-
DateInit();
MIMETypeInit();
@@ -246,47 +242,9 @@
/* Catch defunct children. */
signal(SIGCHLD,sigchld);
- /* Become a daemon */
- switch (fork())
- {
- case 0:
- break;
- case -1:
- TraceExit("Unable to become a daemon");
- default:
- exit(0);
- };
-
-#if !defined( _NO_USERS ) && !defined( __CYGWIN32__ )
- setsid();
- /* Change the current user if we are root */
- if (getuid()==0)
- {
- if (srv.uid==(-1))
- TraceExit("Can't run under root privileges. Please add a User option in your configuration file.");
-
- if (setgroups(0,NULL)==(-1))
- TraceExit("Failed to setup the group.");
-
- if (srv.gid!=(-1))
- if (setgid(srv.gid)==(-1))
- TraceExit("Failed to change the group.");
-
- if (setuid(srv.uid)==(-1))
- TraceExit("Failed to change the user.");
- };
#endif
- if (srv.pidfile!=(-1))
- {
- char z[16];
-
- sprintf(z,"%d",getpid());
- FileWrite(&srv.pidfile,z,strlen(z));
- FileClose(&srv.pidfile);
- };
-
-#endif
+ ServerDaemonize(srv);
ServerRun(&srv);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/server.c Mon May 26 12:59:57 2008
@@ -1,929 +1,1235 @@
-/*******************************************************************************
-**
-** server.c
-**
-** This file is part of the ABYSS Web server project.
-**
-** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-**
-*******************************************************************************/
+/* Copyright information is at end of file */
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+#ifndef WIN32
+ #include <grp.h>
+#endif
+
+#include "xmlrpc_config.h"
+#include "bool.h"
+#include "girmath.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/sleep_int.h"
+
+#include "xmlrpc-c/abyss.h"
+#include "trace.h"
+#include "session.h"
+#include "file.h"
+#include "conn.h"
+#include "chanswitch.h"
+#include "channel.h"
+#include "socket.h"
+#ifdef WIN32
+ #include "socket_win.h"
+#else
+ #include "socket_unix.h"
+#endif
+#include "http.h"
+#include "handler.h"
+
+#include "server.h"
+
+
+void
+ServerTerminate(TServer * const serverP) {
+
+ struct _TServer * const srvP = serverP->srvP;
+
+ srvP->terminationRequested = true;
+
+ if (srvP->chanSwitchP)
+ ChanSwitchInterrupt(srvP->chanSwitchP);
+}
+
+
+
+void
+ServerResetTerminate(TServer * const serverP) {
+
+ struct _TServer * const srvP = serverP->srvP;
+
+ srvP->terminationRequested = false;
+}
+
+
+
+static void
+initUnixStuff(struct _TServer * const srvP) {
+#ifndef WIN32
+ srvP->pidfileP = NULL;
+ srvP->uid = srvP->gid = -1;
+#endif
+}
+
+
+
+static bool
+logOpen(struct _TServer * const srvP) {
+
+ bool success;
+
+ success = FileOpenCreate(&srvP->logfileP, srvP->logfilename,
+ O_WRONLY | O_APPEND);
+ if (success) {
+ bool success;
+ success = MutexCreate(&srvP->logmutexP);
+ if (success)
+ srvP->logfileisopen = TRUE;
+ else
+ TraceMsg("Can't create mutex for log file");
+
+ if (!success)
+ FileClose(srvP->logfileP);
+ } else
+ TraceMsg("Can't open log file '%s'", srvP->logfilename);
+
+ return success;
+}
+
+
+
+static void
+logClose(struct _TServer * const srvP) {
+
+ if (srvP->logfileisopen) {
+ FileClose(srvP->logfileP);
+ MutexDestroy(srvP->logmutexP);
+ srvP->logfileisopen = FALSE;
+ }
+}
+
+
+
+static void
+initChanSwitchStuff(struct _TServer * const srvP,
+ bool const noAccept,
+ TChanSwitch * const userSwitchP,
+ unsigned short const port,
+ const char ** const errorP) {
+
+ if (userSwitchP) {
+ *errorP = NULL;
+ srvP->serverAcceptsConnections = TRUE;
+ srvP->chanSwitchP = userSwitchP;
+ } else if (noAccept) {
+ *errorP = NULL;
+ srvP->serverAcceptsConnections = FALSE;
+ srvP->chanSwitchP = NULL;
+ } else {
+ *errorP = NULL;
+ srvP->serverAcceptsConnections = TRUE;
+ srvP->chanSwitchP = NULL;
+ srvP->port = port;
+ }
+ srvP->weCreatedChanSwitch = FALSE;
+}
+
+
+
+static void
+createServer(struct _TServer ** const srvPP,
+ bool const noAccept,
+ TChanSwitch * const userChanSwitchP,
+ unsigned short const portNumber,
+ const char ** const errorP) {
+
+ struct _TServer * srvP;
+
+ MALLOCVAR(srvP);
+
+ if (srvP == NULL) {
+ xmlrpc_asprintf(errorP,
+ "Unable to allocate space for server descriptor");
+ } else {
+ srvP->terminationRequested = false;
+
+ initChanSwitchStuff(srvP, noAccept, userChanSwitchP, portNumber,
+ errorP);
+
+ if (!*errorP) {
+ srvP->builtinHandlerP = HandlerCreate();
+ if (!srvP->builtinHandlerP)
+ xmlrpc_asprintf(errorP, "Unable to allocate space for "
+ "builtin handler descriptor");
+ else {
+ srvP->defaultHandler = HandlerDefaultBuiltin;
+ srvP->defaultHandlerContext = srvP->builtinHandlerP;
+
+ srvP->name = strdup("unnamed");
+ srvP->logfilename = NULL;
+ srvP->keepalivetimeout = 15;
+ srvP->keepalivemaxconn = 30;
+ srvP->timeout = 15;
+ srvP->advertise = TRUE;
+ srvP->useSigchld = FALSE;
+
+ initUnixStuff(srvP);
+
+ ListInitAutoFree(&srvP->handlers);
+
+ srvP->logfileisopen = FALSE;
+
+ *errorP = NULL;
+
+ if (*errorP)
+ HandlerDestroy(srvP->builtinHandlerP);
+ }
+ }
+ if (*errorP)
+ free(srvP);
+ }
+ *srvPP = srvP;
+}
+
+
+
+static void
+setNamePathLog(TServer * const serverP,
+ const char * const name,
+ const char * const filesPath,
+ const char * const logFileName) {
+/*----------------------------------------------------------------------------
+ This odd function exists to help with backward compatibility.
+ Today, we have the expandable model where you create a server with
+ default parameters, then use ServerSet... functions to choose
+ non-default parameters. But before, you specified these three
+ parameters right in the arguments of various create functions.
+-----------------------------------------------------------------------------*/
+ if (name)
+ ServerSetName(serverP, name);
+ if (filesPath)
+ ServerSetFilesPath(serverP, filesPath);
+ if (logFileName)
+ ServerSetLogFileName(serverP, logFileName);
+}
+
+
+
+abyss_bool
+ServerCreate(TServer * const serverP,
+ const char * const name,
+ xmlrpc_uint16_t const portNumber,
+ const char * const filesPath,
+ const char * const logFileName) {
+
+ bool const noAcceptFalse = FALSE;
+
+ bool success;
+ const char * error;
+
+ createServer(&serverP->srvP, noAcceptFalse, NULL, portNumber, &error);
+
+ if (error) {
+ TraceMsg(error);
+ xmlrpc_strfree(error);
+ success = FALSE;
+ } else {
+ success = TRUE;
+
+ setNamePathLog(serverP, name, filesPath, logFileName);
+ }
+
+ return success;
+}
+
+
+
+static void
+createSwitchFromOsSocket(TOsSocket const osSocket,
+ TChanSwitch ** const chanSwitchPP,
+ const char ** const errorP) {
+
+#ifdef WIN32
+ ChanSwitchWinCreateWinsock(osSocket, chanSwitchPP, errorP);
+#else
+ ChanSwitchUnixCreateFd(osSocket, chanSwitchPP, errorP);
+#endif
+}
+
+
+
+static void
+createChannelFromOsSocket(TOsSocket const osSocket,
+ TChannel ** const channelPP,
+ void ** const channelInfoPP,
+ const char ** const errorP) {
+
+#ifdef WIN32
+ ChannelWinCreateWinsock(osSocket, channelPP,
+ (struct abyss_win_chaninfo**)channelInfoPP,
+ errorP);
+#else
+ ChannelUnixCreateFd(osSocket, channelPP,
+ (struct abyss_unix_chaninfo**)channelInfoPP,
+ errorP);
+#endif
+}
+
+
+
+abyss_bool
+ServerCreateSocket(TServer * const serverP,
+ const char * const name,
+ TOsSocket const socketFd,
+ const char * const filesPath,
+ const char * const logFileName) {
+
+ bool success;
+ TChanSwitch * chanSwitchP;
+ const char * error;
+
+ createSwitchFromOsSocket(socketFd, &chanSwitchP, &error);
+
+ if (error) {
+ TraceMsg(error);
+ success = FALSE;
+ xmlrpc_strfree(error);
+ } else {
+ bool const noAcceptFalse = FALSE;
+
+ const char * error;
+
+ createServer(&serverP->srvP, noAcceptFalse, chanSwitchP, 0, &error);
+
+ if (error) {
+ TraceMsg(error);
+ success = FALSE;
+ xmlrpc_strfree(error);
+ } else {
+ success = TRUE;
+
+ setNamePathLog(serverP, name, filesPath, logFileName);
+ }
+ }
+
+ return success;
+}
+
+
+
+abyss_bool
+ServerCreateNoAccept(TServer * const serverP,
+ const char * const name,
+ const char * const filesPath,
+ const char * const logFileName) {
+
+ bool const noAcceptTrue = TRUE;
+
+ bool success;
+ const char * error;
+
+ createServer(&serverP->srvP, noAcceptTrue, NULL, 0, &error);
+
+ if (error) {
+ TraceMsg(error);
+ success = FALSE;
+ xmlrpc_strfree(error);
+ } else {
+ success = TRUE;
+
+ setNamePathLog(serverP, name, filesPath, logFileName);
+ }
+ return success;
+}
+
+
+
+void
+ServerCreateSwitch(TServer * const serverP,
+ TChanSwitch * const chanSwitchP,
+ const char ** const errorP) {
+
+ bool const noAcceptFalse = FALSE;
+
+ assert(serverP);
+ assert(chanSwitchP);
+
+ createServer(&serverP->srvP, noAcceptFalse, chanSwitchP, 0, errorP);
+}
+
+
+
+void
+ServerCreateSocket2(TServer * const serverP,
+ TSocket * const socketP,
+ const char ** const errorP) {
+
+ TChanSwitch * const chanSwitchP = SocketGetChanSwitch(socketP);
+
+ assert(socketP);
+
+ if (!chanSwitchP)
+ xmlrpc_asprintf(
+ errorP, "Socket is not a listening socket. "
+ "You should use ServerCreateSwitch() instead, anyway.");
+ else
+ ServerCreateSwitch(serverP, chanSwitchP, errorP);
+}
+
+
+
+static void
+terminateHandlers(TList * const handlersP) {
+/*----------------------------------------------------------------------------
+ Terminate all handlers in the list '*handlersP'.
+
+ I.e. call each handler's terminate function.
+-----------------------------------------------------------------------------*/
+ if (handlersP->item) {
+ unsigned int i;
+ for (i = handlersP->size; i > 0; --i) {
+ URIHandler2 * const handlerP = handlersP->item[i-1];
+ if (handlerP->term)
+ handlerP->term(handlerP->userdata);
+ }
+ }
+}
+
+
+
+void
+ServerFree(TServer * const serverP) {
+
+ struct _TServer * const srvP = serverP->srvP;
+
+ if (srvP->weCreatedChanSwitch)
+ ChanSwitchDestroy(srvP->chanSwitchP);
+
+ xmlrpc_strfree(srvP->name);
+
+ terminateHandlers(&srvP->handlers);
+
+ ListFree(&srvP->handlers);
+
+ HandlerDestroy(srvP->builtinHandlerP);
+
+ logClose(srvP);
+
+ if (srvP->logfilename)
+ xmlrpc_strfree(srvP->logfilename);
+
+ free(srvP);
+}
+
+
+
+void
+ServerSetName(TServer * const serverP,
+ const char * const name) {
+
+ xmlrpc_strfree(serverP->srvP->name);
+
+ serverP->srvP->name = strdup(name);
+}
+
+
+
+void
+ServerSetFilesPath(TServer * const serverP,
+ const char * const filesPath) {
+
+ HandlerSetFilesPath(serverP->srvP->builtinHandlerP, filesPath);
+}
+
+
+
+void
+ServerSetLogFileName(TServer * const serverP,
+ const char * const logFileName) {
+
+ struct _TServer * const srvP = serverP->srvP;
+
+ if (srvP->logfilename)
+ xmlrpc_strfree(srvP->logfilename);
+
+ srvP->logfilename = strdup(logFileName);
+}
+
+
+
+void
+ServerSetKeepaliveTimeout(TServer * const serverP,
+ xmlrpc_uint32_t const keepaliveTimeout) {
+
+ serverP->srvP->keepalivetimeout = keepaliveTimeout;
+}
+
+
+
+void
+ServerSetKeepaliveMaxConn(TServer * const serverP,
+ xmlrpc_uint32_t const keepaliveMaxConn) {
+
+ serverP->srvP->keepalivemaxconn = keepaliveMaxConn;
+}
+
+
+
+void
+ServerSetTimeout(TServer * const serverP,
+ xmlrpc_uint32_t const timeout) {
+
+ serverP->srvP->timeout = timeout;
+}
+
+
+
+void
+ServerSetAdvertise(TServer * const serverP,
+ abyss_bool const advertise) {
+
+ serverP->srvP->advertise = advertise;
+}
+
+
+
+void
+ServerSetMimeType(TServer * const serverP,
+ MIMEType * const mimeTypeP) {
+
+ HandlerSetMimeType(serverP->srvP->builtinHandlerP, mimeTypeP);
+}
+
+
+
+static void
+runUserHandler(TSession * const sessionP,
+ struct _TServer * const srvP) {
+
+ abyss_bool handled;
+ int i;
+
+ for (i = srvP->handlers.size-1, handled = FALSE;
+ i >= 0 && !handled;
+ --i) {
+ URIHandler2 * const handlerP = srvP->handlers.item[i];
+
+ if (handlerP->handleReq2)
+ handlerP->handleReq2(handlerP, sessionP, &handled);
+ else if (handlerP->handleReq1)
+ handled = handlerP->handleReq1(sessionP);
+ }
+
+ assert(srvP->defaultHandler);
+
+ if (!handled)
+ srvP->defaultHandler(sessionP);
+}
+
+
+
+static void
+processDataFromClient(TConn * const connectionP,
+ bool const lastReqOnConn,
+ uint32_t const timeout,
+ bool * const keepAliveP) {
+
+ TSession session;
+
+ RequestInit(&session, connectionP);
+
+ session.serverDeniesKeepalive = lastReqOnConn;
+
+ RequestRead(&session, timeout);
+
+ if (session.status == 0) {
+ if (session.version.major >= 2)
+ ResponseStatus(&session, 505);
+ else if (!RequestValidURI(&session))
+ ResponseStatus(&session, 400);
+ else
+ runUserHandler(&session, connectionP->server->srvP);
+ }
+
+ assert(session.status != 0);
+
+ if (session.responseStarted)
+ HTTPWriteEndChunk(&session);
+ else
+ ResponseError(&session);
+
+ *keepAliveP = HTTPKeepalive(&session);
+
+ SessionLog(&session);
+
+ RequestFree(&session);
+}
+
+
+
+static TThreadProc serverFunc;
+
+static void
+serverFunc(void * const userHandle) {
+/*----------------------------------------------------------------------------
+ Do server stuff on one connection. At its simplest, this means do
+ one HTTP request. But with keepalive, it can be many requests.
+-----------------------------------------------------------------------------*/
+ TConn * const connectionP = userHandle;
+ struct _TServer * const srvP = connectionP->server->srvP;
+
+ unsigned int requestCount;
+ /* Number of requests we've handled so far on this connection */
+ bool connectionDone;
+ /* No more need for this HTTP connection */
+
+ requestCount = 0;
+ connectionDone = FALSE;
+
+ while (!connectionDone) {
+ bool success;
+
+ /* Wait to read until timeout */
+ success = ConnRead(connectionP, srvP->keepalivetimeout);
+
+ if (!success)
+ connectionDone = TRUE;
+ else {
+ bool const lastReqOnConn =
+ requestCount + 1 >= srvP->keepalivemaxconn;
+
+ bool keepalive;
+
+ processDataFromClient(connectionP, lastReqOnConn, srvP->timeout,
+ &keepalive);
+
+ ++requestCount;
+
+ if (!keepalive)
+ connectionDone = TRUE;
+
+ /**************** Must adjust the read buffer *****************/
+ ConnReadInit(connectionP);
+ }
+ }
+}
+
+
+
+static void
+createSwitchFromPortNum(unsigned short const portNumber,
+ TChanSwitch ** const chanSwitchPP,
+ const char ** const errorP) {
+
+#ifdef WIN32
+ ChanSwitchWinCreate(portNumber, chanSwitchPP, errorP);
+#else
+ ChanSwitchUnixCreate(portNumber, chanSwitchPP, errorP);
+#endif
+}
+
+
+
+static void
+createChanSwitch(struct _TServer * const srvP,
+ const char ** const errorP) {
+
+ TChanSwitch * chanSwitchP;
+ const char * error;
+
+ /* Not valid to call this when channel switch already exists: */
+ assert(srvP->chanSwitchP == NULL);
+
+ createSwitchFromPortNum(srvP->port, &chanSwitchP, &error);
+
+ if (error) {
+ xmlrpc_asprintf(errorP,
+ "Can't create channel switch. %s", error);
+ xmlrpc_strfree(error);
+ } else {
+ *errorP = NULL;
+
+ srvP->weCreatedChanSwitch = TRUE;
+ srvP->chanSwitchP = chanSwitchP;
+ }
+}
+
+
+
+void
+ServerInit(TServer * const serverP) {
+/*----------------------------------------------------------------------------
+ Initialize a server to accept connections.
+
+ Do not confuse this with creating the server -- ServerCreate().
+
+ Not necessary or valid with a server that doesn't accept connections (i.e.
+ user supplies the channels (TCP connections)).
+-----------------------------------------------------------------------------*/
+ struct _TServer * const srvP = serverP->srvP;
+ const char * retError;
+
+ if (!srvP->serverAcceptsConnections)
+ xmlrpc_asprintf(&retError,
+ "ServerInit() is not valid on a server that doesn't "
+ "accept connections "
+ "(i.e. created with ServerCreateNoAccept)");
+ else {
+ retError = NULL; /* initial value */
+
+ if (!srvP->chanSwitchP) {
+ const char * error;
+ createChanSwitch(srvP, &error);
+
+ if (error) {
+ xmlrpc_asprintf(&retError, "Unable to create a channel switch "
+ "for the server. %s", error);
+ xmlrpc_strfree(error);
+ }
+ }
+
+ if (!retError) {
+ const char * error;
+
+ assert(srvP->chanSwitchP);
+
+ ChanSwitchListen(srvP->chanSwitchP, MAX_CONN, &error);
+
+ if (error) {
+ xmlrpc_asprintf(&retError,
+ "Failed to listen on bound socket. %s",
+ error);
+ xmlrpc_strfree(error);
+ }
+ }
+ }
+ if (retError) {
+ TraceMsg("ServerInit() failed. %s", retError);
+ exit(1);
+ xmlrpc_strfree(retError);
+ }
+}
+
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#ifdef ABYSS_WIN32
-#include <io.h>
-#else
-/* Check this
-#include <sys/io.h>
+
+/* We don't do any locking on the outstanding connections list, so
+ we must make sure that only the master thread (the one that listens
+ for connections) ever accesses it.
+
+ That's why when a thread completes, it places the connection in
+ "finished" status, but doesn't destroy the connection.
*/
-#endif /* ABYSS_WIN32 */
-#include <fcntl.h>
-#include "mallocvar.h"
+typedef struct {
-#include "xmlrpc-c/abyss.h"
+ TConn * firstP;
+ unsigned int count;
+ /* Redundant with 'firstP', for quick access */
+} outstandingConnList;
+
+
+
+static void
+createOutstandingConnList(outstandingConnList ** const listPP) {
+
+ outstandingConnList * listP;
-#define BOUNDARY "##123456789###BOUNDARY"
+ MALLOCVAR_NOFAIL(listP);
-typedef int (*TQSortProc)(const void *, const void *);
+ listP->firstP = NULL; /* empty list */
+ listP->count = 0;
-static int
-cmpfilenames(const TFileInfo **f1,const TFileInfo **f2) {
- if (((*f1)->attrib & A_SUBDIR) && !((*f2)->attrib & A_SUBDIR))
- return (-1);
- if (!((*f1)->attrib & A_SUBDIR) && ((*f2)->attrib & A_SUBDIR))
- return 1;
-
- return strcmp((*f1)->name,(*f2)->name);
-}
-
-static int
-cmpfiledates(const TFileInfo **f1,const TFileInfo **f2) {
- if (((*f1)->attrib & A_SUBDIR) && !((*f2)->attrib & A_SUBDIR))
- return (-1);
- if (!((*f1)->attrib & A_SUBDIR) && ((*f2)->attrib & A_SUBDIR))
- return 1;
-
- return ((*f1)->time_write-(*f2)->time_write);
+ *listPP = listP;
}
-static abyss_bool
-ServerDirectoryHandler(TSession *r,char *z,TDate *dirdate) {
- TFileInfo fileinfo,*fi;
- TFileFind findhandle;
- char *p,z1[26],z2[20],z3[9],u,*z4;
- TList list;
- int16_t i;
- uint32_t k;
- abyss_bool text=FALSE;
- abyss_bool ascending=TRUE;
- uint16_t sort=1; /* 1=by name, 2=by date */
- struct tm ftm;
- TPool pool;
- TDate date;
-
- if (r->query) {
- if (strcmp(r->query,"plain")==0)
- text=TRUE;
- else if (strcmp(r->query,"name-up")==0)
- {
- sort=1;
- ascending=TRUE;
- }
- else if (strcmp(r->query,"name-down")==0)
- {
- sort=1;
- ascending=FALSE;
- }
- else if (strcmp(r->query,"date-up")==0)
- {
- sort=2;
- ascending=TRUE;
- }
- else if (strcmp(r->query,"date-down")==0)
- {
- sort=2;
- ascending=FALSE;
- }
- else
- {
- ResponseStatus(r,400);
- return TRUE;
- };
- }
- if (DateCompare(&r->date,dirdate)<0)
- dirdate=&r->date;
-
- p=RequestHeaderValue(r,"If-Modified-Since");
- if (p) {
- if (DateDecode(p,&date)) {
- if (DateCompare(dirdate,&date)<=0)
- {
- ResponseStatus(r,304);
- ResponseWrite(r);
- return TRUE;
- };
- }
- }
- if (!FileFindFirst(&findhandle,z,&fileinfo))
- {
- ResponseStatusErrno(r);
- return TRUE;
- };
-
- ListInit(&list);
-
- if (!PoolCreate(&pool,1024))
- {
- ResponseStatus(r,500);
- return TRUE;
- };
-
- do
- {
- /* Files which names start with a dot are ignored */
- /* This includes implicitly the ./ and ../ */
- if (*fileinfo.name=='.') {
- if (strcmp(fileinfo.name,"..")==0)
- {
- if (strcmp(r->uri,"/")==0)
- continue;
- }
- else
- continue;
- }
- fi=(TFileInfo *)PoolAlloc(&pool,sizeof(fileinfo));
- if (fi)
- {
- memcpy(fi,&fileinfo,sizeof(fileinfo));
- if (ListAdd(&list,fi))
- continue;
- };
-
- ResponseStatus(r,500);
- FileFindClose(&findhandle);
- ListFree(&list);
- PoolFree(&pool);
- return TRUE;
-
- } while (FileFindNext(&findhandle,&fileinfo));
-
- FileFindClose(&findhandle);
-
- /* Send something to the user to show that we are still alive */
- ResponseStatus(r,200);
- ResponseContentType(r,(text?"text/plain":"text/html"));
-
- if (DateToString(dirdate,z))
- ResponseAddField(r,"Last-Modified",z);
-
- ResponseChunked(r);
- ResponseWrite(r);
-
- if (r->method!=m_head)
- {
- if (text)
- {
- sprintf(z,"Index of %s" CRLF,r->uri);
- i=strlen(z)-2;
- p=z+i+2;
-
- while (i>0)
- {
- *(p++)='-';
- i--;
- };
-
- *p='\0';
- strcat(z,CRLF CRLF
- "Name Size "
- "Date-Time Type" CRLF
- "------------------------------------"
- "--------------------------------------------"CRLF);
- }
- else
- {
- sprintf(z,"<HTML><HEAD><TITLE>Index of %s</TITLE></HEAD><BODY>"
- "<H1>Index of %s</H1><PRE>",r->uri,r->uri);
- strcat(z,"Name Size "
- "Date-Time Type<HR WIDTH=100%>"CRLF);
- };
-
- HTTPWrite(r,z,strlen(z));
-
- /* Sort the files */
- qsort(list.item,list.size,sizeof(void *),
- (TQSortProc)(sort==1?cmpfilenames:cmpfiledates));
-
- /* Write the listing */
- if (ascending)
- i=0;
- else
- i=list.size-1;
+static void
+destroyOutstandingConnList(outstandingConnList * const listP) {
- while ((i<list.size) && (i>=0))
- {
- fi=list.item[i];
-
- if (ascending)
- i++;
- else
- i--;
-
- strcpy(z,fi->name);
+ assert(listP->firstP == NULL);
+ assert(listP->count == 0);
- k=strlen(z);
+ free(listP);
+}
- if (fi->attrib & A_SUBDIR)
- {
- z[k++]='/';
- z[k]='\0';
- };
-
- if (k>24)
- {
- z[10]='\0';
- strcpy(z1,z);
- strcat(z1,"...");
- strcat(z1,z+k-11);
- k=24;
- p=z1+24;
- }
- else
- {
- strcpy(z1,z);
-
- k++;
- p=z1+k;
- while (k<25)
- z1[k++]=' ';
-
- z1[25]='\0';
- };
-
- ftm=*(gmtime(&fi->time_write));
- sprintf(z2,"%02u/%02u/%04u %02u:%02u:%02u",ftm.tm_mday,ftm.tm_mon,
- ftm.tm_year+1900,ftm.tm_hour,ftm.tm_min,ftm.tm_sec);
-
- if (fi->attrib & A_SUBDIR)
- {
- strcpy(z3," -- ");
- z4="Directory";
- }
- else
- {
- if (fi->size<9999)
- u='b';
- else
- {
- fi->size/=1024;
- if (fi->size<9999)
- u='K';
- else
- {
- fi->size/=1024;
- if (fi->size<9999)
- u='M';
- else
- u='G';
- };
- };
-
- sprintf(z3, "%5llu %c", fi->size, u);
-
- if (strcmp(fi->name,"..")==0)
- z4="";
- else
- z4=MIMETypeFromFileName(fi->name);
-
- if (!z4)
- z4="Unknown";
- };
-
- if (text)
- sprintf(z,"%s%s %s %s %s"CRLF,
- z1,p,z3,z2,z4);
- else
- sprintf(z,"<A HREF=\"%s%s\">%s</A>%s %s %s %s"CRLF,
- fi->name,(fi->attrib & A_SUBDIR?"/":""),z1,p,z3,z2,z4);
- HTTPWrite(r,z,strlen(z));
- };
-
- /* Write the tail of the file */
- if (text)
- strcpy(z,SERVER_PLAIN_INFO);
- else
- strcpy(z,"</PRE>" SERVER_HTML_INFO "</BODY></HTML>" CRLF CRLF);
- HTTPWrite(r,z,strlen(z));
- };
-
- HTTPWriteEnd(r);
- /* Free memory and exit */
- ListFree(&list);
- PoolFree(&pool);
-
- return TRUE;
-}
-
-static abyss_bool
-ServerFileHandler(TSession *r,char *z,TDate *filedate) {
- char *mediatype;
- TFile file;
- uint64_t filesize,start,end;
- uint16_t i;
- TDate date;
- char *p;
-
- mediatype=MIMETypeGuessFromFile(z);
-
- if (!FileOpen(&file,z,O_BINARY | O_RDONLY))
- {
- ResponseStatusErrno(r);
- return TRUE;
- };
-
- if (DateCompare(&r->date,filedate)<0)
- filedate=&r->date;
-
- p=RequestHeaderValue(r,"if-modified-since");
- if (p) {
- if (DateDecode(p,&date)) {
- if (DateCompare(filedate,&date)<=0) {
- ResponseStatus(r,304);
- ResponseWrite(r);
- return TRUE;
- }
- else
- r->ranges.size=0;
- }
- }
- filesize=FileSize(&file);
+static void
+addToOutstandingConnList(outstandingConnList * const listP,
+ TConn * const connectionP) {
- switch (r->ranges.size)
- {
- case 0:
- ResponseStatus(r,200);
- break;
+ connectionP->nextOutstandingP = listP->firstP;
- case 1:
- if (!RangeDecode((char *)(r->ranges.item[0]),filesize,&start,&end))
- {
- ListFree(&(r->ranges));
- ResponseStatus(r,200);
- break;
- }
-
- sprintf(z, "bytes %llu-%llu/%llu", start, end, filesize);
+ listP->firstP = connectionP;
- ResponseAddField(r,"Content-range",z);
- ResponseContentLength(r,end-start+1);
- ResponseStatus(r,206);
- break;
+ ++listP->count;
+}
- default:
- ResponseContentType(r,"multipart/ranges; boundary=" BOUNDARY);
- ResponseStatus(r,206);
- break;
- };
-
- if (r->ranges.size==0)
- {
- ResponseContentLength(r,filesize);
- ResponseContentType(r,mediatype);
- };
-
- if (DateToString(filedate,z))
- ResponseAddField(r,"Last-Modified",z);
-
- ResponseWrite(r);
-
- if (r->method!=m_head)
- {
- if (r->ranges.size==0)
- ConnWriteFromFile(r->conn,&file,0,filesize-1,z,4096,0);
- else if (r->ranges.size==1)
- ConnWriteFromFile(r->conn,&file,start,end,z,4096,0);
- else
- for (i=0;i<=r->ranges.size;i++)
- {
- ConnWrite(r->conn,"--",2);
- ConnWrite(r->conn,BOUNDARY,strlen(BOUNDARY));
- ConnWrite(r->conn,CRLF,2);
-
- if (i<r->ranges.size)
- if (RangeDecode((char *)(r->ranges.item[i]),
- filesize,
- &start,&end))
- {
- /* Entity header, not response header */
- sprintf(z,"Content-type: %s" CRLF
- "Content-range: bytes %llu-%llu/%llu" CRLF
- "Content-length: %llu" CRLF
- CRLF, mediatype, start, end,
- filesize, end-start+1);
-
- ConnWrite(r->conn,z,strlen(z));
-
- ConnWriteFromFile(r->conn,&file,start,end,z,4096,0);
- };
- };
- };
-
- FileClose(&file);
-
- return TRUE;
-}
-
-static abyss_bool
-ServerDefaultHandlerFunc(TSession *r) {
- char *p,z[4096];
- TFileStat fs;
- uint16_t i;
- abyss_bool endingslash=FALSE;
- TDate objdate;
-
- if (!RequestValidURIPath(r))
- {
- ResponseStatus(r,400);
- return TRUE;
- };
-
- /* Must check for * (asterisk uri) in the future */
- if (r->method==m_options)
- {
- ResponseAddField(r,"Allow","GET, HEAD");
- ResponseContentLength(r,0);
- ResponseStatus(r,200);
- return TRUE;
- };
-
- if ((r->method!=m_get) && (r->method!=m_head))
- {
- ResponseAddField(r,"Allow","GET, HEAD");
- ResponseStatus(r,405);
- return TRUE;
- };
-
- strcpy(z,r->server->filespath);
- strcat(z,r->uri);
-
- p=z+strlen(z)-1;
- if (*p=='/')
- {
- endingslash=TRUE;
- *p='\0';
- };
-
-#ifdef ABYSS_WIN32
- p=z;
- while (*p)
- {
- if ((*p)=='/')
- *p='\\';
-
- p++;
- };
-#endif /* ABYSS_WIN32 */
-
- if (!FileStat(z,&fs))
- {
- ResponseStatusErrno(r);
- return TRUE;
- };
-
- if (fs.st_mode & S_IFDIR)
- {
- /* Redirect to the same directory but with the ending slash
- ** to avoid problems with some browsers (IE for examples) when
- ** they generate relative urls */
- if (!endingslash)
- {
- strcpy(z,r->uri);
- p=z+strlen(z);
- *p='/';
- *(p+1)='\0';
- ResponseAddField(r,"Location",z);
- ResponseStatus(r,302);
- ResponseWrite(r);
- return TRUE;
- };
-#ifdef ABYSS_WIN32
- *p='\\';
-#else
- *p='/';
-#endif /* ABYSS_WIN32 */
- p++;
-
- i=r->server->defaultfilenames.size;
- while (i-->0) {
- *p='\0';
- strcat(z,(char *)(r->server->defaultfilenames.item[i]));
- if (FileStat(z,&fs)) {
- if (!(fs.st_mode & S_IFDIR)) {
- if (DateFromLocal(&objdate,fs.st_mtime))
- return ServerFileHandler(r,z,&objdate);
- else
- return ServerFileHandler(r,z,NULL);
- }
- }
- };
- *(p-1)='\0';
-
- if (!FileStat(z,&fs))
- {
- ResponseStatusErrno(r);
- return TRUE;
- };
+static void
+freeFinishedConns(outstandingConnList * const listP) {
+/*----------------------------------------------------------------------------
+ Garbage-collect the resources associated with connections that are
+ finished with their jobs. Thread resources, connection pool
+ descriptor, etc.
+-----------------------------------------------------------------------------*/
+ TConn ** pp;
- if (DateFromLocal(&objdate,fs.st_mtime))
- return ServerDirectoryHandler(r,z,&objdate);
- else
- return ServerDirectoryHandler(r,z,NULL);
+ pp = &listP->firstP;
+
+ while (*pp) {
+ TConn * const connectionP = (*pp);
+ ThreadUpdateStatus(connectionP->threadP);
+
+ if (connectionP->finished) {
+ /* Take it out of the list */
+ *pp = connectionP->nextOutstandingP;
+ --listP->count;
+
+ ConnWaitAndRelease(connectionP);
+ } else {
+ /* Move to next connection in list */
+ pp = &connectionP->nextOutstandingP;
+ }
}
- else
- if (DateFromLocal(&objdate,fs.st_mtime))
- return ServerFileHandler(r,z,&objdate);
- else
- return ServerFileHandler(r,z,NULL);
}
-abyss_bool
-ServerCreate(TServer * const srvP,
- const char * const name,
- uint16_t const port,
- const char * const filespath,
- const char * const logfilename) {
-
- abyss_bool success;
-
- if (name)
- srvP->name = strdup(name);
- else
- srvP->name = "unnamed";
+static void
+waitForConnectionFreed(outstandingConnList * const outstandingConnListP
+ ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ Wait for a connection descriptor in 'connectionPool' to be probably
+ freed.
+-----------------------------------------------------------------------------*/
- srvP->port = port;
+ /* TODO: We should do something more sophisticated here. For pthreads,
+ we can have a thread signal us by semaphore when it terminates.
+ For fork, we might be able to use the "done" handler argument
+ to ConnCreate() to get interrupted when the death of a child
+ signal happens.
+ */
- srvP->defaulthandler = ServerDefaultHandlerFunc;
+ xmlrpc_millisecond_sleep(2000);
+}
- if (filespath)
- srvP->filespath = strdup(filespath);
- else
- srvP->filespath = strdup(DEFAULT_DOCS);
- srvP->keepalivetimeout = 15;
- srvP->keepalivemaxconn = 30;
- srvP->timeout = 15;
- srvP->advertise = TRUE;
-#ifdef _UNIX
- srvP->pidfile = srvP->uid = srvP->gid = -1;
-#endif /* _UNIX */
- ListInit(&srvP->handlers);
- ListInitAutoFree(&srvP->defaultfilenames);
+static void
+waitForNoConnections(outstandingConnList * const outstandingConnListP) {
- if (logfilename)
- success = LogOpen(srvP, logfilename);
- else {
- srvP->logfile = -1;
- success = TRUE;
+ while (outstandingConnListP->firstP) {
+ freeFinishedConns(outstandingConnListP);
+
+ if (outstandingConnListP->firstP)
+ waitForConnectionFreed(outstandingConnListP);
}
- return success;
}
static void
-terminateHandlers(TList * const handlersP) {
+waitForConnectionCapacity(outstandingConnList * const outstandingConnListP) {
/*----------------------------------------------------------------------------
- Terminate all handlers in the list '*handlersP'.
-
- I.e. call each handler's terminate function.
+ Wait until there are fewer than the maximum allowed connections in
+ progress.
-----------------------------------------------------------------------------*/
- if (handlersP->item) {
- unsigned int i;
- for (i = handlersP->size; i > 0; --i) {
- URIHandler2 * const handlerP = handlersP->item[i-1];
- if (handlerP->term)
- handlerP->term(handlerP);
- }
+ /* We need to make this number configurable. Note that MAX_CONN (16) is
+ also the backlog limit on the TCP socket, and they really aren't
+ related. As it stands, we can have 16 connections in progress inside
+ Abyss plus 16 waiting in the the channel switch.
+ */
+
+ while (outstandingConnListP->count >= MAX_CONN) {
+ freeFinishedConns(outstandingConnListP);
+ if (outstandingConnListP->firstP)
+ waitForConnectionFreed(outstandingConnListP);
}
}
+#ifndef WIN32
void
-ServerFree(TServer * const srvP) {
+ServerHandleSigchld(pid_t const pid) {
- free(srvP->name);
+ ThreadHandleSigchld(pid);
+}
+#endif
- free(srvP->filespath);
-
- terminateHandlers(&srvP->handlers);
- ListFree(&srvP->handlers);
- ListInitAutoFree(&srvP->defaultfilenames);
+void
+ServerUseSigchld(TServer * const serverP) {
- LogClose(srvP);
+ struct _TServer * const srvP = serverP->srvP;
+
+ srvP->useSigchld = TRUE;
}
+static TThreadDoneFn destroyChannel;
+
static void
-ServerFunc(TConn * c) {
+destroyChannel(void * const userHandle) {
+/*----------------------------------------------------------------------------
+ This is a "connection done" function for the connection the server
+ serves. It gets called some time after the connection has done its
+ thing. Its job is to clean up stuff the server created for use by
+ the connection, but the server can't clean up because the
+ connection might be processed asynchronously in a background
+ thread.
- TSession r;
- uint32_t ka;
- TList handlers = c->server->handlers;
+ To wit, we destroy the connection's channel and release the memory
+ for the information about that channel.
+-----------------------------------------------------------------------------*/
+ TConn * const connectionP = userHandle;
- ka=c->server->keepalivemaxconn;
+ ChannelDestroy(connectionP->channelP);
+ free(connectionP->channelInfoP);
+}
- while (ka--) {
- RequestInit(&r,c);
- /* Wait to read until timeout */
- if (!ConnRead(c,c->server->keepalivetimeout))
- break;
- if (RequestRead(&r)) {
- /* Check if it is the last keepalive */
- if (ka==1)
- r.keepalive=FALSE;
-
- r.cankeepalive=r.keepalive;
-
- if (r.status==0) {
- if (r.versionmajor>=2)
- ResponseStatus(&r,505);
- else if (!RequestValidURI(&r))
- ResponseStatus(&r,400);
- else {
- abyss_bool handled;
- int i;
-
- for (i = c->server->handlers.size-1, handled = FALSE;
- i >= 0 && !handled;
- --i) {
- URIHandler2 * const handlerP = handlers.item[i];
-
- if (handlerP->handleReq2)
- handlerP->handleReq2(handlerP, &r, &handled);
- else if (handlerP->handleReq1)
- handled = handlerP->handleReq1(&r);
- }
+static void
+acceptAndProcessNextConnection(
+ TServer * const serverP,
+ outstandingConnList * const outstandingConnListP) {
+
+ struct _TServer * const srvP = serverP->srvP;
+
+ TConn * connectionP;
+ const char * error;
+ TChannel * channelP;
+ void * channelInfoP;
+
+ ChanSwitchAccept(srvP->chanSwitchP, &channelP, &channelInfoP, &error);
+
+ if (error) {
+ TraceMsg("Failed to accept the next connection from a client "
+ "at the channel level. %s", error);
+ xmlrpc_strfree(error);
+ } else {
+ if (channelP) {
+ const char * error;
- if (!handled)
- ((URIHandler)(c->server->defaulthandler))(&r);
- }
+ freeFinishedConns(outstandingConnListP);
+
+ waitForConnectionCapacity(outstandingConnListP);
+
+ ConnCreate(&connectionP, serverP, channelP, channelInfoP,
+ &serverFunc, &destroyChannel, ABYSS_BACKGROUND,
+ srvP->useSigchld,
+ &error);
+ if (!error) {
+ addToOutstandingConnList(outstandingConnListP,
+ connectionP);
+ ConnProcess(connectionP);
+ /* When connection is done (which could be later, courtesy
+ of a background thread), destroyChannel() will
+ destroy *channelP.
+ */
+ } else {
+ xmlrpc_strfree(error);
+ ChannelDestroy(channelP);
+ free(channelInfoP);
}
+ } else {
+ /* Accept function was interrupted before it got a connection */
}
-
- HTTPWriteEnd(&r);
+ }
+}
+
+
- if (!r.done)
- ResponseError(&r);
+static void
+serverRun2(TServer * const serverP) {
- SessionLog(&r);
+ struct _TServer * const srvP = serverP->srvP;
+ outstandingConnList * outstandingConnListP;
- if (!(r.keepalive && r.cankeepalive))
- break;
+ createOutstandingConnList(&outstandingConnListP);
- /**************** Must adjust the read buffer *****************/
- ConnReadInit(c);
- };
+ while (!srvP->terminationRequested)
+ acceptAndProcessNextConnection(serverP, outstandingConnListP);
- RequestFree(&r);
- SocketClose(&(c->socket));
+ waitForNoConnections(outstandingConnListP);
+
+ destroyOutstandingConnList(outstandingConnListP);
}
-int ServerInit(TServer *srv)
-{
- /********* Must check errors from these functions *************/
- if (!SocketInit()) {
- TraceMsg("Can't initialize TCP sockets\n");
- return FALSE;
- }
- if (!SocketCreate(&srv->listensock)) {
- TraceMsg("Can't create a socket\n");
- return FALSE;
- }
- if (!SocketBind(&srv->listensock,NULL,srv->port)) {
- TraceMsg("Can't bind\n");
- return FALSE;
- }
+void
+ServerRun(TServer * const serverP) {
- if (!SocketListen(&srv->listensock,MAX_CONN)) {
- TraceMsg("Can't listen\n");
- return FALSE;
- }
+ struct _TServer * const srvP = serverP->srvP;
- return TRUE;
+ if (!srvP->chanSwitchP)
+ TraceMsg("This server is not set up to accept connections "
+ "on its own, so you can't use ServerRun(). "
+ "Try ServerRunConn() or ServerInit()");
+ else
+ serverRun2(serverP);
}
-/* With pthread configuration, our connections run as threads of a
- single address space, so we manage a pool of connection
- descriptors. With fork configuration, our connections run as
- separate processes with their own memory, so we don't have the
- pool.
-*/
-static abyss_bool const usingPthreadsForConnections =
-#ifdef _THREAD
-TRUE;
-#else
-FALSE;
-#endif
+static void
+serverRunChannel(TServer * const serverP,
+ TChannel * const channelP,
+ void * const channelInfoP,
+ const char ** const errorP) {
+/*----------------------------------------------------------------------------
+ Do the HTTP transaction on the channel 'channelP'.
+ (channel must be at the beginning of the HTTP request -- nothing having
+ been read or written yet).
+ channelInfoP == NULL means no channel info supplied.
+-----------------------------------------------------------------------------*/
+ struct _TServer * const srvP = serverP->srvP;
-static void
-ServerRunThreaded(TServer *srv)
-{
- uint32_t i;
- TSocket s,ns;
- TIPAddr peerIpAddr;
- TConn *c;
-
- /* Connection array from Heap. Small systems might not
- * have the "stack_size" required to have the array of
- * connections right on it */
- MALLOCARRAY_NOFAIL(c, MAX_CONN);
-
- for (i=0;i<MAX_CONN;i++)
- c[i].inUse = FALSE;
-
- s=srv->listensock;
- srv->running = 1;
- while( srv->running )
- {
- /* collect all threads resources for closed connections */
- for (i=0;i<MAX_CONN;i++)
- {
- if( c[i].inUse && ( c[i].connected == FALSE ) )
- {
- ConnClose( &c[i] );
- c[i].inUse = FALSE;
- }
- }
-
- for (i=0; i<MAX_CONN && c[i].inUse; ++i);
+ TConn * connectionP;
+ const char * error;
- if (i==MAX_CONN)
- {
- /* Every connection descriptor was in use. */
- ThreadWait(2000);
- continue;
- };
-
- if (SocketAccept(&s,&ns,&peerIpAddr))
- {
- abyss_bool success;
- c[i].inUse = TRUE;
- success = ConnCreate2(&c[i], srv, ns, peerIpAddr, &ServerFunc,
- ABYSS_BACKGROUND);
- if (success)
- {
- ConnProcess(&c[i]);
- }
- else
- {
- SocketClose(&ns);
- c[i].inUse = FALSE;
- }
- }
- else
- TraceMsg("Socket Error=%d\n", SocketError());
+ srvP->keepalivemaxconn = 1;
+
+ ConnCreate(&connectionP,
+ serverP, channelP, channelInfoP,
+ &serverFunc, NULL, ABYSS_FOREGROUND, srvP->useSigchld,
+ &error);
+ if (error) {
+ xmlrpc_asprintf(errorP, "Couldn't create HTTP connection out of "
+ "channel (connected socket). %s", error);
+ xmlrpc_strfree(error);
+ } else {
+ *errorP = NULL;
+
+ ConnProcess(connectionP);
+
+ ConnWaitAndRelease(connectionP);
}
- /* We never get here, but it's conceptually possible for someone to
- terminate a server normally, so...
- */
- free( c );
}
-static void
-ServerRunForked(TServer *srv)
-{
- TSocket s,ns;
- TConn c;
- TIPAddr ip;
-
- s=srv->listensock;
-
- while (1)
- {
- if (SocketAccept(&s,&ns,&ip))
- {
- abyss_bool success;
- success = ConnCreate2(&c,
- srv, ns, ip, ServerFunc, ABYSS_BACKGROUND);
-
- /* ConnCreate2() forks. Child does not return. */
- if (success)
- ConnProcess(&c);
+void
+ServerRunChannel(TServer * const serverP,
+ TChannel * const channelP,
+ void * const channelInfoP,
+ const char ** const errorP) {
+/*----------------------------------------------------------------------------
+ Do the HTTP transaction on the channel 'channelP'.
- SocketClose(&ns); /* Close parent's copy of socket */
- }
- else
- TraceMsg("Socket Error=%d\n", SocketError());
- };
+ (channel must be at the beginning of the HTTP request -- nothing having
+ been read or written yet).
+-----------------------------------------------------------------------------*/
+ struct _TServer * const srvP = serverP->srvP;
+
+ if (srvP->serverAcceptsConnections)
+ xmlrpc_asprintf(errorP,
+ "This server is configured to accept connections on "
+ "its own socket. "
+ "Try ServerRun() or ServerCreateNoAccept().");
+ else
+ serverRunChannel(serverP, channelP, channelInfoP, errorP);
}
-void
-ServerRun(TServer * const serverP) {
- if (usingPthreadsForConnections)
- ServerRunThreaded(serverP);
+void
+ServerRunConn2(TServer * const serverP,
+ TSocket * const connectedSocketP,
+ const char ** const errorP) {
+/*----------------------------------------------------------------------------
+ Do the HTTP transaction on the TCP connection on the socket
+ *connectedSocketP.
+ (socket must be connected state, with nothing having been read or
+ written on the connection yet).
+-----------------------------------------------------------------------------*/
+ TChannel * const channelP = SocketGetChannel(connectedSocketP);
+
+ if (!channelP)
+ xmlrpc_asprintf(errorP, "The socket supplied is not a connected "
+ "socket. You should use ServerRunChannel() instead, "
+ "anyway.");
else
- ServerRunForked(serverP);
+ ServerRunChannel(serverP,
+ channelP, SocketGetChannelInfo(connectedSocketP),
+ errorP);
}
-/* ServerRunOnce() supplied by Brian Quinlan of ActiveState. */
+void
+ServerRunConn(TServer * const serverP,
+ TOsSocket const connectedOsSocket) {
-/* Bryan Henderson found this to be completely wrong on 2001.11.29
- and changed it so it does the same thing as ServerRun(), but only
- once.
+ TChannel * channelP;
+ void * channelInfoP;
+ const char * error;
+
+ createChannelFromOsSocket(connectedOsSocket,
+ &channelP, &channelInfoP, &error);
+ if (error) {
+ TraceExit("Unable to use supplied socket");
+ xmlrpc_strfree(error);
+ } else {
+ const char * error;
+
+ ServerRunChannel(serverP, channelP, channelInfoP, &error);
+
+ if (error) {
+ TraceExit("Failed to run server on connection on file "
+ "descriptor %d. %s", connectedOsSocket, error);
+ xmlrpc_strfree(error);
+ }
+ ChannelDestroy(channelP);
+ free(channelInfoP);
+ }
+}
- The biggest problem it had was that when it forked the child (via
- ConnCreate(), both the parent and the child read the socket and
- processed the request!
-*/
-static void
-closeParentSocketCopy(TSocket * socketP) {
+void
+ServerRunOnce(TServer * const serverP) {
/*----------------------------------------------------------------------------
- If we're doing forked connections, close the indicated socket because it
- is the parent's copy and the parent doesn't need it. If we're doing
- threaded connections, then there's no such thing as a parent's copy, so
- nothing to close.
+ Accept a connection from the channel switch and do the HTTP
+ transaction that comes over it.
+
+ If no connection is presently waiting at the switch, wait for one.
+ But return immediately if we receive a signal during the wait.
-----------------------------------------------------------------------------*/
-#ifndef _THREAD
- SocketClose(socketP);
-#endif
+ struct _TServer * const srvP = serverP->srvP;
+
+ if (!srvP->chanSwitchP)
+ TraceMsg("This server is not set up to accept connections "
+ "on its own, so you can't use ServerRunOnce(). "
+ "Try ServerRunChannel() or ServerInit()");
+ else {
+ const char * error;
+ TChannel * channelP;
+ void * channelInfoP;
+
+ srvP->keepalivemaxconn = 1;
+
+ ChanSwitchAccept(srvP->chanSwitchP, &channelP, &channelInfoP, &error);
+ if (error) {
+ TraceMsg("Failed to accept the next connection from a client "
+ "at the channel level. %s", error);
+ xmlrpc_strfree(error);
+ } else {
+ if (channelP) {
+ const char * error;
+
+ serverRunChannel(serverP, channelP, channelInfoP, &error);
+
+ if (error) {
+ const char * peerDesc;
+ ChannelFormatPeerInfo(channelP, &peerDesc);
+ TraceExit("Got a connection from '%s', but failed to "
+ "run server on it. %s", peerDesc, error);
+ xmlrpc_strfree(peerDesc);
+ xmlrpc_strfree(error);
+ }
+ ChannelDestroy(channelP);
+ free(channelInfoP);
+ }
+ }
+ }
}
-void ServerRunOnce2(TServer * const srv,
- enum abyss_foreback const foregroundBackground)
-{
- TConn connection;
- TSocket listenSocket;
- TSocket connectedSocket;
- TIPAddr remoteAddr;
- abyss_bool succeeded;
- srv->keepalivemaxconn = 1;
+void
+ServerRunOnce2(TServer * const serverP,
+ enum abyss_foreback const foregroundBackground ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ This is a backward compatibility interface to ServerRunOnce().
+
+ 'foregroundBackground' is meaningless. We always process the
+ connection in the foreground. The parameter exists because we once
+ thought we could do them in the background, but we really can't do
+ that in any clean way. If Caller wants background execution, he can
+ spin his own thread or process to call us. It makes much more sense
+ in Caller's context.
+-----------------------------------------------------------------------------*/
+ ServerRunOnce(serverP);
+}
+
+
- connection.connected = FALSE;
- connection.inUse = FALSE;
+static void
+setGroups(void) {
- listenSocket = srv->listensock;
-
- succeeded = SocketAccept(&listenSocket, &connectedSocket, &remoteAddr);
- if (succeeded) {
- abyss_bool success;
- success = ConnCreate2(&connection,
- srv, connectedSocket, remoteAddr,
- &ServerFunc,
- foregroundBackground);
- if (success)
- ConnProcess(&connection);
- closeParentSocketCopy(&connectedSocket);
- } else
- TraceMsg("Socket Error=%d\n", SocketError());
+#if HAVE_SETGROUPS
+ if (setgroups(0, NULL) == (-1))
+ TraceExit("Failed to setup the group.");
+#endif
}
-void ServerRunOnce(TServer *srv)
-{
- ServerRunOnce2(srv, ABYSS_BACKGROUND);
+
+
+void
+ServerDaemonize(TServer * const serverP) {
+/*----------------------------------------------------------------------------
+ Turn Caller into a daemon (i.e. fork a child, then exit; the child
+ returns to Caller).
+
+ NOTE: It's ridiculous, but conventional, for us to do this. It's
+ ridiculous because the task of daemonizing is not something
+ particular to Abyss. It ought to be done by a higher level. In
+ fact, it should be done before the Abyss server program is even
+ execed. The user should run a "daemonize" program that creates a
+ daemon which execs the Abyss server program.
+-----------------------------------------------------------------------------*/
+ struct _TServer * const srvP = serverP->srvP;
+
+#ifndef _WIN32
+ /* Become a daemon */
+ switch (fork()) {
+ case 0:
+ break;
+ case -1:
+ TraceExit("Unable to become a daemon");
+ default:
+ /* We are the parent */
+ exit(0);
+ }
+
+ setsid();
+
+ /* Change the current user if we are root */
+ if (getuid()==0) {
+ if (srvP->uid == (uid_t)-1)
+ TraceExit("Can't run under root privileges. "
+ "Please add a User option in your "
+ "Abyss configuration file.");
+
+ setGroups();
+
+ if (srvP->gid != (gid_t)-1)
+ if (setgid(srvP->gid)==(-1))
+ TraceExit("Failed to change the group.");
+
+ if (setuid(srvP->uid) == -1)
+ TraceExit("Failed to change the user.");
+ }
+
+ if (srvP->pidfileP) {
+ char z[16];
+
+ sprintf(z, "%d", getpid());
+ FileWrite(srvP->pidfileP, z, strlen(z));
+ FileClose(srvP->pidfileP);
+ }
+#endif /* _WIN32 */
}
void
-ServerAddHandler2(TServer * const srvP,
+ServerAddHandler2(TServer * const serverP,
URIHandler2 * const handlerArgP,
abyss_bool * const successP) {
@@ -940,14 +1246,9 @@
else
handlerP->init(handlerP, successP);
- if (*successP) {
- *successP = ListAdd(&srvP->handlers, handlerP);
+ if (*successP)
+ *successP = ListAdd(&serverP->srvP->handlers, handlerP);
- if (!*successP) {
- if (handlerP->term)
- handlerP->term(handlerP);
- }
- }
if (!*successP)
free(handlerP);
}
@@ -955,14 +1256,6 @@
-static void
-destroyHandler(URIHandler2 * const handlerP) {
-
- free(handlerP);
-}
-
-
-
static URIHandler2 *
createHandler(URIHandler const function) {
@@ -971,7 +1264,7 @@
MALLOCVAR(handlerP);
if (handlerP != NULL) {
handlerP->init = NULL;
- handlerP->term = destroyHandler;
+ handlerP->term = NULL;
handlerP->userdata = NULL;
handlerP->handleReq2 = NULL;
handlerP->handleReq1 = function;
@@ -982,18 +1275,18 @@
abyss_bool
-ServerAddHandler(TServer * const srvP,
+ServerAddHandler(TServer * const serverP,
URIHandler const function) {
URIHandler2 * handlerP;
- abyss_bool success;
+ bool success;
handlerP = createHandler(function);
if (handlerP == NULL)
success = FALSE;
else {
- success = ListAdd(&srvP->handlers, handlerP);
+ success = ListAdd(&serverP->srvP->handlers, handlerP);
if (!success)
free(handlerP);
@@ -1004,67 +1297,72 @@
void
-ServerDefaultHandler(TServer * const srvP,
+ServerDefaultHandler(TServer * const serverP,
URIHandler const handler) {
- srvP->defaulthandler = handler;
-}
-
-abyss_bool LogOpen(TServer *srv, const char *filename) {
+ struct _TServer * const srvP = serverP->srvP;
- if (FileOpenCreate(&(srv->logfile),filename,O_WRONLY | O_APPEND)) {
- if (MutexCreate(&(srv->logmutex)))
- return TRUE;
- else {
- FileClose(&(srv->logfile));
- srv->logfile=(-1);
- }
+ if (handler)
+ srvP->defaultHandler = handler;
+ else {
+ srvP->defaultHandler = HandlerDefaultBuiltin;
+ srvP->defaultHandlerContext = srvP->builtinHandlerP;
}
-
- TraceMsg("Can't open log file '%s'",filename);
- return FALSE;
-}
-
-void LogWrite(TServer *srv,char *c)
-{
- if ((srv->logfile)==(-1))
- return;
-
- if (!MutexLock(&(srv->logmutex)))
- return;
-
- FileWrite(&(srv->logfile),c,strlen(c));
- FileWrite(&(srv->logfile),LBR,strlen(LBR));
-
- MutexUnlock(&(srv->logmutex));
}
-void LogClose(TServer *srv)
-{
- if ((srv->logfile)==(-1))
- return;
- FileClose(&(srv->logfile));
- MutexFree(&(srv->logmutex));
-}
-
-abyss_bool SessionLog(TSession *s)
-{
- char z[1024];
- uint32_t n;
-
- if (s->requestline == NULL)
- return FALSE;
-
- if (strlen(s->requestline)>1024-26-50)
- s->requestline[1024-26-50]='\0';
- n=sprintf(z,"%d.%d.%d.%d - %s - [",IPB1(s->conn->peerip),IPB2(s->conn->peerip),IPB3(s->conn->peerip),IPB4(s->conn->peerip),(s->user?s->user:""));
+void
+LogWrite(TServer * const serverP,
+ const char * const msg) {
- DateToLogString(&s->date,z+n);
+ struct _TServer * const srvP = serverP->srvP;
- sprintf(z+n+20,"] \"%s\" %d %d",s->requestline,s->status,s->conn->outbytes);
+ if (!srvP->logfileisopen && srvP->logfilename)
+ logOpen(srvP);
- LogWrite(s->server,z);
- return TRUE;
+ if (srvP->logfileisopen) {
+ bool success;
+ success = MutexLock(srvP->logmutexP);
+ if (success) {
+ const char * const lbr = "\n";
+ FileWrite(srvP->logfileP, msg, strlen(msg));
+ FileWrite(srvP->logfileP, lbr, strlen(lbr));
+
+ MutexUnlock(srvP->logmutexP);
+ }
+ }
}
+/*******************************************************************************
+**
+** server.c
+**
+** This file is part of the ABYSS Web server project.
+**
+** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
+** All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+**
+******************************************************************************/
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/socket.c Mon May 26 12:59:57 2008
@@ -1,269 +1,126 @@
-/******************************************************************************
-**
-** socket.c
-**
-** This file is part of the ABYSS Web server project.
-**
-** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-**
-******************************************************************************/
+/*============================================================================
+ socket.c
+==============================================================================
+ Implementation of obsolete TSocket class.
-#include "xmlrpc_config.h"
+ Use TChannel and TChanSwitch instead for new work.
+============================================================================*/
+#include <assert.h>
#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef HAVE_SYS_FILIO_H
- #include <sys/filio.h>
-#endif
+
+#include "mallocvar.h"
#include "xmlrpc-c/abyss.h"
+#include "channel.h"
+#include "chanswitch.h"
-#ifdef ABYSS_WIN32
-#define EINTR WSAEINTR
-#endif
-
-static abyss_bool ABYSS_TRACE_SOCKET;
-
-/*********************************************************************
-** Socket
-*********************************************************************/
-
-abyss_bool SocketInit()
-{
- abyss_bool retval;
-#ifdef ABYSS_WIN32
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
-
- wVersionRequested = MAKEWORD( 2, 0 );
-
- err = WSAStartup( wVersionRequested, &wsaData );
- retval = ( err == 0 );
-#else
- retval = TRUE;
- ABYSS_TRACE_SOCKET = (getenv("ABYSS_TRACE_SOCKET") != NULL);
-#endif /* ABYSS_WIN32 */
- if (ABYSS_TRACE_SOCKET)
- fprintf(stderr, "Abyss socket layer will trace socket traffic "
- "due to ABYSS_TRACE_SOCKET environment variable\n");
- return retval;
-}
+#include "socket.h"
-#define RET(x) return ((x)!=(-1))
-abyss_bool SocketCreate(TSocket *s)
-{
- int rc;
-
- rc =socket(AF_INET,SOCK_STREAM,0);
- if (rc < 0)
- return FALSE;
- else {
- int32_t n=1;
- *s = rc;
- RET(setsockopt(*s,SOL_SOCKET,SO_REUSEADDR,(char*)&n,sizeof(n)));
- }
-}
+/* SocketCreate...() is not exported to the Abyss user. It is meant to
+ be used by an implementation-specific TSocket generator which is
+ exported to the Abyss user, e.g. SocketCreateUnix() in
+ socket_unix.c
-abyss_bool SocketClose(TSocket *s)
-{
-#ifdef ABYSS_WIN32
- RET(closesocket(*s));
-#else
- RET(close(*s));
-#endif /* ABYSS_WIN32 */
-}
+ The TSocket generator functions are the _only_ user-accessible
+ functions that are particular to an implementation.
+*/
-int SocketWrite(TSocket *s, char *buffer, uint32_t len)
-{
- return send(*s,buffer,len,0);
-}
+static uint const socketSignature = 0x060609;
+static void
+socketCreate(TSocket ** const socketPP) {
-uint32_t SocketRead(TSocket * const socketP,
- char * const buffer,
- uint32_t const len) {
- int rc;
- rc = recv(*socketP, buffer, len, 0);
- if (ABYSS_TRACE_SOCKET) {
- if (rc < 0)
- fprintf(stderr, "Abyss socket: recv() failed. errno=%d (%s)",
- errno, strerror(errno));
- else
- fprintf(stderr, "Abyss socket: read %u bytes: '%.*s'\n",
- len, (int)len, buffer);
- }
- return rc;
+ TSocket * socketP;
+
+ MALLOCVAR(socketP);
+
+ if (socketP) {
+ socketP->signature = socketSignature;
+ *socketPP = socketP;
+ } else
+ *socketPP = NULL;
}
-uint32_t SocketPeek(TSocket *s, char *buffer, uint32_t len)
-{
- int32_t r=recv(*s,buffer,len,MSG_PEEK);
-
- if (r==(-1))
-#ifdef ABYSS_WIN32
- if (SocketError()==WSAEMSGSIZE)
-#else
- if (SocketError()==EMSGSIZE)
-#endif
- return len;
+void
+SocketCreateChannel(TChannel * const channelP,
+ void * const channelInfoP,
+ TSocket ** const socketPP) {
- return r;
-}
+ TSocket * socketP;
-abyss_bool SocketConnect(TSocket *s, TIPAddr *addr, uint16_t port)
-{
- struct sockaddr_in name;
-
- name.sin_family=AF_INET;
- name.sin_port=htons(port);
- name.sin_addr=*addr;
+ socketCreate(&socketP);
- RET(connect(*s,(struct sockaddr *)&name,sizeof(name)));
+ if (socketP) {
+ socketP->channelP = channelP;
+ socketP->chanSwitchP = NULL;
+ socketP->channelInfoP = channelInfoP;
+ *socketPP = socketP;
+ } else
+ *socketPP = NULL;
}
-abyss_bool SocketBind(TSocket *s, TIPAddr *addr, uint16_t port)
-{
- struct sockaddr_in name;
-
- name.sin_family=AF_INET;
- name.sin_port=htons(port);
- if (addr)
- name.sin_addr=*addr;
- else
- name.sin_addr.s_addr=INADDR_ANY;
- RET(bind(*s,(struct sockaddr *)&name,sizeof(name)));
-}
-abyss_bool SocketListen(TSocket *s, uint32_t backlog)
-{
- int32_t n=-1;
+void
+SocketCreateChanSwitch(TChanSwitch * const chanSwitchP,
+ TSocket ** const socketPP) {
- /* Disable the naggle algorithm to make persistant connections faster */
- setsockopt(*s, IPPROTO_TCP,TCP_NODELAY,(char *)&n,sizeof(n));
+ TSocket * socketP;
- RET(listen(*s,backlog));
-}
+ socketCreate(&socketP);
-abyss_bool SocketAccept(TSocket *s, TSocket *ns,TIPAddr *ip)
-{
- struct sockaddr_in sa;
- socklen_t size=sizeof(sa);
- abyss_bool connected;
-
- connected = FALSE;
- for (;;) {
- int rc;
- rc = accept(*s,(struct sockaddr *)&sa,&size);
- if (rc >= 0)
- {
- connected = TRUE;
- *ns = rc;
- *ip=sa.sin_addr;
- break;
- }
- else
- if (SocketError()!=EINTR)
- break;
- }
- return connected;
+ if (socketP) {
+ socketP->channelP = NULL;
+ socketP->chanSwitchP = chanSwitchP;
+ *socketPP = socketP;
+ } else
+ *socketPP = NULL;
}
-uint32_t SocketWait(TSocket *s,abyss_bool rd,abyss_bool wr,uint32_t timems)
-{
- fd_set rfds,wfds;
-#ifdef ABYSS_WIN32
- TIMEVAL tv;
-#else
- struct timeval tv;
-#endif /* ABYSS_WIN32 */
-
- FD_ZERO(&rfds);
- FD_ZERO(&wfds);
-
- if (rd)
- FD_SET(*s,&rfds);
-
- if (wr)
- FD_SET(*s,&wfds);
-
- tv.tv_sec=timems/1000;
- tv.tv_usec=timems%1000;
-
-
- for (;;)
- switch(select((*s)+1,&rfds,&wfds,NULL,
- (timems==TIME_INFINITE?NULL:&tv)))
- {
- case 0: /* time out */
- return 0;
-
- case (-1): /* socket error */
- if (SocketError()==EINTR)
- break;
-
- return 0;
-
- default:
- if (FD_ISSET(*s,&rfds))
- return 1;
- if (FD_ISSET(*s,&wfds))
- return 2;
- return 0;
- };
+
+
+void
+SocketDestroy(TSocket * const socketP) {
+
+ assert(socketP->signature == socketSignature);
+
+ if (socketP->channelP) {
+ ChannelDestroy(socketP->channelP);
+ free(socketP->channelInfoP);
+ }
+
+ if (socketP->chanSwitchP)
+ ChanSwitchDestroy(socketP->chanSwitchP);
+
+ socketP->signature = 0; /* For debuggability */
+
+ free(socketP);
}
-abyss_bool SocketBlocking(TSocket *s, abyss_bool b)
-{
- uint32_t x=b;
- RET(ioctlsocket(*s,FIONBIO,&x));
+
+TChanSwitch *
+SocketGetChanSwitch(TSocket * const socketP) {
+
+ return socketP->chanSwitchP;
}
-uint32_t SocketAvailableReadBytes(TSocket *s)
-{
- uint32_t x;
- if (ioctlsocket(*s,FIONREAD,&x)!=0)
- x=0;
- return x;
+TChannel *
+SocketGetChannel(TSocket * const socketP) {
+
+ return socketP->channelP;
}
-uint32_t SocketError()
-{
-#ifdef ABYSS_WIN32
- return WSAGetLastError();
-#else
- return errno;
-#endif /* ABYSS_WIN32 */
+
+
+void *
+SocketGetChannelInfo(TSocket * const socketP) {
+
+ return socketP->channelInfoP;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.c Mon May 26 12:59:57 2008
@@ -1,19 +1,21 @@
#include "xmlrpc-c/abyss.h"
+#include "bool.h"
+
#include "token.h"
void
-NextToken(char ** const p) {
+NextToken(const char ** const pP) {
- abyss_bool gotToken;
+ bool gotToken;
gotToken = FALSE;
while (!gotToken) {
- switch (**p) {
+ switch (**pP) {
case '\t':
case ' ':
- ++(*p);
+ ++(*pP);
break;
default:
gotToken = TRUE;
@@ -24,30 +26,39 @@
char *
-GetToken(char ** const p) {
+GetToken(char ** const pP) {
char * p0;
- p0 = *p;
+ p0 = *pP;
while (1) {
- switch (**p) {
+ switch (**pP) {
case '\t':
case ' ':
case CR:
case LF:
case '\0':
- if (p0 == *p)
+ if (p0 == *pP)
return NULL;
- if (**p) {
- **p = '\0';
- ++(*p);
+ if (**pP) {
+ **pP = '\0';
+ ++(*pP);
};
return p0;
default:
- ++(*p);
+ ++(*pP);
};
}
}
+
+
+
+void
+GetTokenConst(char ** const pP,
+ const char ** const tokenP) {
+
+ *tokenP = GetToken(pP);
+}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/token.h Mon May 26 12:59:57 2008
@@ -2,10 +2,13 @@
#define ABYSS_TOKEN_H_INCLUDED
void
-NextToken(char ** const p);
+NextToken(const char ** const pP);
char *
-GetToken(char ** const p);
+GetToken(char ** const pP);
+void
+GetTokenConst(char ** const pP,
+ const char ** const tokenP);
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/trace.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/trace.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/abyss/src/trace.c Mon May 26 12:59:57 2008
@@ -35,20 +35,27 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
-#include "xmlrpc-c/abyss.h"
+
+#include "trace.h"
/*********************************************************************
** Tracing functions
*********************************************************************/
static void
-TraceVMsg(char *fmt,va_list argptr) {
+TraceVMsg(const char * const fmt,
+ va_list argptr) {
+
vprintf(fmt,argptr);
+
printf("\n");
}
-void TraceMsg(char *fmt,...)
-{
+
+
+void
+TraceMsg(const char * const fmt, ...) {
+
va_list argptr;
va_start(argptr,fmt);
@@ -56,12 +63,16 @@
va_end(argptr);
}
-void TraceExit(char *fmt,...)
-{
+
+
+void
+TraceExit(const char * const fmt, ...) {
+
va_list argptr;
va_start(argptr,fmt);
TraceVMsg(fmt,argptr);
va_end(argptr);
- abort();
+
+ exit(1);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/Makefile Mon May 26 12:59:57 2008
@@ -1,8 +1,26 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ LIBDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/curl_transport
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
+
+default: all
+
+.PHONY: all
+all: xmlrpc_curl_transport.o xmlrpc_curl_transport.osh
+
+# Rules for the above dependencies are in common.mk,
+# courtesy of TARGET_MODS.
+
+TARGET_MODS = xmlrpc_curl_transport
+
+OMIT_CURL_TRANSPORT_RULE=Y
+
+include $(SRCDIR)/common.mk
CURL_INCLUDES := $(shell curl-config --cflags)
# We expect that curl-config --cflags just gives us -I options, because
@@ -10,16 +28,14 @@
# of what any other compiler flag would do to our compile.
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = -lpthread $(LADD)
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include \
+INCLUDES = \
+ -I$(BLDDIR) \
+ -I$(BLDDIR)/include \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/lib/util/include \
$(CURL_INCLUDES)
-default: all
-
-.PHONY: all
-all: xmlrpc_curl_transport.lo
-
.PHONY: clean
clean: clean-common
@@ -38,9 +54,8 @@
.PHONY: dep
dep: dep-common
-include $(SRCDIR)/Makefile.common
-
include Makefile.depend
-xmlrpc_curl_transport.lo:%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(CFLAGS) $<
+# Need this dependency for those who don't use Makefile.depend.
+# Without it, version.h doesn't get created.
+xmlrpc_curl_transport.o xmlrpc_curl_transport.osh: version.h
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/xmlrpc_curl_transport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/xmlrpc_curl_transport.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/curl_transport/xmlrpc_curl_transport.c Mon May 26 12:59:57 2008
@@ -13,87 +13,137 @@
Curl maintains some minor information in process-global variables.
One must call curl_global_init() to initialize them before calling
- any other Curl library function.
-
- But note that one of those global variables tells that
- curl_global_init() has been called, and if you call it again,
- it's just a no-op. So we can call it for each of many transport
- object constructors.
-
- The actual global variables appear to be constant so that it's OK
- for them to be shared among multiple objects and threads. And we never
- want other than the defaults. They're things like the identity of
- the malloc routine.
-
- Note that not only could many Xmlrpc-c Curl XML transport
- objects be using Curl in the same process, but the Xmlrpc-c user may
- have uses of his own. So this whole fragile thing works only as long
- as the user doesn't need to set these global variables to something
- different from the defaults (because those are what we use).
-
- curl_global_cleanup() reverts the process back to a state in which
- nobody can use the Curl library. So we can't ever call it. This
- means there will be some memory leakage, but since curl_global_init
- only ever has effect once, the amount of leakage is trivial. The
- user can do his own curl_global_cleanup() if he really cares.
-
- Some of the Curl global variables are actually the SSL library global
- variables. The SSL library has the same disease.
+ any other Curl library function. This is not state information --
+ it is constants. They just aren't the kind of constants that the
+ library loader knows how to set, so there has to be this explicit
+ call to set them up. The matching function curl_global_cleanup()
+ returns resources these use (to wit, the constants live in
+ malloc'ed storage and curl_global_cleanup() frees the storage).
+
+ So our setup_global_const transport operation calls
+ curl_global_init() and our teardown_global_const calls
+ curl_global_cleanup().
+
+ The Curl library is supposed to maintain a reference count for the
+ global constants so that multiple modules using the library and
+ independently calling curl_global_init() and curl_global_cleanup()
+ are not a problem. But today, it just keeps a flag "I have been
+ initialized" and the first call to curl_global_cleanup() destroys
+ the constants for everybody. Therefore, the user of the Xmlrpc-c
+ Curl client XML transport must make sure not to call
+ teardownGlobalConstants until everything else in his program is
+ done using the Curl library.
+
+ Note that curl_global_init() is not threadsafe (with or without the
+ reference count), therefore our setup_global_const is not, and must
+ be called when no other thread in the process is running.
+ Typically, one calls it right at the beginning of the program.
+
+ There are actually two other classes of global variables in the
+ Curl library, which we are ignoring: debug options and custom
+ memory allocator function identities. Our code never changes these
+ global variables from default. If something else in the user's
+ program does, User is responsible for making sure it doesn't
+ interfere with our use of the library.
+
+ Note that when we say what the Curl library does, we're also
+ talking about various other libraries Curl uses internally, and in
+ fact much of what we're saying about global variables springs from
+ such subordinate libraries as OpenSSL and Winsock.
-----------------------------------------------------------------------------*/
+#include "xmlrpc_config.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <assert.h>
+#include <limits.h>
+#if !MSVCRT
+#include <sys/select.h>
+#endif
+#include <signal.h>
-#include "xmlrpc_config.h"
+#ifdef WIN32
+#include "curllink.h"
+#endif
#include "bool.h"
+#include "girmath.h"
#include "mallocvar.h"
#include "linklist.h"
-#include "sstring.h"
-#include "casprintf.h"
+#include "girstring.h"
#include "pthreadx.h"
-#include "xmlrpc-c/base.h"
-#include "xmlrpc-c/base_int.h"
-#include "xmlrpc-c/client.h"
+
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/select_int.h"
#include "xmlrpc-c/client_int.h"
+#include "xmlrpc-c/transport.h"
+#include "xmlrpc-c/time_int.h"
#include "version.h"
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
+#include <curl/multi.h>
-#if defined (WIN32) && defined(_DEBUG)
+#if MSVCRT
+#if defined(_DEBUG)
# include <crtdbg.h>
# define new DEBUG_NEW
# define malloc(size) _malloc_dbg( size, _NORMAL_BLOCK, __FILE__, __LINE__)
# undef THIS_FILE
static char THIS_FILE[] = __FILE__;
-#endif /*WIN32 && _DEBUG*/
+#endif
+#endif
+#define CMAJOR LIBCURL_VERSION_MAJOR
+#define CMINOR LIBCURL_VERSION_MINOR
+#if CMAJOR > 7 || (CMAJOR == 7 && CMINOR >= 10)
+ #define HAVE_CURL_NOSIGNAL 1
+#else
+ #define HAVE_CURL_NOSIGNAL 0
+#endif
+#if CMAJOR > 7 || (CMAJOR == 7 && CMINOR >= 12)
+ #define HAVE_CURL_STRERROR 1
+#else
+ #define HAVE_CURL_STRERROR 0
+#endif
+
+#undef CMAJOR
+#undef CMINOR
+
+
+
+typedef struct rpc rpc;
+
+typedef struct curlTransaction curlTransaction;
+
+
+
+struct curlSetup {
+
+ /* This is all client transport properties that are implemented as
+ simple Curl session properties (i.e. the transport basically just
+ passes them through to Curl without looking at them).
+
+ People occasionally want to replace all this with something where
+ the Xmlrpc-c user simply does the curl_easy_setopt() call and this
+ code need not know about all these options. Unfortunately, that's
+ a significant modularity violation. Either the Xmlrpc-c user
+ controls the Curl object or he doesn't. If he does, then he
+ shouldn't use libxmlrpc_client -- he should just copy some of this
+ code into his own program. If he doesn't, then he should never see
+ the Curl library.
+
+ Speaking of modularity: the only reason this is a separate struct
+ is to make the code easier to manage. Ideally, the fact that these
+ particular properties of the transport are implemented by simple
+ Curl session setup would be known only at the lowest level code
+ that does that setup.
+ */
-struct xmlrpc_client_transport {
- pthread_mutex_t listLock;
- struct list_head rpcList;
- /* List of all RPCs that exist for this transport. An RPC exists
- from the time the user requests it until the time the user
- acknowledges it is done.
- */
- CURL * syncCurlSessionP;
- /* Handle for a Curl library session object that we use for
- all synchronous RPCs. An async RPC has one of its own,
- and consequently does not share things such as persistent
- connections and cookies with any other RPC.
- */
- pthread_mutex_t syncCurlSessionLock;
- /* Hold this lock while accessing or using *syncCurlSessionP.
- You're using the session from the time you set any
- attributes in it or start a transaction with it until any
- transaction has finished and you've lost interest in any
- attributes of the session.
- */
const char * networkInterface;
/* This identifies the network interface on the local side to
use for the session. It is an ASCIIZ string in the form
@@ -116,312 +166,194 @@
authentic) indicates the host name that is in the URL we
are using for the server.
*/
- const char * userAgent;
- /* Prefix for the User-Agent HTTP header, reflecting facilities
- outside of Xmlrpc-c. The actual User-Agent header consists
- of this prefix plus information about Xmlrpc-c. NULL means
- none.
- */
-};
-
-typedef struct {
- /* This is all stuff that really ought to be in a Curl object,
- but the Curl library is a little too simple for that. So we
- build a layer on top of Curl, and define this "transaction," as
- an object subordinate to a Curl "session."
- */
- CURL * curlSessionP;
- /* Handle for the Curl session that hosts this transaction */
- char curlError[CURL_ERROR_SIZE];
- /* Error message from Curl */
- struct curl_slist * headerList;
- /* The HTTP headers for the transaction */
- const char * serverUrl; /* malloc'ed - belongs to this object */
-} curlTransaction;
-
-
-
-typedef struct {
- struct list_head link; /* link in transport's list of RPCs */
- CURL * curlSessionP;
- /* The Curl session we use for this transaction. Note that only
- one RPC at a time can use a particular Curl session, so this
- had better not be a session that some other RPC is using
- simultaneously.
- */
- curlTransaction * curlTransactionP;
- /* The object which does the HTTP transaction, with no knowledge
- of XML-RPC or Xmlrpc-c.
- */
- xmlrpc_mem_block * responseXmlP;
- xmlrpc_bool threadExists;
- pthread_t thread;
- xmlrpc_transport_asynch_complete complete;
- /* Routine to call to complete the RPC after it is complete HTTP-wise.
- NULL if none.
- */
- struct xmlrpc_call_info * callInfoP;
- /* User's identifier for this RPC */
-} rpc;
+ const char * sslCert;
+ const char * sslCertType;
+ const char * sslCertPasswd;
+ const char * sslKey;
+ const char * sslKeyType;
+ const char * sslKeyPasswd;
+ const char * sslEngine;
+ bool sslEngineDefault;
+ unsigned int sslVersion;
+ const char * caInfo;
+ const char * caPath;
+ const char * randomFile;
+ const char * egdSocket;
+ const char * sslCipherList;
+ unsigned int timeout;
+ /* 0 = no Curl timeout. This is in milliseconds. */
+};
-static size_t
-collect(void * const ptr,
- size_t const size,
- size_t const nmemb,
- FILE * const stream) {
-/*----------------------------------------------------------------------------
- This is a Curl output function. Curl calls this to deliver the
- HTTP response body. Curl thinks it's writing to a POSIX stream.
------------------------------------------------------------------------------*/
- xmlrpc_mem_block * const responseXmlP = (xmlrpc_mem_block *) stream;
- char * const buffer = ptr;
- size_t const length = nmemb * size;
+static int
+timeDiffMillisec(xmlrpc_timespec const minuend,
+ xmlrpc_timespec const subtractor) {
- size_t retval;
- xmlrpc_env env;
+ unsigned int const million = 1000000;
- xmlrpc_env_init(&env);
- xmlrpc_mem_block_append(&env, responseXmlP, buffer, length);
- if (env.fault_occurred)
- retval = (size_t)-1;
- else
- /* Really? Shouldn't it be like fread() and return 'nmemb'? */
- retval = length;
-
- return retval;
+ return (minuend.tv_sec - subtractor.tv_sec) * 1000 +
+ (minuend.tv_nsec - subtractor.tv_nsec + million/2) / million;
}
-static void
-initWindowsStuff(xmlrpc_env * const envP) {
+static bool
+timeIsAfter(xmlrpc_timespec const comparator,
+ xmlrpc_timespec const comparand) {
-#if defined (WIN32)
- /* This is CRITICAL so that cURL-Win32 works properly! */
- WORD wVersionRequested;
- WSADATA wsaData;
- int err;
- wVersionRequested = MAKEWORD(1, 1);
-
- err = WSAStartup(wVersionRequested, &wsaData);
- if (err)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Winsock startup failed. WSAStartup returned rc %d", err);
+ if (comparator.tv_sec > comparand.tv_sec)
+ return true;
+ else if (comparator.tv_sec < comparand.tv_sec)
+ return false;
else {
- if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1) {
- /* Tell the user that we couldn't find a useable */
- /* winsock.dll. */
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Winsock reported that "
- "it does not implement the requested version 1.1.");
- }
- if (envP->fault_occurred)
- WSACleanup();
+ /* Seconds are equal */
+ if (comparator.tv_nsec > comparand.tv_nsec)
+ return true;
+ else
+ return false;
}
-#else
- if (0)
- envP->fault_occurred = TRUE; /* Avoid unused parm warning */
-#endif
}
static void
-getXportParms(xmlrpc_env * const envP,
- const struct xmlrpc_curl_xportparms * const curlXportParmsP,
- size_t const parmSize,
- const char ** const networkInterfaceP,
- xmlrpc_bool * const sslVerifyPeerP,
- xmlrpc_bool * const sslVerifyHostP,
- const char ** const userAgentP) {
-
- if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(user_agent))
- *userAgentP = NULL;
- else if (curlXportParmsP->user_agent == NULL)
- *userAgentP = NULL;
- else
- *userAgentP = strdup(curlXportParmsP->user_agent);
-
- if (!curlXportParmsP ||
- parmSize < XMLRPC_CXPSIZE(no_ssl_verifypeer))
- *sslVerifyPeerP = TRUE;
- else
- *sslVerifyPeerP = !curlXportParmsP->no_ssl_verifypeer;
-
- if (!curlXportParmsP ||
- parmSize < XMLRPC_CXPSIZE(no_ssl_verifyhost))
- *sslVerifyHostP = TRUE;
- else
- *sslVerifyHostP = !curlXportParmsP->no_ssl_verifyhost;
+addMilliseconds(xmlrpc_timespec const addend,
+ unsigned int const adder,
+ xmlrpc_timespec * const sumP) {
- if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(network_interface))
- *networkInterfaceP = NULL;
- else if (curlXportParmsP->network_interface == NULL)
- *networkInterfaceP = NULL;
- else {
- *networkInterfaceP = strdup(curlXportParmsP->network_interface);
- if (*networkInterfaceP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unable to allocate space for network interface name.");
- if (envP->fault_occurred)
- strfree(*networkInterfaceP);
- }
-}
-
-
+ unsigned int const million = 1000000;
+ unsigned int const billion = 1000000000;
-static void
-createSyncCurlSession(xmlrpc_env * const envP,
- CURL ** const curlSessionPP) {
-/*----------------------------------------------------------------------------
- Create a Curl session to be used for multiple serial transactions.
- The Curl session we create is not complete -- it still has to be
- further set up for each particular transaction.
+ xmlrpc_timespec sum;
- We can't set up anything here that changes from one transaction to the
- next.
+ sum.tv_sec = addend.tv_sec + adder / 1000;
+ sum.tv_nsec = addend.tv_nsec + (adder % 1000) * million;
- We don't bother setting up anything that has to be set up for an
- asynchronous transaction because code that is common between synchronous
- and asynchronous transactions takes care of that anyway.
+ if ((uint32_t)sum.tv_nsec >= billion) {
+ sum.tv_sec += 1;
+ sum.tv_nsec -= billion;
+ }
+ *sumP = sum;
+}
- That leaves things such as cookies that don't exist for asynchronous
- transactions, and are common to multiple serial synchronous
- transactions.
------------------------------------------------------------------------------*/
- CURL * const curlSessionP = curl_easy_init();
- if (curlSessionP == NULL)
- xmlrpc_faultf(envP, "Could not create Curl session. "
- "curl_easy_init() failed.");
- else {
- /* The following is a trick. CURLOPT_COOKIEFILE is the name
- of the file containing the initial cookies for the Curl
- session. But setting it is also what turns on the cookie
- function itself, whereby the Curl library accepts and
- stores cookies from the server and sends them back on
- future requests. We don't have a file of initial cookies, but
- we want to turn on cookie function, so we set the option to
- something we know does not validly name a file. Curl will
- ignore the error and just start up cookie function with no
- initial cookies.
- */
- curl_easy_setopt(curlSessionP, CURLOPT_COOKIEFILE, "");
- *curlSessionPP = curlSessionP;
- }
-}
+/*============================================================================
+ locks
+==============================================================================
+ This is the beginnings of a lock abstraction that will allow this
+ transport to be used with locks other than pthread locks
+============================================================================*/
+struct lock {
+ pthread_mutex_t theLock;
+ void (*lock)(struct lock *);
+ void (*unlock)(struct lock *);
+ void (*destroy)(struct lock *);
+};
+typedef struct lock lock;
static void
-destroySyncCurlSession(CURL * const curlSessionP) {
+lock_pthread(struct lock * const lockP) {
+ pthread_mutex_lock(&lockP->theLock);
+}
- curl_easy_cleanup(curlSessionP);
+static void
+unlock_pthread(struct lock * const lockP) {
+ pthread_mutex_unlock(&lockP->theLock);
}
+static void
+destroyLock_pthread(struct lock * const lockP) {
+ pthread_mutex_destroy(&lockP->theLock);
+ free(lockP);
+}
-static void
-create(xmlrpc_env * const envP,
- int const flags ATTR_UNUSED,
- const char * const appname ATTR_UNUSED,
- const char * const appversion ATTR_UNUSED,
- const struct xmlrpc_xportparms * const transportparmsP,
- size_t const parm_size,
- struct xmlrpc_client_transport ** const handlePP) {
-/*----------------------------------------------------------------------------
- This does the 'create' operation for a Curl client transport.
------------------------------------------------------------------------------*/
- struct xmlrpc_curl_xportparms * const curlXportParmsP =
- (struct xmlrpc_curl_xportparms *) transportparmsP;
+static struct lock *
+createLock_pthread(void) {
+ struct lock * lockP;
+ MALLOCVAR(lockP);
+ if (lockP) {
+ pthread_mutex_init(&lockP->theLock, NULL);
+ lockP->lock = &lock_pthread;
+ lockP->unlock = &unlock_pthread;
+ lockP->destroy = &destroyLock_pthread;
+ }
+ return lockP;
+}
- struct xmlrpc_client_transport * transportP;
- initWindowsStuff(envP);
- MALLOCVAR(transportP);
- if (transportP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unable to allocate transport descriptor.");
- else {
- pthread_mutex_init(&transportP->listLock, NULL);
-
- list_make_empty(&transportP->rpcList);
+/*=============================================================================
+ curlTransaction
+=============================================================================*/
- /*
- * This is the main global constructor for the app. Call this before
- * _any_ libcurl usage. If this fails, *NO* libcurl functions may be
- * used, or havoc may be the result.
- */
- curl_global_init(CURL_GLOBAL_ALL);
+typedef void finishCurlTransactionFn(xmlrpc_env * const, curlTransaction * const);
- /* The above makes it look like Curl is not re-entrant. We should
- check into that.
+struct curlTransaction {
+ /* This is all stuff that really ought to be in a Curl object, but
+ the Curl library is a little too simple for that. So we build
+ a layer on top of Curl, and define this "transaction," as an
+ object subordinate to a Curl "session." A Curl session has
+ zero or one transactions in progress. The Curl session
+ "private data" is a pointer to the CurlTransaction object for
+ the current transaction.
+ */
+ CURL * curlSessionP;
+ /* Handle for the Curl session that hosts this transaction.
+ Note that only one transaction at a time can use a particular
+ Curl session, so this had better not be a session that some other
+ transaction is using simultaneously.
*/
-
- getXportParms(envP, curlXportParmsP, parm_size,
- &transportP->networkInterface,
- &transportP->sslVerifyPeer,
- &transportP->sslVerifyHost,
- &transportP->userAgent);
-
- if (!envP->fault_occurred) {
- pthread_mutex_init(&transportP->syncCurlSessionLock, NULL);
- createSyncCurlSession(envP, &transportP->syncCurlSessionP);
-
- if (envP->fault_occurred)
- strfree(transportP->networkInterface);
- }
- if (envP->fault_occurred)
- free(transportP);
- }
- *handlePP = transportP;
-}
+ finishCurlTransactionFn * finish;
+ rpc * rpcP;
+ /* The RPC which this transaction serves. (If this structure
+ were a true extension of the Curl library as described above,
+ this would be a void *, since the Curl library doesn't know what
+ an RPC is, but since we use it only for that, we might as well
+ use the specific type here).
+ */
+ CURLcode result;
+ /* Result of the transaction (succeeded, TCP connect failed, etc.).
+ A properly executed HTTP transaction (request & response) counts
+ as a successful transaction. When 'result' show success,
+ curl_easy_get_info() tells you whether the transaction succeeded
+ at the HTTP level.
+ */
+ char curlError[CURL_ERROR_SIZE];
+ /* Error message from Curl */
+ struct curl_slist * headerList;
+ /* The HTTP headers for the transaction */
+ const char * serverUrl; /* malloc'ed - belongs to this object */
+};
static void
-termWindowStuff(void) {
+interpretCurlEasyError(const char ** const descriptionP,
+ CURLcode const code) {
-#if defined (WIN32)
- WSACleanup();
+#if HAVE_CURL_STRERROR
+ *descriptionP = strdup(curl_easy_strerror(code));
+#else
+ xmlrpc_asprintf(descriptionP, "Curl error code (CURLcode) %d", code);
#endif
}
-static void
-destroy(struct xmlrpc_client_transport * const clientTransportP) {
-/*----------------------------------------------------------------------------
- This does the 'destroy' operation for a Curl client transport.
------------------------------------------------------------------------------*/
- XMLRPC_ASSERT(clientTransportP != NULL);
-
- XMLRPC_ASSERT(list_is_empty(&clientTransportP->rpcList));
-
- destroySyncCurlSession(clientTransportP->syncCurlSessionP);
- pthread_mutex_destroy(&clientTransportP->syncCurlSessionLock);
-
- if (clientTransportP->networkInterface)
- strfree(clientTransportP->networkInterface);
- if (clientTransportP->userAgent)
- strfree(clientTransportP->userAgent);
-
- /* We want to call curl_global_cleanup() now, but can't. See
- explanation of Curl global variables at the top of this file.
- */
-
- pthread_mutex_destroy(&clientTransportP->listLock);
-
- termWindowStuff();
+static void
+interpretCurlMultiError(const char ** const descriptionP,
+ CURLMcode const code) {
- free(clientTransportP);
+#if HAVE_CURL_STRERROR
+ *descriptionP = strdup(curl_multi_strerror(code));
+#else
+ xmlrpc_asprintf(descriptionP, "Curl error code (CURLMcode) %d", code);
+#endif
}
@@ -456,8 +388,13 @@
addUserAgentHeader(xmlrpc_env * const envP,
struct curl_slist ** const headerListP,
const char * const userAgent) {
-
+
if (userAgent) {
+ /* Note: Curl has a CURLOPT_USERAGENT option that does some of this
+ work. We prefer to be totally in control, though, so we build
+ the header explicitly.
+ */
+
curl_version_info_data * const curlInfoP =
curl_version_info(CURLVERSION_NOW);
char curlVersion[32];
@@ -469,17 +406,17 @@
(curlInfoP->version_num >> 0) && 0xff
);
- casprintf(&userAgentHeader,
- "User-Agent: %s Xmlrpc-c/%s Curl/%s",
- userAgent, XMLRPC_C_VERSION, curlVersion);
+ xmlrpc_asprintf(&userAgentHeader,
+ "User-Agent: %s Xmlrpc-c/%s Curl/%s",
+ userAgent, XMLRPC_C_VERSION, curlVersion);
- if (userAgentHeader == NULL)
+ if (userAgentHeader == xmlrpc_strsol)
xmlrpc_faultf(envP, "Couldn't allocate memory for "
"User-Agent header");
else {
addHeader(envP, headerListP, userAgentHeader);
- strfree(userAgentHeader);
+ xmlrpc_strfree(userAgentHeader);
}
}
}
@@ -487,251 +424,1647 @@
static void
-addAuthorizationHeader(xmlrpc_env * const envP,
- struct curl_slist ** const headerListP,
- const char * const basicAuthInfo) {
+addAuthorizationHeader(xmlrpc_env * const envP,
+ struct curl_slist ** const headerListP,
+ const char * const hdrValue) {
+
+ const char * authorizationHeader;
+
+ xmlrpc_asprintf(&authorizationHeader, "Authorization: %s", hdrValue);
+
+ if (authorizationHeader == xmlrpc_strsol)
+ xmlrpc_faultf(envP, "Couldn't allocate memory for "
+ "Authorization header");
+ else {
+ addHeader(envP, headerListP, authorizationHeader);
+
+ xmlrpc_strfree(authorizationHeader);
+ }
+}
+
+
+
+static void
+createCurlHeaderList(xmlrpc_env * const envP,
+ const char * const authHdrValue,
+ const char * const userAgent,
+ struct curl_slist ** const headerListP) {
+
+ struct curl_slist * headerList;
+
+ headerList = NULL; /* initial value - empty list */
+
+ addContentTypeHeader(envP, &headerList);
+ if (!envP->fault_occurred) {
+ addUserAgentHeader(envP, &headerList, userAgent);
+ if (!envP->fault_occurred) {
+ if (authHdrValue)
+ addAuthorizationHeader(envP, &headerList, authHdrValue);
+ }
+ }
+ if (envP->fault_occurred)
+ curl_slist_free_all(headerList);
+ else
+ *headerListP = headerList;
+}
+
+
+
+static void
+assertConstantsMatch(void) {
+/*----------------------------------------------------------------------------
+ There are some constants that we define as part of the Xmlrpc-c
+ interface that are identical to constants in the Curl interface to
+ make curl option setting work. This function asserts such
+ formally.
+-----------------------------------------------------------------------------*/
+ assert(XMLRPC_SSLVERSION_DEFAULT == CURL_SSLVERSION_DEFAULT);
+ assert(XMLRPC_SSLVERSION_TLSv1 == CURL_SSLVERSION_TLSv1);
+ assert(XMLRPC_SSLVERSION_SSLv2 == CURL_SSLVERSION_SSLv2);
+ assert(XMLRPC_SSLVERSION_SSLv3 == CURL_SSLVERSION_SSLv3);
+}
+
+
+
+static size_t
+collect(void * const ptr,
+ size_t const size,
+ size_t const nmemb,
+ FILE * const stream) {
+/*----------------------------------------------------------------------------
+ This is a Curl output function. Curl calls this to deliver the
+ HTTP response body to the Curl client. Curl thinks it's writing to
+ a POSIX stream.
+-----------------------------------------------------------------------------*/
+ xmlrpc_mem_block * const responseXmlP = (xmlrpc_mem_block *) stream;
+ char * const buffer = ptr;
+ size_t const length = nmemb * size;
+
+ size_t retval;
+ xmlrpc_env env;
+
+ xmlrpc_env_init(&env);
+ xmlrpc_mem_block_append(&env, responseXmlP, buffer, length);
+ if (env.fault_occurred)
+ retval = (size_t)-1;
+ else
+ /* Really? Shouldn't it be like fread() and return 'nmemb'? */
+ retval = length;
+
+ return retval;
+}
+
+
+
+static int
+curlProgress(void * const contextP,
+ double const dltotal ATTR_UNUSED,
+ double const dlnow ATTR_UNUSED,
+ double const ultotal ATTR_UNUSED,
+ double const ulnow ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ This is a Curl "progress function." It's something various Curl
+ functions call every so often, including whenever something gets
+ interrupted by the process receiving, and catching, a signal.
+ There are two purposes of a Curl progress function: 1) lets us log
+ the progress of a long-running transaction such as a big download,
+ e.g. by displaying a progress bar somewhere. In Xmlrpc-c, we don't
+ implement this purpose. 2) allows us to tell the Curl function,
+ via our return code, that calls it that we don't want to wait
+ anymore for the operation to complete.
+
+ In Curl versions before March 2007, we get called once per second
+ and signals have no effect. In current Curl, we usually get called
+ immediately after a signal gets caught while Curl is waiting to
+ receive a response from the server. But Curl doesn't properly
+ synchronize with signals, so it may miss one and then we don't get
+ called until the next scheduled one-per-second call.
+
+ All we do is tell Caller it's time to give up if the transport's
+ client says it is via his "interrupt" flag.
+
+ This function is not as important as it once was. This module used
+ to use curl_easy_perform(), which can be interrupted only via this
+ progress function. But because of the above-mentioned failure of
+ Curl to properly synchronize signals (and Bryan's failure to get
+ Curl developers to accept code to fix it), we now use the Curl
+ "multi" facility instead and do our own pselect(). But
+ This function still normally gets called by curl_multi_perform(),
+ which the transport tries to call even when the user has requested
+ interruption, because we don't trust our ability to abort a running
+ Curl transaction. curl_multi_perform() reliably winds up a Curl
+ transaction when this function tells it to.
+-----------------------------------------------------------------------------*/
+ unsigned int * const interruptP = contextP;
+
+ /* We require anyone setting us up as the Curl progress function to
+ supply an interrupt flag:
+ */
+ assert(contextP);
+
+ return *interruptP != 0 ? 1 : 0;
+}
+
+
+
+static void
+setupAuth(xmlrpc_env * const envP ATTR_UNUSED,
+ CURL * const curlSessionP,
+ const xmlrpc_server_info * const serverInfoP,
+ const char ** const authHdrValueP) {
+/*----------------------------------------------------------------------------
+ Set the options in the Curl session 'curlSessionP' to set up the HTTP
+ authentication described by *serverInfoP.
+
+ But we have an odd special function for backward compatibility, because
+ this code dates to a time when libcurl did not have the ability to
+ handle authentication, but we provided such function nonetheless by
+ building our own Authorization: header. But we did this only for
+ HTTP basic authentication.
+
+ So the special function is this: if libcurl is too old to have
+ authorization options and *serverInfoP allows basic authentication,
+ return as *basicAuthHdrParamP an appropriate parameter for the
+ Authorization: Basic: HTTP header. Otherwise, return
+ *basicAuthHdrParamP == NULL.
+-----------------------------------------------------------------------------*/
+ if (serverInfoP->allowedAuth.basic) {
+ CURLcode rc;
+ rc = curl_easy_setopt(curlSessionP, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+
+ if (rc == CURLE_OK)
+ *authHdrValueP = NULL;
+ else {
+ *authHdrValueP = strdup(serverInfoP->basicAuthHdrValue);
+ if (*authHdrValueP == NULL)
+ xmlrpc_faultf(envP, "Unable to allocate memory for basic "
+ "authentication header");
+ }
+ } else
+ *authHdrValueP = NULL;
+
+ /* We don't worry if libcurl is too old for these other kinds of
+ authentication; they're only defined as _allowed_
+ authentication methods, for when client and server are capable
+ of using it, and unlike with basic authentication, we have no
+ historical commitment to consider an old libcurl as capable of
+ doing these.
+ */
+
+ if (serverInfoP->userNamePw)
+ curl_easy_setopt(curlSessionP, CURLOPT_USERPWD,
+ serverInfoP->userNamePw);
+
+ if (serverInfoP->allowedAuth.digest)
+ curl_easy_setopt(
+ curlSessionP, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
+ if (serverInfoP->allowedAuth.gssnegotiate)
+ curl_easy_setopt(
+ curlSessionP, CURLOPT_HTTPAUTH, CURLAUTH_GSSNEGOTIATE);
+ if (serverInfoP->allowedAuth.ntlm)
+ curl_easy_setopt(
+ curlSessionP, CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
+}
+
+
+static void
+setCurlTimeout(CURL * const curlSessionP ATTR_UNUSED,
+ unsigned int const timeout ATTR_UNUSED) {
+
+#if HAVE_CURL_NOSIGNAL
+ unsigned int const timeoutMs = (timeout + 999)/1000;
+
+ curl_easy_setopt(curlSessionP, CURLOPT_NOSIGNAL, 1);
+
+ assert((long)timeoutMs == (int)timeoutMs);
+ /* Calling requirement */
+ curl_easy_setopt(curlSessionP, CURLOPT_TIMEOUT, (long)timeoutMs);
+#else
+ abort();
+#endif
+}
+
+
+
+static void
+setupCurlSession(xmlrpc_env * const envP,
+ curlTransaction * const curlTransactionP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_mem_block * const responseXmlP,
+ const xmlrpc_server_info * const serverInfoP,
+ const char * const userAgent,
+ int * const interruptP,
+ const struct curlSetup * const curlSetupP) {
+/*----------------------------------------------------------------------------
+ Set up the Curl session for the transaction *curlTransactionP so that
+ a subsequent curl_easy_perform() would perform said transaction.
+
+ The data curl_easy_perform() would send for that transaction would
+ be the contents of *callXmlP; the data curl_easy_perform() gets back
+ would go into *responseXmlP.
+
+ 'interruptP' is a pointer to an interrupt flag -- a flag that becomes
+ nonzero when the user wants to abandon this Curl session. NULL means
+ there is no interrupt flag; user will never want to abandon the session.
+-----------------------------------------------------------------------------*/
+ CURL * const curlSessionP = curlTransactionP->curlSessionP;
+
+ assertConstantsMatch();
+
+ curl_easy_setopt(curlSessionP, CURLOPT_POST, 1);
+ curl_easy_setopt(curlSessionP, CURLOPT_URL, curlTransactionP->serverUrl);
+
+ XMLRPC_MEMBLOCK_APPEND(char, envP, callXmlP, "\0", 1);
+ if (!envP->fault_occurred) {
+ curl_easy_setopt(curlSessionP, CURLOPT_POSTFIELDS,
+ XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP));
+ curl_easy_setopt(curlSessionP, CURLOPT_WRITEFUNCTION, collect);
+ curl_easy_setopt(curlSessionP, CURLOPT_FILE, responseXmlP);
+ curl_easy_setopt(curlSessionP, CURLOPT_HEADER, 0);
+ curl_easy_setopt(curlSessionP, CURLOPT_ERRORBUFFER,
+ curlTransactionP->curlError);
+ if (interruptP) {
+ curl_easy_setopt(curlSessionP, CURLOPT_NOPROGRESS, 0);
+ curl_easy_setopt(curlSessionP, CURLOPT_PROGRESSFUNCTION,
+ curlProgress);
+ curl_easy_setopt(curlSessionP, CURLOPT_PROGRESSDATA, interruptP);
+ } else
+ curl_easy_setopt(curlSessionP, CURLOPT_NOPROGRESS, 1);
+
+ curl_easy_setopt(curlSessionP, CURLOPT_SSL_VERIFYPEER,
+ curlSetupP->sslVerifyPeer);
+ curl_easy_setopt(curlSessionP, CURLOPT_SSL_VERIFYHOST,
+ curlSetupP->sslVerifyHost ? 2 : 0);
+
+ if (curlSetupP->networkInterface)
+ curl_easy_setopt(curlSessionP, CURLOPT_INTERFACE,
+ curlSetupP->networkInterface);
+ if (curlSetupP->sslCert)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLCERT,
+ curlSetupP->sslCert);
+ if (curlSetupP->sslCertType)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLCERTTYPE,
+ curlSetupP->sslCertType);
+ if (curlSetupP->sslCertPasswd)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLCERTPASSWD,
+ curlSetupP->sslCertPasswd);
+ if (curlSetupP->sslKey)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLKEY,
+ curlSetupP->sslKey);
+ if (curlSetupP->sslKeyType)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLKEYTYPE,
+ curlSetupP->sslKeyType);
+ if (curlSetupP->sslKeyPasswd)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLKEYPASSWD,
+ curlSetupP->sslKeyPasswd);
+ if (curlSetupP->sslEngine)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLENGINE,
+ curlSetupP->sslEngine);
+ if (curlSetupP->sslEngineDefault)
+ /* 3rd argument seems to be required by some Curl */
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLENGINE_DEFAULT, 1l);
+ if (curlSetupP->sslVersion != XMLRPC_SSLVERSION_DEFAULT)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSLVERSION,
+ curlSetupP->sslVersion);
+ if (curlSetupP->caInfo)
+ curl_easy_setopt(curlSessionP, CURLOPT_CAINFO,
+ curlSetupP->caInfo);
+ if (curlSetupP->caPath)
+ curl_easy_setopt(curlSessionP, CURLOPT_CAPATH,
+ curlSetupP->caPath);
+ if (curlSetupP->randomFile)
+ curl_easy_setopt(curlSessionP, CURLOPT_RANDOM_FILE,
+ curlSetupP->randomFile);
+ if (curlSetupP->egdSocket)
+ curl_easy_setopt(curlSessionP, CURLOPT_EGDSOCKET,
+ curlSetupP->egdSocket);
+ if (curlSetupP->sslCipherList)
+ curl_easy_setopt(curlSessionP, CURLOPT_SSL_CIPHER_LIST,
+ curlSetupP->sslCipherList);
+
+ if (curlSetupP->timeout)
+ setCurlTimeout(curlSessionP, curlSetupP->timeout);
+
+ {
+ const char * authHdrValue;
+ /* NULL means we don't have to construct an explicit
+ Authorization: header. non-null means we have to
+ construct one with this as its value.
+ */
+
+ setupAuth(envP, curlSessionP, serverInfoP, &authHdrValue);
+ if (!envP->fault_occurred) {
+ struct curl_slist * headerList;
+ createCurlHeaderList(envP, authHdrValue, userAgent,
+ &headerList);
+ if (!envP->fault_occurred) {
+ curl_easy_setopt(
+ curlSessionP, CURLOPT_HTTPHEADER, headerList);
+ curlTransactionP->headerList = headerList;
+ }
+ if (authHdrValue)
+ xmlrpc_strfree(authHdrValue);
+ }
+ }
+ }
+}
+
+
+
+static void
+curlTransaction_create(xmlrpc_env * const envP,
+ CURL * const curlSessionP,
+ const xmlrpc_server_info * const serverP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_mem_block * const responseXmlP,
+ const char * const userAgent,
+ const struct curlSetup * const curlSetupStuffP,
+ rpc * const rpcP,
+ int * const interruptP,
+ curlTransaction ** const curlTransactionPP) {
+
+ curlTransaction * curlTransactionP;
+
+ MALLOCVAR(curlTransactionP);
+ if (curlTransactionP == NULL)
+ xmlrpc_faultf(envP, "No memory to create Curl transaction.");
+ else {
+ curlTransactionP->finish = NULL;
+ curlTransactionP->curlSessionP = curlSessionP;
+ curlTransactionP->rpcP = rpcP;
+
+ curlTransactionP->serverUrl = strdup(serverP->serverUrl);
+ if (curlTransactionP->serverUrl == NULL)
+ xmlrpc_faultf(envP, "Out of memory to store server URL.");
+ else {
+ setupCurlSession(envP, curlTransactionP,
+ callXmlP, responseXmlP,
+ serverP, userAgent, interruptP,
+ curlSetupStuffP);
+
+ if (envP->fault_occurred)
+ xmlrpc_strfree(curlTransactionP->serverUrl);
+ }
+ if (envP->fault_occurred)
+ free(curlTransactionP);
+ }
+ *curlTransactionPP = curlTransactionP;
+}
+
+
+
+static void
+curlTransaction_destroy(curlTransaction * const curlTransactionP) {
+
+ curl_slist_free_all(curlTransactionP->headerList);
+ xmlrpc_strfree(curlTransactionP->serverUrl);
+
+ free(curlTransactionP);
+}
+
+
+
+/*=============================================================================
+ curlMulti
+=============================================================================*/
+
+typedef struct {
+/*----------------------------------------------------------------------------
+ This is an extension to Curl's CURLM object. The extensions are:
+
+ 1) It has a lock so multiple threads can use it simultaneously.
+
+ 2) Its "select" file descriptor vectors are self-contained. CURLM
+ requires the user to maintain them separately.
+
+ Plus, it manages Curl transactions (curlTransaction) instead of Curl
+ sessions (CURL).
+-----------------------------------------------------------------------------*/
+ CURLM * curlMultiP;
+ lock * lockP;
+ /* Hold this lock while accessing or using *curlMultiP. You're
+ using the multi manager whenever you're calling a Curl
+ library multi manager function.
+ */
+ /* The following file descriptor sets are an integral part of the
+ CURLM object; Our curlMulti_fdset() routine binds them to the
+ CURLM object, and said object expects us to use them in a very
+ specific way, including doing a select() on them. It is very,
+ very messy.
+ */
+ fd_set readFdSet;
+ fd_set writeFdSet;
+ fd_set exceptFdSet;
+} curlMulti;
+
+
+
+static curlMulti *
+curlMulti_create(void) {
+
+ curlMulti * retval;
+ curlMulti * curlMultiP;
+
+ MALLOCVAR(curlMultiP);
+
+ if (curlMultiP == NULL)
+ retval = NULL;
+ else {
+ curlMultiP->lockP = createLock_pthread();
+
+ if (curlMultiP->lockP == NULL)
+ retval = NULL;
+ else {
+ curlMultiP->curlMultiP = curl_multi_init();
+ if (curlMultiP->curlMultiP == NULL)
+ retval = NULL;
+ else
+ retval = curlMultiP;
+
+ if (retval == NULL)
+ curlMultiP->lockP->destroy(curlMultiP->lockP);
+ }
+ if (retval == NULL)
+ free(curlMultiP);
+ }
+ return retval;
+}
+
+
+
+static void
+curlMulti_destroy(curlMulti * const curlMultiP) {
+
+ curl_multi_cleanup(curlMultiP->curlMultiP);
+
+ curlMultiP->lockP->destroy(curlMultiP->lockP);
+
+ free(curlMultiP);
+}
+
+
+
+static void
+curlMulti_perform(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ bool * const immediateWorkToDoP,
+ int * const runningHandlesP) {
+/*----------------------------------------------------------------------------
+ Do whatever work is ready to be done under the control of multi
+ manager 'curlMultiP'. E.g. if HTTP response data has recently arrived
+ from the network, process it as an HTTP response.
+
+ Iff this results in some work being finished from our point of view,
+ return *immediateWorkToDoP. (Caller can query the multi manager for
+ messages and find out what it is).
+
+ Return as *runningHandlesP the number of Curl easy handles under the
+ multi manager's control that are still running -- yet to finish.
+-----------------------------------------------------------------------------*/
+ CURLMcode rc;
+
+ curlMultiP->lockP->lock(curlMultiP->lockP);
+
+ rc = curl_multi_perform(curlMultiP->curlMultiP, runningHandlesP);
+
+ curlMultiP->lockP->unlock(curlMultiP->lockP);
+
+ if (rc == CURLM_CALL_MULTI_PERFORM) {
+ *immediateWorkToDoP = true;
+ } else {
+ *immediateWorkToDoP = false;
+
+ if (rc != CURLM_OK) {
+ const char * reason;
+ interpretCurlMultiError(&reason, rc);
+ xmlrpc_faultf(envP, "Impossible failure of curl_multi_perform(): "
+ "%s", reason);
+ xmlrpc_strfree(reason);
+ }
+ }
+}
+
+
+
+static void
+curlMulti_addHandle(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ curlTransaction * const curlTransactionP) {
+
+ CURLMcode rc;
+
+ curlMultiP->lockP->lock(curlMultiP->lockP);
+
+ rc = curl_multi_add_handle(curlMultiP->curlMultiP,
+ curlTransactionP->curlSessionP);
+
+ curlMultiP->lockP->unlock(curlMultiP->lockP);
+
+ if (rc != CURLM_OK) {
+ const char * reason;
+ interpretCurlMultiError(&reason, rc);
+ xmlrpc_faultf(envP, "Could not add Curl session to the "
+ "curl multi manager. curl_multi_add_handle() "
+ "failed: %s", reason);
+ xmlrpc_strfree(reason);
+ }
+}
+
+
+static void
+curlMulti_removeHandle(curlMulti * const curlMultiP,
+ curlTransaction * const curlTransactionP) {
+
+ curlMultiP->lockP->lock(curlMultiP->lockP);
+
+ curl_multi_remove_handle(curlMultiP->curlMultiP,
+ curlTransactionP->curlSessionP);
+
+ curlMultiP->lockP->unlock(curlMultiP->lockP);
+}
+
+
+
+static void
+curlMulti_getMessage(curlMulti * const curlMultiP,
+ bool * const endOfMessagesP,
+ CURLMsg * const curlMsgP) {
+/*----------------------------------------------------------------------------
+ Get the next message from the queue of things the Curl multi manager
+ wants to say to us.
+
+ Return the message as *curlMsgP.
+
+ Iff there are no messages in the queue, return *endOfMessagesP == true.
+-----------------------------------------------------------------------------*/
+ int remainingMsgCount;
+ CURLMsg * privateCurlMsgP;
+ /* Note that this is a pointer into the multi manager's memory,
+ so we have to use it under lock.
+ */
+
+ curlMultiP->lockP->lock(curlMultiP->lockP);
+
+ privateCurlMsgP = curl_multi_info_read(curlMultiP->curlMultiP,
+ &remainingMsgCount);
+
+ if (privateCurlMsgP == NULL)
+ *endOfMessagesP = true;
+ else {
+ *endOfMessagesP = false;
+ *curlMsgP = *privateCurlMsgP;
+ }
+ curlMultiP->lockP->unlock(curlMultiP->lockP);
+}
+
+
+
+static void
+curlMulti_fdset(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ fd_set * const readFdSetP,
+ fd_set * const writeFdSetP,
+ fd_set * const exceptFdSetP,
+ int * const maxFdP) {
+/*----------------------------------------------------------------------------
+ Set the CURLM object's file descriptor sets to those in the
+ curlMulti object, update those file descriptor sets with the
+ current needs of the multi manager, and return the resulting values
+ of the file descriptor sets.
+
+ This is a bizarre operation, but is necessary because of the nonmodular
+ way in which the Curl multi interface works with respect to waiting
+ for work with select().
+-----------------------------------------------------------------------------*/
+ CURLMcode rc;
+
+ curlMultiP->lockP->lock(curlMultiP->lockP);
+
+ /* curl_multi_fdset() doesn't _set_ the fdsets. It adds to existing
+ ones (so you can easily do a select() on other fds and Curl
+ fds at the same time). So we have to clear first:
+ */
+ FD_ZERO(&curlMultiP->readFdSet);
+ FD_ZERO(&curlMultiP->writeFdSet);
+ FD_ZERO(&curlMultiP->exceptFdSet);
+
+ /* WARNING: curl_multi_fdset() doesn't just update the fdsets pointed
+ to by its arguments. It makes the CURLM object remember those
+ pointers and refer back to them later! In fact, curl_multi_perform
+ expects its caller to have done a select() on those masks. No,
+ really. The man page even admits it.
+
+ Inspection of the Libcurl code in March 2007 indicates that
+ this isn't actually true -- curl_multi_fdset() updates your
+ fdset and doesn't remember the pointer at all. I.e. it's just
+ what you would expect. The man pages still says it's as
+ described above. My guess is that Libcurl was fixed at some
+ time and the man page not updated. In any case, we have to
+ work with old Libcurl if at all possible, so we still maintain
+ these fdsets as if they belong to the CURLM object.
+ */
+
+ rc = curl_multi_fdset(curlMultiP->curlMultiP,
+ &curlMultiP->readFdSet,
+ &curlMultiP->writeFdSet,
+ &curlMultiP->exceptFdSet,
+ maxFdP);
+
+ *readFdSetP = curlMultiP->readFdSet;
+ *writeFdSetP = curlMultiP->writeFdSet;
+ *exceptFdSetP = curlMultiP->exceptFdSet;
+
+ curlMultiP->lockP->unlock(curlMultiP->lockP);
+
+ if (rc != CURLM_OK) {
+ const char * reason;
+ interpretCurlMultiError(&reason, rc);
+ xmlrpc_faultf(envP, "Impossible failure of curl_multi_fdset(): %s",
+ reason);
+ xmlrpc_strfree(reason);
+ }
+}
+
+
+
+static void
+curlMulti_updateFdSet(curlMulti * const curlMultiP,
+ fd_set const readFdSet,
+ fd_set const writeFdSet,
+ fd_set const exceptFdSet) {
+/*----------------------------------------------------------------------------
+ curl_multi_perform() expects the file descriptor sets, which were bound
+ to the CURLM object via a prior curlMulti_fdset(), to contain the results
+ of a recent select(). This subroutine provides you a way to supply those.
+-----------------------------------------------------------------------------*/
+ curlMultiP->readFdSet = readFdSet;
+ curlMultiP->writeFdSet = writeFdSet;
+ curlMultiP->exceptFdSet = exceptFdSet;
+}
+
+
+
+static xmlrpc_timespec
+pselectTimeout(xmlrpc_timeoutType const timeoutType,
+ xmlrpc_timespec const timeoutDt) {
+/*----------------------------------------------------------------------------
+ Return the value that should be used in the select() call to wait for
+ there to be work for the Curl multi manager to do, given that the user
+ wants to timeout according to 'timeoutType' and 'timeoutDt'.
+-----------------------------------------------------------------------------*/
+ unsigned int const million = 1000000;
+ unsigned int selectTimeoutMillisec;
+ xmlrpc_timespec retval;
+
+ selectTimeoutMillisec = 0; /* quiet compiler warning */
+
+ /* We assume there is work to do at least every 3 seconds, because
+ the Curl multi manager often has retries and other scheduled work
+ that doesn't involve file handles on which we can select().
+ */
+ switch (timeoutType) {
+ case timeout_no:
+ selectTimeoutMillisec = 3000;
+ break;
+ case timeout_yes: {
+ xmlrpc_timespec nowTime;
+ int timeLeft;
+
+ xmlrpc_gettimeofday(&nowTime);
+ timeLeft = timeDiffMillisec(timeoutDt, nowTime);
+
+ selectTimeoutMillisec = MIN(3000, MAX(0, timeLeft));
+ }
+ break;
+ }
+ retval.tv_sec = selectTimeoutMillisec / 1000;
+ retval.tv_nsec = (uint32_t)((selectTimeoutMillisec % 1000) * million);
+
+ return retval;
+}
+
+
+
+static void
+processCurlMessages(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP) {
+
+ bool endOfMessages;
+
+ endOfMessages = false; /* initial assumption */
+
+ while (!endOfMessages && !envP->fault_occurred) {
+ CURLMsg curlMsg;
+
+ curlMulti_getMessage(curlMultiP, &endOfMessages, &curlMsg);
+
+ if (!endOfMessages) {
+ if (curlMsg.msg == CURLMSG_DONE) {
+ curlTransaction * curlTransactionP;
+
+ curl_easy_getinfo(curlMsg.easy_handle, CURLINFO_PRIVATE,
+ &curlTransactionP);
+
+ curlTransactionP->result = curlMsg.data.result;
+
+ if (curlTransactionP->finish)
+ curlTransactionP->finish(envP, curlTransactionP);
+ }
+ }
+ }
+}
+
+
+
+static void
+waitForWork(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ xmlrpc_timeoutType const timeoutType,
+ xmlrpc_timespec const deadline,
+ sigset_t * const sigmaskP) {
+/*----------------------------------------------------------------------------
+ Wait for the Curl multi manager to have work to do, time to run out,
+ or a signal to be received (and caught), whichever comes first.
+
+ Update the Curl multi manager's file descriptor sets to indicate what
+ work we found for it to do.
+
+ Wait under signal mask *sigmaskP. The point of this is that Caller
+ can make sure that arrival of a signal of a certain class
+ interrupts our wait, even if the signal arrives shortly before we
+ begin waiting. Caller blocks that signal class, then checks
+ whether a signal of that class has already been received. If not,
+ he calls us with *sigmaskP indicating that class NOT blocked.
+ Thus, if a signal of that class arrived any time after Caller
+ checked, we will return immediately or when the signal arrives,
+ whichever is sooner. Note that we can provide this service only
+ because pselect() has the same atomic unblock/wait feature.
+
+ If sigmaskP is NULL, wait under whatever the current signal mask
+ is.
+-----------------------------------------------------------------------------*/
+ fd_set readFdSet;
+ fd_set writeFdSet;
+ fd_set exceptFdSet;
+ int maxFd;
+
+ curlMulti_fdset(envP, curlMultiP,
+ &readFdSet, &writeFdSet, &exceptFdSet, &maxFd);
+ if (!envP->fault_occurred) {
+ if (maxFd == -1) {
+ /* There are no Curl file descriptors on which to wait.
+ So either there's work to do right now or all transactions
+ are already complete.
+ */
+ } else {
+ xmlrpc_timespec const pselectTimeoutArg =
+ pselectTimeout(timeoutType, deadline);
+
+ int rc;
+
+ rc = xmlrpc_pselect(maxFd+1, &readFdSet, &writeFdSet, &exceptFdSet,
+ &pselectTimeoutArg, sigmaskP);
+
+ if (rc < 0 && errno != EINTR)
+ xmlrpc_faultf(envP, "Impossible failure of pselect() "
+ "with errno %d (%s)",
+ errno, strerror(errno));
+ else {
+ /* Believe it or not, the Curl multi manager needs the
+ results of our pselect(). So hand them over:
+ */
+ curlMulti_updateFdSet(curlMultiP,
+ readFdSet, writeFdSet, exceptFdSet);
+ }
+ }
+ }
+}
+
+
+
+static void
+waitForWorkInt(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ xmlrpc_timeoutType const timeoutType,
+ xmlrpc_timespec const deadline,
+ int * const interruptP) {
+/*----------------------------------------------------------------------------
+ Same as waitForWork(), except we guarantee to return if a signal handler
+ sets or has set *interruptP, whereas waitForWork() can miss a signal
+ that happens before or just after it starts.
+
+ We mess with global state -- the signal mask -- so we might mess up
+ a multithreaded program. Therefore, don't call this if
+ waitForWork() will suffice.
+-----------------------------------------------------------------------------*/
+ sigset_t callerBlockSet;
+#ifdef WIN32
+ waitForWork(envP, curlMultiP, timeoutType, deadline, &callerBlockSet);
+#else
+ sigset_t allSignals;
+
+ assert(interruptP != NULL);
+
+ sigfillset(&allSignals);
+
+ sigprocmask(SIG_BLOCK, &allSignals, &callerBlockSet);
+
+ if (*interruptP == 0)
+ waitForWork(envP, curlMultiP, timeoutType, deadline, &callerBlockSet);
+
+ sigprocmask(SIG_SETMASK, &callerBlockSet, NULL);
+#endif
+}
+
+
+
+static void
+doCurlWork(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ bool * const transStillRunningP) {
+/*----------------------------------------------------------------------------
+ Do whatever work is ready to be done by the Curl multi manager
+ identified by 'curlMultiP'. This typically is transferring data on
+ an HTTP connection because the server is ready.
+
+ For each transaction for which the multi manager finishes all the
+ required work, complete the transaction by calling its
+ "finish" routine.
+
+ Return *transStillRunningP false if this work completes all of the
+ manager's transactions so that there is no reason to call us ever
+ again.
+-----------------------------------------------------------------------------*/
+ bool immediateWorkToDo;
+ int runningHandles;
+
+ immediateWorkToDo = true; /* initial assumption */
+
+ while (immediateWorkToDo && !envP->fault_occurred) {
+ curlMulti_perform(envP, curlMultiP,
+ &immediateWorkToDo, &runningHandles);
+ }
+
+ /* We either did all the work that's ready to do or hit an error. */
+
+ if (!envP->fault_occurred) {
+ /* The work we did may have resulted in asynchronous messages
+ (asynchronous to the thing they refer to, not to us, of course).
+ In particular the message "Curl transaction has completed".
+ So we process those now.
+ */
+ processCurlMessages(envP, curlMultiP);
+
+ *transStillRunningP = runningHandles > 0;
+ }
+}
+
+
+
+static void
+curlMulti_finish(xmlrpc_env * const envP,
+ curlMulti * const curlMultiP,
+ xmlrpc_timeoutType const timeoutType,
+ xmlrpc_timespec const deadline,
+ int * const interruptP) {
+/*----------------------------------------------------------------------------
+ Prosecute all the Curl transactions under the control of
+ *curlMultiP. E.g. send data if server is ready to take it, get
+ data if server has sent some, wind up the transaction if it is
+ done.
+
+ Don't return until all the Curl transactions are done or we time out.
+
+ The *interruptP flag alone will not interrupt us. We will wait in
+ spite of it for all Curl transactions to complete. *interruptP
+ just gives us a hint that the Curl transactions are being
+ interrupted, so we know there is work to do for them. (The way it
+ works is Caller sets up a "progress" function that checks the same
+ interrupt flag and reports "kill me." When we see the interrupt
+ flag, we call that progress function and get the message).
+-----------------------------------------------------------------------------*/
+ bool rpcStillRunning;
+ bool timedOut;
+
+ rpcStillRunning = true; /* initial assumption */
+ timedOut = false;
+
+ while (rpcStillRunning && !timedOut && !envP->fault_occurred) {
+
+ if (interruptP) {
+ waitForWorkInt(envP, curlMultiP, timeoutType, deadline,
+ interruptP);
+ } else
+ waitForWork(envP, curlMultiP, timeoutType, deadline, NULL);
+
+ if (!envP->fault_occurred) {
+ xmlrpc_timespec nowTime;
+
+ /* doCurlWork() (among other things) finds Curl
+ transactions that user wants to abort and finishes
+ them.
+ */
+ doCurlWork(envP, curlMultiP, &rpcStillRunning);
+
+ xmlrpc_gettimeofday(&nowTime);
+
+ timedOut = (timeoutType == timeout_yes &&
+ timeIsAfter(nowTime, deadline));
+ }
+ }
+}
+
+
+
+/*===========================================================================*/
+
+
+static void
+startCurlTransaction(xmlrpc_env * const envP,
+ curlTransaction * const curlTransactionP,
+ curlMulti * const curlMultiP,
+ finishCurlTransactionFn finish) {
+
+ curlTransactionP->finish = finish;
+
+ /* A Curl session is serial -- it processes zero or one transaction
+ at a time. We use the "private" attribute of the Curl session to
+ indicate which transaction it is presently processing. This is
+ important when the transaction finishes, because libcurl will just
+ tell us that something finished on a particular session, not that
+ a particular transaction finished.
+ */
+ curl_easy_setopt(curlTransactionP->curlSessionP, CURLOPT_PRIVATE,
+ curlTransactionP);
+
+ curlMulti_addHandle(envP, curlMultiP, curlTransactionP);
+}
+
+
+
+static void
+getCurlTransactionError(curlTransaction * const curlTransactionP,
+ xmlrpc_env * const envP) {
+
+ if (curlTransactionP->result != CURLE_OK) {
+ /* We've seen Curl just return a null string for an explanation
+ (e.g. when TCP connect() fails because IP address doesn't exist).
+ */
+ const char * explanation;
+
+ if (strlen(curlTransactionP->curlError) == 0)
+ interpretCurlEasyError(&explanation, curlTransactionP->result);
+ else
+ xmlrpc_asprintf(&explanation, "%s", curlTransactionP->curlError);
+
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR, "libcurl failed to execute the "
+ "HTTP POST transaction. %s", explanation);
+
+ xmlrpc_strfree(explanation);
+ } else {
+ CURLcode res;
+ long http_result;
+
+ res = curl_easy_getinfo(curlTransactionP->curlSessionP,
+ CURLINFO_HTTP_CODE, &http_result);
+
+ if (res != CURLE_OK)
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_INTERNAL_ERROR,
+ "Curl performed the HTTP POST request, but was "
+ "unable to say what the HTTP result code was. "
+ "curl_easy_getinfo(CURLINFO_HTTP_CODE) says: %s",
+ curlTransactionP->curlError);
+ else {
+ if (http_result != 200)
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HTTP response code is %ld, not 200",
+ http_result);
+ }
+ }
+}
+
+
+
+static void
+performCurlTransaction(xmlrpc_env * const envP,
+ curlTransaction * const curlTransactionP,
+ curlMulti * const curlMultiP,
+ int * const interruptP) {
+
+ void * const finish = NULL;
+ /* We don't need a finish function because we're going to wait here
+ for the transaction to complete and then do the next step
+ ourselves.
+ */
+
+ startCurlTransaction(envP, curlTransactionP, curlMultiP, finish);
+
+ /* Failure here just means something screwy in the multi manager;
+ Above does not even begin to perform the HTTP transaction
+ */
+
+ if (!envP->fault_occurred) {
+ xmlrpc_timespec const dummy = {0,0};
+
+ curlMulti_finish(envP, curlMultiP, timeout_no, dummy, interruptP);
+
+ /* Failure here just means something screwy in the multi
+ manager; any failure of the HTTP transaction would have been
+ recorded in *curlTransactionP.
+ */
+
+ if (!envP->fault_occurred) {
+ /* Curl session completed OK. But did HTTP transaction
+ work?
+ */
+ getCurlTransactionError(curlTransactionP, envP);
+ }
+ /* If the CURL transaction is still going, removing the handle
+ here aborts it. At least it's supposed to. From what I've
+ seen in the Curl code in 2007, I don't think it does. I
+ couldn't get Curl maintainers interested in the problem,
+ except to say, "If you're right, there's a bug."
+ */
+ curlMulti_removeHandle(curlMultiP, curlTransactionP);
+ }
+}
+
+
+
+struct xmlrpc_client_transport {
+ CURL * syncCurlSessionP;
+ /* Handle for a Curl library session object that we use for
+ all synchronous RPCs. An async RPC has one of its own,
+ and consequently does not share things such as persistent
+ connections and cookies with any other RPC.
+ */
+ lock * syncCurlSessionLockP;
+ /* Hold this lock while accessing or using *syncCurlSessionP.
+ You're using the session from the time you set any
+ attributes in it or start a transaction with it until any
+ transaction has finished and you've lost interest in any
+ attributes of the session.
+ */
+ curlMulti * syncCurlMultiP;
+ /* The Curl multi manager that this transport uses to execute
+ Curl transactions for RPCs requested via the synchronous
+ interface. The fact that there is never more than one such
+ transaction going at a time might make you wonder why a
+ "multi" manager is needed. The reason is that it is the only
+ interface in libcurl that gives us the flexibility to execute
+ the transaction with proper interruptibility. The only Curl
+ transaction ever attached to this multi manager is
+ 'syncCurlSessionP'.
+
+ This is constant (the handle, not the object).
+ */
+ curlMulti * asyncCurlMultiP;
+ /* The Curl multi manager that this transport uses to execute
+ Curl transactions for RPCs requested via the asynchronous
+ interface. Note that there may be multiple such Curl transactions
+ simultaneously and one can't wait for a particular one to finish;
+ the collection of asynchronous RPCs are an indivisible mass.
+
+ This is constant (the handle, not the object).
+ */
+ const char * userAgent;
+ /* Prefix for the User-Agent HTTP header, reflecting facilities
+ outside of Xmlrpc-c. The actual User-Agent header consists
+ of this prefix plus information about Xmlrpc-c. NULL means
+ none.
+
+ This is constant.
+ */
+ struct curlSetup curlSetupStuff;
+ /* This is constant */
+ int * interruptP;
+ /* Pointer to a value that user sets to nonzero to indicate he wants
+ the transport to give up on whatever it is doing and return ASAP.
+
+ NULL means none -- transport never gives up.
+ */
+};
+
+
+
+struct rpc {
+ struct xmlrpc_client_transport * transportP;
+ /* The client XML transport that transports this RPC */
+ curlTransaction * curlTransactionP;
+ /* The object which does the HTTP transaction, with no knowledge
+ of XML-RPC or Xmlrpc-c.
+ */
+ xmlrpc_mem_block * responseXmlP;
+ /* Where the response XML for this RPC should go or has gone. */
+ xmlrpc_transport_asynch_complete complete;
+ /* Routine to call to complete the RPC after it is complete HTTP-wise.
+ NULL if none.
+ */
+ struct xmlrpc_call_info * callInfoP;
+ /* User's identifier for this RPC */
+};
+
+
+static void
+lockSyncCurlSession(struct xmlrpc_client_transport * const transportP) {
+ transportP->syncCurlSessionLockP->lock(transportP->syncCurlSessionLockP);
+}
+
+
+
+static void
+unlockSyncCurlSession(struct xmlrpc_client_transport * const transportP) {
+ transportP->syncCurlSessionLockP->unlock(transportP->syncCurlSessionLockP);
+}
+
+
+
+static void
+initWindowsStuff(xmlrpc_env * const envP ATTR_UNUSED) {
+
+#if defined (WIN32)
+ /* This is CRITICAL so that cURL-Win32 works properly! */
+
+ /* So this commenter says, but I wonder why. libcurl should do the
+ required WSAStartup() itself, and it looks to me like it does.
+ -Bryan 06.01.01
+ */
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+ wVersionRequested = MAKEWORD(1, 1);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+ if (err)
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_INTERNAL_ERROR,
+ "Winsock startup failed. WSAStartup returned rc %d", err);
+ else {
+ if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1) {
+ /* Tell the user that we couldn't find a useable */
+ /* winsock.dll. */
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_INTERNAL_ERROR, "Winsock reported that "
+ "it does not implement the requested version 1.1.");
+ }
+ if (envP->fault_occurred)
+ WSACleanup();
+ }
+#endif
+}
+
+
+
+static void
+termWindowsStuff(void) {
+
+#if defined (WIN32)
+ WSACleanup();
+#endif
+}
+
+
+
+static bool
+curlHasNosignal(void) {
+
+ bool retval;
+
+#if HAVE_CURL_NOSIGNAL
+ curl_version_info_data * const curlInfoP =
+ curl_version_info(CURLVERSION_NOW);
+
+ retval = (curlInfoP->version_num >= 0x070A00); /* 7.10.0 */
+#else
+ retval = false;
+#endif
+ return retval;
+}
+
+
+
+static void
+getTimeoutParm(xmlrpc_env * const envP,
+ const struct xmlrpc_curl_xportparms * const curlXportParmsP,
+ size_t const parmSize,
+ unsigned int * const timeoutP) {
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(timeout))
+ *timeoutP = 0;
+ else {
+ if (curlHasNosignal()) {
+ /* libcurl takes a 'long' in milliseconds for the timeout value */
+ if ((curlXportParmsP->timeout + 999) / 1000 > LONG_MAX)
+ xmlrpc_faultf(envP, "Timeout value %u is too large.",
+ curlXportParmsP->timeout);
+ else
+ *timeoutP = curlXportParmsP->timeout;
+ } else
+ xmlrpc_faultf(envP, "You cannot specify a 'timeout' parameter "
+ "because the Curl library is too old and is not "
+ "capable of doing timeouts except by using "
+ "signals. You need at least Curl 7.10");
+ }
+}
+
+
+
+static void
+getXportParms(xmlrpc_env * const envP,
+ const struct xmlrpc_curl_xportparms * const curlXportParmsP,
+ size_t const parmSize,
+ struct xmlrpc_client_transport * const transportP) {
+/*----------------------------------------------------------------------------
+ Get the parameters out of *curlXportParmsP and update *transportP
+ to reflect them.
+
+ *curlXportParmsP is a 'parmSize' bytes long prefix of
+ struct xmlrpc_curl_xportparms.
+
+ curlXportParmsP is something the user created. It's designed to be
+ friendly to the user, not to this program, and is encumbered by
+ lots of backward compatibility constraints. In particular, the
+ user may have coded and/or compiled it at a time that struct
+ xmlrpc_curl_xportparms was smaller than it is now!
+
+ Also, the user might have specified something invalid.
+
+ So that's why we don't simply attach a copy of *curlXportParmsP to
+ *transportP.
+
+ To the extent that *curlXportParmsP is too small to contain a parameter,
+ we return the default value for that parameter.
+
+ Special case: curlXportParmsP == NULL means there is no input at all.
+ In that case, we return default values for everything.
+-----------------------------------------------------------------------------*/
+ struct curlSetup * const curlSetupP = &transportP->curlSetupStuff;
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(user_agent))
+ transportP->userAgent = NULL;
+ else if (curlXportParmsP->user_agent == NULL)
+ transportP->userAgent = NULL;
+ else
+ transportP->userAgent = strdup(curlXportParmsP->user_agent);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(network_interface))
+ curlSetupP->networkInterface = NULL;
+ else if (curlXportParmsP->network_interface == NULL)
+ curlSetupP->networkInterface = NULL;
+ else
+ curlSetupP->networkInterface =
+ strdup(curlXportParmsP->network_interface);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(no_ssl_verifypeer))
+ curlSetupP->sslVerifyPeer = true;
+ else
+ curlSetupP->sslVerifyPeer = !curlXportParmsP->no_ssl_verifypeer;
+
+ if (!curlXportParmsP ||
+ parmSize < XMLRPC_CXPSIZE(no_ssl_verifyhost))
+ curlSetupP->sslVerifyHost = true;
+ else
+ curlSetupP->sslVerifyHost = !curlXportParmsP->no_ssl_verifyhost;
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(ssl_cert))
+ curlSetupP->sslCert = NULL;
+ else if (curlXportParmsP->ssl_cert == NULL)
+ curlSetupP->sslCert = NULL;
+ else
+ curlSetupP->sslCert = strdup(curlXportParmsP->ssl_cert);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslcerttype))
+ curlSetupP->sslCertType = NULL;
+ else if (curlXportParmsP->sslcerttype == NULL)
+ curlSetupP->sslCertType = NULL;
+ else
+ curlSetupP->sslCertType = strdup(curlXportParmsP->sslcerttype);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslcertpasswd))
+ curlSetupP->sslCertPasswd = NULL;
+ else if (curlXportParmsP->sslcertpasswd == NULL)
+ curlSetupP->sslCertPasswd = NULL;
+ else
+ curlSetupP->sslCertPasswd = strdup(curlXportParmsP->sslcertpasswd);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslkey))
+ curlSetupP->sslKey = NULL;
+ else if (curlXportParmsP->sslkey == NULL)
+ curlSetupP->sslKey = NULL;
+ else
+ curlSetupP->sslKey = strdup(curlXportParmsP->sslkey);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslkeytype))
+ curlSetupP->sslKeyType = NULL;
+ else if (curlXportParmsP->sslkeytype == NULL)
+ curlSetupP->sslKeyType = NULL;
+ else
+ curlSetupP->sslKeyType = strdup(curlXportParmsP->sslkeytype);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslkeypasswd))
+ curlSetupP->sslKeyPasswd = NULL;
+ else if (curlXportParmsP->sslkeypasswd == NULL)
+ curlSetupP->sslKeyPasswd = NULL;
+ else
+ curlSetupP->sslKeyPasswd = strdup(curlXportParmsP->sslkeypasswd);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslengine))
+ curlSetupP->sslEngine = NULL;
+ else if (curlXportParmsP->sslengine == NULL)
+ curlSetupP->sslEngine = NULL;
+ else
+ curlSetupP->sslEngine = strdup(curlXportParmsP->sslengine);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslengine_default))
+ curlSetupP->sslEngineDefault = false;
+ else
+ curlSetupP->sslEngineDefault = !!curlXportParmsP->sslengine_default;
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(sslversion))
+ curlSetupP->sslVersion = XMLRPC_SSLVERSION_DEFAULT;
+ else
+ curlSetupP->sslVersion = curlXportParmsP->sslversion;
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(cainfo))
+ curlSetupP->caInfo = NULL;
+ else if (curlXportParmsP->cainfo == NULL)
+ curlSetupP->caInfo = NULL;
+ else
+ curlSetupP->caInfo = strdup(curlXportParmsP->cainfo);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(capath))
+ curlSetupP->caPath = NULL;
+ else if (curlXportParmsP->capath == NULL)
+ curlSetupP->caPath = NULL;
+ else
+ curlSetupP->caPath = strdup(curlXportParmsP->capath);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(randomfile))
+ curlSetupP->randomFile = NULL;
+ else if (curlXportParmsP->randomfile == NULL)
+ curlSetupP->randomFile = NULL;
+ else
+ curlSetupP->randomFile = strdup(curlXportParmsP->randomfile);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(egdsocket))
+ curlSetupP->egdSocket = NULL;
+ else if (curlXportParmsP->egdsocket == NULL)
+ curlSetupP->egdSocket = NULL;
+ else
+ curlSetupP->egdSocket = strdup(curlXportParmsP->egdsocket);
+
+ if (!curlXportParmsP || parmSize < XMLRPC_CXPSIZE(ssl_cipher_list))
+ curlSetupP->sslCipherList = NULL;
+ else if (curlXportParmsP->ssl_cipher_list == NULL)
+ curlSetupP->sslCipherList = NULL;
+ else
+ curlSetupP->sslCipherList = strdup(curlXportParmsP->ssl_cipher_list);
+
+ getTimeoutParm(envP, curlXportParmsP, parmSize, &curlSetupP->timeout);
+}
+
+
+
+static void
+freeXportParms(const struct xmlrpc_client_transport * const transportP) {
- if (basicAuthInfo) {
- const char * authorizationHeader;
-
- casprintf(&authorizationHeader, "Authorization: %s", basicAuthInfo);
-
- if (authorizationHeader == NULL)
- xmlrpc_faultf(envP, "Couldn't allocate memory for "
- "Authorization header");
- else {
- addHeader(envP, headerListP, authorizationHeader);
+ const struct curlSetup * const curlSetupP = &transportP->curlSetupStuff;
- strfree(authorizationHeader);
- }
- }
+ if (curlSetupP->sslCipherList)
+ xmlrpc_strfree(curlSetupP->sslCipherList);
+ if (curlSetupP->egdSocket)
+ xmlrpc_strfree(curlSetupP->egdSocket);
+ if (curlSetupP->randomFile)
+ xmlrpc_strfree(curlSetupP->randomFile);
+ if (curlSetupP->caPath)
+ xmlrpc_strfree(curlSetupP->caPath);
+ if (curlSetupP->caInfo)
+ xmlrpc_strfree(curlSetupP->caInfo);
+ if (curlSetupP->sslEngine)
+ xmlrpc_strfree(curlSetupP->sslEngine);
+ if (curlSetupP->sslKeyPasswd)
+ xmlrpc_strfree(curlSetupP->sslKeyPasswd);
+ if (curlSetupP->sslKeyType)
+ xmlrpc_strfree(curlSetupP->sslKeyType);
+ if (curlSetupP->sslKey)
+ xmlrpc_strfree(curlSetupP->sslKey);
+ if (curlSetupP->sslCertPasswd)
+ xmlrpc_strfree(curlSetupP->sslCertPasswd);
+ if (curlSetupP->sslCertType)
+ xmlrpc_strfree(curlSetupP->sslCertType);
+ if (curlSetupP->sslCert)
+ xmlrpc_strfree(curlSetupP->sslCert);
+ if (curlSetupP->networkInterface)
+ xmlrpc_strfree(curlSetupP->networkInterface);
+ if (transportP->userAgent)
+ xmlrpc_strfree(transportP->userAgent);
}
static void
-createCurlHeaderList(xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- const char * const userAgent,
- struct curl_slist ** const headerListP) {
+createSyncCurlSession(xmlrpc_env * const envP,
+ CURL ** const curlSessionPP) {
+/*----------------------------------------------------------------------------
+ Create a Curl session to be used for multiple serial transactions.
+ The Curl session we create is not complete -- it still has to be
+ further set up for each particular transaction.
- struct curl_slist * headerList;
+ We can't set up anything here that changes from one transaction to the
+ next.
- headerList = NULL; /* initial value - empty list */
+ We don't bother setting up anything that has to be set up for an
+ asynchronous transaction because code that is common between synchronous
+ and asynchronous transactions takes care of that anyway.
- addContentTypeHeader(envP, &headerList);
- if (!envP->fault_occurred) {
- addUserAgentHeader(envP, &headerList, userAgent);
- if (!envP->fault_occurred) {
- addAuthorizationHeader(envP, &headerList,
- serverP->_http_basic_auth);
- }
+ That leaves things, such as cookies, that don't exist for
+ asynchronous transactions, and are common to multiple serial
+ synchronous transactions.
+-----------------------------------------------------------------------------*/
+ CURL * const curlSessionP = curl_easy_init();
+
+ if (curlSessionP == NULL)
+ xmlrpc_faultf(envP, "Could not create Curl session. "
+ "curl_easy_init() failed.");
+ else {
+ /* The following is a trick. CURLOPT_COOKIEFILE is the name
+ of the file containing the initial cookies for the Curl
+ session. But setting it is also what turns on the cookie
+ function itself, whereby the Curl library accepts and
+ stores cookies from the server and sends them back on
+ future requests. We don't have a file of initial cookies, but
+ we want to turn on cookie function, so we set the option to
+ something we know does not validly name a file. Curl will
+ ignore the error and just start up cookie function with no
+ initial cookies.
+ */
+ curl_easy_setopt(curlSessionP, CURLOPT_COOKIEFILE, "");
+
+ *curlSessionPP = curlSessionP;
}
- if (envP->fault_occurred)
- curl_slist_free_all(headerList);
- else
- *headerListP = headerList;
}
static void
-setupCurlSession(xmlrpc_env * const envP,
- curlTransaction * const curlTransactionP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block * const responseXmlP,
- const char * const networkInterface,
- xmlrpc_bool const sslVerifyPeer,
- xmlrpc_bool const sslVerifyHost) {
-
- CURL * const curlSessionP = curlTransactionP->curlSessionP;
+destroySyncCurlSession(CURL * const curlSessionP) {
- curl_easy_setopt(curlSessionP, CURLOPT_POST, 1);
- if (networkInterface)
- curl_easy_setopt(curlSessionP, CURLOPT_INTERFACE, networkInterface);
- curl_easy_setopt(curlSessionP, CURLOPT_URL, curlTransactionP->serverUrl);
- curl_easy_setopt(curlSessionP, CURLOPT_SSL_VERIFYPEER, sslVerifyPeer);
- curl_easy_setopt(curlSessionP, CURLOPT_SSL_VERIFYHOST,
- sslVerifyHost ? 2 : 0);
- XMLRPC_MEMBLOCK_APPEND(char, envP, callXmlP, "\0", 1);
- if (!envP->fault_occurred) {
- curl_easy_setopt(curlSessionP, CURLOPT_POSTFIELDS,
- XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP));
-
- curl_easy_setopt(curlSessionP, CURLOPT_FILE, responseXmlP);
- curl_easy_setopt(curlSessionP, CURLOPT_HEADER, 0 );
- curl_easy_setopt(curlSessionP, CURLOPT_WRITEFUNCTION, collect);
- curl_easy_setopt(curlSessionP, CURLOPT_ERRORBUFFER,
- curlTransactionP->curlError);
- curl_easy_setopt(curlSessionP, CURLOPT_NOPROGRESS, 1);
-
- curl_easy_setopt(curlSessionP, CURLOPT_HTTPHEADER,
- curlTransactionP->headerList);
- }
+ curl_easy_cleanup(curlSessionP);
}
static void
-createCurlTransaction(xmlrpc_env * const envP,
- CURL * const curlSessionP,
- const xmlrpc_server_info * const serverP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block * const responseXmlP,
- const char * const networkInterface,
- xmlrpc_bool const sslVerifyPeer,
- xmlrpc_bool const sslVerifyHost,
- const char * const userAgent,
- curlTransaction ** const curlTransactionPP) {
-
- curlTransaction * curlTransactionP;
+makeSyncCurlSession(xmlrpc_env * const envP,
+ struct xmlrpc_client_transport * const transportP) {
- MALLOCVAR(curlTransactionP);
- if (curlTransactionP == NULL)
- xmlrpc_faultf(envP, "No memory to create Curl transaction.");
+ transportP->syncCurlSessionLockP = createLock_pthread();
+ if (transportP->syncCurlSessionLockP == NULL)
+ xmlrpc_faultf(envP, "Unable to create lock for "
+ "synchronous Curl session.");
else {
- curlTransactionP->curlSessionP = curlSessionP;
+ createSyncCurlSession(envP, &transportP->syncCurlSessionP);
+
+ if (!envP->fault_occurred) {
+ /* We'll need a multi manager to actually execute this session: */
+ transportP->syncCurlMultiP = curlMulti_create();
+
+ if (transportP->syncCurlMultiP == NULL)
+ xmlrpc_faultf(envP, "Unable to create Curl multi manager for "
+ "synchronous RPCs");
- curlTransactionP->serverUrl = strdup(serverP->_server_url);
- if (curlTransactionP->serverUrl == NULL)
- xmlrpc_faultf(envP, "Out of memory to store server URL.");
- else {
- createCurlHeaderList(envP, serverP, userAgent,
- &curlTransactionP->headerList);
-
- if (!envP->fault_occurred)
- setupCurlSession(envP, curlTransactionP,
- callXmlP, responseXmlP,
- networkInterface,
- sslVerifyPeer, sslVerifyHost);
-
if (envP->fault_occurred)
- strfree(curlTransactionP->serverUrl);
+ destroySyncCurlSession(transportP->syncCurlSessionP);
}
if (envP->fault_occurred)
- free(curlTransactionP);
+ transportP->syncCurlSessionLockP->destroy(
+ transportP->syncCurlSessionLockP);
}
- *curlTransactionPP = curlTransactionP;
}
static void
-destroyCurlTransaction(curlTransaction * const curlTransactionP) {
+unmakeSyncCurlSession(struct xmlrpc_client_transport * const transportP) {
- curl_slist_free_all(curlTransactionP->headerList);
- strfree(curlTransactionP->serverUrl);
+ curlMulti_destroy(transportP->syncCurlMultiP);
- free(curlTransactionP);
+ destroySyncCurlSession(transportP->syncCurlSessionP);
+
+ transportP->syncCurlSessionLockP->destroy(
+ transportP->syncCurlSessionLockP);
}
-static void
-performCurlTransaction(xmlrpc_env * const envP,
- curlTransaction * const curlTransactionP) {
+static void
+create(xmlrpc_env * const envP,
+ int const flags ATTR_UNUSED,
+ const char * const appname ATTR_UNUSED,
+ const char * const appversion ATTR_UNUSED,
+ const void * const transportparmsP,
+ size_t const parm_size,
+ struct xmlrpc_client_transport ** const handlePP) {
+/*----------------------------------------------------------------------------
+ This does the 'create' operation for a Curl client transport.
+-----------------------------------------------------------------------------*/
+ const struct xmlrpc_curl_xportparms * const curlXportParmsP =
+ transportparmsP;
- CURL * const curlSessionP = curlTransactionP->curlSessionP;
+ struct xmlrpc_client_transport * transportP;
- CURLcode res;
+ assertConstantsMatch();
- res = curl_easy_perform(curlSessionP);
-
- if (res != CURLE_OK)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR, "Curl failed to perform "
- "HTTP POST request. curl_easy_perform() says: %s",
- curlTransactionP->curlError);
+ MALLOCVAR(transportP);
+ if (transportP == NULL)
+ xmlrpc_faultf(envP, "Unable to allocate transport descriptor.");
else {
- CURLcode res;
- long http_result;
- res = curl_easy_getinfo(curlSessionP, CURLINFO_HTTP_CODE,
- &http_result);
+ transportP->interruptP = NULL;
- if (res != CURLE_OK)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Curl performed the HTTP POST request, but was "
- "unable to say what the HTTP result code was. "
- "curl_easy_getinfo(CURLINFO_HTTP_CODE) says: %s",
- curlTransactionP->curlError);
+ transportP->asyncCurlMultiP = curlMulti_create();
+
+ if (transportP->asyncCurlMultiP == NULL)
+ xmlrpc_faultf(envP, "Unable to create Curl multi manager for "
+ "asynchronous RPCs");
else {
- if (http_result != 200)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR, "HTTP response: %ld",
- http_result);
+ getXportParms(envP, curlXportParmsP, parm_size, transportP);
+
+ if (!envP->fault_occurred) {
+ makeSyncCurlSession(envP, transportP);
+
+ if (envP->fault_occurred)
+ freeXportParms(transportP);
+ }
+ if (envP->fault_occurred)
+ curlMulti_destroy(transportP->asyncCurlMultiP);
}
+ if (envP->fault_occurred)
+ free(transportP);
}
+ *handlePP = transportP;
}
static void
-doAsyncRpc2(void * const arg) {
-
- rpc * const rpcP = arg;
+setInterrupt(struct xmlrpc_client_transport * const clientTransportP,
+ int * const interruptP) {
- xmlrpc_env env;
+ clientTransportP->interruptP = interruptP;
+}
- xmlrpc_env_init(&env);
- performCurlTransaction(&env, rpcP->curlTransactionP);
- rpcP->complete(rpcP->callInfoP, rpcP->responseXmlP, env);
+static void
+assertNoOutstandingCurlWork(curlMulti * const curlMultiP) {
+ xmlrpc_env env;
+ bool immediateWorkToDo;
+ int runningHandles;
+
+ xmlrpc_env_init(&env);
+
+ curlMulti_perform(&env, curlMultiP, &immediateWorkToDo, &runningHandles);
+
+ /* We know the above was a no-op, since we're asserting that there
+ is no outstanding work.
+ */
+ XMLRPC_ASSERT(!env.fault_occurred);
+ XMLRPC_ASSERT(!immediateWorkToDo);
+ XMLRPC_ASSERT(runningHandles == 0);
xmlrpc_env_clean(&env);
}
-#ifdef WIN32
-
-static unsigned __stdcall
-doAsyncRpc(void * arg) {
- doAsyncRpc2(arg);
- return 0;
-}
-
-#else
-static void *
-doAsyncRpc(void * arg) {
- doAsyncRpc2(arg);
- return NULL;
-}
-
-#endif
+static void
+destroy(struct xmlrpc_client_transport * const clientTransportP) {
+/*----------------------------------------------------------------------------
+ This does the 'destroy' operation for a Curl client transport.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT(clientTransportP != NULL);
+ assertNoOutstandingCurlWork(clientTransportP->asyncCurlMultiP);
+ /* We know this is true because a condition of destroying the
+ transport is that there be no outstanding asynchronous RPCs.
+ */
+ assertNoOutstandingCurlWork(clientTransportP->syncCurlMultiP);
+ /* This is because a condition of destroying the transport is
+ that no transport method be running. The only way a
+ synchronous RPC can be in progress is for the 'perform' method
+ to be running.
+ */
+ unmakeSyncCurlSession(clientTransportP);
-static void
-createThread(xmlrpc_env * const envP,
- void * (*threadRoutine)(void *),
- rpc * const rpcP,
- pthread_t * const threadP) {
+ curlMulti_destroy(clientTransportP->asyncCurlMultiP);
- int rc;
+ freeXportParms(clientTransportP);
- rc = pthread_create(threadP, NULL, threadRoutine, rpcP);
- switch (rc) {
- case 0:
- break;
- case EAGAIN:
- xmlrpc_faultf(envP, "pthread_create() failed. "
- "System resources exceeded.");
- break;
- case EINVAL:
- xmlrpc_faultf(envP, "pthread_create() failed. "
- "Parameter error");
- break;
- case ENOMEM:
- xmlrpc_faultf(envP, "pthread_create() failed. "
- "No memory for new thread.");
- break;
- default:
- xmlrpc_faultf(envP, "pthread_create() failed. "
- "Unrecognized error code %d.", rc);
- break;
- }
+ free(clientTransportP);
}
@@ -751,33 +2084,25 @@
MALLOCVAR(rpcP);
if (rpcP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for rpc object");
+ xmlrpc_faultf(envP, "Couldn't allocate memory for rpc object");
else {
- rpcP->callInfoP = callInfoP;
- rpcP->complete = complete;
+ rpcP->transportP = clientTransportP;
+ rpcP->callInfoP = callInfoP;
+ rpcP->complete = complete;
rpcP->responseXmlP = responseXmlP;
- rpcP->threadExists = FALSE;
- rpcP->curlSessionP = curlSessionP;
- createCurlTransaction(envP,
- curlSessionP,
- serverP,
- callXmlP, responseXmlP,
- clientTransportP->networkInterface,
- clientTransportP->sslVerifyPeer,
- clientTransportP->sslVerifyHost,
- clientTransportP->userAgent,
- &rpcP->curlTransactionP);
+ curlTransaction_create(envP,
+ curlSessionP,
+ serverP,
+ callXmlP, responseXmlP,
+ clientTransportP->userAgent,
+ &clientTransportP->curlSetupStuff,
+ rpcP,
+ clientTransportP->interruptP,
+ &rpcP->curlTransactionP);
if (!envP->fault_occurred) {
- list_init_header(&rpcP->link, rpcP);
- pthread_mutex_lock(&clientTransportP->listLock);
- list_add_head(&clientTransportP->rpcList, &rpcP->link);
- pthread_mutex_unlock(&clientTransportP->listLock);
-
if (envP->fault_occurred)
- destroyCurlTransaction(rpcP->curlTransactionP);
+ curlTransaction_destroy(rpcP->curlTransactionP);
}
if (envP->fault_occurred)
free(rpcP);
@@ -791,11 +2116,8 @@
destroyRpc(rpc * const rpcP) {
XMLRPC_ASSERT_PTR_OK(rpcP);
- XMLRPC_ASSERT(!rpcP->threadExists);
-
- destroyCurlTransaction(rpcP->curlTransactionP);
- list_remove(&rpcP->link);
+ curlTransaction_destroy(rpcP->curlTransactionP);
free(rpcP);
}
@@ -804,9 +2126,52 @@
static void
performRpc(xmlrpc_env * const envP,
- rpc * const rpcP) {
+ rpc * const rpcP,
+ curlMulti * const curlMultiP,
+ int * const interruptP) {
+
+ performCurlTransaction(envP, rpcP->curlTransactionP, curlMultiP,
+ interruptP);
+}
+
+
+
+static finishCurlTransactionFn finishRpcCurlTransaction;
+
+static void
+finishRpcCurlTransaction(xmlrpc_env * const envP ATTR_UNUSED,
+ curlTransaction * const curlTransactionP) {
+/*----------------------------------------------------------------------------
+ Handle the event that a Curl transaction for an asynchronous RPC has
+ completed on the Curl session identified by 'curlSessionP'.
+
+ Tell the requester of the RPC the results.
+
+ Remove the Curl session from its Curl multi manager and destroy the
+ Curl session, the XML response buffer, the Curl transaction, and the RPC.
+-----------------------------------------------------------------------------*/
+ rpc * const rpcP = curlTransactionP->rpcP;
+ struct xmlrpc_client_transport * const transportP = rpcP->transportP;
+
+ {
+ xmlrpc_env env;
+
+ xmlrpc_env_init(&env);
+
+ getCurlTransactionError(curlTransactionP, &env);
+
+ rpcP->complete(rpcP->callInfoP, rpcP->responseXmlP, env);
+
+ xmlrpc_env_clean(&env);
+ }
+
+ curlMulti_removeHandle(transportP->asyncCurlMultiP, curlTransactionP);
- performCurlTransaction(envP, rpcP->curlTransactionP);
+ curl_easy_cleanup(curlTransactionP->curlSessionP);
+
+ XMLRPC_MEMBLOCK_FREE(char, rpcP->responseXmlP);
+
+ destroyRpc(rpcP);
}
@@ -815,9 +2180,10 @@
startRpc(xmlrpc_env * const envP,
rpc * const rpcP) {
- createThread(envP, &doAsyncRpc, rpcP, &rpcP->thread);
- if (!envP->fault_occurred)
- rpcP->threadExists = TRUE;
+ startCurlTransaction(envP,
+ rpcP->curlTransactionP,
+ rpcP->transportP->asyncCurlMultiP,
+ &finishRpcCurlTransaction);
}
@@ -850,10 +2216,9 @@
"curl_easy_init() failed.");
else {
createRpc(envP, clientTransportP, curlSessionP, serverP,
- callXmlP, responseXmlP,
- complete, callInfoP,
+ callXmlP, responseXmlP, complete, callInfoP,
&rpcP);
-
+
if (!envP->fault_occurred) {
startRpc(envP, rpcP);
@@ -866,59 +2231,86 @@
if (envP->fault_occurred)
XMLRPC_MEMBLOCK_FREE(char, responseXmlP);
}
- /* The user's eventual finish_asynch call will destroy this RPC,
- Curl session, and response buffer
+ /* If we're returning success, the user's eventual finish_asynch
+ call will destroy this RPC, Curl session, and response buffer
+ and remove the Curl session from the Curl multi manager.
+ (If we're returning failure, we didn't create any of those).
*/
}
-static void *
-finishRpc(struct list_head * const headerP,
- void * const context ATTR_UNUSED) {
-
- rpc * const rpcP = headerP->itemP;
-
- if (rpcP->threadExists) {
- void *status;
- int result;
-
- result = pthread_join(rpcP->thread, &status);
-
- rpcP->threadExists = FALSE;
- }
-
- XMLRPC_MEMBLOCK_FREE(char, rpcP->responseXmlP);
+static void
+finishAsynch(
+ struct xmlrpc_client_transport * const clientTransportP,
+ xmlrpc_timeoutType const timeoutType,
+ xmlrpc_timeout const timeout) {
+/*----------------------------------------------------------------------------
+ Wait for the Curl multi manager to finish the Curl transactions for
+ all outstanding RPCs and destroy those RPCs.
- curl_easy_cleanup(rpcP->curlSessionP);
+ But give up if a) too much time passes as defined by 'timeoutType'
+ and 'timeout'; or b) the transport client requests interruption
+ (i.e. the transport's interrupt flag becomes nonzero). Normally, a
+ signal must get our attention for us to notice the interrupt flag.
- destroyRpc(rpcP);
+ This does the 'finish_asynch' operation for a Curl client transport.
- return NULL;
-}
+ It would be cool to replace this with something analogous to the
+ Curl asynchronous interface: Have something like curl_multi_fdset()
+ that returns a bunch of file descriptors on which the user can wait
+ (along with possibly other file descriptors of his own) and
+ something like curl_multi_perform() to finish whatever RPCs are
+ ready to finish at that moment. The implementation would be little
+ more than wrapping curl_multi_fdset() and curl_multi_perform().
+
+ Note that the user can call this multiple times, due to timeouts,
+ but must eventually call it once with no timeout so he
+ knows that all the RPCs are finished. Either that or terminate the
+ process so it doesn't matter if RPCs are still going.
+-----------------------------------------------------------------------------*/
+ xmlrpc_env env;
+ xmlrpc_timespec waitTimeoutTime;
+ /* The datetime after which we should quit waiting */
+ xmlrpc_env_init(&env);
+
+ if (timeoutType == timeout_yes) {
+ xmlrpc_timespec waitStartTime;
+ xmlrpc_gettimeofday(&waitStartTime);
+ addMilliseconds(waitStartTime, timeout, &waitTimeoutTime);
+ }
-static void
-finishAsynch(
- struct xmlrpc_client_transport * const clientTransportP ATTR_UNUSED,
- xmlrpc_timeoutType const timeoutType ATTR_UNUSED,
- xmlrpc_timeout const timeout ATTR_UNUSED) {
-/*----------------------------------------------------------------------------
- Wait for the threads of all outstanding RPCs to exit and destroy those
- RPCs.
+ curlMulti_finish(&env, clientTransportP->asyncCurlMultiP,
+ timeoutType, waitTimeoutTime,
+ clientTransportP->interruptP);
+
+ /* If the above fails, it is catastrophic, because it means there is
+ no way to complete outstanding Curl transactions and RPCs, and
+ no way to release their resources.
+
+ We should at least expand this interface some day to push the
+ problem back up the user, but for now we just do this Hail Mary
+ response.
+
+ Note that a failure of curlMult_finish() does not mean that
+ a session completed with an error or an RPC completed with an
+ error. Those things are reported up through the user's
+ xmlrpc_transport_asynch_complete routine. A failure here is
+ something that stopped us from calling that.
- This does the 'finish_asynch' operation for a Curl client transport.
------------------------------------------------------------------------------*/
- /* We ignore any timeout request. Some day, we should figure out how
- to set an alarm and interrupt running threads.
+ Note that a timeout causes a successful completion,
+ but without finishing all the RPCs!
*/
- pthread_mutex_lock(&clientTransportP->listLock);
-
- list_foreach(&clientTransportP->rpcList, finishRpc, NULL);
+ if (env.fault_occurred)
+ fprintf(stderr, "finishAsync() failed. Xmlrpc-c Curl transport "
+ "is now in an unknown state and may not be able to "
+ "continue functioning. Specifics of the failure: %s\n",
+ env.fault_string);
- pthread_mutex_unlock(&clientTransportP->listLock);
+ xmlrpc_env_clean(&env);
}
@@ -928,7 +2320,7 @@
struct xmlrpc_client_transport * const clientTransportP,
const xmlrpc_server_info * const serverP,
xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block ** const responsePP) {
+ xmlrpc_mem_block ** const responseXmlPP) {
xmlrpc_mem_block * responseXmlP;
rpc * rpcP;
@@ -936,11 +2328,14 @@
XMLRPC_ASSERT_ENV_OK(envP);
XMLRPC_ASSERT_PTR_OK(serverP);
XMLRPC_ASSERT_PTR_OK(callXmlP);
- XMLRPC_ASSERT_PTR_OK(responsePP);
+ XMLRPC_ASSERT_PTR_OK(responseXmlPP);
responseXmlP = XMLRPC_MEMBLOCK_NEW(char, envP, 0);
if (!envP->fault_occurred) {
- pthread_mutex_lock(&clientTransportP->syncCurlSessionLock);
+ /* Only one RPC at a time can use a Curl session, so we have to
+ hold the lock as long as our RPC exists.
+ */
+ lockSyncCurlSession(clientTransportP);
createRpc(envP, clientTransportP, clientTransportP->syncCurlSessionP,
serverP,
callXmlP, responseXmlP,
@@ -948,13 +2343,14 @@
&rpcP);
if (!envP->fault_occurred) {
- performRpc(envP, rpcP);
+ performRpc(envP, rpcP, clientTransportP->syncCurlMultiP,
+ clientTransportP->interruptP);
+
+ *responseXmlPP = responseXmlP;
- *responsePP = responseXmlP;
-
destroyRpc(rpcP);
}
- pthread_mutex_unlock(&clientTransportP->syncCurlSessionLock);
+ unlockSyncCurlSession(clientTransportP);
if (envP->fault_occurred)
XMLRPC_MEMBLOCK_FREE(char, responseXmlP);
}
@@ -962,10 +2358,46 @@
+static void
+setupGlobalConstants(xmlrpc_env * const envP) {
+/*----------------------------------------------------------------------------
+ See longwinded discussion of the global constant issue at the top of
+ this file.
+-----------------------------------------------------------------------------*/
+ initWindowsStuff(envP);
+
+ if (!envP->fault_occurred) {
+ CURLcode rc;
+
+ rc = curl_global_init(CURL_GLOBAL_ALL);
+
+ if (rc != CURLE_OK)
+ xmlrpc_faultf(envP, "curl_global_init() failed with code %d", rc);
+ }
+}
+
+
+
+static void
+teardownGlobalConstants(void) {
+/*----------------------------------------------------------------------------
+ See longwinded discussionof the global constant issue at the top of
+ this file.
+-----------------------------------------------------------------------------*/
+ curl_global_cleanup();
+
+ termWindowsStuff();
+}
+
+
+
struct xmlrpc_client_transport_ops xmlrpc_curl_transport_ops = {
+ &setupGlobalConstants,
+ &teardownGlobalConstants,
&create,
&destroy,
&sendRequest,
&call,
&finishAsynch,
+ &setInterrupt,
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/expat.html
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/expat.html (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/expat.html Mon May 26 12:59:57 2008
@@ -9,6 +9,9 @@
<H1>expat - XML Parser Toolkit</H1>
+<p>This is outdated stuff from the independently developed Expat which
+was forked in 2001 to make the Xmlrpc-c embedded version.
+
<H3>Version 1.2</H3>
<P>Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center
@@ -23,6 +26,10 @@
option. See the comment above <CODE>XML_SetParamEntityParsing</CODE>
in <CODE>xmlparse.h</CODE> for the API addition that enables this.</P>
+<p>For Xmlrpc-c, we find no reason to exclude this function from the
+library, and ifdefs make code harder to maintain, so we include the
+function unconditionally. (i.e. -DXML_DTD does nothing).
+
<P>Expat is an <A
HREF="http://www.w3.org/TR/1998/REC-xml-19980210">XML 1.0</A> parser
written in C. It aims to be fully conforming. It is currently not a
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/gennmtab/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/gennmtab/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/gennmtab/Makefile Mon May 26 12:59:57 2008
@@ -1,18 +1,23 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ EXPATDIR := $(call updir,$(CURDIR))
+ LIBDIR := $(call updir,$(EXPATDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/expat/gennmtab
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
LDFLAGS = $(LADD)
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/lib/util/include
+INCLUDES = -I$(BLDDIR) -I$(SRCDIR)/lib/util/include
default: all
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
.PHONY: all
all: gennmtab
@@ -37,9 +42,9 @@
dep: dep-common
gennmtab.o:%.o:%.c
- $(CC) -c $< -o $@ $(CFLAGS) $(INCLUDES)
+ $(BUILDTOOL_CC) -c $< -o $@ $(CFLAGS) $(INCLUDES)
gennmtab:%:%.o
- $(LINK) -o $@ $(LDFLAGS) $(CFLAGS) $^
+ $(BUILDTOOL_CCLD) -o $@ $(LDFLAGS) $^
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.c Mon May 26 12:59:57 2008
@@ -3,24 +3,55 @@
See the file copying.txt for copying permission.
*/
+/* In 2001, this was part of the Expat package. We copied it into
+ Xmlrpc-c because it's easier on the user than making him get and
+ link Expat separately, and we don't expect to benefit from separate
+ maintenance of Expat.
+
+ But we changed all the external symbols that in Expat are named
+ "XML_xxxx" to "xmlrpc_XML_xxxx" because people do link Xmlrpc-c
+ libraries into programs that also link Expat (a good example is
+ where an Apache module uses Xmlrpc-c). We don't want our names to
+ collide with Expat's.
+*/
+
+#include <stddef.h>
+#include <assert.h>
+
+#include "xmlrpc_config.h"
+#include "c_util.h"
+#include "girmath.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/string_int.h"
#include "xmldef.h"
#include "xmlparse.h"
-#include <stddef.h>
+
+static const char *
+extractXmlSample(const char * const start,
+ const char * const end,
+ size_t const maximumLen) {
+
+ size_t const len = MIN(maximumLen, (size_t)(end - start));
+
+ return xmlrpc_makePrintable_lp(start, len);
+}
+
+
#ifdef XML_UNICODE
#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX
#define XmlConvert XmlUtf16Convert
-#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS
-#define XmlEncode XmlUtf16Encode
+#define XmlGetInternalEncoding xmlrpc_XmlGetUtf16InternalEncoding
+#define XmlGetInternalEncodingNS xmlrpc_XmlGetUtf16InternalEncodingNS
+#define XmlEncode xmlrpc_XmlUtf16Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1))
typedef unsigned short ICHAR;
#else
#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX
#define XmlConvert XmlUtf8Convert
-#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding
-#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS
-#define XmlEncode XmlUtf8Encode
+#define XmlGetInternalEncoding xmlrpc_XmlGetUtf8InternalEncoding
+#define XmlGetInternalEncodingNS xmlrpc_XmlGetUtf8InternalEncodingNS
+#define XmlEncode xmlrpc_XmlUtf8Encode
#define MUST_CONVERT(enc, s) (!(enc)->isUtf8)
typedef char ICHAR;
#endif
@@ -162,9 +193,7 @@
STRING_POOL pool;
int complete;
int standalone;
-#ifdef XML_DTD
HASH_TABLE paramEntities;
-#endif /* XML_DTD */
PREFIX defaultPrefix;
} DTD;
@@ -175,94 +204,13 @@
ENTITY *entity;
} OPEN_INTERNAL_ENTITY;
-typedef enum XML_Error Processor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr);
-
-static Processor prologProcessor;
-static Processor prologInitProcessor;
-static Processor contentProcessor;
-static Processor cdataSectionProcessor;
-#ifdef XML_DTD
-static Processor ignoreSectionProcessor;
-#endif /* XML_DTD */
-static Processor epilogProcessor;
-static Processor errorProcessor;
-static Processor externalEntityInitProcessor;
-static Processor externalEntityInitProcessor2;
-static Processor externalEntityInitProcessor3;
-static Processor externalEntityContentProcessor;
-
-static enum XML_Error
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName);
-static enum XML_Error
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *);
-static enum XML_Error
-initializeEncoding(XML_Parser parser);
-static enum XML_Error
-doProlog(XML_Parser parser, const ENCODING *enc, const char *s,
- const char *end, int tok, const char *next, const char **nextPtr);
-static enum XML_Error
-processInternalParamEntity(XML_Parser parser, ENTITY *entity);
-static enum XML_Error
-doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
- const char *start, const char *end, const char **endPtr);
-static enum XML_Error
-doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr);
-#ifdef XML_DTD
-static enum XML_Error
-doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr);
-#endif /* XML_DTD */
-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s,
- TAG_NAME *tagNamePtr, BINDING **bindingsPtr);
-static
-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr);
-static int
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, int isCdata, int isId, const XML_Char *dfltValue);
-static enum XML_Error
-storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
- STRING_POOL *);
-static enum XML_Error
-appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *,
- STRING_POOL *);
-static ATTRIBUTE_ID *
-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *);
-static enum XML_Error
-storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static int
-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
-static void
-reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end);
+typedef void Processor(XML_Parser parser,
+ const char * const start,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP);
-static const XML_Char *getContext(XML_Parser parser);
-static int setContext(XML_Parser parser, const XML_Char *context);
-static void normalizePublicId(XML_Char *s);
-static int dtdInit(DTD *);
-static void dtdDestroy(DTD *);
-static int dtdCopy(DTD *newDtd, const DTD *oldDtd);
-static int copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *);
-#ifdef XML_DTD
-static void dtdSwap(DTD *, DTD *);
-#endif /* XML_DTD */
-static NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize);
-static void hashTableInit(HASH_TABLE *);
-static void hashTableDestroy(HASH_TABLE *);
-static void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *);
-static NAMED *hashTableIterNext(HASH_TABLE_ITER *);
-static void poolInit(STRING_POOL *);
-static void poolClear(STRING_POOL *);
-static void poolDestroy(STRING_POOL *);
-static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end);
-static int poolGrow(STRING_POOL *pool);
-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s);
-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n);
#define poolStart(pool) ((pool)->start)
#define poolEnd(pool) ((pool)->ptr)
@@ -322,7 +270,18 @@
void (*m_unknownEncodingRelease)(void *);
PROLOG_STATE m_prologState;
Processor *m_processor;
+ /* The next processor to run */
enum XML_Error m_errorCode;
+ /* Explanation of the failure of the most recent call to Expat.
+ XML_ERROR_NONE means it didn't fail. This is redundant with
+ m_errorString if the latter is non-null.
+ The latter is newer and better.
+ */
+ const char * m_errorString;
+ /* malloc'ed string describing the failure of the most recent call
+ to Expat. NULL means m_errorCode is the only error information
+ available.
+ */
const char *m_eventPtr;
const char *m_eventEndPtr;
const char *m_positionPtr;
@@ -353,10 +312,8 @@
unsigned m_groupSize;
int m_hadExternalDoctype;
XML_Char m_namespaceSeparator;
-#ifdef XML_DTD
enum XML_ParamEntityParsing m_paramEntityParsing;
XML_Parser m_parentParser;
-#endif
} Parser;
#define userData (((Parser *)parser)->m_userData)
@@ -381,7 +338,6 @@
#define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler)
#define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg)
#define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler)
-#define encoding (((Parser *)parser)->m_encoding)
#define initEncoding (((Parser *)parser)->m_initEncoding)
#define internalEncoding (((Parser *)parser)->m_internalEncoding)
#define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem)
@@ -394,6 +350,7 @@
#define prologState (((Parser *)parser)->m_prologState)
#define processor (((Parser *)parser)->m_processor)
#define errorCode (((Parser *)parser)->m_errorCode)
+#define errorString (((Parser *)parser)->m_errorString)
#define eventPtr (((Parser *)parser)->m_eventPtr)
#define eventEndPtr (((Parser *)parser)->m_eventEndPtr)
#define positionPtr (((Parser *)parser)->m_positionPtr)
@@ -432,1183 +389,1414 @@
#define groupSize (((Parser *)parser)->m_groupSize)
#define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype)
#define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator)
-#ifdef XML_DTD
#define parentParser (((Parser *)parser)->m_parentParser)
#define paramEntityParsing (((Parser *)parser)->m_paramEntityParsing)
-#endif /* XML_DTD */
-#ifdef _MSC_VER
-#ifdef _DEBUG
-Parser *asParser(XML_Parser parser)
+
+
+static
+void poolInit(STRING_POOL *pool)
{
- return parser;
+ pool->blocks = 0;
+ pool->freeBlocks = 0;
+ pool->start = 0;
+ pool->ptr = 0;
+ pool->end = 0;
}
-#endif
-#endif
-XML_Parser XML_ParserCreate(const XML_Char *encodingName)
+static
+void poolClear(STRING_POOL *pool)
{
- XML_Parser parser = malloc(sizeof(Parser));
- if (!parser)
- return parser;
- processor = prologInitProcessor;
- XmlPrologStateInit(&prologState);
- userData = 0;
- handlerArg = 0;
- startElementHandler = 0;
- endElementHandler = 0;
- characterDataHandler = 0;
- processingInstructionHandler = 0;
- commentHandler = 0;
- startCdataSectionHandler = 0;
- endCdataSectionHandler = 0;
- defaultHandler = 0;
- startDoctypeDeclHandler = 0;
- endDoctypeDeclHandler = 0;
- unparsedEntityDeclHandler = 0;
- notationDeclHandler = 0;
- externalParsedEntityDeclHandler = 0;
- internalParsedEntityDeclHandler = 0;
- startNamespaceDeclHandler = 0;
- endNamespaceDeclHandler = 0;
- notStandaloneHandler = 0;
- externalEntityRefHandler = 0;
- externalEntityRefHandlerArg = parser;
- unknownEncodingHandler = 0;
- buffer = 0;
- bufferPtr = 0;
- bufferEnd = 0;
- parseEndByteIndex = 0;
- parseEndPtr = 0;
- bufferLim = 0;
- declElementType = 0;
- declAttributeId = 0;
- declEntity = 0;
- declNotationName = 0;
- declNotationPublicId = 0;
- memset(&position, 0, sizeof(POSITION));
- errorCode = XML_ERROR_NONE;
- eventPtr = 0;
- eventEndPtr = 0;
- positionPtr = 0;
- openInternalEntities = 0;
- tagLevel = 0;
- tagStack = 0;
- freeTagList = 0;
- freeBindingList = 0;
- inheritedBindings = 0;
- attsSize = INIT_ATTS_SIZE;
- atts = malloc(attsSize * sizeof(ATTRIBUTE));
- nSpecifiedAtts = 0;
- dataBuf = malloc(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
- groupSize = 0;
- groupConnector = 0;
- hadExternalDoctype = 0;
- unknownEncodingMem = 0;
- unknownEncodingRelease = 0;
- unknownEncodingData = 0;
- unknownEncodingHandlerData = 0;
- namespaceSeparator = '!';
-#ifdef XML_DTD
- parentParser = 0;
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
- ns = 0;
- poolInit(&tempPool);
- poolInit(&temp2Pool);
- protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0;
- curBase = 0;
- if (!dtdInit(&dtd) || !atts || !dataBuf
- || (encodingName && !protocolEncodingName)) {
- XML_ParserFree(parser);
- return 0;
+ if (!pool->freeBlocks)
+ pool->freeBlocks = pool->blocks;
+ else {
+ BLOCK *p = pool->blocks;
+ while (p) {
+ BLOCK *tem = p->next;
+ p->next = pool->freeBlocks;
+ pool->freeBlocks = p;
+ p = tem;
+ }
}
- dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
- XmlInitEncoding(&initEncoding, &encoding, 0);
- internalEncoding = XmlGetInternalEncoding();
- return parser;
+ pool->blocks = 0;
+ pool->start = 0;
+ pool->ptr = 0;
+ pool->end = 0;
}
-XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep)
+static
+void poolDestroy(STRING_POOL *pool)
{
- static
- const XML_Char implicitContext[] = {
- XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='),
- XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'),
- XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'),
- XML_T('.'), XML_T('w'), XML_T('3'),
- XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'),
- XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'),
- XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'),
- XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'),
- XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'),
- XML_T('\0')
- };
-
- XML_Parser parser = XML_ParserCreate(encodingName);
- if (parser) {
- XmlInitEncodingNS(&initEncoding, &encoding, 0);
- ns = 1;
- internalEncoding = XmlGetInternalEncodingNS();
- namespaceSeparator = nsSep;
+ BLOCK *p = pool->blocks;
+ while (p) {
+ BLOCK *tem = p->next;
+ free(p);
+ p = tem;
}
- if (!setContext(parser, implicitContext)) {
- XML_ParserFree(parser);
- return 0;
+ pool->blocks = 0;
+ p = pool->freeBlocks;
+ while (p) {
+ BLOCK *tem = p->next;
+ free(p);
+ p = tem;
}
- return parser;
+ pool->freeBlocks = 0;
+ pool->ptr = 0;
+ pool->start = 0;
+ pool->end = 0;
}
-int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
+static
+int poolGrow(STRING_POOL *pool)
{
- if (!encodingName)
- protocolEncodingName = 0;
+ if (pool->freeBlocks) {
+ if (pool->start == 0) {
+ pool->blocks = pool->freeBlocks;
+ pool->freeBlocks = pool->freeBlocks->next;
+ pool->blocks->next = 0;
+ pool->start = pool->blocks->s;
+ pool->end = pool->start + pool->blocks->size;
+ pool->ptr = pool->start;
+ return 1;
+ }
+ if (pool->end - pool->start < pool->freeBlocks->size) {
+ BLOCK *tem = pool->freeBlocks->next;
+ pool->freeBlocks->next = pool->blocks;
+ pool->blocks = pool->freeBlocks;
+ pool->freeBlocks = tem;
+ memcpy(pool->blocks->s, pool->start,
+ (pool->end - pool->start) * sizeof(XML_Char));
+ pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
+ pool->start = pool->blocks->s;
+ pool->end = pool->start + pool->blocks->size;
+ return 1;
+ }
+ }
+ if (pool->blocks && pool->start == pool->blocks->s) {
+ int blockSize = (pool->end - pool->start)*2;
+ pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) +
+ blockSize * sizeof(XML_Char));
+ if (!pool->blocks)
+ return 0;
+ pool->blocks->size = blockSize;
+ pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
+ pool->start = pool->blocks->s;
+ pool->end = pool->start + blockSize;
+ }
else {
- protocolEncodingName = poolCopyString(&tempPool, encodingName);
- if (!protocolEncodingName)
+ BLOCK *tem;
+ int blockSize = pool->end - pool->start;
+ if (blockSize < INIT_BLOCK_SIZE)
+ blockSize = INIT_BLOCK_SIZE;
+ else
+ blockSize *= 2;
+ tem = malloc(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
+ if (!tem)
return 0;
+ tem->size = blockSize;
+ tem->next = pool->blocks;
+ pool->blocks = tem;
+ if (pool->ptr != pool->start)
+ memcpy(tem->s, pool->start,
+ (pool->ptr - pool->start) * sizeof(XML_Char));
+ pool->ptr = tem->s + (pool->ptr - pool->start);
+ pool->start = tem->s;
+ pool->end = tem->s + blockSize;
}
return 1;
}
-XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser,
- const XML_Char *context,
- const XML_Char *encodingName)
+
+
+static
+XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
+ const char *ptr, const char *end)
{
- XML_Parser parser = oldParser;
- DTD *oldDtd = &dtd;
- XML_StartElementHandler oldStartElementHandler = startElementHandler;
- XML_EndElementHandler oldEndElementHandler = endElementHandler;
- XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
- XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler;
- XML_CommentHandler oldCommentHandler = commentHandler;
- XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler;
- XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler;
- XML_DefaultHandler oldDefaultHandler = defaultHandler;
- XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler;
- XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
- XML_ExternalParsedEntityDeclHandler oldExternalParsedEntityDeclHandler = externalParsedEntityDeclHandler;
- XML_InternalParsedEntityDeclHandler oldInternalParsedEntityDeclHandler = internalParsedEntityDeclHandler;
- XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler;
- XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler;
- XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
- XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler;
- XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler;
- void *oldUserData = userData;
- void *oldHandlerArg = handlerArg;
- int oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
- void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
-#ifdef XML_DTD
- int oldParamEntityParsing = paramEntityParsing;
-#endif
- parser = (ns
- ? XML_ParserCreateNS(encodingName, namespaceSeparator)
- : XML_ParserCreate(encodingName));
- if (!parser)
+ if (!pool->ptr && !poolGrow(pool))
return 0;
- startElementHandler = oldStartElementHandler;
- endElementHandler = oldEndElementHandler;
- characterDataHandler = oldCharacterDataHandler;
- processingInstructionHandler = oldProcessingInstructionHandler;
- commentHandler = oldCommentHandler;
- startCdataSectionHandler = oldStartCdataSectionHandler;
- endCdataSectionHandler = oldEndCdataSectionHandler;
- defaultHandler = oldDefaultHandler;
- unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
- notationDeclHandler = oldNotationDeclHandler;
- externalParsedEntityDeclHandler = oldExternalParsedEntityDeclHandler;
- internalParsedEntityDeclHandler = oldInternalParsedEntityDeclHandler;
- startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
- endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
- notStandaloneHandler = oldNotStandaloneHandler;
- externalEntityRefHandler = oldExternalEntityRefHandler;
- unknownEncodingHandler = oldUnknownEncodingHandler;
- userData = oldUserData;
- if (oldUserData == oldHandlerArg)
- handlerArg = userData;
- else
- handlerArg = parser;
- if (oldExternalEntityRefHandlerArg != oldParser)
- externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
- defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
-#ifdef XML_DTD
- paramEntityParsing = oldParamEntityParsing;
- if (context) {
-#endif /* XML_DTD */
- if (!dtdCopy(&dtd, oldDtd) || !setContext(parser, context)) {
- XML_ParserFree(parser);
+ for (;;) {
+ XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
+ if (ptr == end)
+ break;
+ if (!poolGrow(pool))
return 0;
- }
- processor = externalEntityInitProcessor;
-#ifdef XML_DTD
- }
- else {
- dtdSwap(&dtd, oldDtd);
- parentParser = oldParser;
- XmlPrologStateInitExternalEntity(&prologState);
- dtd.complete = 1;
- hadExternalDoctype = 1;
}
-#endif /* XML_DTD */
- return parser;
+ return pool->start;
}
-static
-void destroyBindings(BINDING *bindings)
+static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s)
{
- for (;;) {
- BINDING *b = bindings;
- if (!b)
- break;
- bindings = b->nextTagBinding;
- free(b->uri);
- free(b);
- }
+ do {
+ if (!poolAppendChar(pool, *s))
+ return 0;
+ } while (*s++);
+ s = pool->start;
+ poolFinish(pool);
+ return s;
}
-void XML_ParserFree(XML_Parser parser)
+static const XML_Char *
+poolCopyStringN(STRING_POOL *pool,
+ const XML_Char *s,
+ int n)
{
- for (;;) {
- TAG *p;
- if (tagStack == 0) {
- if (freeTagList == 0)
- break;
- tagStack = freeTagList;
- freeTagList = 0;
- }
- p = tagStack;
- tagStack = tagStack->parent;
- free(p->buf);
- destroyBindings(p->bindings);
- free(p);
+ if (!pool->ptr && !poolGrow(pool))
+ return 0;
+ for (; n > 0; --n, s++) {
+ if (!poolAppendChar(pool, *s))
+ return 0;
+
}
- destroyBindings(freeBindingList);
- destroyBindings(inheritedBindings);
- poolDestroy(&tempPool);
- poolDestroy(&temp2Pool);
-#ifdef XML_DTD
- if (parentParser) {
- if (hadExternalDoctype)
- dtd.complete = 0;
- dtdSwap(&dtd, &((Parser *)parentParser)->m_dtd);
- }
-#endif /* XML_DTD */
- dtdDestroy(&dtd);
- free((void *)atts);
- free(groupConnector);
- free(buffer);
- free(dataBuf);
- free(unknownEncodingMem);
- if (unknownEncodingRelease)
- unknownEncodingRelease(unknownEncodingData);
- free(parser);
+ s = pool->start;
+ poolFinish(pool);
+ return s;
}
-void XML_UseParserAsHandlerArg(XML_Parser parser)
+static
+XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
+ const char *ptr, const char *end)
{
- handlerArg = parser;
+ if (!poolAppend(pool, enc, ptr, end))
+ return 0;
+ if (pool->ptr == pool->end && !poolGrow(pool))
+ return 0;
+ *(pool->ptr)++ = 0;
+ return pool->start;
}
-void XML_SetUserData(XML_Parser parser, void *p)
-{
- if (handlerArg == userData)
- handlerArg = userData = p;
- else
- userData = p;
-}
+#define INIT_SIZE 64
-int XML_SetBase(XML_Parser parser, const XML_Char *p)
+static
+int keyeq(KEY s1, KEY s2)
{
- if (p) {
- p = poolCopyString(&dtd.pool, p);
- if (!p)
- return 0;
- curBase = p;
- }
- else
- curBase = 0;
- return 1;
+ for (; *s1 == *s2; s1++, s2++)
+ if (*s1 == 0)
+ return 1;
+ return 0;
}
-const XML_Char *XML_GetBase(XML_Parser parser)
+static
+unsigned long hash(KEY s)
{
- return curBase;
+ unsigned long h = 0;
+ while (*s)
+ h = (h << 5) + h + (unsigned char)*s++;
+ return h;
}
-int XML_GetSpecifiedAttributeCount(XML_Parser parser)
+static
+NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
{
- return nSpecifiedAtts;
+ size_t i;
+ if (table->size == 0) {
+ if (!createSize)
+ return 0;
+ table->v = calloc(INIT_SIZE, sizeof(NAMED *));
+ if (!table->v)
+ return 0;
+ table->size = INIT_SIZE;
+ table->usedLim = INIT_SIZE / 2;
+ i = hash(name) & (table->size - 1);
+ }
+ else {
+ unsigned long h = hash(name);
+ for (i = h & (table->size - 1);
+ table->v[i];
+ i == 0 ? i = table->size - 1 : --i) {
+ if (keyeq(name, table->v[i]->name))
+ return table->v[i];
+ }
+ if (!createSize)
+ return 0;
+ if (table->used == table->usedLim) {
+ /* check for overflow */
+ size_t newSize = table->size * 2;
+ NAMED **newV = calloc(newSize, sizeof(NAMED *));
+ if (!newV)
+ return 0;
+ for (i = 0; i < table->size; i++)
+ if (table->v[i]) {
+ size_t j;
+ for (j = hash(table->v[i]->name) & (newSize - 1);
+ newV[j];
+ j == 0 ? j = newSize - 1 : --j)
+ ;
+ newV[j] = table->v[i];
+ }
+ free(table->v);
+ table->v = newV;
+ table->size = newSize;
+ table->usedLim = newSize/2;
+ for (i = h & (table->size - 1);
+ table->v[i];
+ i == 0 ? i = table->size - 1 : --i)
+ ;
+ }
+ }
+ table->v[i] = calloc(1, createSize);
+ if (!table->v[i])
+ return 0;
+ table->v[i]->name = name;
+ (table->used)++;
+ return table->v[i];
}
-int XML_GetIdAttributeIndex(XML_Parser parser)
+static
+void hashTableDestroy(HASH_TABLE *table)
{
- return idAttIndex;
+ size_t i;
+ for (i = 0; i < table->size; i++) {
+ NAMED *p = table->v[i];
+ if (p)
+ free(p);
+ }
+ if (table->v)
+ free(table->v);
}
-void XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end)
+static
+void hashTableInit(HASH_TABLE *p)
{
- startElementHandler = start;
- endElementHandler = end;
+ p->size = 0;
+ p->usedLim = 0;
+ p->used = 0;
+ p->v = 0;
}
-void XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler)
+static
+void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
{
- characterDataHandler = handler;
+ iter->p = table->v;
+ iter->end = iter->p + table->size;
}
-void XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler)
+static
+NAMED *hashTableIterNext(HASH_TABLE_ITER *iter)
{
- processingInstructionHandler = handler;
+ while (iter->p != iter->end) {
+ NAMED *tem = *(iter->p)++;
+ if (tem)
+ return tem;
+ }
+ return 0;
}
-void XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler)
-{
- commentHandler = handler;
-}
-void XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end)
-{
- startCdataSectionHandler = start;
- endCdataSectionHandler = end;
-}
-void XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler)
+static int dtdInit(DTD *p)
{
- defaultHandler = handler;
- defaultExpandInternalEntities = 0;
+ poolInit(&(p->pool));
+ hashTableInit(&(p->generalEntities));
+ hashTableInit(&(p->elementTypes));
+ hashTableInit(&(p->attributeIds));
+ hashTableInit(&(p->prefixes));
+ p->complete = 1;
+ p->standalone = 0;
+ hashTableInit(&(p->paramEntities));
+ p->defaultPrefix.name = 0;
+ p->defaultPrefix.binding = 0;
+ return 1;
}
-void XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler)
-{
- defaultHandler = handler;
- defaultExpandInternalEntities = 1;
-}
-void XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end)
-{
- startDoctypeDeclHandler = start;
- endDoctypeDeclHandler = end;
-}
-void XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler)
+static void dtdSwap(DTD *p1, DTD *p2)
{
- unparsedEntityDeclHandler = handler;
+ DTD tem;
+ memcpy(&tem, p1, sizeof(DTD));
+ memcpy(p1, p2, sizeof(DTD));
+ memcpy(p2, &tem, sizeof(DTD));
}
-void XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
- XML_ExternalParsedEntityDeclHandler handler)
-{
- externalParsedEntityDeclHandler = handler;
-}
-void XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
- XML_InternalParsedEntityDeclHandler handler)
-{
- internalParsedEntityDeclHandler = handler;
-}
-void XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler)
-{
- notationDeclHandler = handler;
-}
-void XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end)
+static void dtdDestroy(DTD *p)
{
- startNamespaceDeclHandler = start;
- endNamespaceDeclHandler = end;
+ HASH_TABLE_ITER iter;
+ hashTableIterInit(&iter, &(p->elementTypes));
+ for (;;) {
+ ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
+ if (!e)
+ break;
+ if (e->allocDefaultAtts != 0)
+ free(e->defaultAtts);
+ }
+ hashTableDestroy(&(p->generalEntities));
+ hashTableDestroy(&(p->paramEntities));
+ hashTableDestroy(&(p->elementTypes));
+ hashTableDestroy(&(p->attributeIds));
+ hashTableDestroy(&(p->prefixes));
+ poolDestroy(&(p->pool));
}
-void XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler)
+static int copyEntityTable(HASH_TABLE *newTable,
+ STRING_POOL *newPool,
+ const HASH_TABLE *oldTable)
{
- notStandaloneHandler = handler;
-}
+ HASH_TABLE_ITER iter;
+ const XML_Char *cachedOldBase = 0;
+ const XML_Char *cachedNewBase = 0;
-void XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler)
-{
- externalEntityRefHandler = handler;
-}
+ hashTableIterInit(&iter, oldTable);
-void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
-{
- if (arg)
- externalEntityRefHandlerArg = arg;
- else
- externalEntityRefHandlerArg = parser;
+ for (;;) {
+ ENTITY *newE;
+ const XML_Char *name;
+ const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
+ if (!oldE)
+ break;
+ name = poolCopyString(newPool, oldE->name);
+ if (!name)
+ return 0;
+ newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY));
+ if (!newE)
+ return 0;
+ if (oldE->systemId) {
+ const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
+ if (!tem)
+ return 0;
+ newE->systemId = tem;
+ if (oldE->base) {
+ if (oldE->base == cachedOldBase)
+ newE->base = cachedNewBase;
+ else {
+ cachedOldBase = oldE->base;
+ tem = poolCopyString(newPool, cachedOldBase);
+ if (!tem)
+ return 0;
+ cachedNewBase = newE->base = tem;
+ }
+ }
+ }
+ else {
+ const XML_Char *tem =
+ poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);
+ if (!tem)
+ return 0;
+ newE->textPtr = tem;
+ newE->textLen = oldE->textLen;
+ }
+ if (oldE->notation) {
+ const XML_Char *tem = poolCopyString(newPool, oldE->notation);
+ if (!tem)
+ return 0;
+ newE->notation = tem;
+ }
+ }
+ return 1;
}
-void XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *data)
-{
- unknownEncodingHandler = handler;
- unknownEncodingHandlerData = data;
-}
-int XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing parsing)
-{
-#ifdef XML_DTD
- paramEntityParsing = parsing;
- return 1;
-#else
- return parsing == XML_PARAM_ENTITY_PARSING_NEVER;
-#endif
-}
-int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal)
+/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
+The new DTD has already been initialized. */
+
+static int dtdCopy(DTD *newDtd, const DTD *oldDtd)
{
- if (len == 0) {
- if (!isFinal)
- return 1;
- positionPtr = bufferPtr;
- errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0);
- if (errorCode == XML_ERROR_NONE)
- return 1;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
+ HASH_TABLE_ITER iter;
+
+ /* Copy the prefix table. */
+
+ hashTableIterInit(&iter, &(oldDtd->prefixes));
+ for (;;) {
+ const XML_Char *name;
+ const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
+ if (!oldP)
+ break;
+ name = poolCopyString(&(newDtd->pool), oldP->name);
+ if (!name)
+ return 0;
+ if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
+ return 0;
}
- else if (bufferPtr == bufferEnd) {
- const char *end;
- int nLeftOver;
- parseEndByteIndex += len;
- positionPtr = s;
- if (isFinal) {
- errorCode = processor(parser, s, parseEndPtr = s + len, 0);
- if (errorCode == XML_ERROR_NONE)
- return 1;
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
- errorCode = processor(parser, s, parseEndPtr = s + len, &end);
- if (errorCode != XML_ERROR_NONE) {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
- }
- XmlUpdatePosition(encoding, positionPtr, end, &position);
- nLeftOver = s + len - end;
- if (nLeftOver) {
- if (buffer == 0 || nLeftOver > bufferLim - buffer) {
- /* FIXME avoid integer overflow */
- buffer = buffer == 0 ? malloc(len * 2) : realloc(buffer, len * 2);
- /* FIXME storage leak if realloc fails */
- if (!buffer) {
- errorCode = XML_ERROR_NO_MEMORY;
- eventPtr = eventEndPtr = 0;
- processor = errorProcessor;
- return 0;
- }
- bufferLim = buffer + len * 2;
+
+ hashTableIterInit(&iter, &(oldDtd->attributeIds));
+
+ /* Copy the attribute id table. */
+
+ for (;;) {
+ ATTRIBUTE_ID *newA;
+ const XML_Char *name;
+ const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
+
+ if (!oldA)
+ break;
+ /* Remember to allocate the scratch byte before the name. */
+ if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
+ return 0;
+ name = poolCopyString(&(newDtd->pool), oldA->name);
+ if (!name)
+ return 0;
+ ++name;
+ newA = (ATTRIBUTE_ID *)
+ lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID));
+ if (!newA)
+ return 0;
+ newA->maybeTokenized = oldA->maybeTokenized;
+ if (oldA->prefix) {
+ newA->xmlns = oldA->xmlns;
+ if (oldA->prefix == &oldDtd->defaultPrefix)
+ newA->prefix = &newDtd->defaultPrefix;
+ else
+ newA->prefix = (PREFIX *)
+ lookup(&(newDtd->prefixes), oldA->prefix->name, 0);
+ }
+ }
+
+ /* Copy the element type table. */
+
+ hashTableIterInit(&iter, &(oldDtd->elementTypes));
+
+ for (;;) {
+ int i;
+ ELEMENT_TYPE *newE;
+ const XML_Char *name;
+ const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
+ if (!oldE)
+ break;
+ name = poolCopyString(&(newDtd->pool), oldE->name);
+ if (!name)
+ return 0;
+ newE = (ELEMENT_TYPE *)
+ lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE));
+ if (!newE)
+ return 0;
+ if (oldE->nDefaultAtts) {
+ newE->defaultAtts = (DEFAULT_ATTRIBUTE *)
+ malloc(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
+ if (!newE->defaultAtts)
+ return 0;
+ }
+ if (oldE->idAtt)
+ newE->idAtt = (ATTRIBUTE_ID *)
+ lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
+ newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
+ if (oldE->prefix)
+ newE->prefix = (PREFIX *)
+ lookup(&(newDtd->prefixes), oldE->prefix->name, 0);
+ for (i = 0; i < newE->nDefaultAtts; i++) {
+ newE->defaultAtts[i].id = (ATTRIBUTE_ID *)
+ lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
+ newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
+ if (oldE->defaultAtts[i].value) {
+ newE->defaultAtts[i].value =
+ poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
+ if (!newE->defaultAtts[i].value)
+ return 0;
}
- memcpy(buffer, end, nLeftOver);
- bufferPtr = buffer;
- bufferEnd = buffer + nLeftOver;
+ else
+ newE->defaultAtts[i].value = 0;
}
- return 1;
+ }
+
+ /* Copy the entity tables. */
+ if (!copyEntityTable(&(newDtd->generalEntities),
+ &(newDtd->pool),
+ &(oldDtd->generalEntities)))
+ return 0;
+
+ if (!copyEntityTable(&(newDtd->paramEntities),
+ &(newDtd->pool),
+ &(oldDtd->paramEntities)))
+ return 0;
+
+ newDtd->complete = oldDtd->complete;
+ newDtd->standalone = oldDtd->standalone;
+ return 1;
+}
+
+
+
+static
+int addBinding(XML_Parser parser,
+ PREFIX *prefix,
+ const ATTRIBUTE_ID *attId,
+ const XML_Char *uri,
+ BINDING **bindingsPtr)
+{
+ BINDING *b;
+ int len;
+ for (len = 0; uri[len]; len++)
+ ;
+ if (namespaceSeparator)
+ len++;
+ if (freeBindingList) {
+ b = freeBindingList;
+ if (len > b->uriAlloc) {
+ b->uri = realloc(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
+ if (!b->uri)
+ return 0;
+ b->uriAlloc = len + EXPAND_SPARE;
+ }
+ freeBindingList = b->nextTagBinding;
}
else {
- memcpy(XML_GetBuffer(parser, len), s, len);
- return XML_ParseBuffer(parser, len, isFinal);
+ b = malloc(sizeof(BINDING));
+ if (!b)
+ return 0;
+ b->uri = malloc(sizeof(XML_Char) * (len + EXPAND_SPARE));
+ if (!b->uri) {
+ free(b);
+ return 0;
+ }
+ b->uriAlloc = len + EXPAND_SPARE;
}
+ b->uriLen = len;
+ memcpy(b->uri, uri, len * sizeof(XML_Char));
+ if (namespaceSeparator)
+ b->uri[len - 1] = namespaceSeparator;
+ b->prefix = prefix;
+ b->attId = attId;
+ b->prevPrefixBinding = prefix->binding;
+ if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix)
+ prefix->binding = 0;
+ else
+ prefix->binding = b;
+ b->nextTagBinding = *bindingsPtr;
+ *bindingsPtr = b;
+ if (startNamespaceDeclHandler)
+ startNamespaceDeclHandler(handlerArg, prefix->name,
+ prefix->binding ? uri : 0);
+ return 1;
}
-int XML_ParseBuffer(XML_Parser parser, int len, int isFinal)
+
+
+#define CONTEXT_SEP XML_T('\f')
+
+static
+const XML_Char *getContext(XML_Parser parser)
{
- const char *start = bufferPtr;
- positionPtr = start;
- bufferEnd += len;
- parseEndByteIndex += len;
- errorCode = processor(parser, start, parseEndPtr = bufferEnd,
- isFinal ? (const char **)0 : &bufferPtr);
- if (errorCode == XML_ERROR_NONE) {
- if (!isFinal)
- XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position);
- return 1;
+ HASH_TABLE_ITER iter;
+ int needSep = 0;
+
+ if (dtd.defaultPrefix.binding) {
+ int i;
+ int len;
+ if (!poolAppendChar(&tempPool, XML_T('=')))
+ return 0;
+ len = dtd.defaultPrefix.binding->uriLen;
+ if (namespaceSeparator != XML_T('\0'))
+ len--;
+ for (i = 0; i < len; i++)
+ if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i]))
+ return 0;
+ needSep = 1;
}
- else {
- eventEndPtr = eventPtr;
- processor = errorProcessor;
- return 0;
+
+ hashTableIterInit(&iter, &(dtd.prefixes));
+ for (;;) {
+ int i;
+ int len;
+ const XML_Char *s;
+ PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
+ if (!prefix)
+ break;
+ if (!prefix->binding)
+ continue;
+ if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
+ return 0;
+ for (s = prefix->name; *s; s++)
+ if (!poolAppendChar(&tempPool, *s))
+ return 0;
+ if (!poolAppendChar(&tempPool, XML_T('=')))
+ return 0;
+ len = prefix->binding->uriLen;
+ if (namespaceSeparator != XML_T('\0'))
+ len--;
+ for (i = 0; i < len; i++)
+ if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
+ return 0;
+ needSep = 1;
}
+
+
+ hashTableIterInit(&iter, &(dtd.generalEntities));
+ for (;;) {
+ const XML_Char *s;
+ ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
+ if (!e)
+ break;
+ if (!e->open)
+ continue;
+ if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
+ return 0;
+ for (s = e->name; *s; s++)
+ if (!poolAppendChar(&tempPool, *s))
+ return 0;
+ needSep = 1;
+ }
+
+ if (!poolAppendChar(&tempPool, XML_T('\0')))
+ return 0;
+ return tempPool.start;
}
-void *XML_GetBuffer(XML_Parser parser, int len)
+static
+int setContext(XML_Parser parser, const XML_Char *context)
{
- if (len > bufferLim - bufferEnd) {
- /* FIXME avoid integer overflow */
- int neededSize = len + (bufferEnd - bufferPtr);
- if (neededSize <= bufferLim - buffer) {
- memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
- bufferEnd = buffer + (bufferEnd - bufferPtr);
- bufferPtr = buffer;
+ const XML_Char *s = context;
+
+ while (*context != XML_T('\0')) {
+ if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
+ ENTITY *e;
+ if (!poolAppendChar(&tempPool, XML_T('\0')))
+ return 0;
+ e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0);
+ if (e)
+ e->open = 1;
+ if (*s != XML_T('\0'))
+ s++;
+ context = s;
+ poolDiscard(&tempPool);
+ }
+ else if (*s == '=') {
+ PREFIX *prefix;
+ if (poolLength(&tempPool) == 0)
+ prefix = &dtd.defaultPrefix;
+ else {
+ if (!poolAppendChar(&tempPool, XML_T('\0')))
+ return 0;
+ prefix = (PREFIX *)
+ lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX));
+ if (!prefix)
+ return 0;
+ if (prefix->name == poolStart(&tempPool)) {
+ prefix->name = poolCopyString(&dtd.pool, prefix->name);
+ if (!prefix->name)
+ return 0;
+ }
+ poolDiscard(&tempPool);
+ }
+ for (context = s + 1;
+ *context != CONTEXT_SEP && *context != XML_T('\0');
+ ++context)
+ if (!poolAppendChar(&tempPool, *context))
+ return 0;
+ if (!poolAppendChar(&tempPool, XML_T('\0')))
+ return 0;
+ if (!addBinding(parser, prefix, 0, poolStart(&tempPool),
+ &inheritedBindings))
+ return 0;
+ poolDiscard(&tempPool);
+ if (*context != XML_T('\0'))
+ ++context;
+ s = context;
}
else {
- char *newBuf;
- int bufferSize = bufferLim - bufferPtr;
- if (bufferSize == 0)
- bufferSize = INIT_BUFFER_SIZE;
- do {
- bufferSize *= 2;
- } while (bufferSize < neededSize);
- newBuf = malloc(bufferSize);
- if (newBuf == 0) {
- errorCode = XML_ERROR_NO_MEMORY;
- return 0;
- }
- bufferLim = newBuf + bufferSize;
- if (bufferPtr) {
- memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
- free(buffer);
- }
- bufferEnd = newBuf + (bufferEnd - bufferPtr);
- bufferPtr = buffer = newBuf;
+ if (!poolAppendChar(&tempPool, *s))
+ return 0;
+ s++;
}
}
- return bufferEnd;
+ return 1;
}
-enum XML_Error XML_GetErrorCode(XML_Parser parser)
-{
- return errorCode;
-}
-long XML_GetCurrentByteIndex(XML_Parser parser)
+
+static void
+normalizeLines(XML_Char *s)
{
- if (eventPtr)
- return parseEndByteIndex - (parseEndPtr - eventPtr);
- return -1;
+ XML_Char *p;
+ for (;; s++) {
+ if (*s == XML_T('\0'))
+ return;
+ if (*s == 0xD)
+ break;
+ }
+ p = s;
+ do {
+ if (*s == 0xD) {
+ *p++ = 0xA;
+ if (*++s == 0xA)
+ s++;
+ }
+ else
+ *p++ = *s++;
+ } while (*s);
+ *p = XML_T('\0');
}
-int XML_GetCurrentByteCount(XML_Parser parser)
-{
- if (eventEndPtr && eventPtr)
- return eventEndPtr - eventPtr;
- return 0;
+
+
+static void
+reportDefault(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const startArg,
+ const char * const end) {
+
+ Parser * const parser = (Parser *)xmlParserP;
+
+ const char * s;
+
+ s = startArg;
+
+ if (MUST_CONVERT(enc, s)) {
+ const char **eventPP;
+ const char **eventEndPP;
+
+ if (enc == parser->m_encoding) {
+ eventPP = &eventPtr;
+ eventEndPP = &eventEndPtr;
+ }
+ else {
+ eventPP = &(openInternalEntities->internalEventPtr);
+ eventEndPP = &(openInternalEntities->internalEventEndPtr);
+ }
+ do {
+ ICHAR *dataPtr = (ICHAR *)dataBuf;
+ XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
+ *eventEndPP = s;
+ defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+ *eventPP = s;
+ } while (s != end);
+ } else
+ defaultHandler(handlerArg, (XML_Char *)s,
+ (XML_Char *)end - (XML_Char *)s);
}
-int XML_GetCurrentLineNumber(XML_Parser parser)
+
+
+static int
+reportProcessingInstruction(XML_Parser parser,
+ const ENCODING *enc,
+ const char *start,
+ const char *end)
{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
+ const XML_Char *target;
+ XML_Char *data;
+ const char *tem;
+ if (!processingInstructionHandler) {
+ if (defaultHandler)
+ reportDefault(parser, enc, start, end);
+ return 1;
}
- return position.lineNumber + 1;
+ start += enc->minBytesPerChar * 2;
+ tem = start + XmlNameLength(enc, start);
+ target = poolStoreString(&tempPool, enc, start, tem);
+ if (!target)
+ return 0;
+ poolFinish(&tempPool);
+ data = poolStoreString(&tempPool, enc,
+ XmlSkipS(enc, tem),
+ end - enc->minBytesPerChar*2);
+ if (!data)
+ return 0;
+ normalizeLines(data);
+ processingInstructionHandler(handlerArg, target, data);
+ poolClear(&tempPool);
+ return 1;
}
-int XML_GetCurrentColumnNumber(XML_Parser parser)
+static int
+reportComment(XML_Parser parser,
+ const ENCODING *enc,
+ const char *start,
+ const char *end)
{
- if (eventPtr) {
- XmlUpdatePosition(encoding, positionPtr, eventPtr, &position);
- positionPtr = eventPtr;
+ XML_Char *data;
+ if (!commentHandler) {
+ if (defaultHandler)
+ reportDefault(parser, enc, start, end);
+ return 1;
}
- return position.columnNumber;
+ data = poolStoreString(&tempPool,
+ enc,
+ start + enc->minBytesPerChar * 4,
+ end - enc->minBytesPerChar * 3);
+ if (!data)
+ return 0;
+ normalizeLines(data);
+ commentHandler(handlerArg, data);
+ poolClear(&tempPool);
+ return 1;
}
-void XML_DefaultCurrent(XML_Parser parser)
-{
- if (defaultHandler) {
- if (openInternalEntities)
- reportDefault(parser,
- internalEncoding,
- openInternalEntities->internalEventPtr,
- openInternalEntities->internalEventEndPtr);
- else
- reportDefault(parser, encoding, eventPtr, eventEndPtr);
- }
+
+
+static enum XML_Error
+handleUnknownEncoding(XML_Parser const xmlParserP,
+ const XML_Char * const encodingName) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ if (unknownEncodingHandler) {
+ XML_Encoding info;
+ int i;
+ for (i = 0; i < 256; i++)
+ info.map[i] = -1;
+ info.convert = 0;
+ info.data = 0;
+ info.release = 0;
+ if (unknownEncodingHandler(unknownEncodingHandlerData,
+ encodingName, &info)) {
+ ENCODING *enc;
+ unknownEncodingMem = malloc(xmlrpc_XmlSizeOfUnknownEncoding());
+ if (!unknownEncodingMem) {
+ if (info.release)
+ info.release(info.data);
+ return XML_ERROR_NO_MEMORY;
+ }
+ enc = (ns
+ ? xmlrpc_XmlInitUnknownEncodingNS
+ : xmlrpc_XmlInitUnknownEncoding)(unknownEncodingMem,
+ info.map,
+ info.convert,
+ info.data);
+ if (enc) {
+ unknownEncodingData = info.data;
+ unknownEncodingRelease = info.release;
+ parser->m_encoding = enc;
+ return XML_ERROR_NONE;
+ }
+ }
+ if (info.release)
+ info.release(info.data);
+ }
+ return XML_ERROR_UNKNOWN_ENCODING;
}
-const XML_LChar *XML_ErrorString(int code)
-{
- static const XML_LChar *message[] = {
- 0,
- XML_T("out of memory"),
- XML_T("syntax error"),
- XML_T("no element found"),
- XML_T("not well-formed"),
- XML_T("unclosed token"),
- XML_T("unclosed token"),
- XML_T("mismatched tag"),
- XML_T("duplicate attribute"),
- XML_T("junk after document element"),
- XML_T("illegal parameter entity reference"),
- XML_T("undefined entity"),
- XML_T("recursive entity reference"),
- XML_T("asynchronous entity"),
- XML_T("reference to invalid character number"),
- XML_T("reference to binary entity"),
- XML_T("reference to external entity in attribute"),
- XML_T("xml processing instruction not at start of external entity"),
- XML_T("unknown encoding"),
- XML_T("encoding specified in XML declaration is incorrect"),
- XML_T("unclosed CDATA section"),
- XML_T("error in processing external entity reference"),
- XML_T("document is not standalone")
- };
- if (code > 0 && code < sizeof(message)/sizeof(message[0]))
- return message[code];
- return 0;
+
+
+static enum XML_Error
+initializeEncoding(XML_Parser const xmlParserP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char *s;
+#ifdef XML_UNICODE
+ char encodingBuf[128];
+ if (!protocolEncodingName)
+ s = 0;
+ else {
+ int i;
+ for (i = 0; protocolEncodingName[i]; i++) {
+ if (i == sizeof(encodingBuf) - 1
+ || (protocolEncodingName[i] & ~0x7f) != 0) {
+ encodingBuf[0] = '\0';
+ break;
+ }
+ encodingBuf[i] = (char)protocolEncodingName[i];
+ }
+ encodingBuf[i] = '\0';
+ s = encodingBuf;
+ }
+#else
+ s = protocolEncodingName;
+#endif
+ if ((ns ? xmlrpc_XmlInitEncodingNS : xmlrpc_XmlInitEncoding)(
+ &parser->m_initEncoding, &parser->m_encoding, s))
+ return XML_ERROR_NONE;
+ return handleUnknownEncoding(xmlParserP, protocolEncodingName);
}
-static
-enum XML_Error contentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
+
+
+static enum XML_Error
+processXmlDecl(XML_Parser const xmlParserP,
+ int const isGeneralTextEntity,
+ const char * const s,
+ const char * const next) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char *encodingName = 0;
+ const ENCODING *newEncoding = 0;
+ const char *version;
+ int standalone = -1;
+ if (!(ns
+ ? xmlrpc_XmlParseXmlDeclNS
+ : xmlrpc_XmlParseXmlDecl)(isGeneralTextEntity,
+ parser->m_encoding,
+ s,
+ next,
+ &eventPtr,
+ &version,
+ &encodingName,
+ &newEncoding,
+ &standalone))
+ return XML_ERROR_SYNTAX;
+ if (!isGeneralTextEntity && standalone == 1) {
+ dtd.standalone = 1;
+ if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
+ paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
+ }
+ if (defaultHandler)
+ reportDefault(xmlParserP, parser->m_encoding, s, next);
+ if (!protocolEncodingName) {
+ if (newEncoding) {
+ if (newEncoding->minBytesPerChar !=
+ parser->m_encoding->minBytesPerChar) {
+ eventPtr = encodingName;
+ return XML_ERROR_INCORRECT_ENCODING;
+ }
+ parser->m_encoding = newEncoding;
+ }
+ else if (encodingName) {
+ enum XML_Error result;
+ const XML_Char * s =
+ poolStoreString(&tempPool,
+ parser->m_encoding,
+ encodingName,
+ encodingName
+ + XmlNameLength(parser->m_encoding,
+ encodingName));
+ if (!s)
+ return XML_ERROR_NO_MEMORY;
+ result = handleUnknownEncoding(xmlParserP, s);
+ poolDiscard(&tempPool);
+ if (result == XML_ERROR_UNKNOWN_ENCODING)
+ eventPtr = encodingName;
+ return result;
+ }
+ }
+ return XML_ERROR_NONE;
+}
+
+
+
+static ATTRIBUTE_ID *
+getAttributeId(XML_Parser parser,
+ const ENCODING *enc,
+ const char *start,
+ const char *end)
{
- return doContent(parser, 0, encoding, start, end, endPtr);
+ ATTRIBUTE_ID *id;
+ const XML_Char *name;
+ if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+ return 0;
+ name = poolStoreString(&dtd.pool, enc, start, end);
+ if (!name)
+ return 0;
+ ++name;
+ id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID));
+ if (!id)
+ return 0;
+ if (id->name != name)
+ poolDiscard(&dtd.pool);
+ else {
+ poolFinish(&dtd.pool);
+ if (!ns)
+ ;
+ else if (name[0] == 'x'
+ && name[1] == 'm'
+ && name[2] == 'l'
+ && name[3] == 'n'
+ && name[4] == 's'
+ && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {
+ if (name[5] == '\0')
+ id->prefix = &dtd.defaultPrefix;
+ else
+ id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX));
+ id->xmlns = 1;
+ }
+ else {
+ int i;
+ for (i = 0; name[i]; i++) {
+ if (name[i] == XML_T(':')) {
+ int j;
+ for (j = 0; j < i; j++) {
+ if (!poolAppendChar(&dtd.pool, name[j]))
+ return 0;
+ }
+ if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+ return 0;
+ id->prefix = (PREFIX *)
+ lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
+ if (id->prefix->name == poolStart(&dtd.pool))
+ poolFinish(&dtd.pool);
+ else
+ poolDiscard(&dtd.pool);
+ break;
+ }
+ }
+ }
+ }
+ return id;
}
static
-enum XML_Error externalEntityInitProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
+void normalizePublicId(XML_Char *publicId)
{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = externalEntityInitProcessor2;
- return externalEntityInitProcessor2(parser, start, end, endPtr);
+ XML_Char *p = publicId;
+ XML_Char *s;
+ for (s = publicId; *s; s++) {
+ switch (*s) {
+ case 0x20:
+ case 0xD:
+ case 0xA:
+ if (p != publicId && p[-1] != 0x20)
+ *p++ = 0x20;
+ break;
+ default:
+ *p++ = *s;
+ }
+ }
+ if (p != publicId && p[-1] == 0x20)
+ --p;
+ *p = XML_T('\0');
}
-static
-enum XML_Error externalEntityInitProcessor2(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next;
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_BOM:
- start = next;
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
+
+
+static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
+{
+ const XML_Char *name;
+ for (name = elementType->name; *name; name++) {
+ if (*name == XML_T(':')) {
+ PREFIX *prefix;
+ const XML_Char *s;
+ for (s = elementType->name; s != name; s++) {
+ if (!poolAppendChar(&dtd.pool, *s))
+ return 0;
+ }
+ if (!poolAppendChar(&dtd.pool, XML_T('\0')))
+ return 0;
+ prefix = (PREFIX *)
+ lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
+ if (!prefix)
+ return 0;
+ if (prefix->name == poolStart(&dtd.pool))
+ poolFinish(&dtd.pool);
+ else
+ poolDiscard(&dtd.pool);
+ elementType->prefix = prefix;
+
}
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
}
- processor = externalEntityInitProcessor3;
- return externalEntityInitProcessor3(parser, start, end, endPtr);
+ return 1;
}
-static
-enum XML_Error externalEntityInitProcessor3(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- const char *next;
- int tok = XmlContentTok(encoding, start, end, &next);
- switch (tok) {
- case XML_TOK_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, start, next);
- if (result != XML_ERROR_NONE)
- return result;
- start = next;
- }
- break;
- case XML_TOK_PARTIAL:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (endPtr) {
- *endPtr = start;
- return XML_ERROR_NONE;
- }
- eventPtr = start;
- return XML_ERROR_PARTIAL_CHAR;
- }
- processor = externalEntityContentProcessor;
- tagLevel = 1;
- return doContent(parser, 1, encoding, start, end, endPtr);
-}
-static
-enum XML_Error externalEntityContentProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- return doContent(parser, 1, encoding, start, end, endPtr);
-}
static enum XML_Error
-doContent(XML_Parser parser,
- int startTagLevel,
- const ENCODING *enc,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
+appendAttributeValue(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ int const isCdata,
+ const char * const ptrArg,
+ const char * const end,
+ STRING_POOL * const pool) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char * ptr;
+
+ ptr = ptrArg;
+
for (;;) {
- const char *next = s; /* XmlContentTok doesn't always set the last arg */
- int tok = XmlContentTok(enc, s, end, &next);
- *eventEndPP = next;
+ const char *next;
+ int tok = XmlAttributeValueTok(enc, ptr, end, &next);
switch (tok) {
- case XML_TOK_TRAILING_CR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- *eventEndPP = end;
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0)
- return XML_ERROR_NO_ELEMENTS;
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
case XML_TOK_NONE:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (startTagLevel > 0) {
- if (tagLevel != startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_NO_ELEMENTS;
+ return XML_ERROR_NONE;
case XML_TOK_INVALID:
- *eventPP = next;
+ if (enc == parser->m_encoding)
+ eventPtr = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- XML_Char ch = XmlPredefinedEntityName(enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (characterDataHandler)
- characterDataHandler(handlerArg, &ch, 1);
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&dtd.pool);
- if (!entity) {
- if (dtd.complete || dtd.standalone)
- return XML_ERROR_UNDEFINED_ENTITY;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->notation)
- return XML_ERROR_BINARY_ENTITY_REF;
- if (entity) {
- if (entity->textPtr) {
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- if (defaultHandler && !defaultExpandInternalEntities) {
- reportDefault(parser, enc, s, next);
- break;
- }
- entity->open = 1;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = 0;
- openEntity.internalEventEndPtr = 0;
- result = doContent(parser,
- tagLevel,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr + entity->textLen),
- 0);
- entity->open = 0;
- openInternalEntities = openEntity.next;
- if (result)
- return result;
- }
- else if (externalEntityRefHandler) {
- const XML_Char *context;
- entity->open = 1;
- context = getContext(parser);
- entity->open = 0;
- if (!context)
- return XML_ERROR_NO_MEMORY;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- context,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- poolDiscard(&tempPool);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- }
- case XML_TOK_START_TAG_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_START_TAG_NO_ATTS:
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_INVALID_TOKEN;
+ case XML_TOK_CHAR_REF:
{
- TAG *tag;
- if (freeTagList) {
- tag = freeTagList;
- freeTagList = freeTagList->parent;
- }
- else {
- tag = malloc(sizeof(TAG));
- if (!tag)
- return XML_ERROR_NO_MEMORY;
- tag->buf = malloc(INIT_TAG_BUF_SIZE);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
- }
- tag->bindings = 0;
- tag->parent = tagStack;
- tagStack = tag;
- tag->name.localPart = 0;
- tag->rawName = s + enc->minBytesPerChar;
- tag->rawNameLength = XmlNameLength(enc, tag->rawName);
- if (nextPtr) {
- /* Need to guarantee that:
- tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */
- if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) {
- int bufSize = tag->rawNameLength * 4;
- bufSize = ROUND_UP(bufSize, sizeof(XML_Char));
- tag->buf = realloc(tag->buf, bufSize);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + bufSize;
- }
- memcpy(tag->buf, tag->rawName, tag->rawNameLength);
- tag->rawName = tag->buf;
- }
- ++tagLevel;
- if (startElementHandler) {
- enum XML_Error result;
- XML_Char *toPtr;
- for (;;) {
- const char *rawNameEnd = tag->rawName + tag->rawNameLength;
- const char *fromPtr = tag->rawName;
- int bufSize;
- if (nextPtr)
- toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)));
- else
- toPtr = (XML_Char *)tag->buf;
- tag->name.str = toPtr;
- XmlConvert(enc,
- &fromPtr, rawNameEnd,
- (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
- if (fromPtr == rawNameEnd)
- break;
- bufSize = (tag->bufEnd - tag->buf) << 1;
- tag->buf = realloc(tag->buf, bufSize);
- if (!tag->buf)
- return XML_ERROR_NO_MEMORY;
- tag->bufEnd = tag->buf + bufSize;
- if (nextPtr)
- tag->rawName = tag->buf;
- }
- *toPtr = XML_T('\0');
- result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings));
- if (result)
- return result;
- startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts);
- poolClear(&tempPool);
- }
- else {
- tag->name.str = 0;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
- break;
- }
- case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
- if (!startElementHandler) {
- enum XML_Error result = storeAtts(parser, enc, s, 0, 0);
- if (result)
- return result;
- }
- /* fall through */
- case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
- if (startElementHandler || endElementHandler) {
- const char *rawName = s + enc->minBytesPerChar;
- enum XML_Error result;
- BINDING *bindings = 0;
- TAG_NAME name;
- name.str = poolStoreString(&tempPool, enc, rawName,
- rawName + XmlNameLength(enc, rawName));
- if (!name.str)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
- result = storeAtts(parser, enc, s, &name, &bindings);
- if (result)
- return result;
- poolFinish(&tempPool);
- if (startElementHandler)
- startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
- if (endElementHandler) {
- if (startElementHandler)
- *eventPP = *eventEndPP;
- endElementHandler(handlerArg, name.str);
- }
- poolClear(&tempPool);
- while (bindings) {
- BINDING *b = bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- bindings = bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
+ XML_Char buf[XML_ENCODE_MAX];
+ int i;
+ int n = XmlCharRefNumber(enc, ptr);
+ if (n < 0) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_BAD_CHAR_REF;
+ }
+ if (!isCdata
+ && n == 0x20 /* space */
+ && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
+ break;
+ n = XmlEncode(n, (ICHAR *)buf);
+ if (!n) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_BAD_CHAR_REF;
+ }
+ for (i = 0; i < n; i++) {
+ if (!poolAppendChar(pool, buf[i]))
+ return XML_ERROR_NO_MEMORY;
+ }
}
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
break;
- case XML_TOK_END_TAG:
- if (tagLevel == startTagLevel)
- return XML_ERROR_ASYNC_ENTITY;
- else {
- int len;
- const char *rawName;
- TAG *tag = tagStack;
- tagStack = tag->parent;
- tag->parent = freeTagList;
- freeTagList = tag;
- rawName = s + enc->minBytesPerChar*2;
- len = XmlNameLength(enc, rawName);
- if (len != tag->rawNameLength
- || memcmp(tag->rawName, rawName, len) != 0) {
- *eventPP = rawName;
- return XML_ERROR_TAG_MISMATCH;
- }
- --tagLevel;
- if (endElementHandler && tag->name.str) {
- if (tag->name.localPart) {
- XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen;
- const XML_Char *from = tag->name.localPart;
- while ((*to++ = *from++) != 0)
- ;
- }
- endElementHandler(handlerArg, tag->name.str);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- while (tag->bindings) {
- BINDING *b = tag->bindings;
- if (endNamespaceDeclHandler)
- endNamespaceDeclHandler(handlerArg, b->prefix->name);
- tag->bindings = tag->bindings->nextTagBinding;
- b->nextTagBinding = freeBindingList;
- freeBindingList = b;
- b->prefix->binding = b->prevPrefixBinding;
- }
- if (tagLevel == 0)
- return epilogProcessor(parser, next, end, nextPtr);
- }
+ case XML_TOK_DATA_CHARS:
+ if (!poolAppend(pool, enc, ptr, next))
+ return XML_ERROR_NO_MEMORY;
break;
- case XML_TOK_CHAR_REF:
- {
- int n = XmlCharRefNumber(enc, s);
- if (n < 0)
- return XML_ERROR_BAD_CHAR_REF;
- if (characterDataHandler) {
- XML_Char buf[XML_ENCODE_MAX];
- characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf));
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- }
break;
- case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
+ case XML_TOK_TRAILING_CR:
+ next = ptr + enc->minBytesPerChar;
+ /* fall through */
+ case XML_TOK_ATTRIBUTE_VALUE_S:
case XML_TOK_DATA_NEWLINE:
- if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
+ break;
+ if (!poolAppendChar(pool, 0x20))
+ return XML_ERROR_NO_MEMORY;
break;
- case XML_TOK_CDATA_SECT_OPEN:
+ case XML_TOK_ENTITY_REF:
{
- enum XML_Error result;
- if (startCdataSectionHandler)
- startCdataSectionHandler(handlerArg);
-#if 0
- /* Suppose you doing a transformation on a document that involves
- changing only the character data. You set up a defaultHandler
- and a characterDataHandler. The defaultHandler simply copies
- characters through. The characterDataHandler does the transformation
- and writes the characters out escaping them as necessary. This case
- will fail to work if we leave out the following two lines (because &
- and < inside CDATA sections will be incorrectly escaped).
-
- However, now we have a start/endCdataSectionHandler, so it seems
- easier to let the user deal with this. */
-
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
- result = doCdataSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = cdataSectionProcessor;
- return result;
- }
+ const XML_Char *name;
+ ENTITY *entity;
+ XML_Char ch = XmlPredefinedEntityName(enc,
+ ptr + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (ch) {
+ if (!poolAppendChar(pool, ch))
+ return XML_ERROR_NO_MEMORY;
+ break;
+ }
+ name = poolStoreString(&temp2Pool, enc,
+ ptr + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!name)
+ return XML_ERROR_NO_MEMORY;
+ entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
+ poolDiscard(&temp2Pool);
+ if (!entity) {
+ if (dtd.complete) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_UNDEFINED_ENTITY;
+ }
+ }
+ else if (entity->open) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_RECURSIVE_ENTITY_REF;
+ }
+ else if (entity->notation) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_BINARY_ENTITY_REF;
+ }
+ else if (!entity->textPtr) {
+ if (enc == parser->m_encoding)
+ eventPtr = ptr;
+ return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
+ }
+ else {
+ enum XML_Error result;
+ const XML_Char *textEnd = entity->textPtr + entity->textLen;
+ entity->open = 1;
+ result = appendAttributeValue(xmlParserP, internalEncoding,
+ isCdata, (char *)entity->textPtr,
+ (char *)textEnd, pool);
+ entity->open = 0;
+ if (result)
+ return result;
+ }
}
break;
- case XML_TOK_TRAILING_RSQB:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)end - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, end);
- if (startTagLevel == 0) {
- *eventPP = end;
- return XML_ERROR_NO_ELEMENTS;
- }
- if (tagLevel != startTagLevel) {
- *eventPP = end;
- return XML_ERROR_ASYNC_ENTITY;
+ default:
+ abort();
+ }
+ ptr = next;
+ }
+ /* not reached */
+}
+
+
+
+static enum XML_Error
+storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
+ const char *ptr, const char *end,
+ STRING_POOL *pool)
+{
+ enum XML_Error result =
+ appendAttributeValue(parser, enc, isCdata, ptr, end, pool);
+ if (result)
+ return result;
+ if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
+ poolChop(pool);
+ if (!poolAppendChar(pool, XML_T('\0')))
+ return XML_ERROR_NO_MEMORY;
+ return XML_ERROR_NONE;
+}
+
+
+
+static
+enum XML_Error
+storeEntityValue(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const entityTextPtrArg,
+ const char * const entityTextEnd) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ STRING_POOL * const pool = &(dtd.pool);
+ const char * entityTextPtr;
+
+ entityTextPtr = entityTextPtrArg;
+
+ for (;;) {
+ const char * next;
+ int tok;
+
+ tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
+ switch (tok) {
+ case XML_TOK_PARAM_ENTITY_REF:
+ if (parentParser || enc != parser->m_encoding) {
+ enum XML_Error result;
+ const XML_Char *name;
+ ENTITY *entity;
+ name = poolStoreString(&tempPool, enc,
+ entityTextPtr + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!name)
+ return XML_ERROR_NO_MEMORY;
+ entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
+ poolDiscard(&tempPool);
+ if (!entity) {
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_UNDEFINED_ENTITY;
+ }
+ if (entity->open) {
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_RECURSIVE_ENTITY_REF;
+ }
+ if (entity->systemId) {
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_PARAM_ENTITY_REF;
+ }
+ entity->open = 1;
+ result = storeEntityValue(parser,
+ internalEncoding,
+ (char *)entity->textPtr,
+ (char *)(entity->textPtr + entity->textLen));
+ entity->open = 0;
+ if (result)
+ return result;
+ break;
}
+ eventPtr = entityTextPtr;
+ return XML_ERROR_SYNTAX;
+ case XML_TOK_NONE:
return XML_ERROR_NONE;
+ case XML_TOK_ENTITY_REF:
case XML_TOK_DATA_CHARS:
- if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
- }
- else if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ if (!poolAppend(pool, enc, entityTextPtr, next))
+ return XML_ERROR_NO_MEMORY;
break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
+ case XML_TOK_TRAILING_CR:
+ next = entityTextPtr + enc->minBytesPerChar;
+ /* fall through */
+ case XML_TOK_DATA_NEWLINE:
+ if (pool->end == pool->ptr && !poolGrow(pool))
+ return XML_ERROR_NO_MEMORY;
+ *(pool->ptr)++ = 0xA;
break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
+ case XML_TOK_CHAR_REF:
+ {
+ XML_Char buf[XML_ENCODE_MAX];
+ int i;
+ int n = XmlCharRefNumber(enc, entityTextPtr);
+ if (n < 0) {
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_BAD_CHAR_REF;
+ }
+ n = XmlEncode(n, (ICHAR *)buf);
+ if (!n) {
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_BAD_CHAR_REF;
+ }
+ for (i = 0; i < n; i++) {
+ if (pool->end == pool->ptr && !poolGrow(pool))
+ return XML_ERROR_NO_MEMORY;
+ *(pool->ptr)++ = buf[i];
+ }
+ }
break;
+ case XML_TOK_PARTIAL:
+ if (enc == parser->m_encoding)
+ eventPtr = entityTextPtr;
+ return XML_ERROR_INVALID_TOKEN;
+ case XML_TOK_INVALID:
+ if (enc == parser->m_encoding)
+ eventPtr = next;
+ return XML_ERROR_INVALID_TOKEN;
default:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- break;
+ abort();
}
- *eventPP = s = next;
+ entityTextPtr = next;
}
/* not reached */
}
+
+
+static int
+defineAttribute(ELEMENT_TYPE *type,
+ ATTRIBUTE_ID *attId,
+ int isCdata,
+ int isId,
+ const XML_Char *value)
+{
+ DEFAULT_ATTRIBUTE *att;
+ if (value || isId) {
+ /* The handling of default attributes gets messed up if we have
+ a default which duplicates a non-default. */
+ int i;
+ for (i = 0; i < type->nDefaultAtts; i++)
+ if (attId == type->defaultAtts[i].id)
+ return 1;
+ if (isId && !type->idAtt && !attId->xmlns)
+ type->idAtt = attId;
+ }
+ if (type->nDefaultAtts == type->allocDefaultAtts) {
+ if (type->allocDefaultAtts == 0) {
+ type->allocDefaultAtts = 8;
+ type->defaultAtts =
+ malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+ }
+ else {
+ type->allocDefaultAtts *= 2;
+ type->defaultAtts =
+ realloc(type->defaultAtts,
+ type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
+ }
+ if (!type->defaultAtts)
+ return 0;
+ }
+ att = type->defaultAtts + type->nDefaultAtts;
+ att->id = attId;
+ att->value = value;
+ att->isCdata = isCdata;
+ if (!isCdata)
+ attId->maybeTokenized = 1;
+ type->nDefaultAtts += 1;
+ return 1;
+}
+
+
+
/* If tagNamePtr is non-null, build a real list of attributes,
otherwise just check the attributes for well-formedness. */
-static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc,
- const char *attStr, TAG_NAME *tagNamePtr,
- BINDING **bindingsPtr)
-{
+static enum XML_Error
+storeAtts(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const attStr,
+ TAG_NAME * const tagNamePtr,
+ BINDING ** const bindingsPtr) {
+
+ Parser * const parser = (Parser *)xmlParserP;
+
ELEMENT_TYPE *elementType = 0;
int nDefaultAtts = 0;
- const XML_Char **appAtts; /* the attribute list to pass to the application */
+ const XML_Char ** appAtts;
+ /* the attribute list to pass to the application */
int attIndex = 0;
int i;
int n;
@@ -1618,15 +1806,17 @@
/* lookup the element type name */
if (tagNamePtr) {
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, 0);
+ elementType = (ELEMENT_TYPE *)
+ lookup(&dtd.elementTypes, tagNamePtr->str, 0);
if (!elementType) {
tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str);
if (!tagNamePtr->str)
- return XML_ERROR_NO_MEMORY;
- elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE));
+ return XML_ERROR_NO_MEMORY;
+ elementType = (ELEMENT_TYPE *)
+ lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE));
if (!elementType)
return XML_ERROR_NO_MEMORY;
- if (ns && !setElementTypePrefix(parser, elementType))
+ if (ns && !setElementTypePrefix(xmlParserP, elementType))
return XML_ERROR_NO_MEMORY;
}
nDefaultAtts = elementType->nDefaultAtts;
@@ -1645,15 +1835,15 @@
appAtts = (const XML_Char **)atts;
for (i = 0; i < n; i++) {
/* add the name and value to the attribute list */
- ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name,
- atts[i].name
- + XmlNameLength(enc, atts[i].name));
+ ATTRIBUTE_ID *attId = getAttributeId(xmlParserP, enc, atts[i].name,
+ atts[i].name
+ + XmlNameLength(enc, atts[i].name));
if (!attId)
return XML_ERROR_NO_MEMORY;
/* detect duplicate attributes */
if ((attId->name)[-1]) {
- if (enc == encoding)
- eventPtr = atts[i].name;
+ if (enc == parser->m_encoding)
+ eventPtr = atts[i].name;
return XML_ERROR_DUPLICATE_ATTRIBUTE;
}
(attId->name)[-1] = 1;
@@ -1664,45 +1854,47 @@
/* figure out whether declared as other than CDATA */
if (attId->maybeTokenized) {
- int j;
- for (j = 0; j < nDefaultAtts; j++) {
- if (attId == elementType->defaultAtts[j].id) {
- isCdata = elementType->defaultAtts[j].isCdata;
- break;
- }
- }
+ int j;
+ for (j = 0; j < nDefaultAtts; j++) {
+ if (attId == elementType->defaultAtts[j].id) {
+ isCdata = elementType->defaultAtts[j].isCdata;
+ break;
+ }
+ }
}
/* normalize the attribute value */
- result = storeAttributeValue(parser, enc, isCdata,
- atts[i].valuePtr, atts[i].valueEnd,
- &tempPool);
+ result = storeAttributeValue(xmlParserP, enc, isCdata,
+ atts[i].valuePtr, atts[i].valueEnd,
+ &tempPool);
if (result)
- return result;
+ return result;
if (tagNamePtr) {
- appAtts[attIndex] = poolStart(&tempPool);
- poolFinish(&tempPool);
+ appAtts[attIndex] = poolStart(&tempPool);
+ poolFinish(&tempPool);
}
else
- poolDiscard(&tempPool);
+ poolDiscard(&tempPool);
}
else if (tagNamePtr) {
/* the value did not need normalizing */
- appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd);
+ appAtts[attIndex] =
+ poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd);
if (appAtts[attIndex] == 0)
- return XML_ERROR_NO_MEMORY;
+ return XML_ERROR_NO_MEMORY;
poolFinish(&tempPool);
}
/* handle prefixed attribute names */
if (attId->prefix && tagNamePtr) {
if (attId->xmlns) {
- /* deal with namespace declarations here */
- if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr))
+ /* deal with namespace declarations here */
+ if (!addBinding(xmlParserP, attId->prefix, attId, appAtts[attIndex],
+ bindingsPtr))
return XML_ERROR_NO_MEMORY;
--attIndex;
}
else {
- /* deal with other prefixed names later */
+ /* deal with other prefixed names later */
attIndex++;
nPrefixes++;
(attId->name)[-1] = 2;
@@ -1716,10 +1908,10 @@
nSpecifiedAtts = attIndex;
if (elementType->idAtt && (elementType->idAtt->name)[-1]) {
for (i = 0; i < attIndex; i += 2)
- if (appAtts[i] == elementType->idAtt->name) {
- idAttIndex = i;
- break;
- }
+ if (appAtts[i] == elementType->idAtt->name) {
+ idAttIndex = i;
+ break;
+ }
}
else
idAttIndex = -1;
@@ -1729,21 +1921,22 @@
if (!(da->id->name)[-1] && da->value) {
if (da->id->prefix) {
if (da->id->xmlns) {
- if (!addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr))
- return XML_ERROR_NO_MEMORY;
- }
+ if (!addBinding(xmlParserP, da->id->prefix, da->id, da->value,
+ bindingsPtr))
+ return XML_ERROR_NO_MEMORY;
+ }
else {
- (da->id->name)[-1] = 2;
- nPrefixes++;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
- }
- else {
- (da->id->name)[-1] = 1;
- appAtts[attIndex++] = da->id->name;
- appAtts[attIndex++] = da->value;
- }
+ (da->id->name)[-1] = 2;
+ nPrefixes++;
+ appAtts[attIndex++] = da->id->name;
+ appAtts[attIndex++] = da->value;
+ }
+ }
+ else {
+ (da->id->name)[-1] = 1;
+ appAtts[attIndex++] = da->id->name;
+ appAtts[attIndex++] = da->value;
+ }
}
}
appAtts[attIndex] = 0;
@@ -1755,29 +1948,29 @@
if (appAtts[i][-1] == 2) {
ATTRIBUTE_ID *id;
((XML_Char *)(appAtts[i]))[-1] = 0;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0);
- if (id->prefix->binding) {
- int j;
- const BINDING *b = id->prefix->binding;
- const XML_Char *s = appAtts[i];
- for (j = 0; j < b->uriLen; j++) {
- if (!poolAppendChar(&tempPool, b->uri[j]))
- return XML_ERROR_NO_MEMORY;
- }
- while (*s++ != ':')
- ;
- do {
- if (!poolAppendChar(&tempPool, *s))
- return XML_ERROR_NO_MEMORY;
- } while (*s++);
- appAtts[i] = poolStart(&tempPool);
- poolFinish(&tempPool);
- }
- if (!--nPrefixes)
- break;
+ id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0);
+ if (id->prefix->binding) {
+ int j;
+ const BINDING *b = id->prefix->binding;
+ const XML_Char *s = appAtts[i];
+ for (j = 0; j < b->uriLen; j++) {
+ if (!poolAppendChar(&tempPool, b->uri[j]))
+ return XML_ERROR_NO_MEMORY;
+ }
+ while (*s++ != ':')
+ ;
+ do {
+ if (!poolAppendChar(&tempPool, *s))
+ return XML_ERROR_NO_MEMORY;
+ } while (*s++);
+ appAtts[i] = poolStart(&tempPool);
+ poolFinish(&tempPool);
+ }
+ if (!--nPrefixes)
+ break;
}
else
- ((XML_Char *)(appAtts[i]))[-1] = 0;
+ ((XML_Char *)(appAtts[i]))[-1] = 0;
}
}
/* clear the flags that say whether attributes were specified */
@@ -1813,98 +2006,114 @@
if (!uri)
return XML_ERROR_NO_MEMORY;
binding->uriAlloc = n + EXPAND_SPARE;
- memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
- for (p = tagStack; p; p = p->parent)
- if (p->name.str == binding->uri)
- p->name.str = uri;
- free(binding->uri);
- binding->uri = uri;
- }
- memcpy(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char));
- tagNamePtr->str = binding->uri;
- return XML_ERROR_NONE;
-}
-
-static
-int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr)
-{
- BINDING *b;
- int len;
- for (len = 0; uri[len]; len++)
- ;
- if (namespaceSeparator)
- len++;
- if (freeBindingList) {
- b = freeBindingList;
- if (len > b->uriAlloc) {
- b->uri = realloc(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (!b->uri)
- return 0;
- b->uriAlloc = len + EXPAND_SPARE;
- }
- freeBindingList = b->nextTagBinding;
- }
- else {
- b = malloc(sizeof(BINDING));
- if (!b)
- return 0;
- b->uri = malloc(sizeof(XML_Char) * (len + EXPAND_SPARE));
- if (!b->uri) {
- free(b);
- return 0;
- }
- b->uriAlloc = len + EXPAND_SPARE;
+ memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char));
+ for (p = tagStack; p; p = p->parent)
+ if (p->name.str == binding->uri)
+ p->name.str = uri;
+ free(binding->uri);
+ binding->uri = uri;
}
- b->uriLen = len;
- memcpy(b->uri, uri, len * sizeof(XML_Char));
- if (namespaceSeparator)
- b->uri[len - 1] = namespaceSeparator;
- b->prefix = prefix;
- b->attId = attId;
- b->prevPrefixBinding = prefix->binding;
- if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix)
- prefix->binding = 0;
- else
- prefix->binding = b;
- b->nextTagBinding = *bindingsPtr;
- *bindingsPtr = b;
- if (startNamespaceDeclHandler)
- startNamespaceDeclHandler(handlerArg, prefix->name,
- prefix->binding ? uri : 0);
- return 1;
+ memcpy(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char));
+ tagNamePtr->str = binding->uri;
+ return XML_ERROR_NONE;
}
-/* The idea here is to avoid using stack for each CDATA section when
-the whole file is parsed with one call. */
-static
-enum XML_Error cdataSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr);
- if (start) {
- processor = contentProcessor;
- return contentProcessor(parser, start, end, endPtr);
- }
- return result;
+
+static Processor epilogProcessor;
+
+static void
+epilogProcessor(XML_Parser const xmlParserP,
+ const char * const startArg,
+ const char * const end,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char * s;
+
+ *errorP = NULL;
+
+ s = startArg;
+
+ processor = epilogProcessor;
+ eventPtr = s;
+ for (;;) {
+ const char *next;
+ int tok = XmlPrologTok(parser->m_encoding, s, end, &next);
+ eventEndPtr = next;
+ switch (tok) {
+ case -XML_TOK_PROLOG_S:
+ if (defaultHandler) {
+ eventEndPtr = end;
+ reportDefault(xmlParserP, parser->m_encoding, s, end);
+ }
+ /* fall through */
+ case XML_TOK_NONE:
+ if (nextPtr)
+ *nextPtr = end;
+ *errorCodeP = XML_ERROR_NONE;
+ return;
+ case XML_TOK_PROLOG_S:
+ if (defaultHandler)
+ reportDefault(xmlParserP, parser->m_encoding, s, next);
+ break;
+ case XML_TOK_PI:
+ if (!reportProcessingInstruction(xmlParserP, parser->m_encoding,
+ s, next)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ break;
+ case XML_TOK_COMMENT:
+ if (!reportComment(xmlParserP, parser->m_encoding, s, next)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ break;
+ case XML_TOK_INVALID:
+ eventPtr = next;
+ *errorCodeP = XML_ERROR_INVALID_TOKEN;
+ return;
+ case XML_TOK_PARTIAL:
+ if (nextPtr) {
+ *nextPtr = s;
+ *errorCodeP = XML_ERROR_NONE;
+ } else
+ *errorCodeP = XML_ERROR_UNCLOSED_TOKEN;
+ return;
+ case XML_TOK_PARTIAL_CHAR:
+ if (nextPtr) {
+ *nextPtr = s;
+ *errorCodeP = XML_ERROR_NONE;
+ } else
+ *errorCodeP = XML_ERROR_PARTIAL_CHAR;
+ return;
+ default:
+ *errorCodeP = XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
+ return;
+ }
+ eventPtr = s = next;
+ }
}
-/* startPtr gets set to non-null is the section is closed, and to null if
-the section is not yet closed. */
-static
-enum XML_Error doCdataSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
+
+static enum XML_Error
+doCdataSection(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char ** const startPtr,
+ const char * const end,
+ const char ** const nextPtr) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
const char *s = *startPtr;
const char **eventPP;
const char **eventEndPP;
- if (enc == encoding) {
+ if (enc == parser->m_encoding) {
eventPP = &eventPtr;
*eventPP = s;
eventEndPP = &eventEndPtr;
@@ -1922,59 +2131,54 @@
switch (tok) {
case XML_TOK_CDATA_SECT_CLOSE:
if (endCdataSectionHandler)
- endCdataSectionHandler(handlerArg);
-#if 0
- /* see comment under XML_TOK_CDATA_SECT_OPEN */
- else if (characterDataHandler)
- characterDataHandler(handlerArg, dataBuf, 0);
-#endif
+ endCdataSectionHandler(handlerArg);
else if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ reportDefault(xmlParserP, enc, s, next);
*startPtr = next;
return XML_ERROR_NONE;
case XML_TOK_DATA_NEWLINE:
if (characterDataHandler) {
- XML_Char c = 0xA;
- characterDataHandler(handlerArg, &c, 1);
+ XML_Char c = 0xA;
+ characterDataHandler(handlerArg, &c, 1);
}
else if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ reportDefault(xmlParserP, enc, s, next);
break;
case XML_TOK_DATA_CHARS:
if (characterDataHandler) {
- if (MUST_CONVERT(enc, s)) {
- for (;;) {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = next;
- characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- if (s == next)
- break;
- *eventPP = s;
- }
- }
- else
- characterDataHandler(handlerArg,
- (XML_Char *)s,
- (XML_Char *)next - (XML_Char *)s);
+ if (MUST_CONVERT(enc, s)) {
+ for (;;) {
+ ICHAR *dataPtr = (ICHAR *)dataBuf;
+ XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd);
+ *eventEndPP = next;
+ characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
+ if (s == next)
+ break;
+ *eventPP = s;
+ }
+ }
+ else
+ characterDataHandler(handlerArg,
+ (XML_Char *)s,
+ (XML_Char *)next - (XML_Char *)s);
}
else if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ reportDefault(xmlParserP, enc, s, next);
break;
case XML_TOK_INVALID:
*eventPP = next;
return XML_ERROR_INVALID_TOKEN;
case XML_TOK_PARTIAL_CHAR:
if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
+ *nextPtr = s;
+ return XML_ERROR_NONE;
}
return XML_ERROR_PARTIAL_CHAR;
case XML_TOK_PARTIAL:
case XML_TOK_NONE:
if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
+ *nextPtr = s;
+ return XML_ERROR_NONE;
}
return XML_ERROR_UNCLOSED_CDATA_SECTION;
default:
@@ -1985,246 +2189,1024 @@
/* not reached */
}
-#ifdef XML_DTD
-/* The idea here is to avoid using stack for each IGNORE section when
+
+/* Forward declaration for recursive reference: */
+static void
+doContent(XML_Parser const xmlParserP,
+ int const startTagLevel,
+ const ENCODING * const enc,
+ const char * const startArg,
+ const char * const end,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP);
+
+
+static Processor contentProcessor;
+
+static void
+contentProcessor(XML_Parser const xmlParserP,
+ const char * const start,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char * error;
+
+ parser->m_errorString = NULL;
+
+ doContent(xmlParserP, 0, parser->m_encoding, start, end, endPtr,
+ errorCodeP, &error);
+
+ if (*errorCodeP != XML_ERROR_NONE) {
+ if (error) {
+ xmlrpc_asprintf(errorP, "Invalid XML \"content\". %s", error);
+
+ xmlrpc_strfree(error);
+ } else {
+ const char * const sampleXml = extractXmlSample(start, end, 40);
+
+ xmlrpc_asprintf(errorP, "Invalid XML \"content\" starting "
+ "with '%s'. %s",
+ sampleXml,
+ xmlrpc_XML_ErrorString(*errorCodeP));
+
+ xmlrpc_strfree(sampleXml);
+ }
+ } else
+ *errorP = NULL;
+}
+
+
+
+/* The idea here is to avoid using stack for each CDATA section when
the whole file is parsed with one call. */
-static
-enum XML_Error ignoreSectionProcessor(XML_Parser parser,
- const char *start,
- const char *end,
- const char **endPtr)
-{
- enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr);
- if (start) {
- processor = prologProcessor;
- return prologProcessor(parser, start, end, endPtr);
- }
- return result;
+
+
+static Processor cdataSectionProcessor;
+
+static void
+cdataSectionProcessor(XML_Parser const xmlParserP,
+ const char * const startArg,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ enum XML_Error result;
+ const char * start;
+
+ start = startArg;
+
+ result =
+ doCdataSection(xmlParserP, parser->m_encoding, &start, end, endPtr);
+
+ if (start) {
+ processor = contentProcessor;
+ contentProcessor(xmlParserP, start, end, endPtr, errorCodeP, errorP);
+ } else {
+ *errorCodeP = result;
+ *errorP = NULL;
+ }
}
-/* startPtr gets set to non-null is the section is closed, and to null if
-the section is not yet closed. */
-static
-enum XML_Error doIgnoreSection(XML_Parser parser,
- const ENCODING *enc,
- const char **startPtr,
- const char *end,
- const char **nextPtr)
-{
- const char *next;
- int tok;
- const char *s = *startPtr;
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- *eventPP = s;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- *eventPP = s;
- *startPtr = 0;
- tok = XmlIgnoreSectionTok(enc, s, end, &next);
- *eventEndPP = next;
- switch (tok) {
- case XML_TOK_IGNORE_SECT:
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- *startPtr = next;
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
+
+static void
+doEntityRef(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const s,
+ const char * const next,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ XML_Char const ch = XmlPredefinedEntityName(enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ const XML_Char *name;
+ ENTITY *entity;
+ *errorP = NULL;
+
+ if (ch) {
+ if (characterDataHandler)
+ characterDataHandler(handlerArg, &ch, 1);
+ else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+ *errorCodeP = XML_ERROR_NONE;
+ return;
+ }
+ name = poolStoreString(&dtd.pool, enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
+ poolDiscard(&dtd.pool);
+ if (!entity) {
+ if (dtd.complete || dtd.standalone)
+ *errorCodeP = XML_ERROR_UNDEFINED_ENTITY;
+ else {
+ if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+ *errorCodeP = XML_ERROR_NONE;
+ }
+ return;
+ }
+ if (entity->open) {
+ *errorCodeP = XML_ERROR_RECURSIVE_ENTITY_REF;
+ return;
+ }
+ if (entity->notation) {
+ *errorCodeP = XML_ERROR_BINARY_ENTITY_REF;
+ return;
+ }
+ if (entity) {
+ if (entity->textPtr) {
+ OPEN_INTERNAL_ENTITY openEntity;
+ if (defaultHandler && !defaultExpandInternalEntities) {
+ reportDefault(xmlParserP, enc, s, next);
+ *errorCodeP = XML_ERROR_NONE;
+ return;
+ }
+ entity->open = 1;
+ openEntity.next = openInternalEntities;
+ openInternalEntities = &openEntity;
+ openEntity.entity = entity;
+ openEntity.internalEventPtr = 0;
+ openEntity.internalEventEndPtr = 0;
+ doContent(xmlParserP,
+ tagLevel,
+ internalEncoding,
+ (char *)entity->textPtr,
+ (char *)(entity->textPtr + entity->textLen),
+ 0, errorCodeP, errorP);
+ entity->open = 0;
+ openInternalEntities = openEntity.next;
+ if (*errorCodeP != XML_ERROR_NONE)
+ return;
+ } else if (externalEntityRefHandler) {
+ const XML_Char *context;
+ entity->open = 1;
+ context = getContext(xmlParserP);
+ entity->open = 0;
+ if (!context) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ if (!externalEntityRefHandler(externalEntityRefHandlerArg,
+ context,
+ entity->base,
+ entity->systemId,
+ entity->publicId)) {
+ *errorCodeP = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+ return;
+ }
+ poolDiscard(&tempPool);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
}
- return XML_ERROR_PARTIAL_CHAR;
- case XML_TOK_PARTIAL:
- case XML_TOK_NONE:
+ *errorCodeP = XML_ERROR_NONE;
+}
+
+
+
+static void
+doStartTagNoAtts(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const s,
+ const char * const next,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ TAG *tag;
+
+ *errorP = NULL;
+
+ if (freeTagList) {
+ tag = freeTagList;
+ freeTagList = freeTagList->parent;
+ } else {
+ tag = malloc(sizeof(TAG));
+ if (!tag) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ tag->buf = malloc(INIT_TAG_BUF_SIZE);
+ if (!tag->buf) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE;
+ }
+ tag->bindings = NULL;
+ tag->parent = tagStack;
+ tagStack = tag;
+ tag->name.localPart = 0;
+ tag->rawName = s + enc->minBytesPerChar;
+ tag->rawNameLength = XmlNameLength(enc, tag->rawName);
if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
+ /* Need to guarantee that: tag->buf +
+ ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <=
+ tag->bufEnd - sizeof(XML_Char)
+ */
+
+ if (tag->rawNameLength +
+ (int)(sizeof(XML_Char) - 1) +
+ (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) {
+ int bufSize = tag->rawNameLength * 4;
+ bufSize = ROUND_UP(bufSize, sizeof(XML_Char));
+ tag->buf = realloc(tag->buf, bufSize);
+ if (!tag->buf) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ tag->bufEnd = tag->buf + bufSize;
+ }
+ memcpy(tag->buf, tag->rawName, tag->rawNameLength);
+ tag->rawName = tag->buf;
+ }
+ ++tagLevel;
+ if (startElementHandler) {
+ enum XML_Error result;
+ XML_Char *toPtr;
+ for (;;) {
+ const char *rawNameEnd = tag->rawName + tag->rawNameLength;
+ const char *fromPtr = tag->rawName;
+ if (nextPtr)
+ toPtr = (XML_Char *)
+ (tag->buf + ROUND_UP(tag->rawNameLength,
+ sizeof(XML_Char)));
+ else
+ toPtr = (XML_Char *)tag->buf;
+ tag->name.str = toPtr;
+ XmlConvert(enc,
+ &fromPtr, rawNameEnd,
+ (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1);
+ if (fromPtr == rawNameEnd)
+ break;
+ else {
+ int const bufSize = (tag->bufEnd - tag->buf) << 1;
+ tag->buf = realloc(tag->buf, bufSize);
+ if (!tag->buf) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ tag->bufEnd = tag->buf + bufSize;
+ if (nextPtr)
+ tag->rawName = tag->buf;
+ }
+ }
+ *toPtr = XML_T('\0');
+ result = storeAtts(xmlParserP, enc, s,
+ &(tag->name), &(tag->bindings));
+ if (result) {
+ *errorCodeP = result;
+ return;
+ }
+ startElementHandler(handlerArg, tag->name.str,
+ (const XML_Char **)atts);
+ poolClear(&tempPool);
+ } else {
+ tag->name.str = 0;
+ if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
}
- return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
- default:
- abort();
- }
- /* not reached */
}
-#endif /* XML_DTD */
-static enum XML_Error
-initializeEncoding(XML_Parser parser)
-{
- const char *s;
-#ifdef XML_UNICODE
- char encodingBuf[128];
- if (!protocolEncodingName)
- s = 0;
- else {
- int i;
- for (i = 0; protocolEncodingName[i]; i++) {
- if (i == sizeof(encodingBuf) - 1
- || (protocolEncodingName[i] & ~0x7f) != 0) {
- encodingBuf[0] = '\0';
- break;
- }
- encodingBuf[i] = (char)protocolEncodingName[i];
+
+static void
+doEmptyElementNoAtts(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const s,
+ const char * const end,
+ const char * const next,
+ const char ** const nextPtr,
+ const char ** const eventPP,
+ const char ** const eventEndPP,
+ bool * const doneP,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ if (startElementHandler || endElementHandler) {
+ const char * const rawName = s + enc->minBytesPerChar;
+
+ enum XML_Error result;
+ BINDING * bindings;
+ TAG_NAME name;
+
+ bindings = NULL; /* initial value */
+ name.str = poolStoreString(&tempPool, enc, rawName,
+ rawName + XmlNameLength(enc, rawName));
+ if (!name.str) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ poolFinish(&tempPool);
+ result = storeAtts(xmlParserP, enc, s, &name, &bindings);
+ if (result) {
+ *errorCodeP = result;
+ return;
+ }
+ poolFinish(&tempPool);
+ if (startElementHandler)
+ startElementHandler(handlerArg, name.str, (const XML_Char **)atts);
+ if (endElementHandler) {
+ if (startElementHandler)
+ *eventPP = *eventEndPP;
+ endElementHandler(handlerArg, name.str);
+ }
+ poolClear(&tempPool);
+ while (bindings) {
+ BINDING * const b = bindings;
+ if (endNamespaceDeclHandler)
+ endNamespaceDeclHandler(handlerArg, b->prefix->name);
+ bindings = bindings->nextTagBinding;
+ b->nextTagBinding = freeBindingList;
+ freeBindingList = b;
+ b->prefix->binding = b->prevPrefixBinding;
+ }
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+
+ if (tagLevel == 0) {
+ epilogProcessor(xmlParserP, next, end, nextPtr, errorCodeP, errorP);
+ *doneP = true;
+ } else
+ *doneP = false;
+}
+
+
+
+static void
+doEndTag(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char * const s,
+ const char * const end,
+ const char * const next,
+ const char ** const nextPtr,
+ int const startTagLevel,
+ const char ** const eventPP,
+ bool * const doneP,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ if (tagLevel == startTagLevel)
+ *errorCodeP = XML_ERROR_ASYNC_ENTITY;
+ else {
+ TAG * const tag = tagStack;
+
+ int len;
+ const char * rawName;
+
+ tagStack = tag->parent;
+ tag->parent = freeTagList;
+ freeTagList = tag;
+ rawName = s + enc->minBytesPerChar*2;
+ len = XmlNameLength(enc, rawName);
+ if (len != tag->rawNameLength
+ || memcmp(tag->rawName, rawName, len) != 0) {
+ *eventPP = rawName;
+ *errorCodeP = XML_ERROR_TAG_MISMATCH;
+ } else {
+ --tagLevel;
+ if (endElementHandler && tag->name.str) {
+ if (tag->name.localPart) {
+ XML_Char * to;
+ const XML_Char * from;
+ to = (XML_Char *)tag->name.str + tag->name.uriLen;
+ from = tag->name.localPart;
+ while ((*to++ = *from++) != 0)
+ ;
+ }
+ endElementHandler(handlerArg, tag->name.str);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+
+ while (tag->bindings) {
+ BINDING * const b = tag->bindings;
+ if (endNamespaceDeclHandler)
+ endNamespaceDeclHandler(handlerArg, b->prefix->name);
+ tag->bindings = tag->bindings->nextTagBinding;
+ b->nextTagBinding = freeBindingList;
+ freeBindingList = b;
+ b->prefix->binding = b->prevPrefixBinding;
+ }
+ if (tagLevel == 0) {
+ epilogProcessor(xmlParserP, next, end, nextPtr,
+ errorCodeP, errorP);
+ *doneP = true;
+ } else {
+ *errorCodeP = XML_ERROR_NONE;
+ *doneP = false;
+ }
+ }
}
- encodingBuf[i] = '\0';
- s = encodingBuf;
- }
-#else
- s = protocolEncodingName;
-#endif
- if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s))
- return XML_ERROR_NONE;
- return handleUnknownEncoding(parser, protocolEncodingName);
}
-static enum XML_Error
-processXmlDecl(XML_Parser parser, int isGeneralTextEntity,
- const char *s, const char *next)
-{
- const char *encodingName = 0;
- const ENCODING *newEncoding = 0;
- const char *version;
- int standalone = -1;
- if (!(ns
- ? XmlParseXmlDeclNS
- : XmlParseXmlDecl)(isGeneralTextEntity,
- encoding,
- s,
- next,
- &eventPtr,
- &version,
- &encodingName,
- &newEncoding,
- &standalone))
- return XML_ERROR_SYNTAX;
- if (!isGeneralTextEntity && standalone == 1) {
- dtd.standalone = 1;
-#ifdef XML_DTD
- if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE)
- paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#endif /* XML_DTD */
- }
- if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- if (!protocolEncodingName) {
- if (newEncoding) {
- if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) {
- eventPtr = encodingName;
- return XML_ERROR_INCORRECT_ENCODING;
+
+
+static void
+processContentToken(XML_Parser const xmlParserP,
+ int const tok,
+ const ENCODING * const enc,
+ const char * const s,
+ const char * const end,
+ const char ** const nextP,
+ const char ** const nextPtr,
+ int const startTagLevel,
+ const char ** const eventPP,
+ const char ** const eventEndPP,
+ bool * const doneP,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ *errorP = NULL;
+ *errorCodeP = XML_ERROR_NONE;
+
+ switch (tok) {
+ case XML_TOK_TRAILING_CR:
+ if (nextPtr) {
+ *nextPtr = s;
+ *doneP = true;
+ } else {
+ *eventEndPP = end;
+
+ if (characterDataHandler) {
+ XML_Char c = 0xA;
+ characterDataHandler(handlerArg, &c, 1);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, end);
+
+ if (startTagLevel == 0)
+ *errorCodeP = XML_ERROR_NO_ELEMENTS;
+ else if (tagLevel != startTagLevel) {
+ *errorCodeP = XML_ERROR_ASYNC_ENTITY;
+ } else
+ *doneP = true;
}
- encoding = newEncoding;
+ break;
+ case XML_TOK_NONE:
+ if (nextPtr) {
+ *nextPtr = s;
+ *doneP = true;
+ } else if (startTagLevel > 0) {
+ if (tagLevel != startTagLevel)
+ *errorCodeP = XML_ERROR_ASYNC_ENTITY;
+ else
+ *doneP = true;
+ } else
+ *errorCodeP = XML_ERROR_NO_ELEMENTS;
+ break;
+ case XML_TOK_INVALID:
+ *eventPP = *nextP;
+ *errorCodeP = XML_ERROR_INVALID_TOKEN;
+ xmlrpc_asprintf(errorP, "Invalid token, starting %ld bytes in",
+ (long)(*nextP - s));
+ break;
+ case XML_TOK_PARTIAL:
+ if (nextPtr) {
+ *nextPtr = s;
+ *doneP = true;
+ } else
+ *errorCodeP = XML_ERROR_UNCLOSED_TOKEN;
+ break;
+ case XML_TOK_PARTIAL_CHAR:
+ if (nextPtr) {
+ *nextPtr = s;
+ *doneP = true;
+ } else
+ *errorCodeP = XML_ERROR_PARTIAL_CHAR;
+ break;
+ case XML_TOK_ENTITY_REF:
+ doEntityRef(xmlParserP, enc, s, *nextP, errorCodeP, errorP);
+ break;
+ case XML_TOK_START_TAG_WITH_ATTS:
+ if (!startElementHandler)
+ *errorCodeP = storeAtts(xmlParserP, enc, s, 0, 0);
+ if (*errorCodeP == XML_ERROR_NONE)
+ doStartTagNoAtts(xmlParserP, enc, s, *nextP, nextPtr,
+ errorCodeP, errorP);
+ break;
+ case XML_TOK_START_TAG_NO_ATTS:
+ doStartTagNoAtts(xmlParserP, enc, s, *nextP, nextPtr,
+ errorCodeP, errorP);
+ break;
+ case XML_TOK_EMPTY_ELEMENT_WITH_ATTS:
+ if (!startElementHandler)
+ *errorCodeP = storeAtts(xmlParserP, enc, s, 0, 0);
+
+ if (*errorCodeP == XML_ERROR_NONE)
+ doEmptyElementNoAtts(xmlParserP, enc, s, end, *nextP, nextPtr,
+ eventPP, eventEndPP,
+ doneP, errorCodeP, errorP);
+ break;
+ case XML_TOK_EMPTY_ELEMENT_NO_ATTS:
+ doEmptyElementNoAtts(xmlParserP, enc, s, end, *nextP, nextPtr,
+ eventPP, eventEndPP,
+ doneP, errorCodeP, errorP);
+ break;
+ case XML_TOK_END_TAG:
+ doEndTag(xmlParserP, enc, s, end, *nextP, nextPtr, startTagLevel,
+ eventPP, doneP, errorCodeP, errorP);
+ break;
+ case XML_TOK_CHAR_REF: {
+ int const n = XmlCharRefNumber(enc, s);
+ if (n < 0)
+ *errorCodeP = XML_ERROR_BAD_CHAR_REF;
+ else {
+ if (characterDataHandler) {
+ XML_Char buf[XML_ENCODE_MAX];
+ characterDataHandler(handlerArg, buf,
+ XmlEncode(n, (ICHAR *)buf));
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, *nextP);
+ }
+ } break;
+ case XML_TOK_XML_DECL:
+ *errorCodeP = XML_ERROR_MISPLACED_XML_PI;
+ break;
+ case XML_TOK_DATA_NEWLINE:
+ if (characterDataHandler) {
+ XML_Char c = 0xA;
+ characterDataHandler(handlerArg, &c, 1);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, *nextP);
+ break;
+ case XML_TOK_CDATA_SECT_OPEN: {
+ enum XML_Error result;
+ if (startCdataSectionHandler)
+ startCdataSectionHandler(handlerArg);
+ else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, *nextP);
+ result = doCdataSection(xmlParserP, enc, nextP, end, nextPtr);
+ if (!*nextP) {
+ processor = cdataSectionProcessor;
+ *errorCodeP = result;
+ }
+ } break;
+ case XML_TOK_TRAILING_RSQB:
+ if (nextPtr) {
+ *nextPtr = s;
+ *errorCodeP = XML_ERROR_NONE;
+ } else {
+ if (characterDataHandler) {
+ if (MUST_CONVERT(enc, s)) {
+ const char * from;
+ ICHAR * dataPtr;
+ from = s;
+ dataPtr = (ICHAR *)dataBuf;
+ XmlConvert(enc, &from, end, &dataPtr, (ICHAR *)dataBufEnd);
+ characterDataHandler(handlerArg, dataBuf,
+ dataPtr - (ICHAR *)dataBuf);
+ } else
+ characterDataHandler(handlerArg,
+ (XML_Char *)s,
+ (XML_Char *)end - (XML_Char *)s);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, end);
+
+ if (startTagLevel == 0) {
+ *eventPP = end;
+ *errorCodeP = XML_ERROR_NO_ELEMENTS;
+ } else if (tagLevel != startTagLevel) {
+ *eventPP = end;
+ *errorCodeP = XML_ERROR_ASYNC_ENTITY;
+ } else
+ *doneP = true;
+ }
+ break;
+ case XML_TOK_DATA_CHARS:
+ if (characterDataHandler) {
+ if (MUST_CONVERT(enc, s)) {
+ for (;;) {
+ const char * from;
+ ICHAR * dataPtr;
+ dataPtr = (ICHAR *)dataBuf;
+ from = s;
+ XmlConvert(enc, &from, *nextP, &dataPtr,
+ (ICHAR *)dataBufEnd);
+ *eventEndPP = from;
+ characterDataHandler(handlerArg, dataBuf,
+ dataPtr - (ICHAR *)dataBuf);
+ if (from == *nextP)
+ break;
+ *eventPP = from;
+ }
+ } else
+ characterDataHandler(handlerArg,
+ (XML_Char *)s,
+ (XML_Char *)*nextP - (XML_Char *)s);
+ } else if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, *nextP);
+ break;
+ case XML_TOK_PI:
+ if (!reportProcessingInstruction(xmlParserP, enc, s, *nextP))
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ break;
+ case XML_TOK_COMMENT:
+ if (!reportComment(xmlParserP, enc, s, *nextP))
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ break;
+ default:
+ if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, *nextP);
+ break;
}
- else if (encodingName) {
- enum XML_Error result;
- const XML_Char *s = poolStoreString(&tempPool,
- encoding,
- encodingName,
- encodingName
- + XmlNameLength(encoding, encodingName));
- if (!s)
- return XML_ERROR_NO_MEMORY;
- result = handleUnknownEncoding(parser, s);
- poolDiscard(&tempPool);
- if (result == XML_ERROR_UNKNOWN_ENCODING)
- eventPtr = encodingName;
- return result;
+}
+
+
+
+static void
+doContent(XML_Parser const xmlParserP,
+ int const startTagLevel,
+ const ENCODING * const enc,
+ const char * const startArg,
+ const char * const end,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char **eventPP;
+ const char **eventEndPP;
+ const char * s;
+ bool done;
+
+ if (enc == parser->m_encoding) {
+ eventPP = &eventPtr;
+ eventEndPP = &eventEndPtr;
+ } else {
+ eventPP = &(openInternalEntities->internalEventPtr);
+ eventEndPP = &(openInternalEntities->internalEventEndPtr);
+ }
+
+ s = startArg;
+ *eventPP = s;
+ done = false;
+ *errorCodeP = XML_ERROR_NONE;
+ *errorP = NULL;
+
+ while (*errorCodeP == XML_ERROR_NONE && !done) {
+ int tok;
+ const char * next;
+ const char * error;
+
+ next = s; /* XmlContentTok doesn't always set the last arg */
+ /* XmlContentTok() is normally normal_contentTok(), aka
+ PREFIX(contentTok)() in xmltok/xmltok_impl.c
+ */
+ tok = XmlContentTok(enc, s, end, &next);
+ *eventEndPP = next;
+
+ processContentToken(xmlParserP, tok, enc, s, end, &next, nextPtr,
+ startTagLevel, eventPP, eventEndPP, &done,
+ errorCodeP, &error);
+
+ if (*errorCodeP != XML_ERROR_NONE) {
+ const char * const xmlSample = extractXmlSample(s, end, 40);
+
+ if (error) {
+ xmlrpc_asprintf(errorP, "Problem with token at '%s...': %s",
+ xmlSample, error);
+ xmlrpc_strfree(error);
+ } else
+ xmlrpc_asprintf(errorP, "Problem with token at '%s...': %s",
+ xmlSample,
+ xmlrpc_XML_ErrorString(*errorCodeP));
+
+ xmlrpc_strfree(xmlSample);
+ }
+ *eventPP = s = next;
}
- }
- return XML_ERROR_NONE;
}
-static enum XML_Error
-handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName)
-{
- if (unknownEncodingHandler) {
- XML_Encoding info;
- int i;
- for (i = 0; i < 256; i++)
- info.map[i] = -1;
- info.convert = 0;
- info.data = 0;
- info.release = 0;
- if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) {
- ENCODING *enc;
- unknownEncodingMem = malloc(XmlSizeOfUnknownEncoding());
- if (!unknownEncodingMem) {
- if (info.release)
- info.release(info.data);
- return XML_ERROR_NO_MEMORY;
- }
- enc = (ns
- ? XmlInitUnknownEncodingNS
- : XmlInitUnknownEncoding)(unknownEncodingMem,
- info.map,
- info.convert,
- info.data);
- if (enc) {
- unknownEncodingData = info.data;
- unknownEncodingRelease = info.release;
- encoding = enc;
- return XML_ERROR_NONE;
- }
+
+
+static Processor externalEntityContentProcessor;
+
+static void
+externalEntityContentProcessor(XML_Parser const xmlParserP,
+ const char * const start,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ *errorP = NULL;
+
+ doContent(xmlParserP, 1, parser->m_encoding, start, end, endPtr,
+ errorCodeP, errorP);
+}
+
+
+
+static Processor externalEntityInitProcessor3;
+
+static void
+externalEntityInitProcessor3(XML_Parser const xmlParserP,
+ const char * const startArg,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char * start;
+ const char *next;
+ int tok;
+
+ tok = XmlContentTok(parser->m_encoding, startArg, end, &next);
+
+ *errorP = NULL;
+
+ start = startArg;
+
+ switch (tok) {
+ case XML_TOK_XML_DECL:
+ {
+ enum XML_Error result = processXmlDecl(xmlParserP, 1, start, next);
+ if (result != XML_ERROR_NONE) {
+ *errorCodeP = result;
+ return;
+ }
+ start = next;
+ }
+ break;
+ case XML_TOK_PARTIAL:
+ if (endPtr) {
+ *endPtr = start;
+ *errorCodeP = XML_ERROR_NONE;
+ return;
+ }
+ eventPtr = start;
+ *errorCodeP = XML_ERROR_UNCLOSED_TOKEN;
+ return;
+ case XML_TOK_PARTIAL_CHAR:
+ if (endPtr) {
+ *endPtr = start;
+ *errorCodeP = XML_ERROR_NONE;
+ return;
+ }
+ eventPtr = start;
+ *errorCodeP = XML_ERROR_PARTIAL_CHAR;
+ return;
+ }
+ processor = externalEntityContentProcessor;
+ tagLevel = 1;
+ doContent(xmlParserP, 1, parser->m_encoding, start, end, endPtr,
+ errorCodeP, errorP);
+}
+
+
+
+static Processor externalEntityInitProcessor2;
+
+static void
+externalEntityInitProcessor2(XML_Parser const xmlParserP,
+ const char * const startArg,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *)xmlParserP;
+
+ const char * start;
+ const char * next;
+ int tok;
+
+ tok = XmlContentTok(parser->m_encoding, startArg, end, &next);
+
+ start = startArg;
+
+ switch (tok) {
+ case XML_TOK_BOM:
+ start = next;
+ break;
+ case XML_TOK_PARTIAL:
+ if (endPtr) {
+ *endPtr = start;
+ *errorCodeP = XML_ERROR_NONE;
+ *errorP = NULL;
+ } else {
+ eventPtr = start;
+ *errorCodeP = XML_ERROR_UNCLOSED_TOKEN;
+ *errorP = NULL;
+ }
+ return;
+ case XML_TOK_PARTIAL_CHAR:
+ if (endPtr) {
+ *endPtr = start;
+ *errorCodeP = XML_ERROR_NONE;
+ *errorP = NULL;
+ } else {
+ eventPtr = start;
+ *errorCodeP = XML_ERROR_PARTIAL_CHAR;
+ *errorP = NULL;
+ }
+ return;
+ }
+ processor = externalEntityInitProcessor3;
+ externalEntityInitProcessor3(xmlParserP, start, end, endPtr,
+ errorCodeP, errorP);
+}
+
+
+
+static Processor externalEntityInitProcessor;
+
+static void
+externalEntityInitProcessor(XML_Parser const parser,
+ const char * const start,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ enum XML_Error result;
+
+ result = initializeEncoding(parser);
+
+ if (result != XML_ERROR_NONE) {
+ *errorCodeP = result;
+ *errorP = NULL;
+ } else {
+ processor = externalEntityInitProcessor2;
+
+ externalEntityInitProcessor2(parser, start, end, endPtr,
+ errorCodeP, errorP);
}
- if (info.release)
- info.release(info.data);
- }
- return XML_ERROR_UNKNOWN_ENCODING;
}
+
+
static enum XML_Error
-prologInitProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- enum XML_Error result = initializeEncoding(parser);
- if (result != XML_ERROR_NONE)
- return result;
- processor = prologProcessor;
- return prologProcessor(parser, s, end, nextPtr);
+doIgnoreSection(XML_Parser const xmlParserP,
+ const ENCODING * const enc,
+ const char ** const startPtr,
+ const char * const end,
+ const char ** const nextPtr) {
+/*----------------------------------------------------------------------------
+
+ We set *startPtr to non-null is the section is closed, and to null if
+ the section is not yet closed.
+-----------------------------------------------------------------------------*/
+ Parser * const parser = (Parser *) xmlParserP;
+ const char * const s = *startPtr;
+
+ enum XML_Error retval;
+ const char * next;
+ int tok;
+ const char ** eventPP;
+ const char ** eventEndPP;
+
+ if (enc == parser->m_encoding) {
+ eventPP = &eventPtr;
+ eventEndPP = &eventEndPtr;
+ } else {
+ eventPP = &(openInternalEntities->internalEventPtr);
+ eventEndPP = &(openInternalEntities->internalEventEndPtr);
+ }
+ *eventPP = s;
+ *startPtr = '\0';
+ tok = XmlIgnoreSectionTok(enc, s, end, &next);
+ *eventEndPP = next;
+
+ switch (tok) {
+ case XML_TOK_IGNORE_SECT:
+ if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+ *startPtr = next;
+ retval = XML_ERROR_NONE;
+ break;
+ case XML_TOK_INVALID:
+ *eventPP = next;
+ retval = XML_ERROR_INVALID_TOKEN;
+ break;
+ case XML_TOK_PARTIAL_CHAR:
+ if (nextPtr) {
+ *nextPtr = s;
+ retval = XML_ERROR_NONE;
+ } else
+ retval = XML_ERROR_PARTIAL_CHAR;
+ break;
+ case XML_TOK_PARTIAL:
+ case XML_TOK_NONE:
+ if (nextPtr) {
+ *nextPtr = s;
+ retval = XML_ERROR_NONE;
+ } else
+ retval = XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */
+ break;
+ default:
+ assert(false); /* All possibilities are handled above */
+ retval = 99; /* quiet compiler warning */
+ }
+
+ return retval;
+}
+
+
+
+static Processor prologProcessor;
+
+
+/* The idea here is to avoid using stack for each IGNORE section when
+the whole file is parsed with one call. */
+
+static Processor ignoreSectionProcessor;
+
+static void
+ignoreSectionProcessor(XML_Parser const xmlParserP,
+ const char * const startArg,
+ const char * const end,
+ const char ** const endPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ enum XML_Error result;
+ const char * start;
+
+ start = startArg; /* initial value */
+
+ result = doIgnoreSection(parser, parser->m_encoding, &start, end, endPtr);
+
+ if (start) {
+ processor = prologProcessor;
+ prologProcessor(xmlParserP, start, end, endPtr, errorCodeP, errorP);
+ } else {
+ *errorCodeP = result;
+ *errorP = NULL;
+ }
}
-static enum XML_Error
-prologProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- const char *next;
- int tok = XmlPrologTok(encoding, s, end, &next);
- return doProlog(parser, encoding, s, end, tok, next, nextPtr);
-}
-static enum XML_Error
-doProlog(XML_Parser parser,
- const ENCODING *enc,
- const char *s,
- const char *end,
- int tok,
- const char *next,
- const char **nextPtr)
-{
-#ifdef XML_DTD
+
+/* Forward declaration for recursive reference: */
+static void
+processInternalParamEntity(XML_Parser const parser,
+ ENTITY * const entity,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP);
+
+static void
+doProlog(XML_Parser const xmlParserP,
+ const ENCODING * const encArg,
+ const char * const startArg,
+ const char * const end,
+ int const tokArg,
+ const char * const nextArg,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ int tok;
+ const char * next;
+ const ENCODING * enc;
+ const char * s;
+
static const XML_Char externalSubsetName[] = { '#' , '\0' };
-#endif /* XML_DTD */
const char **eventPP;
const char **eventEndPP;
- if (enc == encoding) {
+
+ *errorP = NULL;
+
+ tok = tokArg;
+ next = nextArg;
+ enc = encArg;
+ s = startArg;
+
+ if (enc == parser->m_encoding) {
eventPP = &eventPtr;
eventEndPP = &eventEndPtr;
}
@@ -2238,138 +3220,164 @@
*eventEndPP = next;
if (tok <= 0) {
if (nextPtr != 0 && tok != XML_TOK_INVALID) {
- *nextPtr = s;
- return XML_ERROR_NONE;
+ *nextPtr = s;
+ *errorCodeP = XML_ERROR_NONE;
+ return;
}
switch (tok) {
case XML_TOK_INVALID:
- *eventPP = next;
- return XML_ERROR_INVALID_TOKEN;
+ *eventPP = next;
+ *errorCodeP = XML_ERROR_INVALID_TOKEN;
+ return;
case XML_TOK_PARTIAL:
- return XML_ERROR_UNCLOSED_TOKEN;
+ *errorCodeP = XML_ERROR_UNCLOSED_TOKEN;
+ return;
case XML_TOK_PARTIAL_CHAR:
- return XML_ERROR_PARTIAL_CHAR;
+ *errorCodeP = XML_ERROR_PARTIAL_CHAR;
+ return;
case XML_TOK_NONE:
-#ifdef XML_DTD
- if (enc != encoding)
- return XML_ERROR_NONE;
- if (parentParser) {
- if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
- == XML_ROLE_ERROR)
- return XML_ERROR_SYNTAX;
- hadExternalDoctype = 0;
- return XML_ERROR_NONE;
- }
-#endif /* XML_DTD */
- return XML_ERROR_NO_ELEMENTS;
+ if (enc != parser->m_encoding)
+ *errorCodeP = XML_ERROR_NONE;
+ else {
+ if (parentParser) {
+ if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc)
+ == XML_ROLE_ERROR) {
+ *errorCodeP = XML_ERROR_SYNTAX;
+ } else {
+ *errorCodeP = XML_ERROR_NONE;
+ hadExternalDoctype = 0;
+ }
+ } else
+ *errorCodeP = XML_ERROR_NO_ELEMENTS;
+ }
+ return;
default:
- tok = -tok;
- next = end;
- break;
+ tok = -tok;
+ next = end;
+ break;
}
}
role = XmlTokenRole(&prologState, tok, s, next, enc);
switch (role) {
- case XML_ROLE_XML_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 0, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
+ case XML_ROLE_XML_DECL: {
+ enum XML_Error result = processXmlDecl(xmlParserP, 0, s, next);
+ if (result != XML_ERROR_NONE) {
+ *errorCodeP = result;
+ return;
+ }
+ enc = parser->m_encoding;
}
break;
case XML_ROLE_DOCTYPE_NAME:
if (startDoctypeDeclHandler) {
- const XML_Char *name = poolStoreString(&tempPool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- startDoctypeDeclHandler(handlerArg, name);
- poolClear(&tempPool);
- }
- break;
-#ifdef XML_DTD
- case XML_ROLE_TEXT_DECL:
- {
- enum XML_Error result = processXmlDecl(parser, 1, s, next);
- if (result != XML_ERROR_NONE)
- return result;
- enc = encoding;
+ const XML_Char *name = poolStoreString(&tempPool, enc, s, next);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ startDoctypeDeclHandler(handlerArg, name);
+ poolClear(&tempPool);
+ }
+ break;
+ case XML_ROLE_TEXT_DECL: {
+ enum XML_Error result = processXmlDecl(xmlParserP, 1, s, next);
+ if (result != XML_ERROR_NONE) {
+ *errorCodeP = result;
+ return;
+ }
+ enc = parser->m_encoding;
}
break;
-#endif /* XML_DTD */
case XML_ROLE_DOCTYPE_PUBLIC_ID:
-#ifdef XML_DTD
declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
-#endif /* XML_DTD */
+ externalSubsetName,
+ sizeof(ENTITY));
+ if (!declEntity) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
/* fall through */
case XML_ROLE_ENTITY_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
+ if (!XmlIsPublicId(enc, s, next, eventPP)) {
+ *errorCodeP = XML_ERROR_SYNTAX;
+ return;
+ }
if (declEntity) {
- XML_Char *tem = poolStoreString(&dtd.pool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declEntity->publicId = tem;
- poolFinish(&dtd.pool);
+ XML_Char *tem = poolStoreString(&dtd.pool,
+ enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!tem) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ normalizePublicId(tem);
+ declEntity->publicId = tem;
+ poolFinish(&dtd.pool);
}
break;
case XML_ROLE_DOCTYPE_CLOSE:
if (dtd.complete && hadExternalDoctype) {
- dtd.complete = 0;
-#ifdef XML_DTD
- if (paramEntityParsing && externalEntityRefHandler) {
- ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- 0);
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId))
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- }
-#endif /* XML_DTD */
- if (!dtd.complete
- && !dtd.standalone
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
+ dtd.complete = 0;
+ if (paramEntityParsing && externalEntityRefHandler) {
+ ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities,
+ externalSubsetName,
+ 0);
+ if (!externalEntityRefHandler(externalEntityRefHandlerArg,
+ 0,
+ entity->base,
+ entity->systemId,
+ entity->publicId)) {
+ *errorCodeP = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+ return;
+ }
+ }
+ if (!dtd.complete
+ && !dtd.standalone
+ && notStandaloneHandler
+ && !notStandaloneHandler(handlerArg)) {
+ *errorCodeP = XML_ERROR_NOT_STANDALONE;
+ return;
+ }
}
if (endDoctypeDeclHandler)
- endDoctypeDeclHandler(handlerArg);
+ endDoctypeDeclHandler(handlerArg);
break;
- case XML_ROLE_INSTANCE_START:
+ case XML_ROLE_INSTANCE_START: {
processor = contentProcessor;
- return contentProcessor(parser, s, end, nextPtr);
+ contentProcessor(xmlParserP, s, end, nextPtr, errorCodeP, errorP);
+ return;
+ }
case XML_ROLE_ATTLIST_ELEMENT_NAME:
{
- const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- declElementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE));
- if (!declElementType)
- return XML_ERROR_NO_MEMORY;
- if (declElementType->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!setElementTypePrefix(parser, declElementType))
- return XML_ERROR_NO_MEMORY;
- }
- break;
+ const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ declElementType = (ELEMENT_TYPE *)
+ lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE));
+ if (!declElementType) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ if (declElementType->name != name)
+ poolDiscard(&dtd.pool);
+ else {
+ poolFinish(&dtd.pool);
+ if (!setElementTypePrefix(xmlParserP, declElementType)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ }
+ break;
}
case XML_ROLE_ATTRIBUTE_NAME:
- declAttributeId = getAttributeId(parser, enc, s, next);
- if (!declAttributeId)
- return XML_ERROR_NO_MEMORY;
+ declAttributeId = getAttributeId(xmlParserP, enc, s, next);
+ if (!declAttributeId) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
declAttributeIsCdata = 0;
declAttributeIsId = 0;
break;
@@ -2382,323 +3390,366 @@
case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE:
case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE:
if (dtd.complete
- && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata,
- declAttributeIsId, 0))
- return XML_ERROR_NO_MEMORY;
+ && !defineAttribute(declElementType, declAttributeId,
+ declAttributeIsCdata,
+ declAttributeIsId, 0)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
break;
case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE:
case XML_ROLE_FIXED_ATTRIBUTE_VALUE:
{
- const XML_Char *attVal;
- enum XML_Error result
- = storeAttributeValue(parser, enc, declAttributeIsCdata,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar,
- &dtd.pool);
- if (result)
- return result;
- attVal = poolStart(&dtd.pool);
- poolFinish(&dtd.pool);
- if (dtd.complete
- /* ID attributes aren't allowed to have a default */
- && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0, attVal))
- return XML_ERROR_NO_MEMORY;
- break;
+ const XML_Char *attVal;
+ enum XML_Error result
+ = storeAttributeValue(xmlParserP, enc, declAttributeIsCdata,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar,
+ &dtd.pool);
+ if (result) {
+ *errorCodeP = result;
+ return;
+ }
+ attVal = poolStart(&dtd.pool);
+ poolFinish(&dtd.pool);
+ if (dtd.complete
+ /* ID attributes aren't allowed to have a default */
+ && !defineAttribute(declElementType, declAttributeId,
+ declAttributeIsCdata, 0, attVal)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ break;
}
case XML_ROLE_ENTITY_VALUE:
{
- enum XML_Error result = storeEntityValue(parser, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (declEntity) {
- declEntity->textPtr = poolStart(&dtd.pool);
- declEntity->textLen = poolLength(&dtd.pool);
- poolFinish(&dtd.pool);
- if (internalParsedEntityDeclHandler
- /* Check it's not a parameter entity */
- && ((ENTITY *)lookup(&dtd.generalEntities, declEntity->name, 0)
- == declEntity)) {
- *eventEndPP = s;
- internalParsedEntityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->textPtr,
- declEntity->textLen);
- }
- }
- else
- poolDiscard(&dtd.pool);
- if (result != XML_ERROR_NONE)
- return result;
+ enum XML_Error result = storeEntityValue(xmlParserP, enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (declEntity) {
+ declEntity->textPtr = poolStart(&dtd.pool);
+ declEntity->textLen = poolLength(&dtd.pool);
+ poolFinish(&dtd.pool);
+ if (internalParsedEntityDeclHandler
+ /* Check it's not a parameter entity */
+ && ((ENTITY *)lookup(&dtd.generalEntities, declEntity->name, 0)
+ == declEntity)) {
+ *eventEndPP = s;
+ internalParsedEntityDeclHandler(handlerArg,
+ declEntity->name,
+ declEntity->textPtr,
+ declEntity->textLen);
+ }
+ }
+ else
+ poolDiscard(&dtd.pool);
+ if (result != XML_ERROR_NONE) {
+ *errorCodeP = result;
+ return;
+ }
}
break;
case XML_ROLE_DOCTYPE_SYSTEM_ID:
if (!dtd.standalone
-#ifdef XML_DTD
- && !paramEntityParsing
-#endif /* XML_DTD */
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
+ && !paramEntityParsing
+ && notStandaloneHandler
+ && !notStandaloneHandler(handlerArg)) {
+ *errorCodeP = XML_ERROR_NOT_STANDALONE;
+ return;
+ }
hadExternalDoctype = 1;
-#ifndef XML_DTD
- break;
-#else /* XML_DTD */
if (!declEntity) {
- declEntity = (ENTITY *)lookup(&dtd.paramEntities,
- externalSubsetName,
- sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
+ declEntity = (ENTITY *)lookup(&dtd.paramEntities,
+ externalSubsetName,
+ sizeof(ENTITY));
+ if (!declEntity) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
}
/* fall through */
-#endif /* XML_DTD */
case XML_ROLE_ENTITY_SYSTEM_ID:
if (declEntity) {
- declEntity->systemId = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!declEntity->systemId)
- return XML_ERROR_NO_MEMORY;
- declEntity->base = curBase;
- poolFinish(&dtd.pool);
+ declEntity->systemId = poolStoreString(&dtd.pool, enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!declEntity->systemId) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ declEntity->base = curBase;
+ poolFinish(&dtd.pool);
}
break;
case XML_ROLE_ENTITY_NOTATION_NAME:
if (declEntity) {
- declEntity->notation = poolStoreString(&dtd.pool, enc, s, next);
- if (!declEntity->notation)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&dtd.pool);
- if (unparsedEntityDeclHandler) {
- *eventEndPP = s;
- unparsedEntityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId,
- declEntity->notation);
- }
+ declEntity->notation = poolStoreString(&dtd.pool, enc, s, next);
+ if (!declEntity->notation) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ poolFinish(&dtd.pool);
+ if (unparsedEntityDeclHandler) {
+ *eventEndPP = s;
+ unparsedEntityDeclHandler(handlerArg,
+ declEntity->name,
+ declEntity->base,
+ declEntity->systemId,
+ declEntity->publicId,
+ declEntity->notation);
+ }
}
break;
case XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION:
if (declEntity && externalParsedEntityDeclHandler) {
- *eventEndPP = s;
- externalParsedEntityDeclHandler(handlerArg,
- declEntity->name,
- declEntity->base,
- declEntity->systemId,
- declEntity->publicId);
+ *eventEndPP = s;
+ externalParsedEntityDeclHandler(handlerArg,
+ declEntity->name,
+ declEntity->base,
+ declEntity->systemId,
+ declEntity->publicId);
}
break;
case XML_ROLE_GENERAL_ENTITY_NAME:
{
- const XML_Char *name;
- if (XmlPredefinedEntityName(enc, s, next)) {
- declEntity = 0;
- break;
- }
- name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- if (dtd.complete) {
- declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
- else
- poolFinish(&dtd.pool);
- }
- else {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
+ const XML_Char *name;
+ if (XmlPredefinedEntityName(enc, s, next)) {
+ declEntity = 0;
+ break;
+ }
+ name = poolStoreString(&dtd.pool, enc, s, next);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ if (dtd.complete) {
+ declEntity = (ENTITY *)
+ lookup(&dtd.generalEntities, name, sizeof(ENTITY));
+ if (!declEntity) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ if (declEntity->name != name) {
+ poolDiscard(&dtd.pool);
+ declEntity = 0;
+ }
+ else
+ poolFinish(&dtd.pool);
+ }
+ else {
+ poolDiscard(&dtd.pool);
+ declEntity = 0;
+ }
}
break;
case XML_ROLE_PARAM_ENTITY_NAME:
-#ifdef XML_DTD
if (dtd.complete) {
- const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- declEntity = (ENTITY *)lookup(&dtd.paramEntities, name, sizeof(ENTITY));
- if (!declEntity)
- return XML_ERROR_NO_MEMORY;
- if (declEntity->name != name) {
- poolDiscard(&dtd.pool);
- declEntity = 0;
- }
- else
- poolFinish(&dtd.pool);
- }
-#else /* not XML_DTD */
- declEntity = 0;
-#endif /* not XML_DTD */
+ const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ declEntity = (ENTITY *)
+ lookup(&dtd.paramEntities, name, sizeof(ENTITY));
+ if (!declEntity) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ if (declEntity->name != name) {
+ poolDiscard(&dtd.pool);
+ declEntity = 0;
+ }
+ else
+ poolFinish(&dtd.pool);
+ }
break;
case XML_ROLE_NOTATION_NAME:
declNotationPublicId = 0;
declNotationName = 0;
if (notationDeclHandler) {
- declNotationName = poolStoreString(&tempPool, enc, s, next);
- if (!declNotationName)
- return XML_ERROR_NO_MEMORY;
- poolFinish(&tempPool);
+ declNotationName = poolStoreString(&tempPool, enc, s, next);
+ if (!declNotationName) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ poolFinish(&tempPool);
}
break;
case XML_ROLE_NOTATION_PUBLIC_ID:
- if (!XmlIsPublicId(enc, s, next, eventPP))
- return XML_ERROR_SYNTAX;
+ if (!XmlIsPublicId(enc, s, next, eventPP)) {
+ *errorCodeP = XML_ERROR_SYNTAX;
+ return;
+ }
if (declNotationName) {
- XML_Char *tem = poolStoreString(&tempPool,
- enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!tem)
- return XML_ERROR_NO_MEMORY;
- normalizePublicId(tem);
- declNotationPublicId = tem;
- poolFinish(&tempPool);
+ XML_Char *tem = poolStoreString(&tempPool,
+ enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!tem) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ normalizePublicId(tem);
+ declNotationPublicId = tem;
+ poolFinish(&tempPool);
}
break;
case XML_ROLE_NOTATION_SYSTEM_ID:
if (declNotationName && notationDeclHandler) {
- const XML_Char *systemId
- = poolStoreString(&tempPool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!systemId)
- return XML_ERROR_NO_MEMORY;
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- systemId,
- declNotationPublicId);
+ const XML_Char *systemId
+ = poolStoreString(&tempPool, enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!systemId) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ *eventEndPP = s;
+ notationDeclHandler(handlerArg,
+ declNotationName,
+ curBase,
+ systemId,
+ declNotationPublicId);
}
poolClear(&tempPool);
break;
case XML_ROLE_NOTATION_NO_SYSTEM_ID:
if (declNotationPublicId && notationDeclHandler) {
- *eventEndPP = s;
- notationDeclHandler(handlerArg,
- declNotationName,
- curBase,
- 0,
- declNotationPublicId);
+ *eventEndPP = s;
+ notationDeclHandler(handlerArg,
+ declNotationName,
+ curBase,
+ 0,
+ declNotationPublicId);
}
poolClear(&tempPool);
break;
case XML_ROLE_ERROR:
switch (tok) {
case XML_TOK_PARAM_ENTITY_REF:
- return XML_ERROR_PARAM_ENTITY_REF;
+ *errorCodeP = XML_ERROR_PARAM_ENTITY_REF;
case XML_TOK_XML_DECL:
- return XML_ERROR_MISPLACED_XML_PI;
+ *errorCodeP = XML_ERROR_MISPLACED_XML_PI;
default:
- return XML_ERROR_SYNTAX;
+ *errorCodeP = XML_ERROR_SYNTAX;
}
-#ifdef XML_DTD
+ return;
case XML_ROLE_IGNORE_SECT:
{
- enum XML_Error result;
- if (defaultHandler)
- reportDefault(parser, enc, s, next);
- result = doIgnoreSection(parser, enc, &next, end, nextPtr);
- if (!next) {
- processor = ignoreSectionProcessor;
- return result;
- }
+ enum XML_Error result;
+ if (defaultHandler)
+ reportDefault(xmlParserP, enc, s, next);
+ result = doIgnoreSection(xmlParserP, enc, &next, end, nextPtr);
+ if (!next) {
+ processor = ignoreSectionProcessor;
+ *errorCodeP = result;
+ return;
+ }
}
break;
-#endif /* XML_DTD */
case XML_ROLE_GROUP_OPEN:
if (prologState.level >= groupSize) {
- if (groupSize)
- groupConnector = realloc(groupConnector, groupSize *= 2);
- else
- groupConnector = malloc(groupSize = 32);
- if (!groupConnector)
- return XML_ERROR_NO_MEMORY;
+ if (groupSize)
+ groupConnector = realloc(groupConnector, groupSize *= 2);
+ else
+ groupConnector = malloc(groupSize = 32);
+ if (!groupConnector) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
}
groupConnector[prologState.level] = 0;
break;
case XML_ROLE_GROUP_SEQUENCE:
- if (groupConnector[prologState.level] == '|')
- return XML_ERROR_SYNTAX;
+ if (groupConnector[prologState.level] == '|') {
+ *errorCodeP = XML_ERROR_SYNTAX;
+ return;
+ }
groupConnector[prologState.level] = ',';
break;
case XML_ROLE_GROUP_CHOICE:
- if (groupConnector[prologState.level] == ',')
- return XML_ERROR_SYNTAX;
+ if (groupConnector[prologState.level] == ',') {
+ *errorCodeP = XML_ERROR_SYNTAX;
+ return;
+ }
groupConnector[prologState.level] = '|';
break;
case XML_ROLE_PARAM_ENTITY_REF:
-#ifdef XML_DTD
case XML_ROLE_INNER_PARAM_ENTITY_REF:
if (paramEntityParsing
- && (dtd.complete || role == XML_ROLE_INNER_PARAM_ENTITY_REF)) {
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&dtd.pool, enc,
- s + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&dtd.pool);
- if (!entity) {
- /* FIXME what to do if !dtd.complete? */
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- if (entity->open)
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- if (entity->textPtr) {
- enum XML_Error result;
- result = processInternalParamEntity(parser, entity);
- if (result != XML_ERROR_NONE)
- return result;
- break;
- }
- if (role == XML_ROLE_INNER_PARAM_ENTITY_REF)
- return XML_ERROR_PARAM_ENTITY_REF;
- if (externalEntityRefHandler) {
- dtd.complete = 0;
- entity->open = 1;
- if (!externalEntityRefHandler(externalEntityRefHandlerArg,
- 0,
- entity->base,
- entity->systemId,
- entity->publicId)) {
- entity->open = 0;
- return XML_ERROR_EXTERNAL_ENTITY_HANDLING;
- }
- entity->open = 0;
- if (dtd.complete)
- break;
- }
+ && (dtd.complete || role == XML_ROLE_INNER_PARAM_ENTITY_REF)) {
+ const XML_Char *name;
+ ENTITY *entity;
+ name = poolStoreString(&dtd.pool, enc,
+ s + enc->minBytesPerChar,
+ next - enc->minBytesPerChar);
+ if (!name) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
+ poolDiscard(&dtd.pool);
+ if (!entity) {
+ /* FIXME what to do if !dtd.complete? */
+ *errorCodeP = XML_ERROR_UNDEFINED_ENTITY;
+ return;
+ }
+ if (entity->open) {
+ *errorCodeP = XML_ERROR_RECURSIVE_ENTITY_REF;
+ return;
+ }
+ if (entity->textPtr) {
+ processInternalParamEntity(xmlParserP, entity, errorCodeP, errorP);
+ if (*errorCodeP != XML_ERROR_NONE)
+ return;
+ break;
+ }
+ if (role == XML_ROLE_INNER_PARAM_ENTITY_REF) {
+ *errorCodeP = XML_ERROR_PARAM_ENTITY_REF;
+ return;
+ }
+ if (externalEntityRefHandler) {
+ dtd.complete = 0;
+ entity->open = 1;
+ if (!externalEntityRefHandler(externalEntityRefHandlerArg,
+ 0,
+ entity->base,
+ entity->systemId,
+ entity->publicId)) {
+ entity->open = 0;
+ *errorCodeP = XML_ERROR_EXTERNAL_ENTITY_HANDLING;
+ return;
+ }
+ entity->open = 0;
+ if (dtd.complete)
+ break;
+ }
}
-#endif /* XML_DTD */
if (!dtd.standalone
- && notStandaloneHandler
- && !notStandaloneHandler(handlerArg))
- return XML_ERROR_NOT_STANDALONE;
+ && notStandaloneHandler
+ && !notStandaloneHandler(handlerArg)) {
+ *errorCodeP = XML_ERROR_NOT_STANDALONE;
+ return;
+ }
dtd.complete = 0;
if (defaultHandler)
- reportDefault(parser, enc, s, next);
+ reportDefault(xmlParserP, enc, s, next);
break;
case XML_ROLE_NONE:
switch (tok) {
case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
+ if (!reportProcessingInstruction(xmlParserP, enc, s, next)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ break;
case XML_TOK_COMMENT:
- if (!reportComment(parser, enc, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
+ if (!reportComment(xmlParserP, enc, s, next)) {
+ *errorCodeP = XML_ERROR_NO_MEMORY;
+ return;
+ }
+ break;
}
break;
}
@@ -2708,16 +3759,12 @@
case XML_TOK_COMMENT:
case XML_TOK_BOM:
case XML_TOK_XML_DECL:
-#ifdef XML_DTD
case XML_TOK_IGNORE_SECT:
-#endif /* XML_DTD */
case XML_TOK_PARAM_ENTITY_REF:
- break;
+ break;
default:
-#ifdef XML_DTD
- if (role != XML_ROLE_IGNORE_SECT)
-#endif /* XML_DTD */
- reportDefault(parser, enc, s, next);
+ if (role != XML_ROLE_IGNORE_SECT)
+ reportDefault(xmlParserP, enc, s, next);
}
}
s = next;
@@ -2726,1200 +3773,886 @@
/* not reached */
}
-static
-enum XML_Error epilogProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
-{
- processor = epilogProcessor;
- eventPtr = s;
- for (;;) {
- const char *next;
- int tok = XmlPrologTok(encoding, s, end, &next);
- eventEndPtr = next;
- switch (tok) {
- case -XML_TOK_PROLOG_S:
- if (defaultHandler) {
- eventEndPtr = end;
- reportDefault(parser, encoding, s, end);
- }
- /* fall through */
- case XML_TOK_NONE:
- if (nextPtr)
- *nextPtr = end;
- return XML_ERROR_NONE;
- case XML_TOK_PROLOG_S:
- if (defaultHandler)
- reportDefault(parser, encoding, s, next);
- break;
- case XML_TOK_PI:
- if (!reportProcessingInstruction(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_COMMENT:
- if (!reportComment(parser, encoding, s, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_INVALID:
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_UNCLOSED_TOKEN;
- case XML_TOK_PARTIAL_CHAR:
- if (nextPtr) {
- *nextPtr = s;
- return XML_ERROR_NONE;
- }
- return XML_ERROR_PARTIAL_CHAR;
- default:
- return XML_ERROR_JUNK_AFTER_DOC_ELEMENT;
+
+
+static Processor prologProcessor;
+
+static void
+prologProcessor(XML_Parser const xmlParserP,
+ const char * const s,
+ const char * const end,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ const char * next;
+ int tok;
+
+ *errorP = NULL;
+
+ tok = XmlPrologTok(parser->m_encoding, s, end, &next);
+
+ doProlog(xmlParserP, parser->m_encoding, s, end, tok, next, nextPtr,
+ errorCodeP, errorP);
+}
+
+
+
+static Processor prologInitProcessor;
+
+static void
+prologInitProcessor(XML_Parser const parser,
+ const char * const s,
+ const char * const end,
+ const char ** const nextPtr,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ enum XML_Error result;
+
+ *errorP = NULL;
+
+ result = initializeEncoding(parser);
+
+ if (result != XML_ERROR_NONE)
+ *errorCodeP = result;
+ else {
+ processor = prologProcessor;
+ prologProcessor(parser, s, end, nextPtr, errorCodeP, errorP);
}
- eventPtr = s = next;
- }
}
-#ifdef XML_DTD
-static enum XML_Error
-processInternalParamEntity(XML_Parser parser, ENTITY *entity)
-{
- const char *s, *end, *next;
- int tok;
- enum XML_Error result;
- OPEN_INTERNAL_ENTITY openEntity;
- entity->open = 1;
- openEntity.next = openInternalEntities;
- openInternalEntities = &openEntity;
- openEntity.entity = entity;
- openEntity.internalEventPtr = 0;
- openEntity.internalEventEndPtr = 0;
- s = (char *)entity->textPtr;
- end = (char *)(entity->textPtr + entity->textLen);
- tok = XmlPrologTok(internalEncoding, s, end, &next);
- result = doProlog(parser, internalEncoding, s, end, tok, next, 0);
- entity->open = 0;
- openInternalEntities = openEntity.next;
- return result;
+
+static void
+processInternalParamEntity(XML_Parser const parser,
+ ENTITY * const entity,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
+
+ const char *s, *end, *next;
+ int tok;
+ OPEN_INTERNAL_ENTITY openEntity;
+
+ entity->open = 1;
+ openEntity.next = openInternalEntities;
+ openInternalEntities = &openEntity;
+ openEntity.entity = entity;
+ openEntity.internalEventPtr = 0;
+ openEntity.internalEventEndPtr = 0;
+ s = (char *)entity->textPtr;
+ end = (char *)(entity->textPtr + entity->textLen);
+ tok = XmlPrologTok(internalEncoding, s, end, &next);
+
+ doProlog(parser, internalEncoding, s, end, tok, next, 0,
+ errorCodeP, errorP);
+
+ entity->open = 0;
+ openInternalEntities = openEntity.next;
+}
+
+
+
+XML_Parser
+xmlrpc_XML_ParserCreate(const XML_Char * const encodingName) {
+
+ XML_Parser const xmlParserP = malloc(sizeof(Parser));
+ Parser * const parser = (Parser *)xmlParserP;
+ if (xmlParserP) {
+ processor = prologInitProcessor;
+ xmlrpc_XmlPrologStateInit(&prologState);
+ userData = 0;
+ handlerArg = 0;
+ startElementHandler = 0;
+ endElementHandler = 0;
+ characterDataHandler = 0;
+ processingInstructionHandler = 0;
+ commentHandler = 0;
+ startCdataSectionHandler = 0;
+ endCdataSectionHandler = 0;
+ defaultHandler = 0;
+ startDoctypeDeclHandler = 0;
+ endDoctypeDeclHandler = 0;
+ unparsedEntityDeclHandler = 0;
+ notationDeclHandler = 0;
+ externalParsedEntityDeclHandler = 0;
+ internalParsedEntityDeclHandler = 0;
+ startNamespaceDeclHandler = 0;
+ endNamespaceDeclHandler = 0;
+ notStandaloneHandler = 0;
+ externalEntityRefHandler = 0;
+ externalEntityRefHandlerArg = parser;
+ unknownEncodingHandler = 0;
+ buffer = 0;
+ bufferPtr = 0;
+ bufferEnd = 0;
+ parseEndByteIndex = 0;
+ parseEndPtr = 0;
+ bufferLim = 0;
+ declElementType = 0;
+ declAttributeId = 0;
+ declEntity = 0;
+ declNotationName = 0;
+ declNotationPublicId = 0;
+ memset(&position, 0, sizeof(POSITION));
+ errorCode = XML_ERROR_NONE;
+ errorString = NULL;
+ eventPtr = 0;
+ eventEndPtr = 0;
+ positionPtr = 0;
+ openInternalEntities = 0;
+ tagLevel = 0;
+ tagStack = 0;
+ freeTagList = 0;
+ freeBindingList = 0;
+ inheritedBindings = 0;
+ attsSize = INIT_ATTS_SIZE;
+ atts = malloc(attsSize * sizeof(ATTRIBUTE));
+ nSpecifiedAtts = 0;
+ dataBuf = malloc(INIT_DATA_BUF_SIZE * sizeof(XML_Char));
+ groupSize = 0;
+ groupConnector = 0;
+ hadExternalDoctype = 0;
+ unknownEncodingMem = 0;
+ unknownEncodingRelease = 0;
+ unknownEncodingData = 0;
+ unknownEncodingHandlerData = 0;
+ namespaceSeparator = '!';
+ parentParser = 0;
+ paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
+ ns = 0;
+ poolInit(&tempPool);
+ poolInit(&temp2Pool);
+ protocolEncodingName =
+ encodingName ? poolCopyString(&tempPool, encodingName) : 0;
+ curBase = 0;
+ if (!dtdInit(&dtd) || !atts || !dataBuf
+ || (encodingName && !protocolEncodingName)) {
+ xmlrpc_XML_ParserFree(xmlParserP);
+ return 0;
+ }
+ dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE;
+ xmlrpc_XmlInitEncoding(&parser->m_initEncoding,
+ &parser->m_encoding,
+ 0);
+ internalEncoding = XmlGetInternalEncoding();
+ }
+ return xmlParserP;
+}
+
+XML_Parser
+xmlrpc_XML_ParserCreateNS(const XML_Char * const encodingName,
+ XML_Char const nsSep) {
+
+ static
+ const XML_Char implicitContext[] = {
+ XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='),
+ XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'),
+ XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'),
+ XML_T('.'), XML_T('w'), XML_T('3'),
+ XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'),
+ XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'),
+ XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'),
+ XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'),
+ XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'),
+ XML_T('\0')
+ };
+
+ XML_Parser const xmlParserP = xmlrpc_XML_ParserCreate(encodingName);
+ Parser * const parser = (Parser *)xmlParserP;
+ XML_Parser retval;
+
+ if (xmlParserP) {
+ int succeeded;
+ xmlrpc_XmlInitEncodingNS(&initEncoding, &parser->m_encoding, 0);
+ ns = 1;
+ internalEncoding = XmlGetInternalEncodingNS();
+ namespaceSeparator = nsSep;
+
+ succeeded = setContext(xmlParserP, implicitContext);
+ if (succeeded)
+ retval = xmlParserP;
+ else {
+ xmlrpc_XML_ParserFree(xmlParserP);
+ retval = NULL;
+ }
+ } else
+ retval = NULL;
+
+ return retval;
}
-#endif /* XML_DTD */
-static
-enum XML_Error errorProcessor(XML_Parser parser,
- const char *s,
- const char *end,
- const char **nextPtr)
+
+int
+xmlrpc_XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName)
{
- return errorCode;
+ if (!encodingName)
+ protocolEncodingName = 0;
+ else {
+ protocolEncodingName = poolCopyString(&tempPool, encodingName);
+ if (!protocolEncodingName)
+ return 0;
+ }
+ return 1;
}
-static enum XML_Error
-storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
+
+
+XML_Parser
+xmlrpc_XML_ExternalEntityParserCreate(XML_Parser oldParser,
+ const XML_Char *context,
+ const XML_Char *encodingName)
{
- enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool);
- if (result)
- return result;
- if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20)
- poolChop(pool);
- if (!poolAppendChar(pool, XML_T('\0')))
- return XML_ERROR_NO_MEMORY;
- return XML_ERROR_NONE;
+ XML_Parser parser = oldParser;
+ DTD *oldDtd = &dtd;
+ XML_StartElementHandler oldStartElementHandler = startElementHandler;
+ XML_EndElementHandler oldEndElementHandler = endElementHandler;
+ XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler;
+ XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler;
+ XML_CommentHandler oldCommentHandler = commentHandler;
+ XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler;
+ XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler;
+ XML_DefaultHandler oldDefaultHandler = defaultHandler;
+ XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler;
+ XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler;
+ XML_ExternalParsedEntityDeclHandler oldExternalParsedEntityDeclHandler = externalParsedEntityDeclHandler;
+ XML_InternalParsedEntityDeclHandler oldInternalParsedEntityDeclHandler = internalParsedEntityDeclHandler;
+ XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler;
+ XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler;
+ XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler;
+ XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler;
+ XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler;
+ void *oldUserData = userData;
+ void *oldHandlerArg = handlerArg;
+ int oldDefaultExpandInternalEntities = defaultExpandInternalEntities;
+ void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg;
+ int oldParamEntityParsing = paramEntityParsing;
+ parser = (ns
+ ? xmlrpc_XML_ParserCreateNS(encodingName, namespaceSeparator)
+ : xmlrpc_XML_ParserCreate(encodingName));
+ if (!parser)
+ return 0;
+ startElementHandler = oldStartElementHandler;
+ endElementHandler = oldEndElementHandler;
+ characterDataHandler = oldCharacterDataHandler;
+ processingInstructionHandler = oldProcessingInstructionHandler;
+ commentHandler = oldCommentHandler;
+ startCdataSectionHandler = oldStartCdataSectionHandler;
+ endCdataSectionHandler = oldEndCdataSectionHandler;
+ defaultHandler = oldDefaultHandler;
+ unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler;
+ notationDeclHandler = oldNotationDeclHandler;
+ externalParsedEntityDeclHandler = oldExternalParsedEntityDeclHandler;
+ internalParsedEntityDeclHandler = oldInternalParsedEntityDeclHandler;
+ startNamespaceDeclHandler = oldStartNamespaceDeclHandler;
+ endNamespaceDeclHandler = oldEndNamespaceDeclHandler;
+ notStandaloneHandler = oldNotStandaloneHandler;
+ externalEntityRefHandler = oldExternalEntityRefHandler;
+ unknownEncodingHandler = oldUnknownEncodingHandler;
+ userData = oldUserData;
+ if (oldUserData == oldHandlerArg)
+ handlerArg = userData;
+ else
+ handlerArg = parser;
+ if (oldExternalEntityRefHandlerArg != oldParser)
+ externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg;
+ defaultExpandInternalEntities = oldDefaultExpandInternalEntities;
+ paramEntityParsing = oldParamEntityParsing;
+ if (context) {
+ if (!dtdCopy(&dtd, oldDtd) || !setContext(parser, context)) {
+ xmlrpc_XML_ParserFree(parser);
+ return 0;
+ }
+ processor = externalEntityInitProcessor;
+ }
+ else {
+ dtdSwap(&dtd, oldDtd);
+ parentParser = oldParser;
+ xmlrpc_XmlPrologStateInitExternalEntity(&prologState);
+ dtd.complete = 1;
+ hadExternalDoctype = 1;
+ }
+ return parser;
}
-static enum XML_Error
-appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata,
- const char *ptr, const char *end,
- STRING_POOL *pool)
+static
+void destroyBindings(BINDING *bindings)
{
for (;;) {
- const char *next;
- int tok = XmlAttributeValueTok(enc, ptr, end, &next);
- switch (tok) {
- case XML_TOK_NONE:
- return XML_ERROR_NONE;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, ptr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- if (!isCdata
- && n == 0x20 /* space */
- && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- for (i = 0; i < n; i++) {
- if (!poolAppendChar(pool, buf[i]))
- return XML_ERROR_NO_MEMORY;
- }
- }
- break;
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, ptr, next))
- return XML_ERROR_NO_MEMORY;
- break;
- break;
- case XML_TOK_TRAILING_CR:
- next = ptr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_ATTRIBUTE_VALUE_S:
- case XML_TOK_DATA_NEWLINE:
- if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20))
- break;
- if (!poolAppendChar(pool, 0x20))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_ENTITY_REF:
- {
- const XML_Char *name;
- ENTITY *entity;
- XML_Char ch = XmlPredefinedEntityName(enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (ch) {
- if (!poolAppendChar(pool, ch))
- return XML_ERROR_NO_MEMORY;
- break;
- }
- name = poolStoreString(&temp2Pool, enc,
- ptr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0);
- poolDiscard(&temp2Pool);
- if (!entity) {
- if (dtd.complete) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- }
- else if (entity->open) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- }
- else if (entity->notation) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_BINARY_ENTITY_REF;
- }
- else if (!entity->textPtr) {
- if (enc == encoding)
- eventPtr = ptr;
- return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF;
- }
- else {
- enum XML_Error result;
- const XML_Char *textEnd = entity->textPtr + entity->textLen;
- entity->open = 1;
- result = appendAttributeValue(parser, internalEncoding, isCdata, (char *)entity->textPtr, (char *)textEnd, pool);
- entity->open = 0;
- if (result)
- return result;
- }
- }
+ BINDING *b = bindings;
+ if (!b)
break;
- default:
- abort();
- }
- ptr = next;
+ bindings = b->nextTagBinding;
+ free(b->uri);
+ free(b);
}
- /* not reached */
}
-static
-enum XML_Error storeEntityValue(XML_Parser parser,
- const ENCODING *enc,
- const char *entityTextPtr,
- const char *entityTextEnd)
+void
+xmlrpc_XML_ParserFree(XML_Parser parser)
{
- STRING_POOL *pool = &(dtd.pool);
for (;;) {
- const char *next;
- int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next);
- switch (tok) {
- case XML_TOK_PARAM_ENTITY_REF:
-#ifdef XML_DTD
- if (parentParser || enc != encoding) {
- enum XML_Error result;
- const XML_Char *name;
- ENTITY *entity;
- name = poolStoreString(&tempPool, enc,
- entityTextPtr + enc->minBytesPerChar,
- next - enc->minBytesPerChar);
- if (!name)
- return XML_ERROR_NO_MEMORY;
- entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0);
- poolDiscard(&tempPool);
- if (!entity) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_UNDEFINED_ENTITY;
- }
- if (entity->open) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_RECURSIVE_ENTITY_REF;
- }
- if (entity->systemId) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_PARAM_ENTITY_REF;
- }
- entity->open = 1;
- result = storeEntityValue(parser,
- internalEncoding,
- (char *)entity->textPtr,
- (char *)(entity->textPtr + entity->textLen));
- entity->open = 0;
- if (result)
- return result;
- break;
- }
-#endif /* XML_DTD */
- eventPtr = entityTextPtr;
- return XML_ERROR_SYNTAX;
- case XML_TOK_NONE:
- return XML_ERROR_NONE;
- case XML_TOK_ENTITY_REF:
- case XML_TOK_DATA_CHARS:
- if (!poolAppend(pool, enc, entityTextPtr, next))
- return XML_ERROR_NO_MEMORY;
- break;
- case XML_TOK_TRAILING_CR:
- next = entityTextPtr + enc->minBytesPerChar;
- /* fall through */
- case XML_TOK_DATA_NEWLINE:
- if (pool->end == pool->ptr && !poolGrow(pool))
- return XML_ERROR_NO_MEMORY;
- *(pool->ptr)++ = 0xA;
- break;
- case XML_TOK_CHAR_REF:
- {
- XML_Char buf[XML_ENCODE_MAX];
- int i;
- int n = XmlCharRefNumber(enc, entityTextPtr);
- if (n < 0) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- n = XmlEncode(n, (ICHAR *)buf);
- if (!n) {
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_BAD_CHAR_REF;
- }
- for (i = 0; i < n; i++) {
- if (pool->end == pool->ptr && !poolGrow(pool))
- return XML_ERROR_NO_MEMORY;
- *(pool->ptr)++ = buf[i];
- }
- }
- break;
- case XML_TOK_PARTIAL:
- if (enc == encoding)
- eventPtr = entityTextPtr;
- return XML_ERROR_INVALID_TOKEN;
- case XML_TOK_INVALID:
- if (enc == encoding)
- eventPtr = next;
- return XML_ERROR_INVALID_TOKEN;
- default:
- abort();
+ TAG *p;
+ if (tagStack == 0) {
+ if (freeTagList == 0)
+ break;
+ tagStack = freeTagList;
+ freeTagList = 0;
}
- entityTextPtr = next;
+ p = tagStack;
+ tagStack = tagStack->parent;
+ free(p->buf);
+ destroyBindings(p->bindings);
+ free(p);
+ }
+ destroyBindings(freeBindingList);
+ destroyBindings(inheritedBindings);
+ poolDestroy(&tempPool);
+ poolDestroy(&temp2Pool);
+ if (parentParser) {
+ if (hadExternalDoctype)
+ dtd.complete = 0;
+ dtdSwap(&dtd, &((Parser *)parentParser)->m_dtd);
}
- /* not reached */
+ dtdDestroy(&dtd);
+ free((void *)atts);
+ free(groupConnector);
+ free(buffer);
+ free(dataBuf);
+ free(unknownEncodingMem);
+ if (unknownEncodingRelease)
+ unknownEncodingRelease(unknownEncodingData);
+ if (errorString)
+ xmlrpc_strfree(errorString);
+ free(parser);
}
-static void
-normalizeLines(XML_Char *s)
+void
+xmlrpc_XML_UseParserAsHandlerArg(XML_Parser parser)
{
- XML_Char *p;
- for (;; s++) {
- if (*s == XML_T('\0'))
- return;
- if (*s == 0xD)
- break;
- }
- p = s;
- do {
- if (*s == 0xD) {
- *p++ = 0xA;
- if (*++s == 0xA)
- s++;
- }
- else
- *p++ = *s++;
- } while (*s);
- *p = XML_T('\0');
+ handlerArg = parser;
}
-static int
-reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+void
+xmlrpc_XML_SetUserData(XML_Parser parser, void *p)
{
- const XML_Char *target;
- XML_Char *data;
- const char *tem;
- if (!processingInstructionHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
- }
- start += enc->minBytesPerChar * 2;
- tem = start + XmlNameLength(enc, start);
- target = poolStoreString(&tempPool, enc, start, tem);
- if (!target)
- return 0;
- poolFinish(&tempPool);
- data = poolStoreString(&tempPool, enc,
- XmlSkipS(enc, tem),
- end - enc->minBytesPerChar*2);
- if (!data)
- return 0;
- normalizeLines(data);
- processingInstructionHandler(handlerArg, target, data);
- poolClear(&tempPool);
- return 1;
+ if (handlerArg == userData)
+ handlerArg = userData = p;
+ else
+ userData = p;
}
-static int
-reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+int
+xmlrpc_XML_SetBase(XML_Parser parser, const XML_Char *p)
{
- XML_Char *data;
- if (!commentHandler) {
- if (defaultHandler)
- reportDefault(parser, enc, start, end);
- return 1;
+ if (p) {
+ p = poolCopyString(&dtd.pool, p);
+ if (!p)
+ return 0;
+ curBase = p;
}
- data = poolStoreString(&tempPool,
- enc,
- start + enc->minBytesPerChar * 4,
- end - enc->minBytesPerChar * 3);
- if (!data)
- return 0;
- normalizeLines(data);
- commentHandler(handlerArg, data);
- poolClear(&tempPool);
+ else
+ curBase = 0;
return 1;
}
-static void
-reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end)
+const XML_Char *
+xmlrpc_XML_GetBase(XML_Parser parser)
{
- if (MUST_CONVERT(enc, s)) {
- const char **eventPP;
- const char **eventEndPP;
- if (enc == encoding) {
- eventPP = &eventPtr;
- eventEndPP = &eventEndPtr;
- }
- else {
- eventPP = &(openInternalEntities->internalEventPtr);
- eventEndPP = &(openInternalEntities->internalEventEndPtr);
- }
- do {
- ICHAR *dataPtr = (ICHAR *)dataBuf;
- XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd);
- *eventEndPP = s;
- defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf);
- *eventPP = s;
- } while (s != end);
- }
- else
- defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s);
+ return curBase;
}
+int
+xmlrpc_XML_GetSpecifiedAttributeCount(XML_Parser parser)
+{
+ return nSpecifiedAtts;
+}
-static int
-defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, int isId, const XML_Char *value)
+int
+xmlrpc_XML_GetIdAttributeIndex(XML_Parser parser)
{
- DEFAULT_ATTRIBUTE *att;
- if (value || isId) {
- /* The handling of default attributes gets messed up if we have
- a default which duplicates a non-default. */
- int i;
- for (i = 0; i < type->nDefaultAtts; i++)
- if (attId == type->defaultAtts[i].id)
- return 1;
- if (isId && !type->idAtt && !attId->xmlns)
- type->idAtt = attId;
- }
- if (type->nDefaultAtts == type->allocDefaultAtts) {
- if (type->allocDefaultAtts == 0) {
- type->allocDefaultAtts = 8;
- type->defaultAtts = malloc(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
- }
- else {
- type->allocDefaultAtts *= 2;
- type->defaultAtts = realloc(type->defaultAtts,
- type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE));
- }
- if (!type->defaultAtts)
- return 0;
- }
- att = type->defaultAtts + type->nDefaultAtts;
- att->id = attId;
- att->value = value;
- att->isCdata = isCdata;
- if (!isCdata)
- attId->maybeTokenized = 1;
- type->nDefaultAtts += 1;
- return 1;
+ return idAttIndex;
}
-static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
+void
+xmlrpc_XML_SetElementHandler(XML_Parser parser,
+ XML_StartElementHandler start,
+ XML_EndElementHandler end)
{
- const XML_Char *name;
- for (name = elementType->name; *name; name++) {
- if (*name == XML_T(':')) {
- PREFIX *prefix;
- const XML_Char *s;
- for (s = elementType->name; s != name; s++) {
- if (!poolAppendChar(&dtd.pool, *s))
- return 0;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
- if (!prefix)
- return 0;
- if (prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- elementType->prefix = prefix;
+ startElementHandler = start;
+ endElementHandler = end;
+}
- }
- }
- return 1;
+void
+xmlrpc_XML_SetCharacterDataHandler(XML_Parser parser,
+ XML_CharacterDataHandler handler)
+{
+ characterDataHandler = handler;
}
-static ATTRIBUTE_ID *
-getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end)
+void
+xmlrpc_XML_SetProcessingInstructionHandler(
+ XML_Parser parser,
+ XML_ProcessingInstructionHandler handler)
{
- ATTRIBUTE_ID *id;
- const XML_Char *name;
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- name = poolStoreString(&dtd.pool, enc, start, end);
- if (!name)
- return 0;
- ++name;
- id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID));
- if (!id)
- return 0;
- if (id->name != name)
- poolDiscard(&dtd.pool);
- else {
- poolFinish(&dtd.pool);
- if (!ns)
- ;
- else if (name[0] == 'x'
- && name[1] == 'm'
- && name[2] == 'l'
- && name[3] == 'n'
- && name[4] == 's'
- && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) {
- if (name[5] == '\0')
- id->prefix = &dtd.defaultPrefix;
- else
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX));
- id->xmlns = 1;
- }
- else {
- int i;
- for (i = 0; name[i]; i++) {
- if (name[i] == XML_T(':')) {
- int j;
- for (j = 0; j < i; j++) {
- if (!poolAppendChar(&dtd.pool, name[j]))
- return 0;
- }
- if (!poolAppendChar(&dtd.pool, XML_T('\0')))
- return 0;
- id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX));
- if (id->prefix->name == poolStart(&dtd.pool))
- poolFinish(&dtd.pool);
- else
- poolDiscard(&dtd.pool);
- break;
- }
- }
- }
- }
- return id;
+ processingInstructionHandler = handler;
}
-#define CONTEXT_SEP XML_T('\f')
+void
+xmlrpc_XML_SetCommentHandler(XML_Parser parser,
+ XML_CommentHandler handler)
+{
+ commentHandler = handler;
+}
-static
-const XML_Char *getContext(XML_Parser parser)
+void
+xmlrpc_XML_SetCdataSectionHandler(XML_Parser parser,
+ XML_StartCdataSectionHandler start,
+ XML_EndCdataSectionHandler end)
{
- HASH_TABLE_ITER iter;
- int needSep = 0;
+ startCdataSectionHandler = start;
+ endCdataSectionHandler = end;
+}
- if (dtd.defaultPrefix.binding) {
- int i;
- int len;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return 0;
- len = dtd.defaultPrefix.binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i]))
- return 0;
- needSep = 1;
- }
+void
+xmlrpc_XML_SetDefaultHandler(XML_Parser parser,
+ XML_DefaultHandler handler)
+{
+ defaultHandler = handler;
+ defaultExpandInternalEntities = 0;
+}
- hashTableIterInit(&iter, &(dtd.prefixes));
- for (;;) {
- int i;
- int len;
- const XML_Char *s;
- PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter);
- if (!prefix)
- break;
- if (!prefix->binding)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return 0;
- for (s = prefix->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- if (!poolAppendChar(&tempPool, XML_T('=')))
- return 0;
- len = prefix->binding->uriLen;
- if (namespaceSeparator != XML_T('\0'))
- len--;
- for (i = 0; i < len; i++)
- if (!poolAppendChar(&tempPool, prefix->binding->uri[i]))
- return 0;
- needSep = 1;
- }
+void
+xmlrpc_XML_SetDefaultHandlerExpand(XML_Parser parser,
+ XML_DefaultHandler handler)
+{
+ defaultHandler = handler;
+ defaultExpandInternalEntities = 1;
+}
+void
+xmlrpc_XML_SetDoctypeDeclHandler(XML_Parser parser,
+ XML_StartDoctypeDeclHandler start,
+ XML_EndDoctypeDeclHandler end)
+{
+ startDoctypeDeclHandler = start;
+ endDoctypeDeclHandler = end;
+}
- hashTableIterInit(&iter, &(dtd.generalEntities));
- for (;;) {
- const XML_Char *s;
- ENTITY *e = (ENTITY *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (!e->open)
- continue;
- if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP))
- return 0;
- for (s = e->name; *s; s++)
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- needSep = 1;
- }
+void
+xmlrpc_XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
+ XML_UnparsedEntityDeclHandler handler)
+{
+ unparsedEntityDeclHandler = handler;
+}
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- return tempPool.start;
+void
+xmlrpc_XML_SetExternalParsedEntityDeclHandler(
+ XML_Parser parser,
+ XML_ExternalParsedEntityDeclHandler handler)
+{
+ externalParsedEntityDeclHandler = handler;
}
-static
-int setContext(XML_Parser parser, const XML_Char *context)
+void
+xmlrpc_XML_SetInternalParsedEntityDeclHandler(
+ XML_Parser parser,
+ XML_InternalParsedEntityDeclHandler handler)
{
- const XML_Char *s = context;
+ internalParsedEntityDeclHandler = handler;
+}
- while (*context != XML_T('\0')) {
- if (*s == CONTEXT_SEP || *s == XML_T('\0')) {
- ENTITY *e;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0);
- if (e)
- e->open = 1;
- if (*s != XML_T('\0'))
- s++;
- context = s;
- poolDiscard(&tempPool);
- }
- else if (*s == '=') {
- PREFIX *prefix;
- if (poolLength(&tempPool) == 0)
- prefix = &dtd.defaultPrefix;
- else {
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX));
- if (!prefix)
- return 0;
- if (prefix->name == poolStart(&tempPool)) {
- prefix->name = poolCopyString(&dtd.pool, prefix->name);
- if (!prefix->name)
- return 0;
- }
- poolDiscard(&tempPool);
- }
- for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++)
- if (!poolAppendChar(&tempPool, *context))
- return 0;
- if (!poolAppendChar(&tempPool, XML_T('\0')))
- return 0;
- if (!addBinding(parser, prefix, 0, poolStart(&tempPool), &inheritedBindings))
- return 0;
- poolDiscard(&tempPool);
- if (*context != XML_T('\0'))
- ++context;
- s = context;
- }
- else {
- if (!poolAppendChar(&tempPool, *s))
- return 0;
- s++;
- }
- }
- return 1;
+void
+xmlrpc_XML_SetNotationDeclHandler(XML_Parser parser,
+ XML_NotationDeclHandler handler)
+{
+ notationDeclHandler = handler;
}
+void
+xmlrpc_XML_SetNamespaceDeclHandler(XML_Parser parser,
+ XML_StartNamespaceDeclHandler start,
+ XML_EndNamespaceDeclHandler end)
+{
+ startNamespaceDeclHandler = start;
+ endNamespaceDeclHandler = end;
+}
-static
-void normalizePublicId(XML_Char *publicId)
+void
+xmlrpc_XML_SetNotStandaloneHandler(XML_Parser parser,
+ XML_NotStandaloneHandler handler)
{
- XML_Char *p = publicId;
- XML_Char *s;
- for (s = publicId; *s; s++) {
- switch (*s) {
- case 0x20:
- case 0xD:
- case 0xA:
- if (p != publicId && p[-1] != 0x20)
- *p++ = 0x20;
- break;
- default:
- *p++ = *s;
- }
- }
- if (p != publicId && p[-1] == 0x20)
- --p;
- *p = XML_T('\0');
+ notStandaloneHandler = handler;
}
-static int dtdInit(DTD *p)
+void
+xmlrpc_XML_SetExternalEntityRefHandler(XML_Parser parser,
+ XML_ExternalEntityRefHandler handler)
{
- poolInit(&(p->pool));
- hashTableInit(&(p->generalEntities));
- hashTableInit(&(p->elementTypes));
- hashTableInit(&(p->attributeIds));
- hashTableInit(&(p->prefixes));
- p->complete = 1;
- p->standalone = 0;
-#ifdef XML_DTD
- hashTableInit(&(p->paramEntities));
-#endif /* XML_DTD */
- p->defaultPrefix.name = 0;
- p->defaultPrefix.binding = 0;
- return 1;
+ externalEntityRefHandler = handler;
}
-#ifdef XML_DTD
+void
+xmlrpc_XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg)
+{
+ if (arg)
+ externalEntityRefHandlerArg = arg;
+ else
+ externalEntityRefHandlerArg = parser;
+}
-static void dtdSwap(DTD *p1, DTD *p2)
+void
+xmlrpc_XML_SetUnknownEncodingHandler(XML_Parser parser,
+ XML_UnknownEncodingHandler handler,
+ void *data)
{
- DTD tem;
- memcpy(&tem, p1, sizeof(DTD));
- memcpy(p1, p2, sizeof(DTD));
- memcpy(p2, &tem, sizeof(DTD));
+ unknownEncodingHandler = handler;
+ unknownEncodingHandlerData = data;
}
-#endif /* XML_DTD */
-static void dtdDestroy(DTD *p)
-{
- HASH_TABLE_ITER iter;
- hashTableIterInit(&iter, &(p->elementTypes));
- for (;;) {
- ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!e)
- break;
- if (e->allocDefaultAtts != 0)
- free(e->defaultAtts);
- }
- hashTableDestroy(&(p->generalEntities));
-#ifdef XML_DTD
- hashTableDestroy(&(p->paramEntities));
-#endif /* XML_DTD */
- hashTableDestroy(&(p->elementTypes));
- hashTableDestroy(&(p->attributeIds));
- hashTableDestroy(&(p->prefixes));
- poolDestroy(&(p->pool));
+
+int
+xmlrpc_XML_SetParamEntityParsing(
+ XML_Parser const parser ATTR_UNUSED,
+ enum XML_ParamEntityParsing const parsing) {
+
+ int retval;
+
+ paramEntityParsing = parsing;
+ retval = 1;
+
+ return retval;
}
-/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise.
-The new DTD has already been initialized. */
-static int dtdCopy(DTD *newDtd, const DTD *oldDtd)
-{
- HASH_TABLE_ITER iter;
- /* Copy the prefix table. */
+static Processor errorProcessor;
- hashTableIterInit(&iter, &(oldDtd->prefixes));
- for (;;) {
- const XML_Char *name;
- const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter);
- if (!oldP)
- break;
- name = poolCopyString(&(newDtd->pool), oldP->name);
- if (!name)
- return 0;
- if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX)))
- return 0;
- }
+static void
+errorProcessor(XML_Parser const parser ATTR_UNUSED,
+ const char * const s ATTR_UNUSED,
+ const char * const end ATTR_UNUSED,
+ const char ** const nextPtr ATTR_UNUSED,
+ enum XML_Error * const errorCodeP,
+ const char ** const errorP) {
- hashTableIterInit(&iter, &(oldDtd->attributeIds));
+ *errorP = errorString;
+ *errorCodeP = errorCode;
+}
- /* Copy the attribute id table. */
- for (;;) {
- ATTRIBUTE_ID *newA;
- const XML_Char *name;
- const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter);
- if (!oldA)
- break;
- /* Remember to allocate the scratch byte before the name. */
- if (!poolAppendChar(&(newDtd->pool), XML_T('\0')))
- return 0;
- name = poolCopyString(&(newDtd->pool), oldA->name);
- if (!name)
- return 0;
- ++name;
- newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID));
- if (!newA)
- return 0;
- newA->maybeTokenized = oldA->maybeTokenized;
- if (oldA->prefix) {
- newA->xmlns = oldA->xmlns;
- if (oldA->prefix == &oldDtd->defaultPrefix)
- newA->prefix = &newDtd->defaultPrefix;
- else
- newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldA->prefix->name, 0);
- }
- }
+static void
+parseFinalLen0(Parser * const parser,
+ int * const retvalP) {
- /* Copy the element type table. */
+ positionPtr = bufferPtr;
+ parseEndPtr = bufferEnd;
- hashTableIterInit(&iter, &(oldDtd->elementTypes));
+ processor(parser, bufferPtr, bufferEnd, 0, &errorCode, &errorString);
- for (;;) {
- int i;
- ELEMENT_TYPE *newE;
- const XML_Char *name;
- const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(&(newDtd->pool), oldE->name);
- if (!name)
- return 0;
- newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE));
- if (!newE)
- return 0;
- if (oldE->nDefaultAtts) {
- newE->defaultAtts = (DEFAULT_ATTRIBUTE *)malloc(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE));
- if (!newE->defaultAtts)
- return 0;
- }
- if (oldE->idAtt)
- newE->idAtt = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0);
- newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts;
- if (oldE->prefix)
- newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldE->prefix->name, 0);
- for (i = 0; i < newE->nDefaultAtts; i++) {
- newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0);
- newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata;
- if (oldE->defaultAtts[i].value) {
- newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value);
- if (!newE->defaultAtts[i].value)
- return 0;
- }
- else
- newE->defaultAtts[i].value = 0;
+ if (errorCode == XML_ERROR_NONE)
+ *retvalP = 1;
+ else {
+ eventEndPtr = eventPtr;
+ processor = errorProcessor;
+ *retvalP = 0;
}
- }
+}
- /* Copy the entity tables. */
- if (!copyEntityTable(&(newDtd->generalEntities),
- &(newDtd->pool),
- &(oldDtd->generalEntities)))
- return 0;
-#ifdef XML_DTD
- if (!copyEntityTable(&(newDtd->paramEntities),
- &(newDtd->pool),
- &(oldDtd->paramEntities)))
- return 0;
-#endif /* XML_DTD */
- newDtd->complete = oldDtd->complete;
- newDtd->standalone = oldDtd->standalone;
- return 1;
+static void
+parseNoBuffer(Parser * const parser,
+ const char * const s,
+ int const len,
+ bool const isFinal,
+ int * const succeededP) {
+
+ parseEndByteIndex += len;
+ positionPtr = s;
+
+ if (isFinal) {
+ processor(parser, s, parseEndPtr = s + len, 0,
+ &errorCode, &errorString);
+ if (errorCode == XML_ERROR_NONE)
+ *succeededP = true;
+ else {
+ eventEndPtr = eventPtr;
+ processor = errorProcessor;
+ *succeededP = false;
+ }
+ } else {
+ const char * end;
+
+ parseEndPtr = s + len;
+ processor(parser, s, s + len, &end, &errorCode, &errorString);
+ if (errorCode != XML_ERROR_NONE) {
+ eventEndPtr = eventPtr;
+ processor = errorProcessor;
+ *succeededP = false;
+ } else {
+ int const nLeftOver = s + len - end;
+ XmlUpdatePosition(parser->m_encoding, positionPtr, end, &position);
+ if (nLeftOver > 0) {
+ if (buffer == 0 || nLeftOver > bufferLim - buffer) {
+ REALLOCARRAY(buffer, len * 2);
+ if (buffer)
+ bufferLim = buffer + len * 2;
+ }
+
+ if (buffer) {
+ memcpy(buffer, end, nLeftOver);
+ bufferPtr = buffer;
+ bufferEnd = buffer + nLeftOver;
+ *succeededP = true;
+ } else {
+ errorCode = XML_ERROR_NO_MEMORY;
+ eventPtr = eventEndPtr = 0;
+ processor = errorProcessor;
+ *succeededP = false;
+ }
+ } else
+ *succeededP = true;
+ }
+ }
}
-static int copyEntityTable(HASH_TABLE *newTable,
- STRING_POOL *newPool,
- const HASH_TABLE *oldTable)
-{
- HASH_TABLE_ITER iter;
- const XML_Char *cachedOldBase = 0;
- const XML_Char *cachedNewBase = 0;
- hashTableIterInit(&iter, oldTable);
- for (;;) {
- ENTITY *newE;
- const XML_Char *name;
- const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter);
- if (!oldE)
- break;
- name = poolCopyString(newPool, oldE->name);
- if (!name)
- return 0;
- newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY));
- if (!newE)
- return 0;
- if (oldE->systemId) {
- const XML_Char *tem = poolCopyString(newPool, oldE->systemId);
- if (!tem)
- return 0;
- newE->systemId = tem;
- if (oldE->base) {
- if (oldE->base == cachedOldBase)
- newE->base = cachedNewBase;
- else {
- cachedOldBase = oldE->base;
- tem = poolCopyString(newPool, cachedOldBase);
- if (!tem)
- return 0;
- cachedNewBase = newE->base = tem;
- }
- }
- }
+int
+xmlrpc_XML_Parse(XML_Parser const xmlParserP,
+ const char * const s,
+ int const len,
+ int const isFinal) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ int retval;
+
+ if (errorString) {
+ xmlrpc_strfree(errorString);
+ errorString = NULL;
+ }
+
+ if (len == 0) {
+ if (!isFinal)
+ retval = 1;
+ else
+ parseFinalLen0(parser, &retval);
+ } else if (bufferPtr == bufferEnd)
+ parseNoBuffer(parser, s, len, isFinal, &retval);
else {
- const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen);
- if (!tem)
- return 0;
- newE->textPtr = tem;
- newE->textLen = oldE->textLen;
- }
- if (oldE->notation) {
- const XML_Char *tem = poolCopyString(newPool, oldE->notation);
- if (!tem)
- return 0;
- newE->notation = tem;
+ memcpy(xmlrpc_XML_GetBuffer(parser, len), s, len);
+ retval = xmlrpc_XML_ParseBuffer(parser, len, isFinal);
}
- }
- return 1;
+ return retval;
}
-#define INIT_SIZE 64
-static
-int keyeq(KEY s1, KEY s2)
-{
- for (; *s1 == *s2; s1++, s2++)
- if (*s1 == 0)
- return 1;
- return 0;
-}
-static
-unsigned long hash(KEY s)
-{
- unsigned long h = 0;
- while (*s)
- h = (h << 5) + h + (unsigned char)*s++;
- return h;
+int
+xmlrpc_XML_ParseBuffer(XML_Parser const xmlParserP,
+ int const len,
+ int const isFinal) {
+
+ Parser * const parser = (Parser *)xmlParserP;
+
+ const char * const start = bufferPtr;
+
+ if (errorString) {
+ xmlrpc_strfree(errorString);
+ errorString = NULL;
+ }
+
+ positionPtr = start;
+ bufferEnd += len;
+ parseEndByteIndex += len;
+ processor(xmlParserP, start, parseEndPtr = bufferEnd,
+ isFinal ? (const char **)0 : &bufferPtr,
+ &errorCode, &errorString);
+ if (errorCode == XML_ERROR_NONE) {
+ if (!isFinal)
+ XmlUpdatePosition(parser->m_encoding, positionPtr, bufferPtr,
+ &position);
+ return 1;
+ } else {
+ eventEndPtr = eventPtr;
+ processor = errorProcessor;
+ return 0;
+ }
}
-static
-NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize)
+void *
+xmlrpc_XML_GetBuffer(XML_Parser parser, int len)
{
- size_t i;
- if (table->size == 0) {
- if (!createSize)
- return 0;
- table->v = calloc(INIT_SIZE, sizeof(NAMED *));
- if (!table->v)
- return 0;
- table->size = INIT_SIZE;
- table->usedLim = INIT_SIZE / 2;
- i = hash(name) & (table->size - 1);
- }
- else {
- unsigned long h = hash(name);
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i) {
- if (keyeq(name, table->v[i]->name))
- return table->v[i];
+ if (len > bufferLim - bufferEnd) {
+ /* FIXME avoid integer overflow */
+ int neededSize = len + (bufferEnd - bufferPtr);
+ if (neededSize <= bufferLim - buffer) {
+ memmove(buffer, bufferPtr, bufferEnd - bufferPtr);
+ bufferEnd = buffer + (bufferEnd - bufferPtr);
+ bufferPtr = buffer;
}
- if (!createSize)
- return 0;
- if (table->used == table->usedLim) {
- /* check for overflow */
- size_t newSize = table->size * 2;
- NAMED **newV = calloc(newSize, sizeof(NAMED *));
- if (!newV)
- return 0;
- for (i = 0; i < table->size; i++)
- if (table->v[i]) {
- size_t j;
- for (j = hash(table->v[i]->name) & (newSize - 1);
- newV[j];
- j == 0 ? j = newSize - 1 : --j)
- ;
- newV[j] = table->v[i];
- }
- free(table->v);
- table->v = newV;
- table->size = newSize;
- table->usedLim = newSize/2;
- for (i = h & (table->size - 1);
- table->v[i];
- i == 0 ? i = table->size - 1 : --i)
- ;
+ else {
+ char *newBuf;
+ int bufferSize = bufferLim - bufferPtr;
+ if (bufferSize == 0)
+ bufferSize = INIT_BUFFER_SIZE;
+ do {
+ bufferSize *= 2;
+ } while (bufferSize < neededSize);
+ newBuf = malloc(bufferSize);
+ if (newBuf == 0) {
+ errorCode = XML_ERROR_NO_MEMORY;
+ return 0;
+ }
+ bufferLim = newBuf + bufferSize;
+ if (bufferPtr) {
+ memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr);
+ free(buffer);
+ }
+ bufferEnd = newBuf + (bufferEnd - bufferPtr);
+ bufferPtr = buffer = newBuf;
}
}
- table->v[i] = calloc(1, createSize);
- if (!table->v[i])
- return 0;
- table->v[i]->name = name;
- (table->used)++;
- return table->v[i];
+ return bufferEnd;
}
-static
-void hashTableDestroy(HASH_TABLE *table)
-{
- size_t i;
- for (i = 0; i < table->size; i++) {
- NAMED *p = table->v[i];
- if (p)
- free(p);
- }
- if (table->v)
- free(table->v);
+
+
+enum XML_Error
+xmlrpc_XML_GetErrorCode(XML_Parser const parser) {
+
+ return errorCode;
}
-static
-void hashTableInit(HASH_TABLE *p)
-{
- p->size = 0;
- p->usedLim = 0;
- p->used = 0;
- p->v = 0;
+
+
+const char *
+xmlrpc_XML_GetErrorString(XML_Parser const parser) {
+
+ if (errorString)
+ return errorString;
+ else if (errorCode == XML_ERROR_NONE)
+ return NULL;
+ else
+ return xmlrpc_XML_ErrorString(errorCode);
}
-static
-void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table)
+
+
+long
+xmlrpc_XML_GetCurrentByteIndex(XML_Parser parser)
{
- iter->p = table->v;
- iter->end = iter->p + table->size;
+ if (eventPtr)
+ return parseEndByteIndex - (parseEndPtr - eventPtr);
+ return -1;
}
-static
-NAMED *hashTableIterNext(HASH_TABLE_ITER *iter)
+int
+xmlrpc_XML_GetCurrentByteCount(XML_Parser parser)
{
- while (iter->p != iter->end) {
- NAMED *tem = *(iter->p)++;
- if (tem)
- return tem;
- }
+ if (eventEndPtr && eventPtr)
+ return eventEndPtr - eventPtr;
return 0;
}
-static
-void poolInit(STRING_POOL *pool)
-{
- pool->blocks = 0;
- pool->freeBlocks = 0;
- pool->start = 0;
- pool->ptr = 0;
- pool->end = 0;
-}
-static
-void poolClear(STRING_POOL *pool)
-{
- if (!pool->freeBlocks)
- pool->freeBlocks = pool->blocks;
- else {
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- p->next = pool->freeBlocks;
- pool->freeBlocks = p;
- p = tem;
+int
+xmlrpc_XML_GetCurrentLineNumber(XML_Parser const xmlParserP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ if (eventPtr) {
+ XmlUpdatePosition(parser->m_encoding, positionPtr, eventPtr,
+ &position);
+ positionPtr = eventPtr;
}
- }
- pool->blocks = 0;
- pool->start = 0;
- pool->ptr = 0;
- pool->end = 0;
+ return position.lineNumber + 1;
}
-static
-void poolDestroy(STRING_POOL *pool)
-{
- BLOCK *p = pool->blocks;
- while (p) {
- BLOCK *tem = p->next;
- free(p);
- p = tem;
- }
- pool->blocks = 0;
- p = pool->freeBlocks;
- while (p) {
- BLOCK *tem = p->next;
- free(p);
- p = tem;
- }
- pool->freeBlocks = 0;
- pool->ptr = 0;
- pool->start = 0;
- pool->end = 0;
-}
-static
-XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!pool->ptr && !poolGrow(pool))
- return 0;
- for (;;) {
- XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end);
- if (ptr == end)
- break;
- if (!poolGrow(pool))
- return 0;
- }
- return pool->start;
-}
-static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s)
-{
- do {
- if (!poolAppendChar(pool, *s))
- return 0;
- } while (*s++);
- s = pool->start;
- poolFinish(pool);
- return s;
-}
+int
+xmlrpc_XML_GetCurrentColumnNumber(XML_Parser const xmlParserP) {
-static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n)
-{
- if (!pool->ptr && !poolGrow(pool))
- return 0;
- for (; n > 0; --n, s++) {
- if (!poolAppendChar(pool, *s))
- return 0;
+ Parser * const parser = (Parser *) xmlParserP;
- }
- s = pool->start;
- poolFinish(pool);
- return s;
+ if (eventPtr) {
+ XmlUpdatePosition(parser->m_encoding, positionPtr, eventPtr,
+ &position);
+ positionPtr = eventPtr;
+ }
+ return position.columnNumber;
}
-static
-XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc,
- const char *ptr, const char *end)
-{
- if (!poolAppend(pool, enc, ptr, end))
- return 0;
- if (pool->ptr == pool->end && !poolGrow(pool))
- return 0;
- *(pool->ptr)++ = 0;
- return pool->start;
-}
-static
-int poolGrow(STRING_POOL *pool)
-{
- if (pool->freeBlocks) {
- if (pool->start == 0) {
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = pool->freeBlocks->next;
- pool->blocks->next = 0;
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- pool->ptr = pool->start;
- return 1;
- }
- if (pool->end - pool->start < pool->freeBlocks->size) {
- BLOCK *tem = pool->freeBlocks->next;
- pool->freeBlocks->next = pool->blocks;
- pool->blocks = pool->freeBlocks;
- pool->freeBlocks = tem;
- memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char));
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + pool->blocks->size;
- return 1;
+
+void
+xmlrpc_XML_DefaultCurrent(XML_Parser const xmlParserP) {
+
+ Parser * const parser = (Parser *) xmlParserP;
+
+ if (defaultHandler) {
+ if (openInternalEntities)
+ reportDefault(xmlParserP,
+ internalEncoding,
+ openInternalEntities->internalEventPtr,
+ openInternalEntities->internalEventEndPtr);
+ else
+ reportDefault(xmlParserP, parser->m_encoding,
+ eventPtr, eventEndPtr);
}
- }
- if (pool->blocks && pool->start == pool->blocks->s) {
- int blockSize = (pool->end - pool->start)*2;
- pool->blocks = realloc(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
- if (!pool->blocks)
- return 0;
- pool->blocks->size = blockSize;
- pool->ptr = pool->blocks->s + (pool->ptr - pool->start);
- pool->start = pool->blocks->s;
- pool->end = pool->start + blockSize;
- }
- else {
- BLOCK *tem;
- int blockSize = pool->end - pool->start;
- if (blockSize < INIT_BLOCK_SIZE)
- blockSize = INIT_BLOCK_SIZE;
+}
+
+const XML_LChar *
+xmlrpc_XML_ErrorString(int const code) {
+
+ static const XML_LChar * const message[] = {
+ /* NONE */ NULL,
+ /* NO_MEMORY */ XML_T("out of memory"),
+ /* SYNTAX */ XML_T("syntax error"),
+ /* NO_ELEMENTS */ XML_T("no element found"),
+ /* INVALID_TOKEN */ XML_T("not well-formed"),
+ /* UNCLOSED_TOKEN */ XML_T("unclosed token"),
+ /* PARTIAL_CHAR */ XML_T("unclosed token"),
+ /* TAG_MISMATCH */ XML_T("mismatched tag"),
+ /* DUPLICATE_ATTRIBUTE */ XML_T("duplicate attribute"),
+ /* JUNK_AFTER_DOC_ELEMENT */ XML_T("junk after document element"),
+ /* PARAM_ENTITY_REF */
+ XML_T("illegal parameter entity reference"),
+ /* UNDEFINED_ENTITY */ XML_T("undefined entity"),
+ /* RECURSIVE_ENTITY_REF */ XML_T("recursive entity reference"),
+ /* ASYNC_ENTITY */ XML_T("asynchronous entity"),
+ /* BAD_CHAR_REF */
+ XML_T("reference to invalid character number"),
+ /* BINARY_ENTITY_REF */ XML_T("reference to binary entity"),
+ /* ATTRIBUTE_EXTERNAL_ENTITY_REF */
+ XML_T("reference to external entity in attribute"),
+ /* MISPLACED_XML_PI */
+ XML_T("xml processing instruction not at start "
+ "of external entity"),
+ /* UNKNOWN_ENCODING */ XML_T("unknown encoding"),
+ /* INCORRECT_ENCODING */
+ XML_T("encoding specified in XML declaration is incorrect"),
+ /* UNCLOSED_CDATA_SECTION */ XML_T("unclosed CDATA section"),
+ /* EXTERNAL_ENTITY_HANDLING */
+ XML_T("error in processing external entity reference"),
+ /* NOT_STANDALONE */ XML_T("document is not standalone")
+ };
+
+ const XML_LChar * retval;
+
+ if (code > 0 && (unsigned)code < ARRAY_SIZE(message))
+ retval = message[code];
else
- blockSize *= 2;
- tem = malloc(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char));
- if (!tem)
- return 0;
- tem->size = blockSize;
- tem->next = pool->blocks;
- pool->blocks = tem;
- if (pool->ptr != pool->start)
- memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char));
- pool->ptr = tem->s + (pool->ptr - pool->start);
- pool->start = tem->s;
- pool->end = tem->s + blockSize;
- }
- return 1;
+ retval = NULL;
+
+ return retval;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.h Mon May 26 12:59:57 2008
@@ -1,10 +1,10 @@
/*
-Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
-See the file copying.txt for copying permission.
+ Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
+ See the file copying.txt for copying permission.
*/
-#ifndef XmlParse_INCLUDED
-#define XmlParse_INCLUDED 1
+#ifndef XMLPARSE_H_INCLUDED
+#define XMLPARSE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
@@ -19,7 +19,8 @@
#ifdef XML_UNICODE_WCHAR_T
/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
-uses Unicode. */
+ uses Unicode.
+*/
/* Information is UTF-16 encoded as wchar_ts */
#ifndef XML_UNICODE
@@ -53,7 +54,7 @@
protocol or null if there is none specified. */
XML_Parser XMLPARSEAPI
-XML_ParserCreate(const XML_Char *encoding);
+xmlrpc_XML_ParserCreate(const XML_Char * const encoding);
/* Constructs a new parser and namespace processor. Element type names
and attribute names that belong to a namespace will be expanded;
@@ -66,28 +67,29 @@
passed through without expansion. */
XML_Parser XMLPARSEAPI
-XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
+xmlrpc_XML_ParserCreateNS(const XML_Char * const encoding,
+ XML_Char const namespaceSeparator);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
typedef void (*XML_StartElementHandler)(void *userData,
- const XML_Char *name,
- const XML_Char **atts);
+ const XML_Char *name,
+ const XML_Char **atts);
typedef void (*XML_EndElementHandler)(void *userData,
- const XML_Char *name);
+ const XML_Char *name);
/* s is not 0 terminated. */
typedef void (*XML_CharacterDataHandler)(void *userData,
- const XML_Char *s,
- int len);
+ const XML_Char *s,
+ int len);
/* target and data are 0 terminated */
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
- const XML_Char *target,
- const XML_Char *data);
+ const XML_Char *target,
+ const XML_Char *data);
/* data is 0 terminated */
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
@@ -109,13 +111,13 @@
multiple calls. */
typedef void (*XML_DefaultHandler)(void *userData,
- const XML_Char *s,
- int len);
+ const XML_Char *s,
+ int len);
/* This is called for the start of the DOCTYPE declaration when the
name of the DOCTYPE is encountered. */
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
- const XML_Char *doctypeName);
+ const XML_Char *doctypeName);
/* This is called for the start of the DOCTYPE declaration when the
closing > is encountered, but after processing any external subset. */
@@ -127,32 +129,32 @@
The other arguments may be. */
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId,
- const XML_Char *notationName);
+ const XML_Char *entityName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId,
+ const XML_Char *notationName);
/* This is called for a declaration of notation.
The base argument is whatever was set by XML_SetBase.
The notationName will never be null. The other arguments can be. */
typedef void (*XML_NotationDeclHandler)(void *userData,
- const XML_Char *notationName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
+ const XML_Char *notationName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId);
typedef void (*XML_ExternalParsedEntityDeclHandler)(void *userData,
- const XML_Char *entityName,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
+ const XML_Char *entityName,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId);
typedef void (*XML_InternalParsedEntityDeclHandler)(void *userData,
- const XML_Char *entityName,
- const XML_Char *replacementText,
- int replacementTextLength);
+ const XML_Char *entityName,
+ const XML_Char *replacementText,
+ int replacementTextLength);
/* When namespace processing is enabled, these are called once for
each namespace declaration. The call to the start and end element
@@ -161,11 +163,11 @@
For an xmlns="" attribute, uri will be null. */
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix,
- const XML_Char *uri);
+ const XML_Char *prefix,
+ const XML_Char *uri);
typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
- const XML_Char *prefix);
+ const XML_Char *prefix);
/* This is called if the document is not standalone (it has an
external subset or a reference to a parameter entity, but does not
@@ -200,10 +202,10 @@
Note that unlike other handlers the first argument is the parser, not userData. */
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *base,
- const XML_Char *systemId,
- const XML_Char *publicId);
+ const XML_Char *context,
+ const XML_Char *base,
+ const XML_Char *systemId,
+ const XML_Char *publicId);
/* This structure is filled in by the XML_UnknownEncodingHandler
to provide information to the parser about encodings that are unknown
@@ -265,97 +267,105 @@
then the parser will return an XML_UNKNOWN_ENCODING error. */
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
- const XML_Char *name,
- XML_Encoding *info);
+ const XML_Char *name,
+ XML_Encoding *info);
void XMLPARSEAPI
-XML_SetElementHandler(XML_Parser parser,
- XML_StartElementHandler start,
- XML_EndElementHandler end);
+xmlrpc_XML_SetElementHandler(XML_Parser parser,
+ XML_StartElementHandler start,
+ XML_EndElementHandler end);
void XMLPARSEAPI
-XML_SetCharacterDataHandler(XML_Parser parser,
- XML_CharacterDataHandler handler);
+xmlrpc_XML_SetCharacterDataHandler(XML_Parser parser,
+ XML_CharacterDataHandler handler);
void XMLPARSEAPI
-XML_SetProcessingInstructionHandler(XML_Parser parser,
- XML_ProcessingInstructionHandler handler);
+xmlrpc_XML_SetProcessingInstructionHandler(
+ XML_Parser parser,
+ XML_ProcessingInstructionHandler handler);
void XMLPARSEAPI
-XML_SetCommentHandler(XML_Parser parser,
- XML_CommentHandler handler);
+xmlrpc_XML_SetCommentHandler(XML_Parser parser,
+ XML_CommentHandler handler);
void XMLPARSEAPI
-XML_SetCdataSectionHandler(XML_Parser parser,
- XML_StartCdataSectionHandler start,
- XML_EndCdataSectionHandler end);
+xmlrpc_XML_SetCdataSectionHandler(XML_Parser parser,
+ XML_StartCdataSectionHandler start,
+ XML_EndCdataSectionHandler end);
-/* This sets the default handler and also inhibits expansion of internal entities.
-The entity reference will be passed to the default handler. */
+/* This sets the default handler and also inhibits expansion of
+ internal entities. The entity reference will be passed to the default
+ handler.
+*/
void XMLPARSEAPI
-XML_SetDefaultHandler(XML_Parser parser,
- XML_DefaultHandler handler);
+xmlrpc_XML_SetDefaultHandler(XML_Parser parser,
+ XML_DefaultHandler handler);
/* This sets the default handler but does not inhibit expansion of internal entities.
The entity reference will not be passed to the default handler. */
void XMLPARSEAPI
-XML_SetDefaultHandlerExpand(XML_Parser parser,
- XML_DefaultHandler handler);
+xmlrpc_XML_SetDefaultHandlerExpand(XML_Parser parser,
+ XML_DefaultHandler handler);
void XMLPARSEAPI
-XML_SetDoctypeDeclHandler(XML_Parser parser,
- XML_StartDoctypeDeclHandler start,
- XML_EndDoctypeDeclHandler end);
+xmlrpc_XML_SetDoctypeDeclHandler(XML_Parser parser,
+ XML_StartDoctypeDeclHandler start,
+ XML_EndDoctypeDeclHandler end);
void XMLPARSEAPI
-XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
- XML_UnparsedEntityDeclHandler handler);
+xmlrpc_XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
+ XML_UnparsedEntityDeclHandler handler);
void XMLPARSEAPI
-XML_SetNotationDeclHandler(XML_Parser parser,
- XML_NotationDeclHandler handler);
+xmlrpc_XML_SetNotationDeclHandler(XML_Parser parser,
+ XML_NotationDeclHandler handler);
void XMLPARSEAPI
-XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
- XML_ExternalParsedEntityDeclHandler handler);
+xmlrpc_XML_SetExternalParsedEntityDeclHandler(
+ XML_Parser parser,
+ XML_ExternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
-XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
- XML_InternalParsedEntityDeclHandler handler);
+xmlrpc_XML_SetInternalParsedEntityDeclHandler(
+ XML_Parser parser,
+ XML_InternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
-XML_SetNamespaceDeclHandler(XML_Parser parser,
- XML_StartNamespaceDeclHandler start,
- XML_EndNamespaceDeclHandler end);
+xmlrpc_XML_SetNamespaceDeclHandler(XML_Parser parser,
+ XML_StartNamespaceDeclHandler start,
+ XML_EndNamespaceDeclHandler end);
void XMLPARSEAPI
-XML_SetNotStandaloneHandler(XML_Parser parser,
- XML_NotStandaloneHandler handler);
+xmlrpc_XML_SetNotStandaloneHandler(XML_Parser parser,
+ XML_NotStandaloneHandler handler);
void XMLPARSEAPI
-XML_SetExternalEntityRefHandler(XML_Parser parser,
- XML_ExternalEntityRefHandler handler);
+xmlrpc_XML_SetExternalEntityRefHandler(XML_Parser parser,
+ XML_ExternalEntityRefHandler handler);
-/* If a non-null value for arg is specified here, then it will be passed
-as the first argument to the external entity ref handler instead
-of the parser object. */
+/* If a non-null value for arg is specified here, then it will be
+ passed as the first argument to the external entity ref handler
+ instead of the parser object.
+*/
void XMLPARSEAPI
-XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
+xmlrpc_XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
void XMLPARSEAPI
-XML_SetUnknownEncodingHandler(XML_Parser parser,
- XML_UnknownEncodingHandler handler,
- void *encodingHandlerData);
+xmlrpc_XML_SetUnknownEncodingHandler(XML_Parser parser,
+ XML_UnknownEncodingHandler handler,
+ void *encodingHandlerData);
/* This can be called within a handler for a start element, end element,
-processing instruction or character data. It causes the corresponding
-markup to be passed to the default handler. */
-void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
+ processing instruction or character data. It causes the corresponding
+ markup to be passed to the default handler.
+*/
+void XMLPARSEAPI
+xmlrpc_XML_DefaultCurrent(XML_Parser parser);
/* This value is passed as the userData argument to callbacks. */
void XMLPARSEAPI
-XML_SetUserData(XML_Parser parser, void *userData);
+xmlrpc_XML_SetUserData(XML_Parser parser, void *userData);
/* Returns the last value set by XML_SetUserData or null. */
#define XML_GetUserData(parser) (*(void **)(parser))
@@ -365,71 +375,78 @@
or XML_ParseBuffer. */
int XMLPARSEAPI
-XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
+xmlrpc_XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
/* If this function is called, then the parser will be passed
-as the first argument to callbacks instead of userData.
-The userData will still be accessible using XML_GetUserData. */
-
+ as the first argument to callbacks instead of userData.
+ The userData will still be accessible using XML_GetUserData.
+*/
void XMLPARSEAPI
-XML_UseParserAsHandlerArg(XML_Parser parser);
-
-/* Sets the base to be used for resolving relative URIs in system identifiers in
-declarations. Resolving relative identifiers is left to the application:
-this value will be passed through as the base argument to the
-XML_ExternalEntityRefHandler, XML_NotationDeclHandler
-and XML_UnparsedEntityDeclHandler. The base argument will be copied.
-Returns zero if out of memory, non-zero otherwise. */
+xmlrpc_XML_UseParserAsHandlerArg(XML_Parser parser);
+/* Sets the base to be used for resolving relative URIs in system
+ identifiers in declarations. Resolving relative identifiers is left
+ to the application: this value will be passed through as the base
+ argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler
+ and XML_UnparsedEntityDeclHandler. The base argument will be copied.
+ Returns zero if out of memory, non-zero otherwise.
+*/
int XMLPARSEAPI
-XML_SetBase(XML_Parser parser, const XML_Char *base);
+xmlrpc_XML_SetBase(XML_Parser parser, const XML_Char *base);
const XML_Char XMLPARSEAPI *
-XML_GetBase(XML_Parser parser);
+xmlrpc_XML_GetBase(XML_Parser parser);
/* Returns the number of the attribute/value pairs passed in last call
-to the XML_StartElementHandler that were specified in the start-tag
-rather than defaulted. Each attribute/value pair counts as 2; thus
-this correspondds to an index into the atts array passed to the
-XML_StartElementHandler. */
-
-int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
+ to the XML_StartElementHandler that were specified in the start-tag
+ rather than defaulted. Each attribute/value pair counts as 2; thus
+ this correspondds to an index into the atts array passed to the
+ XML_StartElementHandler.
+*/
+int XMLPARSEAPI
+xmlrpc_XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to
-XML_StartElementHandler, or -1 if there is no ID attribute. Each
-attribute/value pair counts as 2; thus this correspondds to an index
-into the atts array passed to the XML_StartElementHandler. */
-int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
+ XML_StartElementHandler, or -1 if there is no ID attribute. Each
+ attribute/value pair counts as 2; thus this correspondds to an index
+ into the atts array passed to the XML_StartElementHandler.
+*/
+int XMLPARSEAPI
+xmlrpc_XML_GetIdAttributeIndex(XML_Parser parser);
/* Parses some input. Returns 0 if a fatal error is detected.
-The last call to XML_Parse must have isFinal true;
-len may be zero for this call (or any other). */
+ The last call to XML_Parse must have isFinal true;
+ len may be zero for this call (or any other).
+*/
int XMLPARSEAPI
-XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
+xmlrpc_XML_Parse(XML_Parser const parser, const char * const s, int const len, int const isFinal);
void XMLPARSEAPI *
-XML_GetBuffer(XML_Parser parser, int len);
+xmlrpc_XML_GetBuffer(XML_Parser parser, int len);
int XMLPARSEAPI
-XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
+xmlrpc_XML_ParseBuffer(XML_Parser const parser, int const len, int const isFinal);
-/* Creates an XML_Parser object that can parse an external general entity;
-context is a '\0'-terminated string specifying the parse context;
-encoding is a '\0'-terminated string giving the name of the externally specified encoding,
-or null if there is no externally specified encoding.
-The context string consists of a sequence of tokens separated by formfeeds (\f);
-a token consisting of a name specifies that the general entity of the name
-is open; a token of the form prefix=uri specifies the namespace for a particular
-prefix; a token of the form =uri specifies the default namespace.
-This can be called at any point after the first call to an ExternalEntityRefHandler
-so longer as the parser has not yet been freed.
-The new parser is completely independent and may safely be used in a separate thread.
-The handlers and userData are initialized from the parser argument.
-Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
+/* Creates an XML_Parser object that can parse an external general
+ entity; context is a '\0'-terminated string specifying the parse
+ context; encoding is a '\0'-terminated string giving the name of the
+ externally specified encoding, or null if there is no externally
+ specified encoding. The context string consists of a sequence of
+ tokens separated by formfeeds (\f); a token consisting of a name
+ specifies that the general entity of the name is open; a token of the
+ form prefix=uri specifies the namespace for a particular prefix; a
+ token of the form =uri specifies the default namespace. This can be
+ called at any point after the first call to an
+ ExternalEntityRefHandler so longer as the parser has not yet been
+ freed. The new parser is completely independent and may safely be
+ used in a separate thread. The handlers and userData are initialized
+ from the parser argument. Returns 0 if out of memory. Otherwise
+ returns a new XML_Parser object.
+*/
XML_Parser XMLPARSEAPI
-XML_ExternalEntityParserCreate(XML_Parser parser,
- const XML_Char *context,
- const XML_Char *encoding);
+xmlrpc_XML_ExternalEntityParserCreate(XML_Parser parser,
+ const XML_Char *context,
+ const XML_Char *encoding);
enum XML_ParamEntityParsing {
XML_PARAM_ENTITY_PARSING_NEVER,
@@ -438,27 +455,27 @@
};
/* Controls parsing of parameter entities (including the external DTD
-subset). If parsing of parameter entities is enabled, then references
-to external parameter entities (including the external DTD subset)
-will be passed to the handler set with
-XML_SetExternalEntityRefHandler. The context passed will be 0.
-Unlike external general entities, external parameter entities can only
-be parsed synchronously. If the external parameter entity is to be
-parsed, it must be parsed during the call to the external entity ref
-handler: the complete sequence of XML_ExternalEntityParserCreate,
-XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
-this call. After XML_ExternalEntityParserCreate has been called to
-create the parser for the external parameter entity (context must be 0
-for this call), it is illegal to make any calls on the old parser
-until XML_ParserFree has been called on the newly created parser. If
-the library has been compiled without support for parameter entity
-parsing (ie without XML_DTD being defined), then
-XML_SetParamEntityParsing will return 0 if parsing of parameter
-entities is requested; otherwise it will return non-zero. */
-
+ subset). If parsing of parameter entities is enabled, then references
+ to external parameter entities (including the external DTD subset)
+ will be passed to the handler set with
+ XML_SetExternalEntityRefHandler. The context passed will be 0.
+ Unlike external general entities, external parameter entities can only
+ be parsed synchronously. If the external parameter entity is to be
+ parsed, it must be parsed during the call to the external entity ref
+ handler: the complete sequence of XML_ExternalEntityParserCreate,
+ XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
+ this call. After XML_ExternalEntityParserCreate has been called to
+ create the parser for the external parameter entity (context must be 0
+ for this call), it is illegal to make any calls on the old parser
+ until XML_ParserFree has been called on the newly created parser. If
+ the library has been compiled without support for parameter entity
+ parsing (ie without XML_DTD being defined), then
+ XML_SetParamEntityParsing will return 0 if parsing of parameter
+ entities is requested; otherwise it will return non-zero.
+*/
int XMLPARSEAPI
-XML_SetParamEntityParsing(XML_Parser parser,
- enum XML_ParamEntityParsing parsing);
+xmlrpc_XML_SetParamEntityParsing(XML_Parser parser,
+ enum XML_ParamEntityParsing parsing);
enum XML_Error {
XML_ERROR_NONE,
@@ -486,27 +503,38 @@
XML_ERROR_NOT_STANDALONE
};
-/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
-returns information about the error. */
+/* If xmlrpc_XML_Parse or xmlrpc_XML_ParseBuffer have returned 0, then
+ xmlrpc_XML_GetErrorString and xmlrpc_XML_GetErrorCode return
+ information about the error.
+*/
+
+enum XML_Error XMLPARSEAPI
+xmlrpc_XML_GetErrorCode(XML_Parser const parser);
-enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
+const char * XMLPARSEAPI
+xmlrpc_XML_GetErrorString(XML_Parser const parser);
/* These functions return information about the current parse location.
-They may be called when XML_Parse or XML_ParseBuffer return 0;
-in this case the location is the location of the character at which
-the error was detected.
-They may also be called from any other callback called to report
-some parse event; in this the location is the location of the first
-of the sequence of characters that generated the event. */
-
-int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
-int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
-long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
+ They may be called when XML_Parse or XML_ParseBuffer return 0;
+ in this case the location is the location of the character at which
+ the error was detected.
+ They may also be called from any other callback called to report
+ some parse event; in this the location is the location of the first
+ of the sequence of characters that generated the event.
+*/
+
+int XMLPARSEAPI
+xmlrpc_XML_GetCurrentLineNumber(XML_Parser parser);
+int XMLPARSEAPI
+xmlrpc_XML_GetCurrentColumnNumber(XML_Parser parser);
+long XMLPARSEAPI
+xmlrpc_XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
-int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
+int XMLPARSEAPI
+xmlrpc_XML_GetCurrentByteCount(XML_Parser parser);
/* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
@@ -515,13 +543,14 @@
/* Frees memory used by the parser. */
void XMLPARSEAPI
-XML_ParserFree(XML_Parser parser);
+xmlrpc_XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
-const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
+const XML_LChar XMLPARSEAPI *
+xmlrpc_XML_ErrorString(int const code);
#ifdef __cplusplus
}
#endif
-#endif /* not XmlParse_INCLUDED */
+#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/Makefile Mon May 26 12:59:57 2008
@@ -1,8 +1,23 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../../..
+###############################################################################
+# This directory builds libxmlrpc_xmltok, an XML token parser. This is
+# essentially the separately distributed Expat library from 2001, but
+# with slight changes. The main reason it is bundled with Xmlrpc-c is
+# to make the latter easier to build and use.
+#
+# The library is about XML in general. There is nothing specific to
+# XML-RPC here.
+###############################################################################
+
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ EXPATDIR := $(call updir,$(CURDIR))
+ LIBDIR := $(call updir,$(EXPATDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/expat/xmltok
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
# I can't figure out what XML_BYTE_ORDER is, but it doesn't look like the
# code has ever defined it. That means it's treated like 0 in #if. Since
@@ -11,16 +26,54 @@
CFLAGS = $(CFLAGS_COMMON) -DXML_BYTE_ORDER=0 $(CFLAGS_PERSONAL) $(CADD)
-LIBLDFLAGS = $(LDFLAGS_VERSINFO) -rpath $(LIBINST_DIR) $(LADD)
-
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/lib/util/include
+# -I. is necessary when blddir != srcdir
+INCLUDES = -I. -I$(BLDDIR) -I$(SRCDIR)/lib/util/include
default: all
-include $(SRCDIR)/Makefile.common
+TARGET_LIBRARY_NAMES := libxmlrpc_xmltok
+
+STATIC_LIBRARIES_TO_INSTALL = libxmlrpc_xmltok.a
+
+SHARED_LIBS_TO_BUILD := libxmlrpc_xmltok
+SHARED_LIBS_TO_INSTALL := libxmlrpc_xmltok
+
+TARGET_MODS = xmltok xmlrole
+
+OMIT_XMLTOK_LIB_RULE = Y
+MAJ=3
+ # Major number of shared libraries in this directory
+
+include $(SRCDIR)/common.mk
+
+XMLTOK_SHLIB = $(call shlibfn,libxmlrpc_xmltok)
+#XMLTOK_SHLIB is e.g. libxmlrpc_xmltok.so.3.1
+XMLTOK_SHLIBLE = $(call shliblefn,libxmlrpc_xmltok)
+#XMLTOK_SHLIBLE is e.g. libxmlrpc_xmltok.so
+
+ifneq ($(SHARED_LIB_TYPE),NONE)
+ TARGET_SHARED_LIBS := $(XMLTOK_SHLIB) $(XMLTOK_SHLIBLE)
+ endif
.PHONY: all
-all: libxmlrpc_xmltok.la
+all: libxmlrpc_xmltok.a $(TARGET_SHARED_LIBS) $(TARGET_SHARED_LE_LIBS)
+
+# Rule for this is in common.mk, courtesy of TARGET_SHARED_LIBRARIES:
+$(XMLTOK_SHLIB): $(TARGET_MODS:%=%.osh)
+$(XMLTOK_SHLIB): LIBOBJECTS = $(TARGET_MODS:%=%.osh)
+
+# Rule for this is in common.mk, courtesy of TARGET_STATIC_LIBRARIES:
+
+libxmlrpc_xmltok.a: $(TARGET_MODS:%=%.o)
+libxmlrpc_xmltok.a: LIBOBJECTS = $(TARGET_MODS:%=%.o)
+
+#-----------------------------------------------------------------------------
+# RULES TO COMPILE OBJECT MODULES FOR LIBRARIES
+#-----------------------------------------------------------------------------
+
+# Rules to compile object modules from which to build the static and shared
+# library are in common.mk, courtesy of TARGET_MODS.
+
.PHONY: clean
clean: clean-common
@@ -41,26 +94,15 @@
.PHONY: dep
dep: dep-common
-LTLIBRARIES_TO_INSTALL = libxmlrpc_xmltok.la
-
-LIBXMLRPC_XMLTOK_OBJS = xmltok.lo xmlrole.lo
-
-libxmlrpc_xmltok.la: $(LIBXMLRPC_XMLTOK_OBJS)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
-
-$(LIBXMLRPC_XMLTOK_OBJS):%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(LIBXML_INCLUDES) \
- $(CFLAGS) $<
-
GENNMTAB = ../gennmtab/gennmtab
nametab.h: $(GENNMTAB)
rm -f $@
- $(GENNMTAB) >$@ || rm -f $@
+ $(GENNMTAB) >$@
$(GENNMTAB):
$(MAKE) -C $(dir $@) $(notdir $@)
-xmltok.lo: nametab.h
+xmltok.o xmltok.osh: nametab.h
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmldef.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmldef.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmldef.h Mon May 26 12:59:57 2008
@@ -8,7 +8,9 @@
#ifdef XML_WINLIB
#define WIN32_LEAN_AND_MEAN
-#define STRICT
+#ifndef STRICT
+#define STRICT 1
+#endif
#include <windows.h>
#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x))
@@ -44,9 +46,4 @@
#define XML_UNICODE
#endif
-/* Enable external parameter entity parsing in expat */
-#ifndef XML_DTD
-#define XML_DTD 1
-#endif
-
#endif /* MOZILLA_CLIENT */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.c Mon May 26 12:59:57 2008
@@ -43,14 +43,10 @@
#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar)
#endif
-#ifdef XML_DTD
#define setTopLevel(state) \
((state)->handler = ((state)->documentEntity \
? internalSubset \
: externalSubset1))
-#else /* not XML_DTD */
-#define setTopLevel(state) ((state)->handler = internalSubset)
-#endif /* not XML_DTD */
typedef int PROLOG_HANDLER(PROLOG_STATE *state,
int tok,
@@ -69,10 +65,8 @@
attlist7, attlist8, attlist9,
element0, element1, element2, element3, element4, element5, element6,
element7,
-#ifdef XML_DTD
externalSubset0, externalSubset1,
condSect0, condSect1, condSect2,
-#endif /* XML_DTD */
declClose,
error;
@@ -335,7 +329,7 @@
return common(state, tok);
}
-#ifdef XML_DTD
+
static
int externalSubset0(PROLOG_STATE *state,
@@ -380,7 +374,7 @@
return common(state, tok);
}
-#endif /* XML_DTD */
+
static
int entity0(PROLOG_STATE *state,
@@ -1124,7 +1118,7 @@
return common(state, tok);
}
-#ifdef XML_DTD
+
static
int condSect0(PROLOG_STATE *state,
@@ -1150,42 +1144,46 @@
return common(state, tok);
}
-static
-int condSect1(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- state->includeLevel += 1;
- return XML_ROLE_NONE;
- }
- return common(state, tok);
+
+
+static int
+condSect1(PROLOG_STATE * state,
+ int tok,
+ const char * ptr ATTR_UNUSED,
+ const char * end ATTR_UNUSED,
+ const ENCODING * enc ATTR_UNUSED) {
+
+ switch (tok) {
+ case XML_TOK_PROLOG_S:
+ return XML_ROLE_NONE;
+ case XML_TOK_OPEN_BRACKET:
+ state->handler = externalSubset1;
+ state->includeLevel += 1;
+ return XML_ROLE_NONE;
+ }
+ return common(state, tok);
}
-static
-int condSect2(PROLOG_STATE *state,
- int tok,
- const char *ptr,
- const char *end,
- const ENCODING *enc)
-{
- switch (tok) {
- case XML_TOK_PROLOG_S:
- return XML_ROLE_NONE;
- case XML_TOK_OPEN_BRACKET:
- state->handler = externalSubset1;
- return XML_ROLE_IGNORE_SECT;
- }
- return common(state, tok);
+
+
+static int
+condSect2(PROLOG_STATE * state,
+ int tok,
+ const char * ptr ATTR_UNUSED,
+ const char * end ATTR_UNUSED,
+ const ENCODING * enc ATTR_UNUSED) {
+
+ switch (tok) {
+ case XML_TOK_PROLOG_S:
+ return XML_ROLE_NONE;
+ case XML_TOK_OPEN_BRACKET:
+ state->handler = externalSubset1;
+ return XML_ROLE_IGNORE_SECT;
+ }
+ return common(state, tok);
}
-#endif /* XML_DTD */
+
static
int declClose(PROLOG_STATE *state,
@@ -1237,30 +1235,28 @@
static
int common(PROLOG_STATE *state, int tok ATTR_UNUSED)
{
-#ifdef XML_DTD
if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF)
return XML_ROLE_INNER_PARAM_ENTITY_REF;
-#endif
state->handler = error;
return XML_ROLE_ERROR;
}
-void XmlPrologStateInit(PROLOG_STATE *state)
-{
- state->handler = prolog0;
-#ifdef XML_DTD
- state->documentEntity = 1;
- state->includeLevel = 0;
-#endif /* XML_DTD */
-}
-#ifdef XML_DTD
-void XmlPrologStateInitExternalEntity(PROLOG_STATE *state)
-{
- state->handler = externalSubset0;
- state->documentEntity = 0;
- state->includeLevel = 0;
+void
+xmlrpc_XmlPrologStateInit(PROLOG_STATE * const state) {
+
+ state->handler = prolog0;
+ state->documentEntity = 1;
+ state->includeLevel = 0;
}
-#endif /* XML_DTD */
+
+
+void
+xmlrpc_XmlPrologStateInitExternalEntity(PROLOG_STATE * const state) {
+
+ state->handler = externalSubset0;
+ state->documentEntity = 0;
+ state->includeLevel = 0;
+}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.h Mon May 26 12:59:57 2008
@@ -62,11 +62,9 @@
XML_ROLE_CONTENT_ELEMENT_REP,
XML_ROLE_CONTENT_ELEMENT_OPT,
XML_ROLE_CONTENT_ELEMENT_PLUS,
-#ifdef XML_DTD
XML_ROLE_TEXT_DECL,
XML_ROLE_IGNORE_SECT,
XML_ROLE_INNER_PARAM_ENTITY_REF,
-#endif /* XML_DTD */
XML_ROLE_PARAM_ENTITY_REF,
XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION
};
@@ -78,16 +76,15 @@
const char *end,
const ENCODING *enc);
unsigned level;
-#ifdef XML_DTD
unsigned includeLevel;
int documentEntity;
-#endif /* XML_DTD */
} PROLOG_STATE;
-void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
-#ifdef XML_DTD
-void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *);
-#endif /* XML_DTD */
+XMLTOKAPI void
+xmlrpc_XmlPrologStateInit(PROLOG_STATE * const state);
+
+XMLTOKAPI void
+xmlrpc_XmlPrologStateInitExternalEntity(PROLOG_STATE * const state);
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.c Mon May 26 12:59:57 2008
@@ -8,11 +8,7 @@
#include "xmltok.h"
#include "nametab.h"
-#ifdef XML_DTD
#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok)
-#else
-#define IGNORE_SECTION_TOK_VTABLE /* as nothing */
-#endif
#define VTABLE1 \
{ PREFIX(prologTok), PREFIX(contentTok), \
@@ -321,7 +317,6 @@
*toP = to;
}
-#ifdef XML_NS
static const struct normal_encoding utf8_encoding_ns = {
{ VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
{
@@ -330,7 +325,6 @@
},
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-#endif
static const struct normal_encoding utf8_encoding = {
{ VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
@@ -343,8 +337,6 @@
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-#ifdef XML_NS
-
static const struct normal_encoding internal_utf8_encoding_ns = {
{ VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
{
@@ -354,8 +346,6 @@
STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_)
};
-#endif
-
static const struct normal_encoding internal_utf8_encoding = {
{ VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 },
{
@@ -401,8 +391,6 @@
*(*toP)++ = (unsigned char)*(*fromP)++;
}
-#ifdef XML_NS
-
static const struct normal_encoding latin1_encoding_ns = {
{ VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
{
@@ -412,8 +400,6 @@
STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding latin1_encoding = {
{ VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 },
{
@@ -434,19 +420,15 @@
*(*toP)++ = *(*fromP)++;
}
-#ifdef XML_NS
-
static const struct normal_encoding ascii_encoding_ns = {
{ VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
{
#include "asciitab.h"
/* BT_NONXML == 0 */
},
- STANDARD_VTABLE(sb_)
+ STANDARD_VTABLE(sb_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding ascii_encoding = {
{ VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 },
{
@@ -651,8 +633,6 @@
#endif /* not XML_MIN_SIZE */
-#ifdef XML_NS
-
static const struct normal_encoding little2_encoding_ns = {
{ VTABLE, 2, 0,
#if XML_BYTE_ORDER == 12
@@ -668,8 +648,6 @@
STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding little2_encoding = {
{ VTABLE, 2, 0,
#if XML_BYTE_ORDER == 12
@@ -689,8 +667,6 @@
#if XML_BYTE_ORDER != 21
-#ifdef XML_NS
-
static const struct normal_encoding internal_little2_encoding_ns = {
{ VTABLE, 2, 0, 1 },
{
@@ -700,8 +676,6 @@
STANDARD_VTABLE(little2_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding internal_little2_encoding = {
{ VTABLE, 2, 0, 1 },
{
@@ -790,8 +764,6 @@
#endif /* not XML_MIN_SIZE */
-#ifdef XML_NS
-
static const struct normal_encoding big2_encoding_ns = {
{ VTABLE, 2, 0,
#if XML_BYTE_ORDER == 21
@@ -807,8 +779,6 @@
STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding big2_encoding = {
{ VTABLE, 2, 0,
#if XML_BYTE_ORDER == 21
@@ -828,19 +798,15 @@
#if XML_BYTE_ORDER != 12
-#ifdef XML_NS
-
static const struct normal_encoding internal_big2_encoding_ns = {
{ VTABLE, 2, 0, 1 },
{
#include "iasciitab.h"
#include "latin1tab.h"
},
- STANDARD_VTABLE(big2_)
+ STANDARD_VTABLE(big2_) NULL_NORMAL_VTABLE
};
-#endif
-
static const struct normal_encoding internal_big2_encoding = {
{ VTABLE, 2, 0, 1 },
{
@@ -1119,8 +1085,12 @@
return result;
}
-int XmlUtf8Encode(int c, char *buf)
-{
+
+
+int
+xmlrpc_XmlUtf8Encode(int const c,
+ char * const buf) {
+
enum {
/* minN is minimum legal resulting value for N byte sequence */
min2 = 0x80,
@@ -1155,23 +1125,33 @@
return 0;
}
-int XmlUtf16Encode(int charNum, unsigned short *buf)
-{
- if (charNum < 0)
+
+
+int
+xmlrpc_XmlUtf16Encode(int const charNumArg,
+ unsigned short * const buf) {
+
+ int charNum;
+
+ charNum = charNumArg; /* initial value */
+
+ if (charNum < 0)
+ return 0;
+ if (charNum < 0x10000) {
+ buf[0] = charNum;
+ return 1;
+ }
+ if (charNum < 0x110000) {
+ charNum -= 0x10000;
+ buf[0] = (charNum >> 10) + 0xD800;
+ buf[1] = (charNum & 0x3FF) + 0xDC00;
+ return 2;
+ }
return 0;
- if (charNum < 0x10000) {
- buf[0] = charNum;
- return 1;
- }
- if (charNum < 0x110000) {
- charNum -= 0x10000;
- buf[0] = (charNum >> 10) + 0xD800;
- buf[1] = (charNum & 0x3FF) + 0xDC00;
- return 2;
- }
- return 0;
}
+
+
struct unknown_encoding {
struct normal_encoding normal;
int (*convert)(void *userData, const char *p);
@@ -1180,11 +1160,16 @@
char utf8[256][4];
};
-int XmlSizeOfUnknownEncoding(void)
-{
- return sizeof(struct unknown_encoding);
+
+
+int
+xmlrpc_XmlSizeOfUnknownEncoding(void) {
+
+ return sizeof(struct unknown_encoding);
}
+
+
static
int unknown_isName(const ENCODING *enc, const char *p)
{
@@ -1229,7 +1214,7 @@
if (n == 0) {
int c = ((const struct unknown_encoding *)enc)
->convert(((const struct unknown_encoding *)enc)->userData, *fromP);
- n = XmlUtf8Encode(c, buf);
+ n = xmlrpc_XmlUtf8Encode(c, buf);
if (n > toLim - *toP)
break;
utf8 = buf;
@@ -1268,11 +1253,11 @@
}
ENCODING *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
+xmlrpc_XmlInitUnknownEncoding(void * const mem,
+ int * const table,
+ int (*convert)(void *userData, const char *p),
+ void * const userData) {
+
int i;
struct unknown_encoding *e = mem;
for (i = 0; i < (int)sizeof(struct normal_encoding); i++)
@@ -1324,7 +1309,7 @@
e->normal.type[i] = BT_NAME;
else
e->normal.type[i] = BT_OTHER;
- e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1);
+ e->utf8[i][0] = (char)xmlrpc_XmlUtf8Encode(c, e->utf8[i] + 1);
e->utf16[i] = c;
}
}
@@ -1428,11 +1413,6 @@
encPtr = enc->encPtr;
if (ptr + 1 == end) {
/* only a single byte available for auto-detection */
-#ifndef XML_DTD /* FIXME */
- /* a well-formed document entity must have more than one byte */
- if (state != XML_CONTENT_STATE)
- return XML_TOK_PARTIAL;
-#endif
/* so we're parsing an external text entity... */
/* if UTF-16 was externally specified, then we need at least 2 bytes */
switch (INIT_ENC_INDEX(enc)) {
@@ -1536,8 +1516,6 @@
#undef NS
#undef ns
-#ifdef XML_NS
-
#define NS(x) x ## NS
#define ns(x) x ## _ns
@@ -1547,15 +1525,14 @@
#undef ns
ENCODING *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*convert)(void *userData, const char *p),
- void *userData)
-{
- ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData);
- if (enc)
- ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
- return enc;
+xmlrpc_XmlInitUnknownEncodingNS(void * const mem,
+ int * const table,
+ int (*convert)(void *userData, const char *p),
+ void * const userData) {
+
+ ENCODING * const enc =
+ xmlrpc_XmlInitUnknownEncoding(mem, table, convert, userData);
+ if (enc)
+ ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON;
+ return enc;
}
-
-#endif /* XML_NS */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok.h Mon May 26 12:59:57 2008
@@ -83,22 +83,14 @@
for a name with a colon. */
#define XML_TOK_PREFIXED_NAME 41
-#ifdef XML_DTD
#define XML_TOK_IGNORE_SECT 42
-#endif /* XML_DTD */
-#ifdef XML_DTD
#define XML_N_STATES 4
-#else /* not XML_DTD */
-#define XML_N_STATES 3
-#endif /* not XML_DTD */
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2
-#ifdef XML_DTD
#define XML_IGNORE_SECTION_STATE 3
-#endif /* XML_DTD */
#define XML_N_LITERAL_TYPES 2
#define XML_ATTRIBUTE_VALUE_LITERAL 0
@@ -198,13 +190,9 @@
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
-#ifdef XML_DTD
-
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
-#endif /* XML_DTD */
-
/* This is used for performing a 2nd-level tokenization on
the content of a literal that has already been returned by XmlTok. */
@@ -254,46 +242,73 @@
const ENCODING **encPtr;
} INIT_ENCODING;
-int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-
-int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(void);
-const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(void);
-int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf);
-int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf);
-
-int XMLTOKAPI XmlSizeOfUnknownEncoding(void);
-ENCODING XMLTOKAPI *
-XmlInitUnknownEncoding(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
-
-int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **encodingNamePtr,
- const ENCODING **namedEncodingPtr,
- int *standalonePtr);
-int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
-const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS(void);
-const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS(void);
-ENCODING XMLTOKAPI *
-XmlInitUnknownEncodingNS(void *mem,
- int *table,
- int (*conv)(void *userData, const char *p),
- void *userData);
+XMLTOKAPI int
+xmlrpc_XmlParseXmlDecl(int const isGeneralTextEntity,
+ const ENCODING * const enc,
+ const char * const ptr,
+ const char * const end,
+ const char ** const badPtr,
+ const char ** const versionPtr,
+ const char ** const encodingNamePtr,
+ const ENCODING ** const namedEncodingPtr,
+ int * const standalonePtr);
+
+XMLTOKAPI const ENCODING *
+xmlrpc_XmlGetUtf8InternalEncoding(void);
+
+XMLTOKAPI const ENCODING *
+xmlrpc_XmlGetUtf16InternalEncoding(void);
+
+XMLTOKAPI int
+xmlrpc_XmlInitEncoding(INIT_ENCODING * const p,
+ const ENCODING ** const encPtr,
+ const char * const name);
+
+XMLTOKAPI int
+xmlrpc_XmlUtf8Encode(int const c,
+ char * const buf);
+
+XMLTOKAPI int
+xmlrpc_XmlUtf16Encode(int const charNum,
+ unsigned short * const buf);
+
+XMLTOKAPI int
+xmlrpc_XmlSizeOfUnknownEncoding(void);
+
+XMLTOKAPI ENCODING *
+xmlrpc_XmlInitUnknownEncoding(void * const mem,
+ int * const table,
+ int (*convert)(void *userData, const char *p),
+ void * const userData);
+
+int
+xmlrpc_XmlParseXmlDeclNS(int const isGeneralTextEntity,
+ const ENCODING * const enc,
+ const char * const ptr,
+ const char * const end,
+ const char ** const badPtr,
+ const char ** const versionPtr,
+ const char ** const encodingNamePtr,
+ const ENCODING ** const namedEncodingPtr,
+ int * const standalonePtr);
+
+int
+xmlrpc_XmlInitEncodingNS(INIT_ENCODING * const p,
+ const ENCODING ** const encPtr,
+ const char * const name);
+
+const ENCODING *
+xmlrpc_XmlGetUtf8InternalEncodingNS(void);
+
+const ENCODING *
+xmlrpc_XmlGetUtf16InternalEncodingNS(void);
+
+ENCODING *
+xmlrpc_XmlInitUnknownEncodingNS(void * const mem,
+ int * const table,
+ int (*convert)(void *userData, const char *p),
+ void * const userData);
+
#ifdef __cplusplus
}
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_impl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_impl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_impl.c Mon May 26 12:59:57 2008
@@ -410,12 +410,10 @@
}
}
return XML_TOK_PARTIAL;
-#ifdef XML_NS
case BT_COLON:
/* no need to check qname syntax here, since end-tag must match exactly */
ptr += MINBPC(enc);
break;
-#endif
case BT_GT:
*nextTokPtr = ptr + MINBPC(enc);
return XML_TOK_END_TAG;
@@ -527,13 +525,10 @@
int PREFIX(scanAtts)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
-#ifdef XML_NS
int hadColon = 0;
-#endif
while (ptr != end) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
case BT_COLON:
if (hadColon) {
*nextTokPtr = ptr;
@@ -550,7 +545,6 @@
return XML_TOK_INVALID;
}
break;
-#endif
case BT_S: case BT_CR: case BT_LF:
for (;;) {
int t;
@@ -575,9 +569,7 @@
case BT_EQUALS:
{
int open;
-#ifdef XML_NS
hadColon = 0;
-#endif
for (;;) {
ptr += MINBPC(enc);
@@ -687,9 +679,7 @@
int PREFIX(scanLt)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
-#ifdef XML_NS
int hadColon;
-#endif
if (ptr == end)
return XML_TOK_PARTIAL;
switch (BYTE_TYPE(enc, ptr)) {
@@ -713,14 +703,11 @@
*nextTokPtr = ptr;
return XML_TOK_INVALID;
}
-#ifdef XML_NS
hadColon = 0;
-#endif
/* we have a start-tag */
while (ptr != end) {
switch (BYTE_TYPE(enc, ptr)) {
CHECK_NAME_CASES(enc, ptr, end, nextTokPtr)
-#ifdef XML_NS
case BT_COLON:
if (hadColon) {
*nextTokPtr = ptr;
@@ -737,7 +724,6 @@
return XML_TOK_INVALID;
}
break;
-#endif
case BT_S: case BT_CR: case BT_LF:
{
ptr += MINBPC(enc);
@@ -1117,9 +1103,7 @@
case BT_DIGIT:
case BT_NAME:
case BT_MINUS:
-#ifdef XML_NS
case BT_COLON:
-#endif
tok = XML_TOK_NMTOKEN;
ptr += MINBPC(enc);
break;
@@ -1147,7 +1131,6 @@
case BT_S: case BT_CR: case BT_LF:
*nextTokPtr = ptr;
return tok;
-#ifdef XML_NS
case BT_COLON:
ptr += MINBPC(enc);
switch (tok) {
@@ -1167,7 +1150,6 @@
break;
}
break;
-#endif
case BT_PLUS:
if (tok == XML_TOK_NMTOKEN) {
*nextTokPtr = ptr;
@@ -1307,7 +1289,7 @@
return XML_TOK_DATA_CHARS;
}
-#ifdef XML_DTD
+
static
int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end,
@@ -1360,7 +1342,7 @@
return XML_TOK_PARTIAL;
}
-#endif /* XML_DTD */
+
static
int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
@@ -1388,9 +1370,7 @@
case BT_AST:
case BT_PERCNT:
case BT_NUM:
-#ifdef XML_NS
case BT_COLON:
-#endif
break;
case BT_S:
if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) {
@@ -1626,9 +1606,7 @@
break;
case BT_NONASCII:
case BT_NMSTRT:
-#ifdef XML_NS
case BT_COLON:
-#endif
case BT_HEX:
case BT_DIGIT:
case BT_NAME:
@@ -1657,9 +1635,7 @@
case BT_LEAD4:
case BT_NONASCII:
case BT_NMSTRT:
-#ifdef XML_NS
case BT_COLON:
-#endif
case BT_HEX:
case BT_DIGIT:
case BT_NAME:
@@ -1700,9 +1676,7 @@
#undef LEAD_CASE
case BT_NONASCII:
case BT_NMSTRT:
-#ifdef XML_NS
case BT_COLON:
-#endif
case BT_HEX:
case BT_DIGIT:
case BT_NAME:
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_ns.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_ns.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmltok/xmltok_ns.c Mon May 26 12:59:57 2008
@@ -1,17 +1,23 @@
-const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
-{
- return &ns(internal_utf8_encoding).enc;
+const ENCODING *
+NS(xmlrpc_XmlGetUtf8InternalEncoding)(void) {
+
+ return &ns(internal_utf8_encoding).enc;
}
-const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
-{
+
+
+const ENCODING *
+NS(xmlrpc_XmlGetUtf16InternalEncoding)(void) {
+
#if XML_BYTE_ORDER == 12
- return &ns(internal_little2_encoding).enc;
+ return &ns(internal_little2_encoding).enc;
#elif XML_BYTE_ORDER == 21
- return &ns(internal_big2_encoding).enc;
+ return &ns(internal_big2_encoding).enc;
#else
- const short n = 1;
- return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
+ const short n = 1;
+ return *(const char *)&n ?
+ &ns(internal_little2_encoding).enc :
+ &ns(internal_big2_encoding).enc;
#endif
}
@@ -40,20 +46,27 @@
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
}
-int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
-{
- int i = getEncodingIndex(name);
- if (i == UNKNOWN_ENC)
- return 0;
- SET_INIT_ENC_INDEX(p, i);
- p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
- p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
- p->initEnc.updatePosition = initUpdatePosition;
- p->encPtr = encPtr;
- *encPtr = &(p->initEnc);
- return 1;
+
+
+int
+NS(xmlrpc_XmlInitEncoding)(INIT_ENCODING * const p,
+ const ENCODING ** const encPtr,
+ const char * const name) {
+
+ int i = getEncodingIndex(name);
+ if (i == UNKNOWN_ENC)
+ return 0;
+ SET_INIT_ENC_INDEX(p, i);
+ p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
+ p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
+ p->initEnc.updatePosition = initUpdatePosition;
+ p->encPtr = encPtr;
+ *encPtr = &(p->initEnc);
+ return 1;
}
+
+
static
const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
{
@@ -73,24 +86,27 @@
return NS(encodings)[i];
}
-int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
- const ENCODING *enc,
- const char *ptr,
- const char *end,
- const char **badPtr,
- const char **versionPtr,
- const char **encodingName,
- const ENCODING **encoding,
- int *standalone)
-{
+
+
+int
+NS(xmlrpc_XmlParseXmlDecl)(int const isGeneralTextEntity,
+ const ENCODING * const enc,
+ const char * const ptr,
+ const char * const end,
+ const char ** const badPtr,
+ const char ** const versionPtr,
+ const char ** const encodingName,
+ const ENCODING ** const encoding,
+ int * const standalone) {
+
return doParseXmlDecl(NS(findEncoding),
- isGeneralTextEntity,
- enc,
- ptr,
- end,
- badPtr,
- versionPtr,
- encodingName,
- encoding,
- standalone);
+ isGeneralTextEntity,
+ enc,
+ ptr,
+ end,
+ badPtr,
+ versionPtr,
+ encodingName,
+ encoding,
+ standalone);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlfile.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlfile.c Mon May 26 12:59:57 2008
@@ -13,7 +13,7 @@
#include "xmltchar.h"
#include "filemap.h"
-#ifdef _MSC_VER
+#if MSVCRT
#include <io.h>
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlwf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlwf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/expat/xmlwf/xmlwf.c Mon May 26 12:59:57 2008
@@ -13,7 +13,7 @@
#include "xmlfile.h"
#include "xmltchar.h"
-#ifdef _MSC_VER
+#if MSVCRT
#include <crtdbg.h>
#endif
@@ -584,7 +584,7 @@
int requireStandalone = 0;
int paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER;
-#ifdef _MSC_VER
+#if MSVCRT
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/Makefile Mon May 26 12:59:57 2008
@@ -1,22 +1,38 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ LIBDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/libwww_transport
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
+
+default: all
+
+.PHONY: all
+all: xmlrpc_libwww_transport.o xmlrpc_libwww_transport.osh
+
+# Rules for the above dependencies are in common.mk,
+# courtesy of TARGET_MODS.
+
+TARGET_MODS = xmlrpc_libwww_transport
+
+OMIT_LIBWWW_TRANSPORT_RULE=Y
+
+include $(SRCDIR)/common.mk
LIBWWW_INCLUDES := $(shell libwww-config --cflags)
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = -lpthread $(LADD)
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include \
+INCLUDES = \
+ -I$(BLDDIR) \
+ -I$(BLDDIR)/include \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/lib/util/include \
$(LIBWWW_INCLUDES)
-default: all
-
-.PHONY: all
-all: xmlrpc_libwww_transport.lo
-
.PHONY: clean
clean: clean-common
@@ -35,11 +51,8 @@
.PHONY: dep
dep: dep-common
-include $(SRCDIR)/Makefile.common
-
include Makefile.depend
-xmlrpc_libwww_transport.lo:%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(CFLAGS) $<
-
-
+# Need this dependency for those who don't use Makefile.depend.
+# Without it, version.h doesn't get created.
+xmlrpc_libwww_transport.o xmlrpc_libwww_transport.osh: version.h
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/xmlrpc_libwww_transport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/xmlrpc_libwww_transport.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/libwww_transport/xmlrpc_libwww_transport.c Mon May 26 12:59:57 2008
@@ -29,10 +29,10 @@
#include "bool.h"
#include "mallocvar.h"
-#include "xmlrpc-c/base.h"
-#include "xmlrpc-c/base_int.h"
-#include "xmlrpc-c/client.h"
+
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/client_int.h"
+#include "xmlrpc-c/transport.h"
/* The libwww interface */
@@ -53,8 +53,6 @@
#include "WWWSSL.h"
#endif
-#include "xmlrpc_libwww_transport.h"
-
/* This value was discovered by Rick Blair. His efforts shaved two seconds
** off of every request processed. Many thanks. */
#define SMALLEST_LEGAL_LIBWWW_TIMEOUT (21)
@@ -86,10 +84,10 @@
int http_status;
/* Low-level information used by libwww. */
- HTRequest *request;
- HTChunk *response_data;
- HTParentAnchor *source_anchor;
- HTAnchor *dest_anchor;
+ HTRequest * request;
+ HTChunk * response_data;
+ HTParentAnchor * source_anchor;
+ HTAnchor * dest_anchor;
xmlrpc_transport_asynch_complete complete;
struct xmlrpc_call_info * callInfoP;
@@ -119,8 +117,11 @@
const char * const appversion) {
/* We initialize the library using a robot profile, because we don't
- ** care about redirects or HTTP authentication, and we want to
- ** reduce our application footprint as much as possible. */
+ care about redirects or HTTP authentication, and we want to
+ reduce our application footprint as much as possible.
+
+ This takes the place of HTLibInit().
+ */
HTProfile_newRobot(appname, appversion);
/* Ilya Goldberg <igg(a)mit.edu> provided the following code to access
@@ -168,11 +169,16 @@
int const flags,
const char * const appname,
const char * const appversion,
- const struct xmlrpc_xportparms * const transportParmsP ATTR_UNUSED,
+ const void * const transportParmsP ATTR_UNUSED,
size_t const parm_size ATTR_UNUSED,
struct xmlrpc_client_transport ** const handlePP) {
/*----------------------------------------------------------------------------
This does the 'create' operation for a Libwww client transport.
+
+ TODO: put 'appname' and 'appversion' in *transportParmsP and
+ deprecate the create() arguments. Reason: these are particular to
+ the Libwww transport. They're create() arguments because originally,
+ Libwww was the only transport.
-----------------------------------------------------------------------------*/
/* The Libwww transport is not re-entrant -- you can have only one
per program instance. Even if we changed the Xmlrpc-c code not
@@ -221,6 +227,7 @@
if (!(clientTransportP->saved_flags & XMLRPC_CLIENT_SKIP_LIBWWW_INIT)) {
HTProfile_delete();
+ /* This takes the place of HTLibTerminate() */
}
destroyCookieJar(clientTransportP->cookieJarP);
}
@@ -231,6 +238,44 @@
** HTTP Error Reporting
**=======================================================================*/
+static void
+formatLibwwwError(HTRequest * const requestP,
+ const char ** const msgP) {
+/*----------------------------------------------------------------------------
+ When something fails in a Libwww request, Libwww generates a stack
+ of error information (precious little information, of course, in the
+ Unix tradition) and attaches it to the request object. We make a message
+ out of that information.
+
+ We rely on Libwww's HTDialog_errorMessage() to do the bulk of the
+ formatting; we might be able to coax more information out of the request
+ if we interpreted the error stack directly.
+-----------------------------------------------------------------------------*/
+ HTList * const errStack = HTRequest_error(requestP);
+
+ if (errStack == NULL)
+ xmlrpc_asprintf(msgP, "Libwww supplied no error details");
+ else {
+ /* Get an error message from libwww. The middle three
+ parameters to HTDialog_errorMessage appear to be ignored.
+ XXX - The documentation for this API is terrible, so we may
+ be using it incorrectly.
+ */
+ const char * const msg =
+ HTDialog_errorMessage(requestP, HT_A_MESSAGE, HT_MSG_NULL,
+ "An error occurred", errStack);
+
+ if (msg == NULL)
+ xmlrpc_asprintf(msgP, "Libwww supplied some error detail, "
+ "but its HTDialog_errorMessage() subroutine "
+ "mysteriously failed to interpret it for us.");
+ else
+ *msgP = msg;
+ }
+}
+
+
+
static void
set_fault_from_http_request(xmlrpc_env * const envP,
int const status,
@@ -244,45 +289,20 @@
if (status == 200) {
/* No error. Don't set one in *envP */
} else {
- /* Get an error message from libwww. The middle three
- parameters to HTDialog_errorMessage appear to be ignored.
- XXX - The documentation for this API is terrible, so we may
- be using it incorrectly.
- */
- HTList * const errStack = HTRequest_error(requestP);
-
- if (errStack == NULL) {
- /* I think this is probably impossible, because we didn't get
- status 200, but I don't completely understand HTTP and libwww.
- */
+ const char * libwwwMsg;
+ formatLibwwwError(requestP, &libwwwMsg);
+
+ if (status == -1)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_NETWORK_ERROR,
- "HTTP error #%d occurred, but there was no additional "
- "error information supplied", status);
- } else {
- const char * const msg =
- HTDialog_errorMessage(requestP, HT_A_MESSAGE, HT_MSG_NULL,
- "An error occurred", errStack);
-
- if (msg == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR,
- "HTTP error #%d occurred. Libwww's "
- "HTDialog_errorMessage() routine was mysteriously "
- "unable to interpret the additional error information, "
- "so we have none to report.", status);
- else {
- /* Set our fault. Note that this may inlcude line breaks,
- because 'msg' may. We should fix that. Formatting for
- display is none of our business at this level.
- */
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR,
- "HTTP error #%d occurred. libwww says %s", status, msg);
-
- xmlrpc_strfree(msg);
- }
+ "Unable to complete the HTTP request. %s", libwwwMsg);
+ else {
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HTTP request completed with HTTp error %d. %s",
+ status, libwwwMsg);
}
+ xmlrpc_strfree(libwwwMsg);
}
}
@@ -400,7 +420,7 @@
HTAnchor ** const destAnchorPP,
const xmlrpc_server_info * const serverP) {
- *destAnchorPP = HTAnchor_findAddress(serverP->_server_url);
+ *destAnchorPP = HTAnchor_findAddress(serverP->serverUrl);
if (*destAnchorPP == NULL)
xmlrpc_env_set_fault_formatted(
@@ -460,9 +480,9 @@
HTRequest_setRqHd(rpcP->request, request_headers);
/* Send an authorization header if we need one. */
- if (serverP->_http_basic_auth)
+ if (serverP->allowedAuth.basic)
HTRequest_addCredentials(rpcP->request, "Authorization",
- serverP->_http_basic_auth);
+ (char *)serverP->basicAuthHdrValue);
/* Make sure there is no XML conversion handler to steal our data.
** The 'override' parameter is currently ignored by libwww, so our
@@ -509,8 +529,8 @@
rpcDestroy(rpc * const rpcP) {
XMLRPC_ASSERT_PTR_OK(rpcP);
- XMLRPC_ASSERT(rpcP->request != XMLRPC_BAD_POINTER);
- XMLRPC_ASSERT(rpcP->response_data != XMLRPC_BAD_POINTER);
+ XMLRPC_ASSERT(rpcP->request != NULL);
+ XMLRPC_ASSERT(rpcP->response_data != NULL);
/* Junji Kanemaru reports on 05.04.11 that with asynch calls, he
get a segfault, and reversing the order of deleting the request
@@ -524,9 +544,9 @@
*/
HTRequest_delete(rpcP->request);
- rpcP->request = XMLRPC_BAD_POINTER;
+ rpcP->request = NULL;
HTChunk_delete(rpcP->response_data);
- rpcP->response_data = XMLRPC_BAD_POINTER;
+ rpcP->response_data = NULL;
/* This anchor points to private data, so we're allowed to delete it. */
deleteSourceAnchor(rpcP->source_anchor);
@@ -557,6 +577,16 @@
rpc * const rpcP,
xmlrpc_mem_block ** const responseXmlPP) {
+ /* Implementation warning: A Libwww chunk has nothing to do with
+ an HTTP chunk. HTTP chunks (as in a chunked response) are not
+ visible to us; Libwww delivers the entire unchunked body to us
+ at once (we never see chunk headers and trailers). This
+ subroutine is about a Libwww chunk, which is just a memory
+ buffer. (Libwww is capable of delivering the response in a
+ number of ways other than a chunk, e.g. it can write it to a
+ file.
+ */
+
/* Check to make sure that w3c-libwww actually sent us some data.
** XXX - This may happen if libwww is shut down prematurely, believe it
** or not--we'll get a 200 OK and no data. Gag me with a bogus design
@@ -641,7 +671,7 @@
rpcP->request);
if (!ok)
xmlrpc_env_set_fault(
- envP, XMLRPC_INTERNAL_ERROR,
+ envP, XMLRPC_NETWORK_ERROR,
"Libwww HTPostAnchor() failed to start POST request");
else {
/* Run our event-processing loop. HTEventList_newLoop()
@@ -685,7 +715,7 @@
static void
register_asynch_call(void) {
XMLRPC_ASSERT(outstanding_asynch_calls >= 0);
- outstanding_asynch_calls++;
+ ++outstanding_asynch_calls;
}
@@ -694,7 +724,7 @@
unregister_asynch_call(void) {
XMLRPC_ASSERT(outstanding_asynch_calls > 0);
- outstanding_asynch_calls--;
+ --outstanding_asynch_calls;
if (outstanding_asynch_calls == 0)
HTEventList_stopLoop();
}
@@ -702,9 +732,9 @@
static int
-timer_callback(HTTimer * const timer ATTR_UNUSED,
+timer_callback(HTTimer * const timer ATTR_UNUSED,
void * const user_data ATTR_UNUSED,
- HTEventType const event) {
+ HTEventType const event ATTR_UNUSED) {
/*----------------------------------------------------------------------------
A handy timer callback which cancels the running event loop.
-----------------------------------------------------------------------------*/
@@ -900,7 +930,7 @@
rpcP->request);
if (!ok) {
unregister_asynch_call();
- xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR,
+ xmlrpc_env_set_fault(envP, XMLRPC_NETWORK_ERROR,
"Libwww (HTPostAnchor()) failed to start the "
"POST request.");
}
@@ -912,9 +942,12 @@
struct xmlrpc_client_transport_ops xmlrpc_libwww_transport_ops = {
+ NULL,
+ NULL,
&create,
&destroy,
&sendRequest,
&call,
&finishAsynch,
+ NULL,
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/Makefile Mon May 26 12:59:57 2008
@@ -1,23 +1,58 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
-BUILDDIR = $(SRCDIR)
+###############################################################################
+# This directory builds object modules that provide utility functions that
+# programs can use. Not libraries, though -- just programs. The reason
+# we don't want any library to use object modules in here is that they'll
+# probably pollute the name space when users link those libraries to their
+# programs. In fact, if more than one Xmlrpc-c library includes one of these
+# modules, the libraries will conflict with each other.
+#
+# So a utility function that is to be used by libraries (and, optionally,
+# programs) should go in libxmlrpc_util. libxmlrpc_util is a prerequisite
+# for many Xmlrpc-c libraries, gets included in a program link only once,
+# and uses external symbol names that have the "xmlrpc_" prefix to avoid
+# collision with users' code.
+#
+# If we knew a portable way to link multiple object modules into one and
+# restrict the symbols exported by the whole, we could avoid this mess and
+# just link utility object modules into each Xmlrpc-c library.
+##############################################################################
+
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ LIBDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/util
default: all
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
-include $(SRCDIR)/Makefile.common
+OMIT_UTILS_RULE = Y
+
+include $(SRCDIR)/common.mk
+
+LIBOBJS = \
+ casprintf.o \
+ cmdline_parser.o \
+ cmdline_parser_cpp.o \
+ getoptx.o \
+ string_parser.o \
+ stripcaseeq.o \
.PHONY: all
-all: casprintf.lo cmdline_parser.lo getoptx.lo
+all: $(LIBOBJS)
-INCLUDES = -Iinclude -I$(BUILDDIR)
+INCLUDES = -I$(SRCDIR)/$(SUBDIR)/include -I$(BLDDIR)
CFLAGS = $(CFLAGS_COMMON) $(INCLUDES) $(CFLAGS_PERSONAL) $(CADD)
-%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $<
+%.o:%.c
+ $(CC) -c $(CFLAGS) $<
+
+%.o:%.cpp
+ $(CXX) -c $(CFLAGS) $<
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/casprintf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/casprintf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/casprintf.c Mon May 26 12:59:57 2008
@@ -1,4 +1,4 @@
-#define _GNU_SOURCE
+//#define _GNU_SOURCE
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -21,12 +21,12 @@
result = malloc(initialSize);
if (result != NULL) {
size_t bytesNeeded;
- bytesNeeded = vsnprintf(result, initialSize, fmt, varargs);
+ bytesNeeded = XMLRPC_VSNPRINTF(result, initialSize, fmt, varargs);
if (bytesNeeded > initialSize) {
free(result);
result = malloc(bytesNeeded);
if (result != NULL)
- vsnprintf(result, bytesNeeded, fmt, varargs);
+ XMLRPC_VSNPRINTF(result, bytesNeeded, fmt, varargs);
} else if (bytesNeeded == initialSize) {
if (result[initialSize-1] != '\0') {
/* This is one of those old systems where vsnprintf()
@@ -46,23 +46,31 @@
+const char * const strsol = "[Insufficient memory to build string]";
+
+
+
void
cvasprintf(const char ** const retvalP,
const char * const fmt,
va_list varargs) {
- char * retval;
+ char * string;
#if HAVE_ASPRINTF
- vasprintf(&retval, fmt, varargs);
+ vasprintf(&string, fmt, varargs);
#else
- simpleVasprintf(&retval, fmt, varargs);
+ simpleVasprintf(&string, fmt, varargs);
#endif
- *retvalP = retval;
+ if (string == NULL)
+ *retvalP = strsol;
+ else
+ *retvalP = string;
}
+
void GNU_PRINTF_ATTR(2,3)
casprintf(const char ** const retvalP, const char * const fmt, ...) {
@@ -79,5 +87,7 @@
void
strfree(const char * const string) {
- free((void *)string);
+
+ if (string != strsol)
+ free((void *)string);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/cmdline_parser.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/cmdline_parser.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/cmdline_parser.c Mon May 26 12:59:57 2008
@@ -1,14 +1,17 @@
#include "xmlrpc_config.h" /* prereq for mallocvar.h -- defines __inline__ */
+#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <limits.h>
-#include "mallocvar.h"
#include "bool.h"
+#include "int.h"
+#include "mallocvar.h"
#include "casprintf.h"
#include "getoptx.h"
+#include "string_parser.h"
#include "cmdline_parser.h"
@@ -19,9 +22,11 @@
enum optiontype type;
bool present;
union {
- unsigned int u;
- int i;
- const char * s;
+ unsigned int u;
+ int i;
+ const char * s;
+ uint64_t llu;
+ double d;
} value;
};
@@ -72,42 +77,108 @@
static void
+parseInt(enum optiontype const type,
+ const char * const optarg,
+ unsigned int * const valueUintP,
+ int * const valueIntP,
+ const char ** const errorP) {
+
+ if (optarg == NULL)
+ casprintf(errorP, "Option requires a value");
+ else if (strlen(optarg) == 0)
+ casprintf(errorP, "Numeric option value is null string");
+ else {
+ char * tailptr;
+ long const longvalue = strtol(optarg, &tailptr, 10);
+
+ if (*tailptr != '\0')
+ casprintf(errorP, "Non-numeric value "
+ "for numeric option value: '%s'", optarg);
+ else if (errno == ERANGE || longvalue > INT_MAX)
+ casprintf(errorP, "Numeric value out of range: %s", optarg);
+ else {
+ if (type == OPTTYPE_UINT) {
+ if (longvalue < 0)
+ casprintf(errorP, "Unsigned numeric value is "
+ "negative: %ld", longvalue);
+ else {
+ *errorP = NULL;
+ *valueUintP = (unsigned int) longvalue;
+ }
+ } else {
+ *errorP = NULL;
+ *valueIntP = (int) longvalue;
+ }
+ }
+ }
+}
+
+
+
+static void
+parseBinUint(const char * const optarg,
+ uint64_t * const valueP,
+ const char ** const errorP) {
+
+ if (optarg == NULL)
+ casprintf(errorP, "Option requires a value");
+ else if (strlen(optarg) == 0)
+ casprintf(errorP, "Numeric option value is null string");
+ else {
+ const char * error;
+ interpretBinUint(optarg, valueP, &error);
+
+ if (error) {
+ casprintf(errorP, "Invalid numeric option value '%s'. %s",
+ optarg, error);
+ strfree(error);
+ }
+ }
+}
+
+
+
+static void
+parseFloat(const char * const optarg,
+ double * const valueP,
+ const char ** const errorP) {
+
+ if (optarg == NULL)
+ casprintf(errorP, "Option requires a value");
+ else if (strlen(optarg) == 0)
+ casprintf(errorP, "Numeric option value is null string");
+ else {
+ char * tailptr;
+ double const doublevalue = strtod(optarg, &tailptr);
+
+ if (*tailptr != '\0')
+ casprintf(errorP, "Non-numeric value "
+ "for numeric option value: '%s'", optarg);
+ else if (errno == ERANGE)
+ casprintf(errorP, "Numeric value out of range: %s", optarg);
+ else {
+ *errorP = NULL;
+ *valueP = doublevalue;
+ }
+ }
+}
+
+
+
+static void
parseOptionValue(const char * const optarg,
struct optionDesc * const optionP,
const char ** const errorP) {
switch (optionP->type) {
+ case OPTTYPE_FLAG:
+ *errorP = NULL;
+ break;
+ case OPTTYPE_INT:
case OPTTYPE_UINT:
- case OPTTYPE_INT: {
- if (optarg == NULL)
- casprintf(errorP, "Option requires a value");
- else if (strlen(optarg) == 0)
- casprintf(errorP, "Numeric option value is null string");
- else {
- char * tailptr;
- long const longvalue = strtol(optarg, &tailptr, 10);
- if (*tailptr != '\0')
- casprintf(errorP, "Non-numeric value "
- "for numeric option value: '%s'", optarg);
- else if (errno == ERANGE || longvalue > INT_MAX)
- casprintf(errorP, "Numeric value out of range: %s", optarg);
- else {
- if (optionP->type == OPTTYPE_UINT) {
- if (longvalue < 0)
- casprintf(errorP, "Unsigned numeric value is "
- "negative: %ld", longvalue);
- else {
- *errorP = NULL;
- optionP->value.u = (unsigned int) longvalue;
- }
- } else {
- *errorP = NULL;
- optionP->value.u = (int) longvalue;
- }
- }
- }
- }
- break;
+ parseInt(optionP->type, optarg, &optionP->value.u, &optionP->value.i,
+ errorP);
+ break;
case OPTTYPE_STRING:
if (optarg == NULL)
casprintf(errorP, "Option requires a value");
@@ -116,8 +187,11 @@
optionP->value.s = strdup(optarg);
}
break;
- case OPTTYPE_FLAG:
- *errorP = NULL;
+ case OPTTYPE_BINUINT:
+ parseBinUint(optarg, &optionP->value.llu, errorP);
+ break;
+ case OPTTYPE_FLOAT:
+ parseFloat(optarg, &optionP->value.d, errorP);
break;
}
}
@@ -135,7 +209,7 @@
if (error)
casprintf(errorP, "Error in '%s' option: %s", optionP->name, error);
else
- optionP->present = TRUE;
+ optionP->present = true;
}
@@ -149,7 +223,8 @@
MALLOCARRAY(cpP->argumentArray, cpP->numArguments);
if (cpP->argumentArray == NULL) {
- fprintf(stderr, "Unable to allocate memory for argument array\n");
+ fprintf(stderr, "Unable to allocate memory for argument array "
+ "(%u arguments)\n", cpP->numArguments);
abort();
} else {
unsigned int i;
@@ -188,9 +263,9 @@
/* Set up initial assumption: No options present */
for (i = 0; i < cpP->numOptions; ++i)
- cpP->optionDescArray[i].present = FALSE;
+ cpP->optionDescArray[i].present = false;
- endOfOptions = FALSE; /* initial value */
+ endOfOptions = false; /* initial value */
while (!endOfOptions && !*errorP) {
int const opterr0 = 0;
@@ -419,6 +494,69 @@
+uint64_t
+cmd_getOptionValueBinUint(cmdlineParser const cpP,
+ const char * const name) {
+
+ struct optionDesc * const optionDescP = findOptionDesc(cpP, name);
+
+ uint64_t retval;
+
+ if (!optionDescP) {
+ fprintf(stderr, "cmdlineParser called incorrectly. "
+ "cmd_getOptionValueUint() called for undefined option '%s'\n",
+ name);
+ abort();
+ } else {
+ if (optionDescP->type != OPTTYPE_BINUINT) {
+ fprintf(stderr, "cmdlineParser called incorrectly. "
+ "cmd_getOptionValueBinUint() called for "
+ "non-OPTTYPE_BINUINT "
+ "option '%s'\n", optionDescP->name);
+ abort();
+ } else {
+ if (optionDescP->present)
+ retval = optionDescP->value.llu;
+ else
+ retval = 0;
+ }
+ }
+ return retval;
+}
+
+
+
+double
+cmd_getOptionValueFloat(cmdlineParser const cpP,
+ const char * const name) {
+
+ struct optionDesc * const optionDescP = findOptionDesc(cpP, name);
+
+ double retval;
+
+ if (!optionDescP) {
+ fprintf(stderr, "cmdlineParser called incorrectly. "
+ "cmd_getOptionValueInt() called for undefined option '%s'\n",
+ name);
+ abort();
+ } else {
+ if (optionDescP->type != OPTTYPE_FLOAT) {
+ fprintf(stderr, "cmdlineParser called incorrectly. "
+ "cmd_getOptionValueInt() called for non-float "
+ "option '%s'\n", optionDescP->name);
+ abort();
+ } else {
+ if (optionDescP->present)
+ retval = optionDescP->value.d;
+ else
+ retval = 0.0;
+ }
+ }
+ return retval;
+}
+
+
+
unsigned int
cmd_argumentCount(cmdlineParser const cpP) {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/getoptx.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/getoptx.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/getoptx.c Mon May 26 12:59:57 2008
@@ -19,10 +19,6 @@
#include "getoptx.h"
-#ifdef _AIX
-#pragma alloca
-#endif
-
/* Note that on some systems, the header files above declare variables
for use with their native getopt facilities, and those variables have
the same names as we'd like to use. So we use things like optargx
@@ -94,20 +90,25 @@
exchange(char ** const argv) {
unsigned int const nonopts_size =
(last_nonopt - first_nonopt) * sizeof (char *);
- char **temp = (char **) alloca (nonopts_size);
+ char **temp = (char **) malloc (nonopts_size);
+
+ if (temp == NULL)
+ abort();
/* Interchange the two blocks of data in argv. */
- bcopy (&argv[first_nonopt], temp, nonopts_size);
- bcopy (&argv[last_nonopt], &argv[first_nonopt],
- (optindx - last_nonopt) * sizeof (char *));
- bcopy (temp, &argv[first_nonopt + optindx - last_nonopt],
- nonopts_size);
+ memcpy (temp, &argv[first_nonopt], nonopts_size);
+ memcpy (&argv[first_nonopt], &argv[last_nonopt],
+ (optindx - last_nonopt) * sizeof (char *));
+ memcpy (&argv[first_nonopt + optindx - last_nonopt], temp,
+ nonopts_size);
/* Update records for the slots the non-options now occupy. */
first_nonopt += (optindx - last_nonopt);
last_nonopt = optindx;
+
+ free(temp);
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
@@ -243,13 +244,16 @@
char *s = nextchar;
int exact = 0;
int ambig = 0;
- struct optionx *pfound = 0;
+ struct optionx * pfound;
int indfound;
while (*s && *s != '=') s++;
+ indfound = 0; /* quite compiler warning */
+
/* Test all options for either exact match or abbreviated matches. */
- for (p = _getopt_long_options, option_index = 0; p->name;
+ for (p = _getopt_long_options, option_index = 0, pfound = NULL;
+ p->name;
p++, option_index++)
if (!strncmp (p->name, nextchar, s - nextchar))
{
@@ -261,7 +265,7 @@
exact = 1;
break;
}
- else if (pfound == 0)
+ else if (!pfound)
{
/* First nonexact match found. */
pfound = p;
@@ -280,7 +284,7 @@
return '?';
}
- if (pfound != 0)
+ if (pfound)
{
option_index = indfound;
optindx++;
@@ -314,7 +318,7 @@
*(pfound->flag) = pfound->val;
return 0;
}
- if (argv[optindx][0] == '+' || index (optstring, *nextchar) == 0)
+ if (argv[optindx][0] == '+' || strchr (optstring, *nextchar) == 0)
{
if (opterrx != 0)
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
@@ -328,7 +332,7 @@
{
char c = *nextchar++;
- char *temp = index (optstring, c);
+ char *temp = strchr (optstring, c);
/* Increment `optindx' when we start to process its last character. */
if (*nextchar == 0)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/bool.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/bool.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/bool.h Mon May 26 12:59:57 2008
@@ -1,18 +1,18 @@
-#ifndef BOOL_H_INCLUDED
-#define BOOL_H_INCLUDED
+/* This takes the place of C99 stdbool.h, which at least some Windows
+ compilers don't have. (October 2005).
-#ifndef TRUE
-#define TRUE (1)
-#endif
-#ifndef FALSE
-#define FALSE (0)
-#endif
+ One must not also include <stdbool.h>, because it might cause a name
+ collision.
+*/
#ifndef __cplusplus
-#ifndef HAVE_BOOL
-#define HAVE_BOOL
-typedef int bool;
+/* At least the GNU compiler defines __bool_true_false_are_defined */
+#ifndef __bool_true_false_are_defined
+#define __bool_true_false_are_defined
+typedef enum {
+ false = 0,
+ true = 1
+} bool;
#endif
#endif
-#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/casprintf.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/casprintf.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/casprintf.h Mon May 26 12:59:57 2008
@@ -3,16 +3,14 @@
#include <stdarg.h>
-/* GNU_PRINTF_ATTR lets the GNU compiler check printf-type
- calls to be sure the arguments match the format string, thus preventing
- runtime segmentation faults and incorrect messages.
-*/
-#ifdef __GNUC__
-#define GNU_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b)))
-#else
-#define GNU_PRINTF_ATTR(a,b)
+#include "c_util.h"
+
+#ifdef __cplusplus
+extern "C" {
#endif
+extern const char * const strsol;
+
void
cvasprintf(const char ** const retvalP,
const char * const fmt,
@@ -24,4 +22,8 @@
void
strfree(const char * const string);
+#ifdef __cplusplus
+}
+#endif
+
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/cmdline_parser.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/cmdline_parser.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/cmdline_parser.h Mon May 26 12:59:57 2008
@@ -1,6 +1,14 @@
#ifndef CMDLINE_PARSER_H
#define CMDLINE_PARSER_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+} /* to fake out automatic code indenters */
+#endif
+
+#include "int.h"
/*
@@ -10,17 +18,24 @@
*/
-enum optiontype {OPTTYPE_FLAG, OPTTYPE_INT, OPTTYPE_UINT, OPTTYPE_STRING};
+enum optiontype {
+ OPTTYPE_FLAG,
+ OPTTYPE_INT,
+ OPTTYPE_UINT,
+ OPTTYPE_STRING,
+ OPTTYPE_BINUINT,
+ OPTTYPE_FLOAT
+};
struct cmdlineParserCtl;
typedef struct cmdlineParserCtl * cmdlineParser;
void
-cmd_processOptions(cmdlineParser const cpP,
- int const argc,
- const char ** const argv,
- const char ** const errorP);
+cmd_processOptions(cmdlineParser const cpP,
+ int const argc,
+ const char ** const argv,
+ const char ** const errorP);
cmdlineParser
cmd_createOptionParser(void);
@@ -37,18 +52,26 @@
cmd_optionIsPresent(cmdlineParser const cpP,
const char * const name);
-unsigned int
-cmd_getOptionValueUint(cmdlineParser const cpP,
- const char * const name);
-
int
cmd_getOptionValueInt(cmdlineParser const cpP,
const char * const name);
+unsigned int
+cmd_getOptionValueUint(cmdlineParser const cpP,
+ const char * const name);
+
const char *
cmd_getOptionValueString(cmdlineParser const cpP,
const char * const name);
+uint64_t
+cmd_getOptionValueBinUint(cmdlineParser const cpP,
+ const char * const name);
+
+double
+cmd_getOptionValueFloat(cmdlineParser const cpP,
+ const char * const name);
+
unsigned int
cmd_argumentCount(cmdlineParser const cpP);
@@ -56,4 +79,8 @@
cmd_getArgument(cmdlineParser const cpP,
unsigned int const argNumber);
+#ifdef __cplusplus
+}
+#endif
+
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/mallocvar.h Mon May 26 12:59:57 2008
@@ -50,14 +50,28 @@
reallocProduct(void ** const blockP,
unsigned int const factor1,
unsigned int const factor2) {
+
+ void * const oldBlockP = *blockP;
+
+ void * newBlockP;
if (UINT_MAX / factor2 < factor1)
- *blockP = NULL;
+ newBlockP = NULL;
else
- *blockP = realloc(*blockP, factor1 * factor2);
+ newBlockP = realloc(oldBlockP, factor1 * factor2);
+
+ if (newBlockP)
+ *blockP = newBlockP;
+ else {
+ free(oldBlockP);
+ *blockP = NULL;
+ }
}
+/* IMPLEMENTATION NOTE: There are huge strict aliasing pitfalls here
+ if you cast pointers, e.g. (void **)
+*/
#define MALLOCARRAY(arrayName, nElements) do { \
void * array; \
@@ -65,8 +79,11 @@
arrayName = array; \
} while (0)
-#define REALLOCARRAY(arrayName, nElements) \
- reallocProduct((void **)&arrayName, nElements, sizeof(arrayName[0]))
+#define REALLOCARRAY(arrayName, nElements) do { \
+ void * array = arrayName; \
+ reallocProduct(&array, nElements, sizeof(arrayName[0])); \
+ arrayName = array; \
+} while (0)
#define MALLOCARRAY_NOFAIL(arrayName, nElements) \
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/pthreadx.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/pthreadx.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/include/pthreadx.h Mon May 26 12:59:57 2008
@@ -30,39 +30,51 @@
# define _REENTRANT
# include <pthread.h>
#elif defined (WIN32)
+#include <windows.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef HANDLE pthread_t;
typedef CRITICAL_SECTION pthread_mutex_t;
#define PTHREAD_MUTEX_INITIALIZER NULL
- //usage: pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+ /* usage: pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; */
typedef
struct {
- int attrs; //currently unused. placeholder.
+ int attrs; /* currently unused. placeholder. */
} pthread_attr_t;
typedef
struct {
- int attrs; //currently unused. placeholder.
+ int attrs; /* currently unused. placeholder. */
} pthread_mutexattr_t;
-//typedef void * (*pthread_func)(void *);
-typedef unsigned ( __stdcall *pthread_func )( void * );
-
-extern int pthread_create(pthread_t *new_thread_ID,
- const pthread_attr_t *attr,
- pthread_func start_func, void *arg);
+/* We make pthread_func identical to a Windows thread start function
+ so we can use Windows thread functions to implement these pthread
+ functions directly.
+*/
+typedef unsigned (WINAPI pthread_func)(void *);
+
+extern int pthread_create(pthread_t * const new_thread_ID,
+ const pthread_attr_t * const attr,
+ pthread_func * start_func,
+ void * const arg);
extern int pthread_cancel(pthread_t target_thread);
extern int pthread_join(pthread_t target_thread, void **status);
extern int pthread_detach(pthread_t target_thread);
-extern int pthread_mutex_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t *attr);
-extern int pthread_mutex_lock(pthread_mutex_t *mp);
-extern int pthread_mutex_unlock(pthread_mutex_t *mp);
-extern int pthread_mutex_destroy(pthread_mutex_t *mp);
+extern int pthread_mutex_init(pthread_mutex_t * const mp,
+ const pthread_mutexattr_t * const attr);
+extern int pthread_mutex_lock(pthread_mutex_t * const mp);
+extern int pthread_mutex_unlock(pthread_mutex_t * const mp);
+extern int pthread_mutex_destroy(pthread_mutex_t * const mp);
+#ifdef __cplusplus
+}
+#endif
#endif /* WIN32 */
#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/pthreadx_win32.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/pthreadx_win32.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/util/pthreadx_win32.c Mon May 26 12:59:57 2008
@@ -25,7 +25,7 @@
#include "xmlrpc_config.h"
-#if WIN32
+#ifdef WIN32
#include "pthreadx.h"
@@ -34,15 +34,17 @@
#undef PACKAGE
#undef VERSION
-int pthread_create(pthread_t *new_thread_ID,
- const pthread_attr_t * attr,
- pthread_func start_func, void *arg)
-{
+int
+pthread_create(pthread_t * const new_thread_ID,
+ const pthread_attr_t * const attr,
+ pthread_func * func,
+ void * const arg) {
+
HANDLE hThread;
DWORD dwThreadID;
hThread = (HANDLE) _beginthreadex (
- NULL, 0, start_func, (LPVOID)arg, CREATE_SUSPENDED, &dwThreadID);
+ NULL, 0, func, (LPVOID)arg, CREATE_SUSPENDED, &dwThreadID);
SetThreadPriority (hThread, THREAD_PRIORITY_NORMAL);
ResumeThread (hThread);
@@ -52,48 +54,68 @@
return hThread ? 0 : -1;
}
+
+
/* Just kill it. */
-int pthread_cancel(pthread_t target_thread)
-{
- CloseHandle (target_thread);
+int
+pthread_cancel(pthread_t const target_thread) {
+
+ CloseHandle(target_thread);
return 0;
}
+
+
/* Waits for the thread to exit before continuing. */
-int pthread_join(pthread_t target_thread, void **status)
-{
+int
+pthread_join(pthread_t const target_thread,
+ void ** const statusP) {
+
DWORD dwResult = WaitForSingleObject(target_thread, INFINITE);
- (*status) = (void *)dwResult;
+ *statusP = (void *)dwResult;
return 0;
}
-/* Stubbed. Do nothing. */
-int pthread_detach(pthread_t target_thread)
-{
+
+
+int
+pthread_detach(pthread_t const target_thread) {
return 0;
}
-int pthread_mutex_init(pthread_mutex_t *mp,
- const pthread_mutexattr_t * attr)
-{
+
+
+int
+pthread_mutex_init(pthread_mutex_t * const mp,
+ const pthread_mutexattr_t * const attr) {
+
InitializeCriticalSection(mp);
return 0;
}
-int pthread_mutex_lock(pthread_mutex_t *mp)
-{
+
+
+int
+pthread_mutex_lock(pthread_mutex_t * const mp) {
+
EnterCriticalSection(mp);
return 0;
}
-int pthread_mutex_unlock(pthread_mutex_t *mp)
-{
+
+
+int
+pthread_mutex_unlock(pthread_mutex_t * const mp) {
+
LeaveCriticalSection(mp);
return 0;
}
-int pthread_mutex_destroy(pthread_mutex_t *mp)
-{
+
+
+int
+pthread_mutex_destroy(pthread_mutex_t * const mp) {
+
DeleteCriticalSection(mp);
return 0;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/Makefile Mon May 26 12:59:57 2008
@@ -1,18 +1,34 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ LIBDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(LIBDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := lib/wininet_transport
-include $(SRCDIR)/Makefile.config
-
-CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = -lpthread $(LADD)
-
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/src
+include $(BLDDIR)/config.mk
default: all
.PHONY: all
-all: xmlrpc_wininet_transport.lo
+all: xmlrpc_wininet_transport.o xmlrpc_wininet_transport.osh
+
+# Rules for the above dependencies are in common.mk,
+# courtesy of TARGET_MODS.
+
+TARGET_MODS = xmlrpc_wininet_transport
+
+OMIT_WININET_TRANSPORT_RULE=Y
+
+include $(SRCDIR)/common.mk
+
+CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
+
+INCLUDES = \
+ -I$(BLDDIR) \
+ -I$(BLDDIR)/include \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/lib/util/include \
.PHONY: clean
clean: clean-common
@@ -32,9 +48,8 @@
.PHONY: dep
dep: dep-common
-include $(SRCDIR)/Makefile.common
-
include Makefile.depend
-xmlrpc_wininet_transport.lo:%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(CFLAGS) $<
+# Need this dependency for those who don't use Makefile.depend.
+# Without it, version.h doesn't get created.
+xmlrpc_wininet_transport.o xmlrpc_wininet_transport.osh: version.h
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/xmlrpc_wininet_transport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/xmlrpc_wininet_transport.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/lib/wininet_transport/xmlrpc_wininet_transport.c Mon May 26 12:59:57 2008
@@ -4,56 +4,48 @@
WinInet-based client transport for Xmlrpc-c. Copyright information at
the bottom of this file.
- Changelog (changes by Steven A. Bone - sbone(a)pobox.com unless otherwise noted):
- 05.01.01 - Significant refactoring of the transport layer due to internal
- changes of the xmlrpc-c transports. Modeled after the CURL
- based transport changes by Bryan Henderson.
- 05.02.03 - Fixed Authorization header - thanks yamer.
- 05.03.20 - Supports xmlrpc_xportparms, xmlrpc_wininet_xportparms added
- *potential breaking change* - now by default we fail on invalid
- SSL certs, use the xmlrpc_wininet_xportparms option to enable old
- behavior.
-
=============================================================================*/
#include "xmlrpc_config.h"
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stddef.h>
+#include <windows.h>
+#include <wininet.h>
+
#include "bool.h"
#include "mallocvar.h"
#include "linklist.h"
#include "casprintf.h"
+#include "pthreadx.h"
+
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
#include "xmlrpc-c/client.h"
#include "xmlrpc-c/client_int.h"
-#include "pthreadx.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stddef.h>
+#include "xmlrpc-c/transport.h"
-#if defined (WIN32)
-# include <wininet.h>
-#endif /*WIN32*/
-
-#if defined (WIN32) && defined(_DEBUG)
-# include <crtdbg.h>
-# define new DEBUG_NEW
-# define malloc(size) _malloc_dbg( size, _NORMAL_BLOCK, __FILE__, __LINE__)
-# undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
-#endif /*WIN32 && _DEBUG*/
+#if defined(_DEBUG)
+# include <crtdbg.h>
+# define new DEBUG_NEW
+# define malloc(size) _malloc_dbg( size, _NORMAL_BLOCK, __FILE__, __LINE__)
+# undef THIS_FILE
+ static char THIS_FILE[] = __FILE__;
+#endif
static HINTERNET hSyncInternetSession = NULL;
/* Declare WinInet status callback. */
-void CALLBACK statusCallback (HINTERNET hInternet,
- unsigned long dwContext,
- unsigned long dwInternetStatus,
- void * lpvStatusInformation,
- unsigned long dwStatusInformationLength);
+void CALLBACK
+statusCallback(HINTERNET const hInternet,
+ unsigned long const dwContext,
+ unsigned long const dwInternetStatus,
+ void * const lpvStatusInformation,
+ unsigned long const dwStatusInformationLength);
struct xmlrpc_client_transport {
@@ -65,24 +57,24 @@
*/
int allowInvalidSSLCerts;
/* Flag to specify if we ignore invalid SSL Certificates. If this
- is set to zero, calling a XMLRPC server with an invalid SSL
- certificate will fail. This is the default behavior of the other
- transports, but invalid certificates were allowed in pre 1.2
- wininet xmlrpc-c transports.
+ is set to zero, calling a XMLRPC server with an invalid SSL
+ certificate will fail. This is the default behavior of the other
+ transports, but invalid certificates were allowed in pre 1.2
+ wininet xmlrpc-c transports.
*/
};
typedef struct {
unsigned long http_status;
- HINTERNET hHttpRequest;
- HINTERNET hURL;
- INTERNET_PORT nPort;
- char szHostName[255];
- char szUrlPath[255];
- BOOL bUseSSL;
- char *headerList;
- BYTE *pSendData;
- xmlrpc_mem_block *pResponseData;
+ HINTERNET hHttpRequest;
+ HINTERNET hURL;
+ INTERNET_PORT nPort;
+ char szHostName[255];
+ char szUrlPath[255];
+ BOOL bUseSSL;
+ char * headerList;
+ BYTE * pSendData;
+ xmlrpc_mem_block * pResponseData;
} winInetTransaction;
typedef struct {
@@ -100,112 +92,117 @@
*/
struct xmlrpc_call_info * callInfoP;
/* User's identifier for this RPC */
- struct xmlrpc_client_transport * clientTransportP;
+ struct xmlrpc_client_transport * clientTransportP;
} rpc;
+
+
static void
-createWinInetHeaderList( xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- char ** const headerListP) {
+createWinInetHeaderList(xmlrpc_env * const envP,
+ const xmlrpc_server_info * const serverP,
+ char ** const headerListP) {
+
+ const char * const szContentType = "Content-Type: text/xml\r\n";
- char *szHeaderList = NULL;
- char *szContentType = "Content-Type: text/xml\r\n";
+ char * szHeaderList;
/* Send an authorization header if we need one. */
- if (serverP->_http_basic_auth) {
+ if (serverP->allowedAuth.basic) {
/* Make the header with content type and authorization */
/* NOTE: A newline is required between each added header */
- szHeaderList = malloc(strlen(szContentType) + 17 + strlen(serverP->_http_basic_auth) + 1 );
+ szHeaderList = malloc(strlen(szContentType) + 17 +
+ strlen(serverP->basicAuthHdrValue) + 1);
if (szHeaderList == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for authorization header");
+ xmlrpc_faultf(envP,
+ "Couldn't allocate memory for authorization header");
else {
- memcpy(szHeaderList,szContentType, strlen(szContentType));
- memcpy(szHeaderList + strlen(szContentType),"\r\nAuthorization: ", 17);
- memcpy(szHeaderList + strlen(szContentType) + 17, serverP->_http_basic_auth,
- strlen(serverP->_http_basic_auth) + 1);
+ memcpy(szHeaderList, szContentType, strlen(szContentType));
+ memcpy(szHeaderList + strlen(szContentType),"\r\nAuthorization: ",
+ 17);
+ memcpy(szHeaderList + strlen(szContentType) + 17,
+ serverP->basicAuthHdrValue,
+ strlen(serverP->basicAuthHdrValue) + 1);
}
- }
- else
- {
- /* Just the content type header is needed */
- szHeaderList = malloc(strlen(szContentType) + 1);
+ } else {
+ /* Just the content type header is needed */
+ szHeaderList = malloc(strlen(szContentType) + 1);
if (szHeaderList == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Couldn't allocate memory for standard header");
+ xmlrpc_faultf(envP,
+ "Couldn't allocate memory for standard header");
else
- memcpy(szHeaderList,szContentType, strlen(szContentType)+1);
- }
-
+ memcpy(szHeaderList, szContentType, strlen(szContentType) + 1);
+ }
*headerListP = szHeaderList;
}
+
+
static void
-createWinInetTransaction(xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block * const responseXmlP,
- winInetTransaction ** const winInetTransactionPP) {
+createWinInetTransaction(xmlrpc_env * const envP,
+ const xmlrpc_server_info * const serverP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_mem_block * const responseXmlP,
+ winInetTransaction ** const winInetTranPP) {
winInetTransaction * winInetTransactionP;
MALLOCVAR(winInetTransactionP);
if (winInetTransactionP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "No memory to create WinInet transaction.");
+ xmlrpc_faultf(envP, "No memory to create WinInet transaction.");
else {
- char szExtraInfo[255];
- char szScheme[100];
- URL_COMPONENTS uc;
-
- /* Init to defaults */
- winInetTransactionP->http_status = 0;
- winInetTransactionP->hHttpRequest = NULL;
- winInetTransactionP->hURL = NULL;
- winInetTransactionP->headerList=NULL;
- winInetTransactionP->pSendData=NULL;
- winInetTransactionP->pResponseData=responseXmlP;
-
- /* Parse the URL and store results into the winInetTransaction struct */
- memset (&uc, 0, sizeof (uc));
- uc.dwStructSize = sizeof (uc);
- uc.lpszScheme = szScheme;
- uc.dwSchemeLength = 100;
- uc.lpszHostName = winInetTransactionP->szHostName;
- uc.dwHostNameLength = 255;
- uc.lpszUrlPath = winInetTransactionP->szUrlPath;
- uc.dwUrlPathLength = 255;
- uc.lpszExtraInfo = szExtraInfo;
- uc.dwExtraInfoLength = 255;
- if (InternetCrackUrl (serverP->_server_url, strlen (serverP->_server_url), ICU_ESCAPE, &uc) == FALSE)
- {
- xmlrpc_env_set_fault_formatted( envP, XMLRPC_INTERNAL_ERROR,
- "Unable to parse the server URL.");
- }
- else
- {
- winInetTransactionP->nPort = (uc.nPort) ? uc.nPort : INTERNET_DEFAULT_HTTP_PORT;
- if (_strnicmp (uc.lpszScheme, "https", 5) == 0)
- winInetTransactionP->bUseSSL=TRUE;
- else
- winInetTransactionP->bUseSSL=FALSE;
- createWinInetHeaderList(envP, serverP, &winInetTransactionP->headerList);
-
- XMLRPC_MEMBLOCK_APPEND(char, envP, callXmlP, "\0", 1);
- if (!envP->fault_occurred) {
- winInetTransactionP->pSendData = XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP);
- }
- }
-
-
- if (envP->fault_occurred)
+ char szExtraInfo[255];
+ char szScheme[100];
+ URL_COMPONENTS uc;
+ BOOL succeeded;
+
+ /* Init to defaults */
+ winInetTransactionP->http_status = 0;
+ winInetTransactionP->hHttpRequest = NULL;
+ winInetTransactionP->hURL = NULL;
+ winInetTransactionP->headerList = NULL;
+ winInetTransactionP->pSendData = NULL;
+ winInetTransactionP->pResponseData = responseXmlP;
+
+ /* Parse the URL and store results into the winInetTransaction */
+
+ memset(&uc, 0, sizeof(uc));
+ uc.dwStructSize = sizeof (uc);
+ uc.lpszScheme = szScheme;
+ uc.dwSchemeLength = 100;
+ uc.lpszHostName = winInetTransactionP->szHostName;
+ uc.dwHostNameLength = 255;
+ uc.lpszUrlPath = winInetTransactionP->szUrlPath;
+ uc.dwUrlPathLength = 255;
+ uc.lpszExtraInfo = szExtraInfo;
+ uc.dwExtraInfoLength = 255;
+ succeeded = InternetCrackUrl(serverP->serverUrl,
+ strlen(serverP->serverUrl),
+ ICU_ESCAPE, &uc);
+ if (!succeeded)
+ xmlrpc_faultf(envP, "Unable to parse the server URL.");
+ else {
+ winInetTransactionP->nPort =
+ uc.nPort ? uc.nPort : INTERNET_DEFAULT_HTTP_PORT;
+ if (_strnicmp(uc.lpszScheme, "https", 5) == 0)
+ winInetTransactionP->bUseSSL=TRUE;
+ else
+ winInetTransactionP->bUseSSL=FALSE;
+ createWinInetHeaderList(envP, serverP,
+ &winInetTransactionP->headerList);
+
+ XMLRPC_MEMBLOCK_APPEND(char, envP, callXmlP, "\0", 1);
+ if (!envP->fault_occurred) {
+ winInetTransactionP->pSendData =
+ XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP);
+ }
+ }
+
+ if (envP->fault_occurred)
free(winInetTransactionP);
}
- *winInetTransactionPP = winInetTransactionP;
+ *winInetTranPP = winInetTransactionP;
}
@@ -213,338 +210,373 @@
static void
destroyWinInetTransaction(winInetTransaction * const winInetTransactionP) {
- XMLRPC_ASSERT_PTR_OK(winInetTransactionP);
+ XMLRPC_ASSERT_PTR_OK(winInetTransactionP);
+
+ if (winInetTransactionP->hHttpRequest)
+ InternetCloseHandle(winInetTransactionP->hHttpRequest);
- if (winInetTransactionP->hHttpRequest)
- InternetCloseHandle (winInetTransactionP->hHttpRequest);
+ if (winInetTransactionP->hURL)
+ InternetCloseHandle(winInetTransactionP->hURL);
- if (winInetTransactionP->hURL)
- InternetCloseHandle (winInetTransactionP->hURL);
+ if (winInetTransactionP->headerList)
+ free(winInetTransactionP->headerList);
- if (winInetTransactionP->headerList)
- free(winInetTransactionP->headerList);
-
- free(winInetTransactionP);
-}
-
-static void get_wininet_response ( xmlrpc_env * const envP,
- winInetTransaction * const winInetTransactionP)
-{
- INTERNET_BUFFERS inetBuffer;
- LPTSTR pMsg = NULL;
- PVOID pMsgMem = NULL;
- unsigned long dwFlags;
- unsigned long dwErr = 0;
- unsigned long nExpected = 0;
- unsigned long dwLen = sizeof (unsigned long);
- void * body = NULL;
- BOOL bOK = FALSE;
-
- inetBuffer.dwStructSize = sizeof (INTERNET_BUFFERS);
- inetBuffer.Next = NULL;
- inetBuffer.lpcszHeader = NULL;
- inetBuffer.dwHeadersTotal = inetBuffer.dwHeadersLength = 0;
- inetBuffer.dwOffsetHigh = inetBuffer.dwOffsetLow = 0;
- inetBuffer.dwBufferLength = 0;
-
- bOK = HttpQueryInfo (winInetTransactionP->hHttpRequest,
- HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER,
- &inetBuffer.dwBufferTotal, &dwLen, NULL);
- if (!bOK)
- {
- dwErr = GetLastError ();
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- dwErr,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &pMsgMem,
- 1024,NULL);
-
- pMsg = (pMsgMem) ? (LPTSTR)(pMsgMem) : "Sync HttpQueryInfo failed.";
- XMLRPC_FAIL (envP, XMLRPC_NETWORK_ERROR, pMsg);
- }
+ free(winInetTransactionP);
+}
+
+
+
+static void
+get_wininet_response(xmlrpc_env * const envP,
+ winInetTransaction * const winInetTransactionP) {
+
+ unsigned long dwLen;
+ INTERNET_BUFFERS inetBuffer;
+ unsigned long dwFlags;
+ unsigned long dwErr;
+ unsigned long nExpected;
+ void * body;
+ BOOL bOK;
+ PVOID pMsgMem;
+
+ pMsgMem = NULL; /* initial value */
+ dwErr = 0; /* initial value */
+ body = NULL; /* initial value */
+ dwLen = sizeof(unsigned long); /* initial value */
+
+ inetBuffer.dwStructSize = sizeof (INTERNET_BUFFERS);
+ inetBuffer.Next = NULL;
+ inetBuffer.lpcszHeader = NULL;
+ inetBuffer.dwHeadersTotal = 0;
+ inetBuffer.dwHeadersLength = 0;
+ inetBuffer.dwOffsetHigh = 0;
+ inetBuffer.dwOffsetLow = 0;
+ inetBuffer.dwBufferLength = 0;
+
+ /* Note that while Content-Length is optional in HTTP 1.1, it is
+ required by XML-RPC. Following fails if server didn't send it.
+ */
+
+ bOK = HttpQueryInfo(winInetTransactionP->hHttpRequest,
+ HTTP_QUERY_CONTENT_LENGTH|HTTP_QUERY_FLAG_NUMBER,
+ &inetBuffer.dwBufferTotal, &dwLen, NULL);
+ if (!bOK) {
+ LPTSTR pMsg;
+ dwErr = GetLastError ();
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ dwErr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &pMsgMem,
+ 1024,NULL);
+
+ pMsg = pMsgMem ? (LPTSTR)pMsgMem : "Sync HttpQueryInfo failed.";
+ XMLRPC_FAIL(envP, XMLRPC_NETWORK_ERROR, pMsg);
+ }
if (inetBuffer.dwBufferTotal == 0)
- XMLRPC_FAIL (envP, XMLRPC_NETWORK_ERROR, "WinInet returned no data");
+ XMLRPC_FAIL(envP, XMLRPC_NETWORK_ERROR, "WinInet returned no data");
- body = inetBuffer.lpvBuffer = calloc (inetBuffer.dwBufferTotal, sizeof (TCHAR));
- dwFlags = IRF_SYNC;
- inetBuffer.dwBufferLength = nExpected = inetBuffer.dwBufferTotal;
- InternetQueryDataAvailable (winInetTransactionP->hHttpRequest, &inetBuffer.dwBufferLength, 0, 0);
-
- /* Read Response from InternetFile */
- do
- {
- if (inetBuffer.dwBufferLength != 0)
- bOK = InternetReadFileEx (winInetTransactionP->hHttpRequest, &inetBuffer, dwFlags, 1);
-
- if (!bOK)
- dwErr = GetLastError ();
-
- if (dwErr)
- {
- if (dwErr == WSAEWOULDBLOCK || dwErr == ERROR_IO_PENDING)
- {
- /* Non-block socket operation wait 10 msecs */
- SleepEx (10, TRUE);
- /* Reset dwErr to zero for next pass */
- dwErr = 0;
- }
- else
- {
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- dwErr,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &pMsgMem,
- 1024,NULL);
- pMsg = (pMsgMem) ? (LPTSTR)(pMsgMem) : "ASync InternetReadFileEx failed.";
- XMLRPC_FAIL (envP, XMLRPC_NETWORK_ERROR, pMsg);
- }
- }
-
- if (inetBuffer.dwBufferLength)
- {
- TCHAR * bufptr = inetBuffer.lpvBuffer;
- bufptr += inetBuffer.dwBufferLength;
- inetBuffer.lpvBuffer = bufptr;
- nExpected -= inetBuffer.dwBufferLength;
- /* Adjust inetBuffer.dwBufferLength when it is greater than the */
- /* expected end of file */
- if (inetBuffer.dwBufferLength > nExpected)
- inetBuffer.dwBufferLength = nExpected;
-
- }
- else
- inetBuffer.dwBufferLength = nExpected;
- dwErr = 0;
- } while (nExpected != 0);
+ inetBuffer.lpvBuffer = calloc(inetBuffer.dwBufferTotal, sizeof(TCHAR));
+ body = inetBuffer.lpvBuffer;
+ dwFlags = IRF_SYNC;
+ nExpected = inetBuffer.dwBufferTotal;
+ inetBuffer.dwBufferLength = nExpected;
+ InternetQueryDataAvailable(winInetTransactionP->hHttpRequest,
+ &inetBuffer.dwBufferLength, 0, 0);
+
+ /* Read Response from InternetFile */
+ do {
+ if (inetBuffer.dwBufferLength != 0)
+ bOK = InternetReadFileEx(winInetTransactionP->hHttpRequest,
+ &inetBuffer, dwFlags, 1);
+
+ if (!bOK)
+ dwErr = GetLastError();
+
+ if (dwErr) {
+ if (dwErr == WSAEWOULDBLOCK || dwErr == ERROR_IO_PENDING) {
+ /* Non-block socket operation wait 10 msecs */
+ SleepEx(10, TRUE);
+ /* Reset dwErr to zero for next pass */
+ dwErr = 0;
+ } else {
+ LPTSTR pMsg;
+ FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ dwErr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &pMsgMem,
+ 1024,NULL);
+ pMsg = pMsgMem ?
+ (LPTSTR)pMsgMem : "ASync InternetReadFileEx failed.";
+ XMLRPC_FAIL(envP, XMLRPC_NETWORK_ERROR, pMsg);
+ }
+ }
+
+ if (inetBuffer.dwBufferLength) {
+ TCHAR * const oldBufptr = inetBuffer.lpvBuffer;
+ inetBuffer.lpvBuffer = oldBufptr + inetBuffer.dwBufferLength;
+ nExpected -= inetBuffer.dwBufferLength;
+ /* Adjust inetBuffer.dwBufferLength when it is greater than the */
+ /* expected end of file */
+ if (inetBuffer.dwBufferLength > nExpected)
+ inetBuffer.dwBufferLength = nExpected;
+
+ } else
+ inetBuffer.dwBufferLength = nExpected;
+ dwErr = 0;
+ } while (nExpected != 0);
/* Add to the response buffer. */
- xmlrpc_mem_block_append(envP, winInetTransactionP->pResponseData, body, inetBuffer.dwBufferTotal);
- XMLRPC_FAIL_IF_FAULT (envP);
+ xmlrpc_mem_block_append(envP, winInetTransactionP->pResponseData, body,
+ inetBuffer.dwBufferTotal);
+ XMLRPC_FAIL_IF_FAULT(envP);
cleanup:
- /* Since the XMLRPC_FAIL calls goto cleanup, we must handle */
- /* the free'ing of the memory here. */
- if (pMsgMem != NULL)
- {
- LocalFree( pMsgMem );
- }
+ /* Since the XMLRPC_FAIL calls goto cleanup, we must handle */
+ /* the free'ing of the memory here. */
+ if (pMsgMem != NULL)
+ LocalFree(pMsgMem);
- if (body)
- free (body);
+ if (body)
+ free(body);
}
+
static void
-performWinInetTransaction(xmlrpc_env * const envP,
- winInetTransaction * const winInetTransactionP,
- struct xmlrpc_client_transport * const clientTransportP) {
- LPTSTR pMsg = NULL;
- LPVOID pMsgMem = NULL;
-
- unsigned long lastErr;
- unsigned long reqFlags = INTERNET_FLAG_NO_UI;
- char * acceptTypes[] = {"text/xml", NULL};
- unsigned long queryLen = sizeof (unsigned long);
-
- winInetTransactionP->hURL = InternetConnect (hSyncInternetSession,
- winInetTransactionP->szHostName, winInetTransactionP->nPort,
- NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
-
- /* Start our request running. */
- if (winInetTransactionP->bUseSSL == TRUE)
- reqFlags |= INTERNET_FLAG_SECURE |INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
-
- winInetTransactionP->hHttpRequest = HttpOpenRequest (winInetTransactionP->hURL, "POST",
- winInetTransactionP->szUrlPath, "HTTP/1.1", NULL, (const char **)&acceptTypes,
- reqFlags, 1);
-
- XMLRPC_FAIL_IF_NULL(winInetTransactionP->hHttpRequest,envP, XMLRPC_INTERNAL_ERROR,
- "Unable to open the requested URL.");
-
- if ( HttpAddRequestHeaders (winInetTransactionP->hHttpRequest, winInetTransactionP->headerList,
- strlen (winInetTransactionP->headerList), HTTP_ADDREQ_FLAG_ADD|HTTP_ADDREQ_FLAG_REPLACE ) ==FALSE)
- {
- XMLRPC_FAIL (envP, XMLRPC_INTERNAL_ERROR, "Could not set Content-Type.");
- }
-
-#ifdef DEBUG
- /* Provide the user with transport status information */
- InternetSetStatusCallback (winInetTransactionP->hHttpRequest, statusCallback);
-#endif
+performWinInetTransaction(
+ xmlrpc_env * const envP,
+ winInetTransaction * const winInetTransactionP,
+ struct xmlrpc_client_transport * const clientTransportP) {
+
+ const char * const acceptTypes[] = {"text/xml", NULL};
+
+ unsigned long queryLen;
+ LPVOID pMsgMem;
+ BOOL succeeded;
+
+ unsigned long lastErr;
+ unsigned long reqFlags;
+
+ pMsgMem = NULL; /* initial value */
+
+ reqFlags = INTERNET_FLAG_NO_UI; /* initial value */
+
+ winInetTransactionP->hURL =
+ InternetConnect(hSyncInternetSession,
+ winInetTransactionP->szHostName,
+ winInetTransactionP->nPort,
+ NULL, NULL, INTERNET_SERVICE_HTTP, 0, 1);
+
+ /* Start our request running. */
+ if (winInetTransactionP->bUseSSL == TRUE)
+ reqFlags |=
+ INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
+
+ winInetTransactionP->hHttpRequest =
+ HttpOpenRequest(winInetTransactionP->hURL, "POST",
+ winInetTransactionP->szUrlPath, "HTTP/1.1", NULL,
+ (const char **)&acceptTypes,
+ reqFlags, 1);
+
+ XMLRPC_FAIL_IF_NULL(winInetTransactionP->hHttpRequest, envP,
+ XMLRPC_INTERNAL_ERROR,
+ "Unable to open the requested URL.");
+
+ succeeded =
+ HttpAddRequestHeaders(winInetTransactionP->hHttpRequest,
+ winInetTransactionP->headerList,
+ strlen (winInetTransactionP->headerList),
+ HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE);
+
+ if (!succeeded)
+ XMLRPC_FAIL(envP, XMLRPC_INTERNAL_ERROR,
+ "Could not set Content-Type.");
Again:
- /* Send the requested XML remote procedure command */
- if (HttpSendRequest (winInetTransactionP->hHttpRequest, NULL, 0,
- winInetTransactionP->pSendData,
- strlen(winInetTransactionP->pSendData))==FALSE)
- {
- lastErr = GetLastError ();
-
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- lastErr,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &pMsgMem,
- 0, NULL);
-
-
- if (pMsgMem == NULL)
- {
- switch (lastErr)
- {
- case ERROR_INTERNET_CANNOT_CONNECT:
- pMsg = "Sync HttpSendRequest failed: Connection refused.";
- break;
- case ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED:
- pMsg = "Sync HttpSendRequest failed: Client authorization certificate needed.";
- break;
-
- /* The following conditions are recommendations that microsoft */
- /* provides in their knowledge base. */
-
- /* HOWTO: Handle Invalid Certificate Authority Error with WinInet (Q182888) */
- case ERROR_INTERNET_INVALID_CA:
- if (clientTransportP->allowInvalidSSLCerts){
- OutputDebugString ("Sync HttpSendRequest failed: "
- "The function is unfamiliar with the certificate "
- "authority that generated the server's certificate. ");
- reqFlags = SECURITY_FLAG_IGNORE_UNKNOWN_CA;
-
- InternetSetOption (winInetTransactionP->hHttpRequest, INTERNET_OPTION_SECURITY_FLAGS,
- &reqFlags, sizeof (reqFlags));
-
- goto Again;
- }
- else{
- pMsg = "Invalid or unknown/untrusted SSL Certificate Authority.";
- }
- break;
-
- /* HOWTO: Make SSL Requests Using WinInet (Q168151) */
- case ERROR_INTERNET_SEC_CERT_CN_INVALID:
- if (clientTransportP->allowInvalidSSLCerts){
- OutputDebugString ("Sync HttpSendRequest failed: "
- "The SSL certificate common name (host name field) is incorrect\r\n "
- "for example, if you entered www.server.com and the common name "
- "on the certificate says www.different.com. ");
-
- reqFlags = INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
-
- InternetSetOption (winInetTransactionP->hHttpRequest, INTERNET_OPTION_SECURITY_FLAGS,
- &reqFlags, sizeof (reqFlags));
-
- goto Again;
- }
- else{
- pMsg = "The SSL certificate common name (host name field) is incorrect.";
- }
- break;
-
- case ERROR_INTERNET_SEC_CERT_DATE_INVALID:
- if (clientTransportP->allowInvalidSSLCerts){
- OutputDebugString ("Sync HttpSendRequest failed: "
- "The SSL certificate date that was received from the server is "
- "bad. The certificate is expired. ");
-
- reqFlags = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
-
- InternetSetOption (winInetTransactionP->hHttpRequest, INTERNET_OPTION_SECURITY_FLAGS,
- &reqFlags, sizeof (reqFlags));
-
- goto Again;
- }
- else{
- pMsg = "The SSL certificate date that was received from the server is invalid.";
- }
- break;
-
- default:
- pMsg = (LPTSTR)pMsgMem = LocalAlloc (LPTR, MAX_PATH);
- sprintf (pMsg, "Sync HttpSendRequest failed: GetLastError (%d)", lastErr);
- break;
-
- }
- }
- else
- {
- pMsg = (LPTSTR)(pMsgMem);
-
- }
- XMLRPC_FAIL (envP, XMLRPC_NETWORK_ERROR, pMsg);
-
- }
-
- if( HttpQueryInfo (winInetTransactionP->hHttpRequest,
- HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE,
- &winInetTransactionP->http_status, &queryLen, NULL) == FALSE)
- {
- lastErr = GetLastError ();
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM,
- NULL,
- lastErr,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) &pMsgMem,
- 1024,NULL);
+ /* Send the requested XML remote procedure command */
+ succeeded = HttpSendRequest(winInetTransactionP->hHttpRequest, NULL, 0,
+ winInetTransactionP->pSendData,
+ strlen(winInetTransactionP->pSendData));
+ if (!succeeded) {
+ LPTSTR pMsg;
+
+ lastErr = GetLastError();
+
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ lastErr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &pMsgMem,
+ 0, NULL);
+
+ if (pMsgMem == NULL) {
+ switch (lastErr) {
+ case ERROR_INTERNET_CANNOT_CONNECT:
+ pMsg = "Sync HttpSendRequest failed: Connection refused.";
+ break;
+ case ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED:
+ pMsg = "Sync HttpSendRequest failed: "
+ "Client authorization certificate needed.";
+ break;
+
+ /* The following conditions are recommendations that microsoft */
+ /* provides in their knowledge base. */
+
+ /* HOWTO: Handle Invalid Certificate Authority Error with
+ WinInet (Q182888)
+ */
+ case ERROR_INTERNET_INVALID_CA:
+ if (clientTransportP->allowInvalidSSLCerts){
+ OutputDebugString(
+ "Sync HttpSendRequest failed: "
+ "The function is unfamiliar with the certificate "
+ "authority that generated the server's certificate. ");
+ reqFlags = SECURITY_FLAG_IGNORE_UNKNOWN_CA;
+
+ InternetSetOption(winInetTransactionP->hHttpRequest,
+ INTERNET_OPTION_SECURITY_FLAGS,
+ &reqFlags, sizeof(reqFlags));
+
+ goto Again;
+ } else
+ pMsg = "Invalid or unknown/untrusted "
+ "SSL Certificate Authority.";
+ break;
+
+ /* HOWTO: Make SSL Requests Using WinInet (Q168151) */
+ case ERROR_INTERNET_SEC_CERT_CN_INVALID:
+ if (clientTransportP->allowInvalidSSLCerts) {
+ OutputDebugString(
+ "Sync HttpSendRequest failed: "
+ "The SSL certificate common name (host name field) "
+ "is incorrect\r\n "
+ "for example, if you entered www.server.com "
+ "and the common name "
+ "on the certificate says www.different.com. ");
+
+ reqFlags = INTERNET_FLAG_IGNORE_CERT_CN_INVALID;
+
+ InternetSetOption(winInetTransactionP->hHttpRequest,
+ INTERNET_OPTION_SECURITY_FLAGS,
+ &reqFlags, sizeof(reqFlags));
+
+ goto Again;
+ } else
+ pMsg = "The SSL certificate common name "
+ "(host name field) is incorrect.";
+ break;
+
+ case ERROR_INTERNET_SEC_CERT_DATE_INVALID:
+ if (clientTransportP->allowInvalidSSLCerts) {
+ OutputDebugString(
+ "Sync HttpSendRequest failed: "
+ "The SSL certificate date that was received "
+ "from the server is "
+ "bad. The certificate is expired. ");
+
+ reqFlags = INTERNET_FLAG_IGNORE_CERT_DATE_INVALID;
+
+ InternetSetOption(winInetTransactionP->hHttpRequest,
+ INTERNET_OPTION_SECURITY_FLAGS,
+ &reqFlags, sizeof(reqFlags));
+
+ goto Again;
+ } else
+ pMsg = "The SSL certificate date that was received "
+ "from the server is invalid.";
+ break;
+
+ default:
+ pMsg = (LPTSTR)pMsgMem = LocalAlloc(LPTR, MAX_PATH);
+ sprintf(pMsg, "Sync HttpSendRequest failed: "
+ "GetLastError (%d)", lastErr);
+ break;
- pMsg = (pMsgMem) ? (LPTSTR)(pMsgMem) : "Sync HttpQueryInfo failed.";
- XMLRPC_FAIL (envP, XMLRPC_NETWORK_ERROR, pMsg);
+ }
+ } else
+ pMsg = (LPTSTR)pMsgMem;
+
+ XMLRPC_FAIL(envP, XMLRPC_NETWORK_ERROR, pMsg);
+ }
+
+ queryLen = sizeof(unsigned long); /* initial value */
- }
+ succeeded = HttpQueryInfo(winInetTransactionP->hHttpRequest,
+ HTTP_QUERY_FLAG_NUMBER | HTTP_QUERY_STATUS_CODE,
+ &winInetTransactionP->http_status,
+ &queryLen, NULL);
+ if (!succeeded) {
+ LPTSTR pMsg;
+
+ lastErr = GetLastError();
+ FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ NULL,
+ lastErr,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+ (LPTSTR) &pMsgMem,
+ 1024, NULL);
+
+ pMsg = pMsgMem ? (LPTSTR)pMsgMem : "Sync HttpQueryInfo failed.";
+ XMLRPC_FAIL(envP, XMLRPC_NETWORK_ERROR, pMsg);
+ }
/* Make sure we got a "200 OK" message from the remote server. */
- if(winInetTransactionP->http_status!=200)
- {
- unsigned long msgLen = 1024;
- char errMsg [1024];
- *errMsg = 0;
- HttpQueryInfo (winInetTransactionP->hHttpRequest, HTTP_QUERY_STATUS_TEXT, errMsg, &msgLen, NULL);
-
- /* Set our fault. We break this into multiple lines because it */
- /* will generally contain line breaks to begin with. */
- xmlrpc_env_set_fault_formatted (envP, XMLRPC_NETWORK_ERROR,
- "HTTP error #%d occurred\n %s", winInetTransactionP->http_status, errMsg);
- goto cleanup;
-
- }
- /* Read the response. */
- get_wininet_response (envP, winInetTransactionP);
- XMLRPC_FAIL_IF_FAULT (envP);
+ if (winInetTransactionP->http_status != 200) {
+ unsigned long msgLen;
+ char errMsg[1024];
+ errMsg[0] = '\0';
+ msgLen = 1024; /* initial value */
- cleanup:
- /* Since the XMLRPC_FAIL calls goto cleanup, we must handle */
- /* the free'ing of the memory here. */
- if (pMsgMem != NULL)
- {
- LocalFree( pMsgMem );
- }
+ HttpQueryInfo(winInetTransactionP->hHttpRequest,
+ HTTP_QUERY_STATUS_TEXT, errMsg, &msgLen, NULL);
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HTTP error #%d occurred\n %s",
+ winInetTransactionP->http_status, errMsg);
+ goto cleanup;
+ }
+ /* Read the response. */
+ get_wininet_response(envP, winInetTransactionP);
+ XMLRPC_FAIL_IF_FAULT(envP);
+
+ cleanup:
+ /* Since the XMLRPC_FAIL calls goto cleanup, we must handle */
+ /* the free'ing of the memory here. */
+ if (pMsgMem)
+ LocalFree(pMsgMem);
}
+
+
static unsigned __stdcall
-doAsyncRpc(void * arg) {
+doAsyncRpc(void * const arg) {
rpc * const rpcP = arg;
xmlrpc_env env;
xmlrpc_env_init(&env);
- performWinInetTransaction(&env, rpcP->winInetTransactionP, rpcP->clientTransportP );
+ performWinInetTransaction(&env, rpcP->winInetTransactionP,
+ rpcP->clientTransportP );
rpcP->complete(rpcP->callInfoP, rpcP->responseXmlP, env);
xmlrpc_env_clean(&env);
+
return 0;
}
+
static void
-createRpcThread(xmlrpc_env * const envP,
- rpc * const rpcP,
- pthread_t * const threadP) {
+createRpcThread(xmlrpc_env * const envP,
+ rpc * const rpcP,
+ pthread_t * const threadP) {
int rc;
@@ -553,54 +585,49 @@
case 0:
break;
case EAGAIN:
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "pthread_create() failed: System Resources exceeded.");
+ xmlrpc_faultf(envP, "pthread_create() failed: "
+ "System Resources exceeded.");
break;
case EINVAL:
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "pthread_create() failed: Param Error for attr.");
+ xmlrpc_faultf(envP, "pthread_create() failed: "
+ "Param Error for attr.");
break;
case ENOMEM:
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "pthread_create() failed: No memory for new thread.");
+ xmlrpc_faultf(envP, "pthread_create() failed: "
+ "No memory for new thread.");
break;
default:
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "pthread_create() failed: Unrecognized error code %d.", rc);
+ xmlrpc_faultf(envP, "pthread_create() failed: "
+ "Unrecognized error code %d.", rc);
break;
}
}
+
+
static void
-rpcCreate(xmlrpc_env * const envP,
+rpcCreate(xmlrpc_env * const envP,
struct xmlrpc_client_transport * const clientTransportP,
- const xmlrpc_server_info * const serverP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block * const responseXmlP,
- xmlrpc_transport_asynch_complete complete,
- struct xmlrpc_call_info * const callInfoP,
- rpc ** const rpcPP) {
+ const xmlrpc_server_info * const serverP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_mem_block * const responseXmlP,
+ xmlrpc_transport_asynch_complete complete,
+ struct xmlrpc_call_info * const callInfoP,
+ rpc ** const rpcPP) {
rpc * rpcP;
MALLOCVAR(rpcP);
if (rpcP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for rpc object");
+ xmlrpc_faultf(envP, "Couldn't allocate memory for rpc object");
else {
- rpcP->callInfoP = callInfoP;
- rpcP->complete = complete;
+ rpcP->callInfoP = callInfoP;
+ rpcP->complete = complete;
rpcP->responseXmlP = responseXmlP;
rpcP->threadExists = FALSE;
- createWinInetTransaction(envP, serverP,
- callXmlP, responseXmlP,
- &rpcP->winInetTransactionP);
+ createWinInetTransaction(envP, serverP, callXmlP, responseXmlP,
+ &rpcP->winInetTransactionP);
if (!envP->fault_occurred) {
if (complete) {
createRpcThread(envP, rpcP, &rpcP->thread);
@@ -622,6 +649,8 @@
*rpcPP = rpcP;
}
+
+
static void
rpcDestroy(rpc * const rpcP) {
@@ -635,6 +664,8 @@
free(rpcP);
}
+
+
static void *
finishRpc(struct list_head * const headerP,
void * const context ATTR_UNUSED) {
@@ -642,7 +673,7 @@
rpc * const rpcP = headerP->itemP;
if (rpcP->threadExists) {
- void *status;
+ void * status;
int result;
result = pthread_join(rpcP->thread, &status);
@@ -659,148 +690,154 @@
/* Used for debugging purposes to track the status of
-** your request. */
-void CALLBACK statusCallback (HINTERNET hInternet,
- unsigned long dwContext,
- unsigned long dwInternetStatus,
- void * lpvStatusInformation,
- unsigned long dwStatusInformationLength)
-{
- switch (dwInternetStatus)
- {
- case INTERNET_STATUS_RESOLVING_NAME:
- OutputDebugString("INTERNET_STATUS_RESOLVING_NAME\r\n");
- break;
-
- case INTERNET_STATUS_NAME_RESOLVED:
- OutputDebugString("INTERNET_STATUS_NAME_RESOLVED\r\n");
- break;
-
- case INTERNET_STATUS_HANDLE_CREATED:
- OutputDebugString("INTERNET_STATUS_HANDLE_CREATED\r\n");
- break;
-
- case INTERNET_STATUS_CONNECTING_TO_SERVER:
- OutputDebugString("INTERNET_STATUS_CONNECTING_TO_SERVER\r\n");
- break;
-
- case INTERNET_STATUS_REQUEST_SENT:
- OutputDebugString("INTERNET_STATUS_REQUEST_SENT\r\n");
- break;
-
- case INTERNET_STATUS_SENDING_REQUEST:
- OutputDebugString("INTERNET_STATUS_SENDING_REQUEST\r\n");
- break;
-
- case INTERNET_STATUS_CONNECTED_TO_SERVER:
- OutputDebugString("INTERNET_STATUS_CONNECTED_TO_SERVER\r\n");
- break;
-
- case INTERNET_STATUS_RECEIVING_RESPONSE:
- OutputDebugString("INTERNET_STATUS_RECEIVING_RESPONSE\r\n");
- break;
-
- case INTERNET_STATUS_RESPONSE_RECEIVED:
- OutputDebugString("INTERNET_STATUS_RESPONSE_RECEIVED\r\n");
- break;
-
- case INTERNET_STATUS_CLOSING_CONNECTION:
- OutputDebugString("INTERNET_STATUS_CLOSING_CONNECTION\r\n");
- break;
-
- case INTERNET_STATUS_CONNECTION_CLOSED:
- OutputDebugString("INTERNET_STATUS_CONNECTION_CLOSED\r\n");
- break;
-
- case INTERNET_STATUS_HANDLE_CLOSING:
- OutputDebugString("INTERNET_STATUS_HANDLE_CLOSING\r\n");
- break;
-
- case INTERNET_STATUS_CTL_RESPONSE_RECEIVED:
- OutputDebugString("INTERNET_STATUS_CTL_RESPONSE_RECEIVED\r\n");
- break;
-
- case INTERNET_STATUS_REDIRECT:
- OutputDebugString("INTERNET_STATUS_REDIRECT\r\n");
- break;
-
- case INTERNET_STATUS_REQUEST_COMPLETE:
- /* This indicates the data is ready. */
- OutputDebugString("INTERNET_STATUS_REQUEST_COMPLETE\r\n");
- break;
-
- default:
- OutputDebugString("statusCallback, default case!\r\n");
- break;
+ your request.
+*/
+void CALLBACK
+statusCallback (HINTERNET const hInternet,
+ unsigned long const dwContext,
+ unsigned long const dwInternetStatus,
+ void * const lpvStatusInformation,
+ unsigned long const dwStatusInformationLength) {
+
+ switch (dwInternetStatus) {
+ case INTERNET_STATUS_RESOLVING_NAME:
+ OutputDebugString("INTERNET_STATUS_RESOLVING_NAME\r\n");
+ break;
+
+ case INTERNET_STATUS_NAME_RESOLVED:
+ OutputDebugString("INTERNET_STATUS_NAME_RESOLVED\r\n");
+ break;
+
+ case INTERNET_STATUS_HANDLE_CREATED:
+ OutputDebugString("INTERNET_STATUS_HANDLE_CREATED\r\n");
+ break;
+
+ case INTERNET_STATUS_CONNECTING_TO_SERVER:
+ OutputDebugString("INTERNET_STATUS_CONNECTING_TO_SERVER\r\n");
+ break;
+
+ case INTERNET_STATUS_REQUEST_SENT:
+ OutputDebugString("INTERNET_STATUS_REQUEST_SENT\r\n");
+ break;
+
+ case INTERNET_STATUS_SENDING_REQUEST:
+ OutputDebugString("INTERNET_STATUS_SENDING_REQUEST\r\n");
+ break;
+
+ case INTERNET_STATUS_CONNECTED_TO_SERVER:
+ OutputDebugString("INTERNET_STATUS_CONNECTED_TO_SERVER\r\n");
+ break;
+
+ case INTERNET_STATUS_RECEIVING_RESPONSE:
+ OutputDebugString("INTERNET_STATUS_RECEIVING_RESPONSE\r\n");
+ break;
+
+ case INTERNET_STATUS_RESPONSE_RECEIVED:
+ OutputDebugString("INTERNET_STATUS_RESPONSE_RECEIVED\r\n");
+ break;
+
+ case INTERNET_STATUS_CLOSING_CONNECTION:
+ OutputDebugString("INTERNET_STATUS_CLOSING_CONNECTION\r\n");
+ break;
+
+ case INTERNET_STATUS_CONNECTION_CLOSED:
+ OutputDebugString("INTERNET_STATUS_CONNECTION_CLOSED\r\n");
+ break;
+
+ case INTERNET_STATUS_HANDLE_CLOSING:
+ OutputDebugString("INTERNET_STATUS_HANDLE_CLOSING\r\n");
+ break;
+
+ case INTERNET_STATUS_CTL_RESPONSE_RECEIVED:
+ OutputDebugString("INTERNET_STATUS_CTL_RESPONSE_RECEIVED\r\n");
+ break;
+
+ case INTERNET_STATUS_REDIRECT:
+ OutputDebugString("INTERNET_STATUS_REDIRECT\r\n");
+ break;
+
+ case INTERNET_STATUS_REQUEST_COMPLETE:
+ /* This indicates the data is ready. */
+ OutputDebugString("INTERNET_STATUS_REQUEST_COMPLETE\r\n");
+ break;
+
+ default:
+ OutputDebugString("statusCallback, default case!\r\n");
+ break;
}
}
+
+
static void
-create(xmlrpc_env * const envP,
- int const flags ATTR_UNUSED,
- const char * const appname ATTR_UNUSED,
- const char * const appversion ATTR_UNUSED,
- const struct xmlrpc_xportparms * const transportparmsP,
- size_t const parm_size,
+create(xmlrpc_env * const envP,
+ int const flags ATTR_UNUSED,
+ const char * const appname ATTR_UNUSED,
+ const char * const appversion ATTR_UNUSED,
+ const void * const transportparmsP,
+ size_t const parm_size,
struct xmlrpc_client_transport ** const handlePP) {
/*----------------------------------------------------------------------------
This does the 'create' operation for a WinInet client transport.
-----------------------------------------------------------------------------*/
- struct xmlrpc_client_transport * transportP;
+ const struct xmlrpc_wininet_xportparms * const wininetXportParmsP =
+ transportparmsP;
- struct xmlrpc_wininet_xportparms * const wininetXportParmsP =
- (struct xmlrpc_wininet_xportparms *) transportparmsP;
+ struct xmlrpc_client_transport * transportP;
MALLOCVAR(transportP);
if (transportP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unable to allocate transport descriptor.");
+ xmlrpc_faultf(envP, "Unable to allocate transport descriptor.");
else {
pthread_mutex_init(&transportP->listLock, NULL);
list_make_empty(&transportP->rpcList);
- if (hSyncInternetSession == NULL)
- hSyncInternetSession = InternetOpen ("xmlrpc-c wininet transport",
- INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
-
- if (!wininetXportParmsP || parm_size < XMLRPC_WXPSIZE(allowInvalidSSLCerts))
- transportP->allowInvalidSSLCerts = 0;
- else
- transportP->allowInvalidSSLCerts = wininetXportParmsP->allowInvalidSSLCerts;
+ if (hSyncInternetSession == NULL)
+ hSyncInternetSession =
+ InternetOpen("xmlrpc-c wininet transport",
+ INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
+
+ if (!wininetXportParmsP ||
+ parm_size < XMLRPC_WXPSIZE(allowInvalidSSLCerts))
+ transportP->allowInvalidSSLCerts = 0;
+ else
+ transportP->allowInvalidSSLCerts =
+ wininetXportParmsP->allowInvalidSSLCerts;
*handlePP = transportP;
}
}
+
static void
destroy(struct xmlrpc_client_transport * const clientTransportP) {
/*----------------------------------------------------------------------------
This does the 'destroy' operation for a WinInet client transport.
-----------------------------------------------------------------------------*/
- XMLRPC_ASSERT(clientTransportP != NULL);
+ XMLRPC_ASSERT(clientTransportP != NULL);
XMLRPC_ASSERT(list_is_empty(&clientTransportP->rpcList));
- if (hSyncInternetSession)
- InternetCloseHandle(hSyncInternetSession);
- hSyncInternetSession = NULL;
+ if (hSyncInternetSession)
+ InternetCloseHandle(hSyncInternetSession);
+ hSyncInternetSession = NULL;
- pthread_mutex_destroy(&clientTransportP->listLock);
+ pthread_mutex_destroy(&clientTransportP->listLock);
- free(clientTransportP);
+ free(clientTransportP);
}
+
static void
-sendRequest(xmlrpc_env * const envP,
+sendRequest(xmlrpc_env * const envP,
struct xmlrpc_client_transport * const clientTransportP,
- const xmlrpc_server_info * const serverP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_transport_asynch_complete complete,
- struct xmlrpc_call_info * const callInfoP) {
+ const xmlrpc_server_info * const serverP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_transport_asynch_complete complete,
+ struct xmlrpc_call_info * const callInfoP) {
/*----------------------------------------------------------------------------
Initiate an XML-RPC rpc asynchronously. Don't wait for it to go to
the server.
@@ -827,10 +864,12 @@
*/
}
+
+
static void
finishAsynch(struct xmlrpc_client_transport * const clientTransportP,
- xmlrpc_timeoutType const timeoutType ATTR_UNUSED,
- xmlrpc_timeout const timeout ATTR_UNUSED) {
+ xmlrpc_timeoutType const timeoutType ATTR_UNUSED,
+ xmlrpc_timeout const timeout ATTR_UNUSED) {
/*----------------------------------------------------------------------------
Wait for the threads of all outstanding RPCs to exit and destroy those
RPCs.
@@ -849,14 +888,14 @@
}
+
static void
-call(xmlrpc_env * const envP,
+call(xmlrpc_env * const envP,
struct xmlrpc_client_transport * const clientTransportP,
- const xmlrpc_server_info * const serverP,
- xmlrpc_mem_block * const callXmlP,
- xmlrpc_mem_block ** const responsePP) {
+ const xmlrpc_server_info * const serverP,
+ xmlrpc_mem_block * const callXmlP,
+ xmlrpc_mem_block ** const responsePP) {
-
xmlrpc_mem_block * responseXmlP;
rpc * rpcP;
@@ -870,7 +909,8 @@
rpcCreate(envP, clientTransportP, serverP, callXmlP, responseXmlP,
NULL, NULL, &rpcP);
if (!envP->fault_occurred) {
- performWinInetTransaction(envP, rpcP->winInetTransactionP, clientTransportP);
+ performWinInetTransaction(envP, rpcP->winInetTransactionP,
+ clientTransportP);
*responsePP = responseXmlP;
@@ -882,14 +922,20 @@
}
+
struct xmlrpc_client_transport_ops xmlrpc_wininet_transport_ops = {
+ NULL,
+ NULL,
&create,
&destroy,
&sendRequest,
&call,
&finishAsynch,
+ NULL,
};
+
+
/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/mkinstalldirs
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/mkinstalldirs (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/mkinstalldirs Mon May 26 12:59:57 2008
@@ -4,7 +4,7 @@
# Created: 1993-05-16
# Public domain
-# $Id: mkinstalldirs,v 1.1 2004/10/16 21:41:08 giraffedata Exp $
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/Makefile Mon May 26 12:59:57 2008
@@ -1,147 +1,296 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ SRCDIR := $(call updir,$(CURDIR))
+ BLDDIR := $(SRCDIR)
endif
-SUBDIR = src
-BUILDDIR = $(SRCDIR)
-VPATH = .:$(SRCDIR)
+SUBDIR := src
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
default: all
SUBDIRS =
-CPPCLEAN =
ifeq ($(ENABLE_CPLUSPLUS),yes)
SUBDIRS += cpp
- CPPCLEAN += cpp/clean
endif
-WININET_TRANSPORT_DIR = $(SRCDIR)/lib/wininet_transport
-CURL_TRANSPORT_DIR = $(SRCDIR)/lib/curl_transport
-LIBWWW_TRANSPORT_DIR = $(SRCDIR)/lib/libwww_transport
+TARGET_LIBRARY_NAMES := libxmlrpc libxmlrpc_server
-CASPRINTF_OBJ = $(BUILDDIR)/lib/util/casprintf.lo
+# We cannot build libxmlrpc_server_abyss if we can't also build Abyss,
+# because we need libxmlrpc_abyss in order to build the proper runtime
+# dependencies into libxmlrpc_server_abyss.
-TRANSPORT_OBJS =
-ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
- TRANSPORT_OBJS += $(WININET_TRANSPORT_DIR)/xmlrpc_wininet_transport.lo
-endif
-ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
- TRANSPORT_OBJS += $(CURL_TRANSPORT_DIR)/xmlrpc_curl_transport.lo
-endif
-ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
- TRANSPORT_OBJS += $(LIBWWW_TRANSPORT_DIR)/xmlrpc_libwww_transport.lo
+ifeq ($(ENABLE_ABYSS_SERVER),yes)
+ TARGET_LIBRARY_NAMES += libxmlrpc_server_abyss
endif
-ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
- LIBXML_INCLUDES = $(LIBXML2_CFLAGS)
- LIBXML = $(LIBXML2_LIBS)
-else
- LIBXML_INCLUDES = -I$(SRCDIR)/lib/expat/xmlparse
- LIBXML = $(BUILDDIR)/lib/expat/xmlparse/libxmlrpc_xmlparse.la \
- $(BUILDDIR)/lib/expat/xmltok/libxmlrpc_xmltok.la
+ifeq ($(MUST_BUILD_CLIENT),yes)
+ TARGET_LIBRARY_NAMES += libxmlrpc_client
endif
-ABYSS_INCLUDES = -I$(SRCDIR)/lib/abyss/src
-
-LIBXMLRPC_CLIENT_OBJS = xmlrpc_client.lo
-LIBXMLRPC_SERVER_OBJS = xmlrpc_registry.lo
-LIBXMLRPC_SERVER_ABYSS_OBJS = xmlrpc_server_abyss.lo
-
-ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
- XMLRPC_XML_PARSER = xmlrpc_libxml2.lo
-else
- XMLRPC_XML_PARSER = xmlrpc_expat.lo
+ifeq ($(ENABLE_CGI_SERVER),yes)
+ TARGET_LIBRARY_NAMES += libxmlrpc_server_cgi
endif
-LIBXMLRPC_OBJS = xmlrpc_support.lo xmlrpc_data.lo xmlrpc_builddecomp.lo \
- xmlrpc_datetime.lo xmlrpc_array.lo xmlrpc_struct.lo \
- $(XMLRPC_XML_PARSER) xmlrpc_parse.lo \
- xmlrpc_serialize.lo xmlrpc_base64.lo \
- xmlrpc_utf8.lo xmlrpc_authcookie.lo xmlrpc_strutil.lo
+STATIC_LIBRARIES_TO_INSTALL = $(TARGET_STATIC_LIBRARIES)
-LIB_OBJS = $(LIBXMLRPC_CLIENT_OBJS) $(LIBXMLRPC_SERVER_OBJS)
+SHARED_LIBS_TO_BUILD := $(TARGET_LIBRARY_NAMES)
+SHARED_LIBS_TO_INSTALL := $(TARGET_LIBRARY_NAMES)
-TRANSPORT_INCLUDES = \
- -I$(WININET_TRANSPORT_DIR) \
- -I$(CURL_TRANSPORT_DIR) \
- -I$(LIBWWW_TRANSPORT_DIR) \
-
-INCLUDES = -I$(BUILDDIR) -I$(SRCDIR) \
- -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include \
- -I$(SRCDIR)/lib/abyss/src \
- $(TRANSPORT_INCLUDES) \
- $(LIBXML_INCLUDES) \
+# TRANSPORT_MODS is the list of modules that have to go into the client
+# library to provide the client XML transport functions.
-TARGET_LTLIBRARIES = libxmlrpc.la libxmlrpc_server.la \
- libxmlrpc_server_abyss.la
+# TRANSPORT_LIBDEP is linker -l options to declare what libraries contain
+# things to which the transport objects refer. (like LIBxxx_LIBDEP --
+# see below)
-ifeq ($(MUST_BUILD_CLIENT),yes)
- TARGET_LTLIBRARIES += libxmlrpc_client.la
+TRANSPORT_MODS =
+TRANSPORT_LIBDEP =
+ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
+ TRANSPORT_MODS += $(BLDDIR)/lib/wininet_transport/xmlrpc_wininet_transport
+ TRANSPORT_LIBDEP += $(shell wininet-config --libs)
endif
-
-ifeq ($(ENABLE_CGI_SERVER),yes)
- TARGET_LTLIBRARIES += libxmlrpc_server_cgi.la
+ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
+ TRANSPORT_MODS += $(BLDDIR)/lib/curl_transport/xmlrpc_curl_transport
+ TRANSPORT_LIBDEP += $(shell curl-config --libs)
+endif
+ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
+ TRANSPORT_MODS += $(BLDDIR)/lib/libwww_transport/xmlrpc_libwww_transport
+ TRANSPORT_LIBDEP += $(shell libwww-config --libs)
endif
-all: $(TARGET_LTLIBRARIES) $(SUBDIRS:%=%/all)
-
-LDFLAGS = $(LADD)
+ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
+ XMLRPC_XML_PARSER = xmlrpc_libxml2
+ XML_PARSER_LIBDEP = $(shell xml2-config --libs)
+ XML_PARSER_LIBDEP_DEP =
+else
+ XMLRPC_XML_PARSER = xmlrpc_expat
+ XML_PARSER_LIBDEP = -L$(BLDDIR)/lib/expat/xmlparse -lxmlrpc_xmlparse
+ XML_PARSER_LIBDEP_DEP = $(LIBXMLRPC_XMLPARSE)
+endif
-LIBLDFLAGS = $(LDFLAGS_VERSINFO) -rpath $(LIBINST_DIR) $(LADD)
+# LIBxxx_OBJS is the list of object files that make up library libxxx.
-libxmlrpc.la: $(LIBXMLRPC_OBJS)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
+LIBXMLRPC_MODS = \
+ double \
+ parse_value \
+ resource \
+ trace \
+ version \
+ xmlrpc_data \
+ xmlrpc_datetime \
+ xmlrpc_string \
+ xmlrpc_array \
+ xmlrpc_struct \
+ xmlrpc_build \
+ xmlrpc_decompose \
+ $(XMLRPC_XML_PARSER) \
+ xmlrpc_parse \
+ xmlrpc_serialize \
+ xmlrpc_base64 \
+ xmlrpc_authcookie \
+
+LIBXMLRPC_CLIENT_MODS = xmlrpc_client xmlrpc_client_global xmlrpc_server_info
+
+LIBXMLRPC_SERVER_MODS = registry method system_method
+
+LIBXMLRPC_SERVER_ABYSS_MODS = xmlrpc_server_abyss
+
+LIBXMLRPC_SERVER_CGI_MODS = xmlrpc_server_cgi
+
+TARGET_MODS = \
+ $(LIBXMLRPC_MODS) \
+ $(LIBXMLRPC_SERVER_MODS) \
+ $(LIBXMLRPC_SERVER_ABYSS_MODS) \
+ $(LIBXMLRPC_SERVER_CGI_MODS) \
+ $(LIBXMLRPC_CLIENT_MODS) \
+
+OMIT_XMLRPC_LIB_RULE=Y
+MAJ=3
+ # Major number of shared libraries in this directory
+
+include $(SRCDIR)/common.mk
+
+# This 'common.mk' dependency makes sure the symlinks get built before
+# this make file is used for anything.
+
+$(SRCDIR)/common.mk: srcdir blddir
+
+# TARGET_STATIC_LIBRARIES, etc. are set by common.mk, based on
+# TARGET_LIBRARY_NAMES.
+
+
+all: \
+ $(TARGET_STATIC_LIBRARIES) \
+ $(TARGET_SHARED_LIBRARIES) \
+ $(TARGET_SHARED_LE_LIBS) \
+ $(SUBDIRS:%=%/all) \
+
+# Extra dependencies to make parallel make work in spite of all the submakes
+# (See top level make file for details)
+ifeq ($MUST_BUILD_CLIENT),yes)
+cpp/all: $(BLDDIR)/transport_config.h
+endif
-libxmlrpc_client.la: xmlrpc_client.lo $(TRANSPORT_OBJS) $(CASPRINTF_OBJ)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
+#-----------------------------------------------------------------------------
+# RULES TO LINK LIBRARIES
+#-----------------------------------------------------------------------------
+
+# Rules for these are in common.mk, courtesy of TARGET_LIBRARY_NAMES:
+
+# shlibfn generates e.g. libxmlrpc.so.3.1
+# shliblefn generates e.g. libxmlrpc.so
+
+LIBXMLRPC = $(call shlibfn, libxmlrpc)
+
+$(LIBXMLRPC): $(LIBXMLRPC_MODS:%=%.osh) \
+ $(LIBXMLRPC_UTIL) \
+ $(XML_PARSER_LIBDEP_DEP)
+$(LIBXMLRPC): LIBOBJECTS = $(LIBXMLRPC_MODS:%=%.osh)
+$(LIBXMLRPC): LIBDEP = \
+ -L$(LIBXMLRPC_UTIL_DIR) -lxmlrpc_util \
+ $(XML_PARSER_LIBDEP)
+
+LIBXMLRPC_SERVER = $(call shlibfn, libxmlrpc_server)
+
+$(LIBXMLRPC_SERVER): \
+ $(LIBXMLRPC_SERVER_MODS:%=%.osh) \
+ $(LIBXMLRPC_UTIL) \
+ $(call shliblefn, libxmlrpc)
+$(LIBXMLRPC_SERVER): LIBOBJECTS = $(LIBXMLRPC_SERVER_MODS:%=%.osh)
+$(LIBXMLRPC_SERVER): LIBDEP = \
+ -L$(LIBXMLRPC_UTIL_DIR) -lxmlrpc_util -L. -lxmlrpc
+
+LIBXMLRPC_SERVER_ABYSS = $(call shlibfn, libxmlrpc_server_abyss)
+
+$(LIBXMLRPC_SERVER_ABYSS): \
+ $(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.osh) \
+ $(LIBXMLRPC_UTIL) \
+ $(LIBXMLRPC_ABYSS) \
+ $(call shliblefn, libxmlrpc_server) \
+ $(call shliblefn, libxmlrpc)
+$(LIBXMLRPC_SERVER_ABYSS): LIBOBJECTS = $(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.osh)
+$(LIBXMLRPC_SERVER_ABYSS): LIBDEP = \
+ -L$(LIBXMLRPC_UTIL_DIR) -lxmlrpc_util \
+ -L. -lxmlrpc_server \
+ -L$(LIBXMLRPC_ABYSS_DIR) -lxmlrpc_abyss \
+ -lxmlrpc
+
+LIBXMLRPC_SERVER_CGI = $(call shlibfn, libxmlrpc_server_cgi)
+
+$(LIBXMLRPC_SERVER_CGI): \
+ $(LIBXMLRPC_SERVER_CGI_MODS:%=%.osh) \
+ $(LIBXMRPC_UTIL) \
+ $(call shliblefn, libxmlrpc_server) \
+ $(call shliblefn, libxmlrpc)
+$(LIBXMLRPC_SERVER_CGI): LIBOBJECTS = $(LIBXMLRPC_SERVER_CGI_MODS:%=%.osh)
+$(LIBXMLRPC_SERVER_CGI): LIBDEP = \
+ -L$(LIBXMLRPC_UTIL_DIR) -lxmlrpc_util -L. -lxmlrpc_server -lxmlrpc
+
+LIBXMLRPC_CLIENT = $(call shlibfn, libxmlrpc_client)
+
+$(LIBXMLRPC_CLIENT): \
+ $(LIBXMLRPC_CLIENT_MODS:%=%.osh) \
+ $(TRANSPORT_MODS:%=%.osh) \
+ $(LIBXMLRPC_UTIL) \
+ $(call shliblefn, libxmlrpc)
+$(LIBXMLRPC_CLIENT): LIBOBJECTS = \
+ $(LIBXMLRPC_CLIENT_MODS:%=%.osh) \
+ $(TRANSPORT_MODS:%=%.osh)
+$(LIBXMLRPC_CLIENT): LIBDEP = \
+ -L$(LIBXMLRPC_UTIL_DIR) -lxmlrpc_util \
+ -L. -lxmlrpc \
+ $(TRANSPORT_LIBDEP)
+
+
+libxmlrpc.a: $(LIBXMLRPC_MODS:%=%.o)
+libxmlrpc.a: LIBOBJECTS = $(LIBXMLRPC_MODS:%=%.o)
+
+libxmlrpc_server.a: $(LIBXMLRPC_SERVER_MODS:%=%.o)
+libxmlrpc_server.a: LIBOBJECTS = $(LIBXMLRPC_SERVER_MODS:%=%.o)
+
+libxmlrpc_server_abyss.a: $(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.o)
+libxmlrpc_server_abyss.a: LIBOBJECTS=$(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.o)
+
+libxmlrpc_server_cgi.a: $(LIBXMLRPC_SERVER_CGI_MODS:%=%.o)
+libxmlrpc_server_cgi.a: LIBOBJECTS=$(LIBXMLRPC_SERVER_CGI_MODS:%=%.o)
+
+libxmlrpc_client.a: $(LIBXMLRPC_CLIENT_MODS:%=%.o) $(TRANSPORT_MODS:%=%.o)
+libxmlrpc_client.a: LIBOBJECTS = \
+ $(LIBXMLRPC_CLIENT_MODS:%=%.o) \
+ $(TRANSPORT_MODS:%=%.o)
+
+
+#-----------------------------------------------------------------------------
+# RULES TO COMPILE OBJECT MODULES FOR LIBRARIES
+#-----------------------------------------------------------------------------
+
+# Rules for these are in common.mk, courtesy of TARGET_MODS:
+
+BASIC_INCLUDES = \
+ -I$(BLDDIR) \
+ -I$(BLDDIR)/include \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/lib/util/include \
-libxmlrpc_server.la: xmlrpc_registry.lo
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
+TRANSPORT_INCLUDES = \
+ -I$($SRCDIR)/lib/wininet_transport \
+ -I$(SRCDIR)/lib/curl_transport \
+ -I$(SRCDIR)/lib/libwww_transport \
-libxmlrpc_server_abyss.la: xmlrpc_server_abyss.lo
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
+ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
+ LIBXML_INCLUDES = $(shell xml2-config --cflags)
+else
+ LIBXML_INCLUDES = -I$(SRCDIR)/lib/expat/xmlparse
+endif
-libxmlrpc_server_cgi.la: xmlrpc_server_cgi.lo
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LIBLDFLAGS) $^
+$(LIBXMLRPC_MODS:%=%.o) \
+$(LIBXMLRPC_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES) $(LIBXML_INCLUDES)
+
+$(LIBXMLRPC_CLIENT_MODS:%=%.o) \
+$(LIBXMLRPC_CLIENT_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES) $(TRANSPORT_INCLUDES)
+
+$(LIBXMLRPC_SERVER_MODS:%=%.o) \
+$(LIBXMLRPC_SERVER_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES)
+
+$(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.o) \
+$(LIBXMLRPC_SERVER_ABYSS_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES) -I$(SRCDIR)/lib/abyss/src
+
+$(LIBXMLRPC_SERVER_CGI_MODS:%=%.o) \
+$(LIBXMLRPC_SERVER_CGI_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES)
CFLAGS = $(CFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
-$(LIB_OBJS):%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(CFLAGS) $<
-
-$(LIBXMLRPC_OBJS):%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(LIBXML_INCLUDES) \
- $(CFLAGS) $<
-
-$(LIBXMLRPC_SERVER_ABYSS_OBJS):%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) $(ABYSS_INCLUDES) \
- $(CFLAGS) $<
-
-xmlrpc_server_cgi.lo:%.lo:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(INCLUDES) \
- $(CFLAGS) $<
-
-LTLIBRARIES_TO_INSTALL = $(TARGET_LTLIBRARIES)
check:
- $(MAKE) -C test check
+ $(MAKE) -C test runtests
+ $(MAKE) -C cpp check
.PHONY: install
install: install-common $(SUBDIRS:%=%/install)
.PHONY: clean clean-local distclean
-clean: clean-common clean-local
-clean-local: $(CPPCLEAN)
+clean: clean-common clean-local $(SUBDIRS:%=%/clean)
+clean-local:
+ $(MAKE) -C test clean
-distclean: clean distclean-common
+distclean: clean-common clean-local distclean-common $(SUBDIRS:%=%/distclean)
.PHONY: dep
-dep: $(SUBDIRS:%=%/dep) $(BUILDDIR)/transport_config.h dep-common
+dep: $(SUBDIRS:%=%/dep) $(BLDDIR)/transport_config.h dep-common
-include $(SRCDIR)/Makefile.common
+dep-common:
+ INCLUDES = $(BASIC_INCLUDES) $(TRANSPORT_INCLUDES) $(LIBXML_INCLUDES)
-xmlrpc_client.lo: $(BUILDDIR)/transport_config.h
+xmlrpc_client.o xmlrpc_client.osh: $(BLDDIR)/transport_config.h
+xmlrpc_client.o xmlrpc_client.osh: $(BLDDIR)/version.h
+registry.o registry.osh: $(BLDDIR)/version.h
+version.o version.osh: $(BLDDIR)/version.h
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/Makefile Mon May 26 12:59:57 2008
@@ -1,177 +1,245 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ srcDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(srcDIR))
+ BLDDIR := $(SRCDIR)
endif
-SUBDIR = src/cpp
-BUILDDIR = $(SRCDIR)
-VPATH = .:$(SRCDIR)
+SUBDIR := src/cpp
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
default: all
-WININET_TRANSPORT_DIR = $(SRCDIR)/lib/wininet_transport
-CURL_TRANSPORT_DIR = $(SRCDIR)/lib/curl_transport
-LIBWWW_TRANSPORT_DIR = $(SRCDIR)/lib/libwww_transport
+# libxmlrpc_cpp is the legacy C++ wrapper library. The others are the
+# more elaborate replacements.
+
+TARGET_LIB_NAMES_PP := \
+ libxmlrpc_cpp \
+ libxmlrpc++ \
+ libxmlrpc_server++ \
+ libxmlrpc_server_abyss++ \
+ libxmlrpc_server_pstream++ \
+ libxmlrpc_packetsocket \
+
+ifeq ($(MUST_BUILD_CLIENT),yes)
+ TARGET_LIB_NAMES_PP += libxmlrpc_client++
+endif
+
+STATIC_LIBRARIES_TO_INSTALL = $(TARGET_STATIC_LIBRARIES)
+
+SHARED_LIBS_TO_BUILD := $(TARGET_LIB_NAMES_PP)
+SHARED_LIBS_TO_INSTALL := $(TARGET_LIB_NAMES_PP)
+
+# INCLUDES and DEP_SOURCES are used by dep-common target
+INCLUDES = $(BASIC_INCLUDES) $(CLIENT_INCLUDES) $(LIBXML_INCLUDES) \
+ $(SERVER_INCLUDES) $(SERVER_ABYSS_INCLUDES) $(TRANSPORT_INCLUDES)
+DEP_SOURCES = *.cpp
+
+WININET_TRANSPORT_DIR = srcdir/lib/wininet_transport
+CURL_TRANSPORT_DIR = srcdir/lib/curl_transport
+LIBWWW_TRANSPORT_DIR = srcdir/lib/libwww_transport
ifeq ($(ENABLE_LIBXML2_BACKEND),yes)
LIBXML_INCLUDES = $(LIBXML2_CFLAGS)
- LIBXML = $(LIBXML2_LIBS)
else
- LIBXML_INCLUDES = -I$(SRCDIR)/lib/expat/xmlparse
- LIBXML = $(BUILDDIR)/lib/expat/xmlparse/libxmlrpc_xmlparse.la \
- $(BUILDDIR)/lib/expat/xmltok/libxmlrpc_xmltok.la
+ LIBXML_INCLUDES = -Isrcdir/lib/expat/xmlparse
endif
-ifeq ($(ENABLE_LIBXML2),yes)
- XMLRPC_XML_PARSER = xmlrpc_libxml2.lo
-else
- XMLRPC_XML_PARSER = xmlrpc_expat.lo
-endif
+LIBXMLRPCPP_MODS = \
+ base64 env_wrap fault girerr girmem outcome param_list value xml
+LIBXMLRPC_SERVERPP_MODS = registry
+LIBXMLRPC_SERVER_ABYSSPP_MODS = server_abyss
+LIBXMLRPC_SERVER_PSTREAMPP_MODS = server_pstream
+LIBXMLRPC_CLIENTPP_MODS = client client_simple curl libwww wininet pstream
+LIBXMLRPC_PACKETSOCKET_MODS = packetsocket
-LIBXMLRPC = $(BUILDDIR)/src/libxmlrpc.la
-LIBXMLRPC_SERVER = $(BUILDDIR)/src/libxmlrpc_server.la
-LIBXMLRPC_CLIENT = $(BUILDDIR)/src/libxmlrpc_client.la
-
-LIBXMLRPCPP_OBJS = girmem.o value.o fault.o outcome.o param_list.o xml.o
-LIBXMLRPC_SERVERPP_OBJS = registry.o
-LIBXMLRPC_SERVER_ABYSSPP_OBJS = server_abyss.o
-LIBXMLRPC_CLIENTPP_OBJS = client.o client_simple.o
-
-$(LIBXMLRPC_CLIENTPP_OBJS): $(BUILDDIR)/transport_config.h
-
-TRANSPORT_OBJS =
-ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
- TRANSPORT_OBJS += $(WININET_TRANSPORT_DIR)/xmlrpc_wininet_transport.lo
-endif
-ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
- TRANSPORT_OBJS += $(CURL_TRANSPORT_DIR)/xmlrpc_curl_transport.lo
-endif
-ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
- TRANSPORT_OBJS += $(LIBWWW_TRANSPORT_DIR)/xmlrpc_libwww_transport.lo
-endif
+TARGET_MODS_PP = \
+ XmlRpcCpp \
+ $(LIBXMLRPCPP_MODS) \
+ $(LIBXMLRPC_SERVERPP_MODS) \
+ $(LIBXMLRPC_SERVER_ABYSSPP_MODS) \
+ $(LIBXMLRPC_SERVER_PSTREAMPP_MODS) \
+ $(LIBXMLRPC_CLIENTPP_MODS) \
+ $(LIBXMLRPC_PACKETSOCKET_MODS) \
+
+OMIT_CPP_LIB_RULES = Y
+MAJ=4
+ # Major number of shared libraries in this directory
+
+include $(SRCDIR)/common.mk
+
+
+# This 'common.mk' dependency makes sure the symlinks get built before
+# this make file is used for anything.
+
+$(SRCDIR)/common.mk: srcdir blddir
TRANSPORT_INCLUDES = \
-I$(WININET_TRANSPORT_DIR) \
-I$(CURL_TRANSPORT_DIR) \
-I$(LIBWWW_TRANSPORT_DIR) \
-BASIC_INCLUDES = -I$(SRCDIR)/include -I$(BUILDDIR) -I$(SRCDIR) \
- -I$(SRCDIR)/lib/util/include
+BASIC_INCLUDES = \
+ -Iblddir/include \
+ -Isrcdir/include \
+ -Iblddir \
+ -Isrcdir/lib/util/include
-# We always statically-link our C++ code because it's tiny, and C++ is
-# no good at shared libraries, anyway. It's actually getting bigger,
-# but since I'm determined not to expand the use of libtool (because
-# it obfuscates the build process), I haven't figured out yet how to
-# get the shared libraries to build for all the platforms.
-# libxmlrpc_cpp.a is the legacy C++ wrapper library. The others are the
-# more elaborate replacements.
+# TARGET_STATIC_LIBARIES, etc. are set by common.mk, based on
+# TARGET_LIB_NAMES_PP.
-TARGET_LIBRARIES = \
- libxmlrpc_cpp.a \
- libxmlrpc++.a \
- libxmlrpc_server++.a \
- libxmlrpc_server_abyss++.a \
- libxmlrpc_client++.a \
+all: \
+ $(TARGET_STATIC_LIBRARIES) \
+ $(TARGET_SHARED_LIBS_PP) \
+ $(TARGET_SHARED_LE_LIBS)
-TARGET_PROGS = cpptest
-all: $(TARGET_LIBRARIES)
+#-----------------------------------------------------------------------------
+# RULES TO LINK LIBRARIES
+#-----------------------------------------------------------------------------
-ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
- LDFLAGS += $(shell curl-config --libs) -lpthread
-endif
-ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
- LDFLAGS += $(shell libwww-config --libs)
-endif
+# Rules for these are in common.mk, courtesy of TARGET_LIB_NAMES_PP:
-LDFLAGS += $(LADD)
+# shlibfn generates e.g. libxmlrpc.so.3.1
+# shliblefn generates e.g. libxmlrpc.so
-cpptest:%:%.o libxmlrpc_server_abyss++.a libxmlrpc_server++.a \
- libxmlrpc_client++.a libxmlrpc++.a libxmlrpc_cpp.a \
- $(LIBXMLRPC) $(LIBXMLRPC_SERVER) $(LIBXMLRPC_CLIENT) $(LIBXML)
- $(LIBTOOL) --mode=link $(CXXLD) -o $@ $(LDFLAGS) $^
+LIBXMLRPC_CPP = $(call shlibfn, libxmlrpc_cpp)
-LIBLDFLAGS = $(LADD)
+$(LIBXMLRPC_CPP): XmlRpcCpp.osh
+$(LIBXMLRPC_CPP): LIBOBJECTS = XmlRpcCpp.osh
+
+LIBXMLRPCPP = $(call shlibfn, libxmlrpc++)
+
+$(LIBXMLRPCPP): $(LIBXMLRPCPP_MODS:%=%.osh) \
+ $(LIBXMLRPC)
+$(LIBXMLRPCPP): LIBOBJECTS = $(LIBXMLRPCPP_MODS:%=%.osh)
+$(LIBXMLRPCPP): LIBDEP = -Lblddir/src -lxmlrpc
+
+LIBXMLRPC_SERVERPP = $(call shlibfn, libxmlrpc_server++)
+
+$(LIBXMLRPC_SERVERPP): $(LIBXMLRPC_SERVERPP_MODS:%=%.osh) \
+ $(LIBXMLRPC_SERVER) \
+ $(LIBXMLRPC)
+$(LIBXMLRPC_SERVERPP): LIBOBJECTS = $(LIBXMLRPC_SERVERPP_MODS:%=%.osh)
+$(LIBXMLRPC_SERVERPP): LIBDEP = -Lblddir/src -lxmlrpc_server -lxmlrpc
+
+LIBXMLRPC_SERVER_ABYSSPP = $(call shlibfn, libxmlrpc_server_abyss++)
+
+$(LIBXMLRPC_SERVER_ABYSSPP): $(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.osh) \
+ $(LIBXMLRPC_ABYSS) \
+ $(LIBXMLRPC)
+$(LIBXMLRPC_SERVER_ABYSSPP): LIBOBJECTS = $(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.osh)
+$(LIBXMLRPC_SERVER_ABYSSPP): LIBDEP = \
+ -L$(LIBXMLRPC_ABYSS_DIR) -lxmlrpc_abyss -Lblddir/src -lxmlrpc
+
+LIBXMLRPC_SERVER_PSTREAMPP = $(call shlibfn, libxmlrpc_server_pstream++)
+
+$(LIBXMLRPC_SERVER_PSTREAMPP): $(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.osh) \
+ $(LIBXMLRPC_SERVER) \
+ $(LIBXMLRPC_PACKETSOCKET)
+$(LIBXMLRPC_SERVER_PSTREAMPP): LIBOBJECTS = $(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.osh)
+$(LIBXMLRPC_SERVER_PSTREAMPP): LIBDEP = \
+ -Lblddir/src -lxmlrpc_server -L. -lxmlrpc_packetsocket
+
+LIBXMLRPC_CLIENTPP = $(call shlibfn, libxmlrpc_client++)
+
+$(LIBXMLRPC_CLIENTPP): $(LIBXMLRPC_CLIENTPP_MODS:%=%.osh) \
+ $(LIBXMLRPCPP) \
+ $(LIBXMLRPC_CLIENT)
+$(LIBXMLRPC_CLIENTPP): LIBOBJECTS = $(LIBXMLRPC_CLIENTPP_MODS:%=%.osh)
+$(LIBXMLRPC_CLIENTPP): LIBDEP = \
+ -L. -lxmlrpc++ -Lblddir/src -lxmlrpc_client
+
+LIBXMLRPC_PACKETSOCKET = $(call shlibfn, libxmlrpc_packetsocket)
+
+$(LIBXMLRPC_PACKETSOCKET): $(LIBXMLRPC_PACKETSOCKET_MODS:%=%.osh)
+$(LIBXMLRPC_PACKETSOCKET): LIBOBJECTS = $(LIBXMLRPC_PACKETSOCKET_MODS:%=%.osh)
libxmlrpc_cpp.a: XmlRpcCpp.o
- -rm -f $@
- $(AR) cru $@ $^
- $(RANLIB) $@
-
-libxmlrpc++.a: $(LIBXMLRPCPP_OBJS)
- -rm -f $@
- $(AR) cru $@ $^
- $(RANLIB) $@
-
-libxmlrpc_server++.a: $(LIBXMLRPC_SERVERPP_OBJS)
- -rm -f $@
- $(AR) cru $@ $^
- $(RANLIB) $@
-
-libxmlrpc_server_abyss++.a: $(LIBXMLRPC_SERVER_ABYSSPP_OBJS)
- -rm -f $@
- $(AR) cru $@ $^
- $(RANLIB) $@
-
-libxmlrpc_client++.a: $(LIBXMLRPC_CLIENTPP_OBJS)
- -rm -f $@
- $(AR) cru $@ $^
- $(RANLIB) $@
+libxmlrpc_cpp.a: LIBOBJECTS = XmlRpcCpp.o
-CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
+libxmlrpc++.a: $(LIBXMLRPCPP_MODS:%=%.o)
+libxmlrpc++.a: LIBOBJECTS = $(LIBXMLRPCPP_MODS:%=%.o)
-cpptest.o:%.o:%.cpp
- $(CXX) -c $(BASIC_INCLUDES) $(CXXFLAGS) $<
+libxmlrpc_server++.a: $(LIBXMLRPC_SERVERPP_MODS:%=%.o)
+libxmlrpc_server++.a: LIBOBJECTS = $(LIBXMLRPC_SERVERPP_MODS:%=%.o)
-XmlRpcCpp.o:%.o:%.cpp
- $(CXX) -c $(BASIC_INCLUDES) $(CXXFLAGS) $<
+libxmlrpc_server_abyss++.a: $(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.o)
+libxmlrpc_server_abyss++.a: LIBOBJECTS=$(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.o)
-$(LIBXMLRPCPP_OBJS):%.o:%.cpp
- $(CXX) -c $(BASIC_INCLUDES) $(CXXFLAGS) $<
+libxmlrpc_server_pstream++.a: $(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.o)
+libxmlrpc_server_pstream++.a: LIBOBJECTS=$(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.o)
-SERVER_INCLUDES = $(BASIC_INCLUDES) $(LIBXML_INCLUDES)
+libxmlrpc_client++.a: $(LIBXMLRPC_CLIENTPP_MODS:%=%.o)
+libxmlrpc_client++.a: LIBOBJECTS = $(LIBXMLRPC_CLIENTPP_MODS:%=%.o)
+
+libxmlrpc_packetsocket.a: $(LIBXMLRPC_PACKETSOCKET_MODS:%=%.o)
+libxmlrpc_packetsocket.a: LIBOBJECTS = $(LIBXMLRPC_PACKETSOCKET_MODS:%=%.o)
-$(LIBXMLRPC_SERVERPP_OBJS):%.o:%.cpp
- $(CXX) -c $(SERVER_INCLUDES) $(CXXFLAGS) $<
+#-----------------------------------------------------------------------------
+# RULES TO COMPILE OBJECT MODULES FOR LIBRARIES
+#-----------------------------------------------------------------------------
-SERVER_ABYSS_INCLUDES = $(SERVER_INCLUDES) -I$(SRCDIR)/lib/abyss/src
+# Rules for these are in common.mk, courtesy of TARGET_MODS_PP:
-$(LIBXMLRPC_SERVER_ABYSSPP_OBJS):%.o:%.cpp
- $(CXX) -c $(SERVER_ABYSS_INCLUDES) $(CXXFLAGS) $<
+XmlRpcCpp.o% XmlrpcCpp.osh: \
+ INCLUDES = $(BASIC_INCLUDES)
+
+$(LIBXMLRPCPP_MODS:%=%.o) \
+$(LIBXMLRPCPP_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES)
+
+SERVER_INCLUDES = $(BASIC_INCLUDES) $(LIBXML_INCLUDES)
-CLIENT_INCLUDES = $(BASIC_INCLUDES) $(LIBXML_INCLUDES) $(TRANSPORT_INCLUDES)
+$(LIBXMLRPC_SERVERPP_MODS:%=%.o) \
+$(LIBXMLRPC_SERVERPP_MODS:%=%.osh): \
+ INCLUDES = $(SERVER_INCLUDES)
+
+$(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.o) \
+$(LIBXMLRPC_SERVER_ABYSSPP_MODS:%=%.o): \
+ INCLUDES = $(SERVER_INCLUDES)
+
+$(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.o) \
+$(LIBXMLRPC_SERVER_PSTREAMPP_MODS:%=%.o): \
+ INCLUDES = $(SERVER_INCLUDES)
+
+$(LIBXMLRPC_CLIENTPP_MODS:%=%.o) \
+$(LIBXMLRPC_CLIENTPP_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES) $(LIBXML_INCLUDES) $(TRANSPORT_INCLUDES)
+
+$(LIBXMLRPC_PACKETSOCKET_MODS:%=%.o) \
+$(LIBXMLRPC_PACKETSOCKET_MODS:%=%.osh): \
+ INCLUDES = $(BASIC_INCLUDES)
-$(LIBXMLRPC_CLIENTPP_OBJS):%.o:%.cpp
- $(CXX) -c $(CLIENT_INCLUDES) $(CXXFLAGS) $<
+CXXFLAGS = $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
+TRANSPORT_CONFIG_USERS = client curl libwww wininet
+$(TRANSPORT_CONFIG_USERS:%=%.o) $(TRANSPORT_CONFIG_USERS:%=%.osh): \
+ $(BLDDIR)/transport_config.h
-LIBRARIES_TO_INSTALL = $(TARGET_LIBRARIES)
+#-----------------------------------------------------------------------------
+# MISCELLANEOUS RULES
+#-----------------------------------------------------------------------------
-check: cpptest
- for tst in $^; do \
- ./$$tst; \
- done;
+check:
+ $(MAKE) -C test runtests
.PHONY: install
install: install-common
-.PHONY: clean clean-local distclean
+.PHONY: clean clean-local distclean distclean-local
clean: clean-common clean-local
clean-local:
- rm -f $(TARGET_PROGS)
+ $(MAKE) -C test clean
-distclean: clean distclean-common
+distclean: clean distclean-local distclean-common
-# INCLUDES and DEP_SOURCES are used by dep-common target
-INCLUDES = $(BASIC_INCLUDES) $(CLIENT_INCLUDES) $(LIBXML_INCLUDES) \
- $(SERVER_INCLUDES) $(SERVER_ABYSS_INCLUDES) $(TRANSPORT_INCLUDES)
-DEP_SOURCES = *.cpp
+distclean-local:
+ $(MAKE) -C test distclean
.PHONY: dep
-dep: $(BUILDDIR)/transport_config.h dep-common
-
-include $(SRCDIR)/Makefile.common
+dep: dep-common $(BLDDIR)/transport_config.h
include Makefile.depend
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/XmlRpcCpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/XmlRpcCpp.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/XmlRpcCpp.cpp Mon May 26 12:59:57 2008
@@ -25,6 +25,8 @@
#include <string>
+#include <cstring>
+
#include "xmlrpc-c/oldcppwrapper.hpp"
using std::string;
@@ -36,23 +38,23 @@
XmlRpcFault::XmlRpcFault (const XmlRpcFault &fault) {
xmlrpc_env_init(&mFault);
xmlrpc_env_set_fault(&mFault,
- fault.mFault.fault_code,
- fault.mFault.fault_string);
+ fault.mFault.fault_code,
+ fault.mFault.fault_string);
}
XmlRpcFault::XmlRpcFault (const int faultCode, const string faultString) {
xmlrpc_env_init(&mFault);
xmlrpc_env_set_fault(&mFault, faultCode,
- const_cast<char*>(faultString.c_str()));
+ const_cast<char*>(faultString.c_str()));
}
XmlRpcFault::XmlRpcFault (const xmlrpc_env *env) {
if (!env->fault_string)
- throw XmlRpcFault(XMLRPC_INTERNAL_ERROR,
- "Tried to create empty fault");
+ throw XmlRpcFault(XMLRPC_INTERNAL_ERROR,
+ "Tried to create empty fault");
xmlrpc_env_init(&mFault);
xmlrpc_env_set_fault(&mFault, env->fault_code,
- const_cast<char*>(env->fault_string));
+ const_cast<char*>(env->fault_string));
}
XmlRpcFault::~XmlRpcFault (void) {
@@ -72,9 +74,9 @@
XmlRpcEnv::XmlRpcEnv (const XmlRpcEnv &env) {
xmlrpc_env_init(&mEnv);
if (env.hasFaultOccurred())
- xmlrpc_env_set_fault(&mEnv,
- env.mEnv.fault_code,
- env.mEnv.fault_string);
+ xmlrpc_env_set_fault(&mEnv,
+ env.mEnv.fault_code,
+ env.mEnv.fault_string);
}
XmlRpcFault XmlRpcEnv::getFault (void) const {
@@ -166,7 +168,7 @@
}
XmlRpcValue XmlRpcValue::makeBase64 (const unsigned char *const data,
- size_t len)
+ size_t len)
{
XmlRpcEnv env;
xmlrpc_value *value = xmlrpc_build_value(env, "6", data, len);
@@ -187,7 +189,7 @@
xmlrpc_bool result;
xmlrpc_parse_value(env, mValue, "b", &result);
env.throwIfFaultOccurred();
- return result;
+ return (result != 0);
}
double XmlRpcValue::getDouble (void) const {
@@ -233,7 +235,7 @@
}
void XmlRpcValue::getBase64 (const unsigned char *& out_data,
- size_t& out_len) const
+ size_t& out_len) const
{
XmlRpcEnv env;
xmlrpc_parse_value(env, mValue, "6", &out_data, &out_len);
@@ -271,10 +273,10 @@
XmlRpcEnv env;
const char *keystr = key.data();
size_t keylen = key.size();
- bool result = xmlrpc_struct_has_key_n(env, mValue,
- const_cast<char*>(keystr), keylen);
+ int result = xmlrpc_struct_has_key_n(env, mValue,
+ const_cast<char*>(keystr), keylen);
env.throwIfFaultOccurred();
- return result;
+ return (result != 0);
}
XmlRpcValue XmlRpcValue::structGetValue (const string& key) const {
@@ -282,8 +284,8 @@
const char *keystr = key.data();
size_t keylen = key.size();
xmlrpc_value *result =
- xmlrpc_struct_get_value_n(env, mValue,
- const_cast<char*>(keystr), keylen);
+ xmlrpc_struct_get_value_n(env, mValue,
+ const_cast<char*>(keystr), keylen);
env.throwIfFaultOccurred();
return XmlRpcValue(result);
}
@@ -294,13 +296,13 @@
const char *keystr = key.data();
size_t keylen = key.size();
xmlrpc_struct_set_value_n(env, mValue, (char*) keystr, keylen,
- value.borrowReference());
+ value.borrowReference());
env.throwIfFaultOccurred();
}
void XmlRpcValue::structGetKeyAndValue (const int index,
- string& out_key,
- XmlRpcValue& out_value) const
+ string& out_key,
+ XmlRpcValue& out_value) const
{
XmlRpcEnv env;
@@ -313,81 +315,81 @@
}
XmlRpcGenSrv& XmlRpcGenSrv::addMethod (const string& name,
- xmlrpc_method method,
- void *data)
+ xmlrpc_method method,
+ void *data)
{
XmlRpcEnv env;
- xmlrpc_registry_add_method (env, mRegistry, NULL,
- name.c_str (),
- method, data);
+ xmlrpc_registry_add_method (env, mRegistry, NULL,
+ name.c_str (),
+ method, data);
env.throwIfFaultOccurred ();
- return (*this);
+ return (*this);
}
XmlRpcGenSrv& XmlRpcGenSrv::addMethod (const string& name,
- xmlrpc_method method,
- void* data,
- const string& signature,
- const string& help)
+ xmlrpc_method method,
+ void* data,
+ const string& signature,
+ const string& help)
{
XmlRpcEnv env;
- xmlrpc_registry_add_method_w_doc (env, mRegistry, NULL,
- name.c_str (),
- method, data,
- signature.c_str (),
- help.c_str ());
+ xmlrpc_registry_add_method_w_doc (env, mRegistry, NULL,
+ name.c_str (),
+ method, data,
+ signature.c_str (),
+ help.c_str ());
env.throwIfFaultOccurred ();
- return (*this);
+ return (*this);
}
xmlrpc_mem_block* XmlRpcGenSrv::alloc (XmlRpcEnv& env, const string& body) const
{
- xmlrpc_mem_block* result = NULL;
- char* contents;
+ xmlrpc_mem_block* result = NULL;
+ char* contents;
- result = xmlrpc_mem_block_new (env, body.length ());
- env.throwIfFaultOccurred ();
+ result = xmlrpc_mem_block_new (env, body.length ());
+ env.throwIfFaultOccurred ();
- contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, result);
+ contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, result);
- memcpy (contents, body.c_str (), body.length ());
- return result;
+ memcpy (contents, body.c_str (), body.length ());
+ return result;
}
string XmlRpcGenSrv::handle (const string& body) const
{
- XmlRpcEnv env;
- string result;
- xmlrpc_mem_block* input = NULL, * output = NULL;
- char* input_data, * output_data;
- size_t input_size, output_size;
-
- if (body.length () > xmlrpc_limit_get (XMLRPC_XML_SIZE_LIMIT_ID))
- throw XmlRpcFault (XMLRPC_LIMIT_EXCEEDED_ERROR, "XML-RPC request too large");
-
- input = alloc (env, body);
- input_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, input);
- input_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, input);
-
- output = xmlrpc_registry_process_call (env, mRegistry, NULL,
- input_data, input_size);
-
- if (output)
- {
- output_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output);
- output_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
-
- result.assign (output_data, output_size);
- xmlrpc_mem_block_free (output);
- }
-
- xmlrpc_mem_block_free (input);
- if (!result.length ())
- throw XmlRpcFault (env);
+ XmlRpcEnv env;
+ string result;
+ xmlrpc_mem_block* input = NULL, * output = NULL;
+ char* input_data, * output_data;
+ size_t input_size, output_size;
+
+ if (body.length () > xmlrpc_limit_get (XMLRPC_XML_SIZE_LIMIT_ID))
+ throw XmlRpcFault (XMLRPC_LIMIT_EXCEEDED_ERROR, "XML-RPC request too large");
+
+ input = alloc (env, body);
+ input_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, input);
+ input_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, input);
+
+ output = xmlrpc_registry_process_call (env, mRegistry, NULL,
+ input_data, input_size);
+
+ if (output)
+ {
+ output_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output);
+ output_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
+
+ result.assign (output_data, output_size);
+ xmlrpc_mem_block_free (output);
+ }
+
+ xmlrpc_mem_block_free (input);
+ if (!result.length ())
+ throw XmlRpcFault (env);
- return result;
+ return result;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client.cpp Mon May 26 12:59:57 2008
@@ -9,36 +9,25 @@
help from internal C utility libraries).
=============================================================================*/
+#include <stdlib.h>
#include <cassert>
#include <string>
+#include <vector>
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
+using girerr::throwf;
#include "xmlrpc-c/girmem.hpp"
using girmem::autoObjectPtr;
using girmem::autoObject;
+#include "env_wrap.hpp"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/client.h"
#include "xmlrpc-c/transport.h"
-/* transport_config.h defines XMLRPC_DEFAULT_TRANSPORT,
- MUST_BUILD_WININET_CLIENT, MUST_BUILD_CURL_CLIENT,
- MUST_BUILD_LIBWWW_CLIENT
-*/
-#include "transport_config.h"
-
-#if MUST_BUILD_WININET_CLIENT
-#include "xmlrpc_wininet_transport.h"
-#endif
-#if MUST_BUILD_CURL_CLIENT
-#include "xmlrpc_curl_transport.h"
-#endif
-#if MUST_BUILD_LIBWWW_CLIENT
-#include "xmlrpc_libwww_transport.h"
-#endif
-
#include "xmlrpc-c/base.hpp"
#include "xmlrpc-c/xml.hpp"
#include "xmlrpc-c/client.hpp"
+#include "transport_config.h"
using namespace std;
using namespace xmlrpc_c;
@@ -46,23 +35,28 @@
namespace {
+void
+throwIfError(env_wrap const& env) {
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
class memblockStringWrapper {
public:
memblockStringWrapper(string const value) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->memblockP = XMLRPC_MEMBLOCK_NEW(char, &env, 0);
+ this->memblockP = XMLRPC_MEMBLOCK_NEW(char, &env.env_c, 0);
+ throwIfError(env);
- if (env.fault_occurred)
- throw(error(env.fault_string));
-
- XMLRPC_MEMBLOCK_APPEND(char, &env, this->memblockP,
+ XMLRPC_MEMBLOCK_APPEND(char, &env.env_c, this->memblockP,
value.c_str(), value.size());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
memblockStringWrapper(xmlrpc_mem_block * const memblockP) :
@@ -79,6 +73,30 @@
namespace xmlrpc_c {
+struct client_xml_impl {
+ /* We have both kinds of pointers to give the user flexibility -- we
+ have constructors that take both. But the simple pointer
+ 'transportP' is valid in both cases.
+ */
+ clientXmlTransport * transportP;
+ clientXmlTransportPtr transportPtr;
+ xmlrpc_dialect dialect;
+
+ client_xml_impl(clientXmlTransport * const transportP,
+ xmlrpc_dialect const dialect = xmlrpc_dialect_i8) :
+ transportP(transportP),
+ dialect(dialect) {}
+
+ client_xml_impl(clientXmlTransportPtr const transportPtr,
+ clientXmlTransport * const transportP,
+ xmlrpc_dialect const dialect = xmlrpc_dialect_i8) :
+ transportP(transportP),
+ transportPtr(transportPtr),
+ dialect(dialect) {}
+};
+
+
+
carriageParm::carriageParm() {}
@@ -87,6 +105,33 @@
+carriageParmPtr::carriageParmPtr() {
+ // Base class constructor will construct pointer that points to nothing
+}
+
+
+
+carriageParmPtr::carriageParmPtr(
+carriageParm * const carriageParmP) : autoObjectPtr(carriageParmP) {}
+
+
+
+carriageParm *
+carriageParmPtr::operator->() const {
+
+ autoObject * const p(this->objectP);
+ return dynamic_cast<carriageParm *>(p);
+}
+
+
+
+carriageParm *
+carriageParmPtr::get() const {
+ return dynamic_cast<carriageParm *>(objectP);
+}
+
+
+
carriageParm_http0::carriageParm_http0() :
c_serverInfoP(NULL) {}
@@ -99,6 +144,7 @@
}
+
carriageParm_http0::~carriageParm_http0() {
if (this->c_serverInfoP)
@@ -113,13 +159,158 @@
if (c_serverInfoP)
throw(error("object already instantiated"));
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
+
+ this->c_serverInfoP =
+ xmlrpc_server_info_new(&env.env_c, serverUrl.c_str());
+ throwIfError(env);
+}
+
+
+
+void
+carriageParm_http0::setUser(string const userid,
+ string const password) {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_set_user(
+ &env.env_c, this->c_serverInfoP, userid.c_str(), password.c_str());
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::allowAuthBasic() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_allow_auth_basic(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::disallowAuthBasic() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_disallow_auth_basic(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::allowAuthDigest() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_allow_auth_digest(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
- this->c_serverInfoP = xmlrpc_server_info_new(&env, serverUrl.c_str());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+
+void
+carriageParm_http0::disallowAuthDigest() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_disallow_auth_digest(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::allowAuthNegotiate() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_allow_auth_negotiate(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::disallowAuthNegotiate() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_disallow_auth_negotiate(
+ &env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::allowAuthNtlm() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_allow_auth_ntlm(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+carriageParm_http0::disallowAuthNtlm() {
+
+ if (!this->c_serverInfoP)
+ throw(error("object not instantiated"));
+
+ env_wrap env;
+
+ xmlrpc_server_info_disallow_auth_ntlm(&env.env_c, this->c_serverInfoP);
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
}
@@ -128,43 +319,35 @@
carriageParm_http0::setBasicAuth(string const username,
string const password) {
- if (!c_serverInfoP)
+ if (!this->c_serverInfoP)
throw(error("object not instantiated"));
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
xmlrpc_server_info_set_basic_auth(
- &env, this->c_serverInfoP, username.c_str(), password.c_str());
-
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ &env.env_c, this->c_serverInfoP, username.c_str(), password.c_str());
+ throwIfError(env);
}
-carriageParm_curl0::carriageParm_curl0(
- string const serverUrl
- ) {
-
- this->instantiate(serverUrl);
+carriageParm_http0Ptr::carriageParm_http0Ptr() {
+ // Base class constructor will construct pointer that points to nothing
}
-carriageParm_libwww0::carriageParm_libwww0(
- string const serverUrl
- ) {
- this->instantiate(serverUrl);
-}
+carriageParm_http0Ptr::carriageParm_http0Ptr(
+ carriageParm_http0 * const carriageParmP) :
+ carriageParmPtr(carriageParmP) {}
-carriageParm_wininet0::carriageParm_wininet0(
- string const serverUrl
- ) {
+carriageParm_http0 *
+carriageParm_http0Ptr::operator->() const {
- this->instantiate(serverUrl);
+ autoObject * const p(this->objectP);
+ return dynamic_cast<carriageParm_http0 *>(p);
}
@@ -192,6 +375,11 @@
+xmlTransactionPtr::xmlTransactionPtr(xmlTransaction * xmlTransP) :
+ autoObjectPtr(xmlTransP) {}
+
+
+
xmlTransaction *
xmlTransactionPtr::operator->() const {
autoObject * const p(this->objectP);
@@ -200,6 +388,51 @@
+struct xmlTranCtl {
+/*----------------------------------------------------------------------------
+ This contains information needed to conduct a transaction. You
+ construct it as you start the transaction and destroy it after the
+ work is done. You need this only for an asynchronous one, because
+ where the user starts and finishes the RPC in the same
+ libxmlrpc_client call, you can just keep this information in
+ various stack variables, and it's faster and easier to understand
+ that way.
+
+ The C transport is designed to take a xmlrpc_call_info argument for
+ similar stuff needed by the the C client object. But it's really
+ opaque to the transport, so we just let xmlTranCtl masquerade as
+ xmlprc_call_info in our call to the C transport.
+-----------------------------------------------------------------------------*/
+ xmlTranCtl(xmlTransactionPtr const& xmlTranP,
+ string const& callXml) :
+
+ xmlTranP(xmlTranP) {
+
+ env_wrap env;
+
+ this->callXmlP = XMLRPC_MEMBLOCK_NEW(char, &env.env_c, 0);
+ throwIfError(env);
+
+ XMLRPC_MEMBLOCK_APPEND(char, &env.env_c, this->callXmlP,
+ callXml.c_str(), callXml.size());
+ throwIfError(env);
+ }
+
+ ~xmlTranCtl() {
+ XMLRPC_MEMBLOCK_FREE(char, this->callXmlP);
+ }
+
+ xmlTransactionPtr const xmlTranP;
+ // The transaction we're controlling. Most notable use of this is
+ // that this object we inform when the transaction is done. This
+ // is where the response XML and other transaction results go.
+
+ xmlrpc_mem_block * callXmlP;
+ // The XML of the call. This is what the transport transports.
+};
+
+
+
clientXmlTransport::~clientXmlTransport() {}
@@ -208,6 +441,9 @@
clientXmlTransport::start(carriageParm * const carriageParmP,
string const& callXml,
xmlTransactionPtr const& xmlTranP) {
+
+ // Note: derived class clientXmlTransport_http overrides this,
+ // so it doesn't normally get used.
string responseXml;
@@ -219,9 +455,14 @@
void
-clientXmlTransport::finishAsync(xmlrpc_c::timeout const timeout) {
- if (timeout.finite == timeout.finite)
- throw(error("This class does not have finishAsync()"));
+clientXmlTransport::finishAsync(xmlrpc_c::timeout) {
+
+ // Since our start() does the whole thing, there's nothing for
+ // us to do.
+
+ // A derived class that overrides start() with something properly
+ // asynchronous had better also override finishAsync() with something
+ // substantial.
}
@@ -232,17 +473,16 @@
xmlrpc_mem_block * const responseXmlMP,
xmlrpc_env const transportEnv) {
- xmlTransactionPtr * const xmlTranPP =
- reinterpret_cast<xmlTransactionPtr *>(callInfoP);
+ xmlTranCtl * const xmlTranCtlP = reinterpret_cast<xmlTranCtl *>(callInfoP);
try {
if (transportEnv.fault_occurred) {
- (*xmlTranPP)->finishErr(error(transportEnv.fault_string));
+ xmlTranCtlP->xmlTranP->finishErr(error(transportEnv.fault_string));
} else {
string const responseXml(
XMLRPC_MEMBLOCK_CONTENTS(char, responseXmlMP),
XMLRPC_MEMBLOCK_SIZE(char, responseXmlMP));
- (*xmlTranPP)->finish(responseXml);
+ xmlTranCtlP->xmlTranP->finish(responseXml);
}
} catch(error) {
/* We can't throw an error back to C code, and the async_complete
@@ -251,17 +491,52 @@
*/
assert(false);
}
- delete(xmlTranPP);
+ delete(xmlTranCtlP);
- /* Ordinarily, *xmlTranPP is the last reference to **xmlTranPP
- (The xmlTransaction), so it will get destroyed too. But
+ /* Ordinarily, *xmlTranCtlP is the last reference to
+ xmlTranCtlP->xmlTranP, so that will get destroyed too. But
->finish() could conceivably create a new reference to
- **xmlTranPP, and then it would keep living.
+ xmlTranCtlP->xmlTranP, and then it would keep living.
*/
}
+void
+clientXmlTransport::setInterrupt(int *) {
+
+ throwf("The client XML transport is not interruptible");
+}
+
+
+
+clientXmlTransportPtr::clientXmlTransportPtr() {
+ // Base class constructor will construct pointer that points to nothing
+}
+
+
+
+clientXmlTransportPtr::clientXmlTransportPtr(
+ clientXmlTransport * const transportP) : autoObjectPtr(transportP) {}
+
+
+
+clientXmlTransport *
+clientXmlTransportPtr::get() const {
+ return dynamic_cast<clientXmlTransport *>(objectP);
+}
+
+
+
+clientXmlTransport *
+clientXmlTransportPtr::operator->() const {
+
+ autoObject * const p(this->objectP);
+ return dynamic_cast<clientXmlTransport *>(p);
+}
+
+
+
clientXmlTransport_http::~clientXmlTransport_http() {}
@@ -272,9 +547,6 @@
string const& callXml,
string * const responseXmlP) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
carriageParm_http0 * const carriageParmHttpP =
dynamic_cast<carriageParm_http0 *>(carriageParmP);
@@ -286,14 +558,15 @@
xmlrpc_mem_block * responseXmlMP;
- this->c_transportOpsP->call(&env,
+ env_wrap env;
+
+ this->c_transportOpsP->call(&env.env_c,
this->c_transportP,
carriageParmHttpP->c_serverInfoP,
callXmlM.memblockP,
&responseXmlMP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
memblockStringWrapper responseHolder(responseXmlMP);
// Makes responseXmlMP get freed at end of scope
@@ -310,8 +583,7 @@
string const& callXml,
xmlTransactionPtr const& xmlTranP) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
carriageParm_http0 * const carriageParmHttpP =
dynamic_cast<carriageParm_http0 *>(carriageParmP);
@@ -320,27 +592,20 @@
throw(error("HTTP client XML transport called with carriage "
"parameter object not of type carriageParm_http"));
- memblockStringWrapper callXmlM(callXml);
-
- /* xmlTranP2 is the reference to the XML transaction that is held by
- the running transaction, in C code. It lives in dynamically allocated
- storage and xmlTranP2P points to it.
- */
- xmlTransactionPtr * const xmlTranP2P(new xmlTransactionPtr(xmlTranP));
+ xmlTranCtl * const tranCtlP(new xmlTranCtl(xmlTranP, callXml));
try {
this->c_transportOpsP->send_request(
- &env,
+ &env.env_c,
this->c_transportP,
carriageParmHttpP->c_serverInfoP,
- callXmlM.memblockP,
+ tranCtlP->callXmlP,
&this->asyncComplete,
- reinterpret_cast<xmlrpc_call_info *>(xmlTranP2P));
+ reinterpret_cast<xmlrpc_call_info *>(tranCtlP));
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
} catch (...) {
- delete xmlTranP2P;
+ delete tranCtlP;
throw;
}
}
@@ -360,219 +625,263 @@
+void
+clientXmlTransport_http::setInterrupt(int * const interruptP) {
+
+ if (this->c_transportOpsP->set_interrupt)
+ this->c_transportOpsP->set_interrupt(this->c_transportP, interruptP);
+}
+
+
+
+bool const haveCurl(
#if MUST_BUILD_CURL_CLIENT
+true
+#else
+false
+#endif
+);
+
+bool const haveLibwww(
+#if MUST_BUILD_LIBWWW_CLIENT
+true
+#else
+false
+#endif
+);
-clientXmlTransport_curl::clientXmlTransport_curl(
- string const networkInterface,
- bool const noSslVerifyPeer,
- bool const noSslVerifyHost,
- string const userAgent) {
+bool const haveWininet(
+#if MUST_BUILD_WININET_CLIENT
+true
+#else
+false
+#endif
+);
- struct xmlrpc_curl_xportparms transportParms;
- transportParms.network_interface =
- networkInterface.size() > 0 ? networkInterface.c_str() : NULL;
- transportParms.no_ssl_verifypeer = noSslVerifyPeer;
- transportParms.no_ssl_verifyhost = noSslVerifyHost;
- transportParms.user_agent =
- userAgent.size() > 0 ? userAgent.c_str() : NULL;
- this->c_transportOpsP = &xmlrpc_curl_transport_ops;
+vector<string>
+clientXmlTransport_http::availableTypes() {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ vector<string> retval;
- xmlrpc_curl_transport_ops.create(
- &env, 0, "", "", (xmlrpc_xportparms *)&transportParms,
- XMLRPC_CXPSIZE(user_agent),
- &this->c_transportP);
+ if (haveCurl)
+ retval.push_back("curl");
- if (env.fault_occurred)
- throw(error(env.fault_string));
-}
-#else // MUST_BUILD_CURL_CLIENT
+ if (haveLibwww)
+ retval.push_back("libwww");
-clientXmlTransport_curl::clientXmlTransport_curl(string, bool, bool, string) {
+ if (haveWininet)
+ retval.push_back("wininet");
- throw("There is no Curl client XML transport in this XML-RPC client "
- "library");
+ return retval;
}
-#endif
-
-clientXmlTransport_curl::~clientXmlTransport_curl() {
+clientXmlTransportPtr
+clientXmlTransport_http::create() {
+/*----------------------------------------------------------------------------
+ Make an HTTP Client XML transport of any kind (Caller doesn't care).
+
+ Caller can find out what kind he got by trying dynamic casts.
- this->c_transportOpsP->destroy(this->c_transportP);
+ Caller can use a carriageParm_http0 with the transport.
+-----------------------------------------------------------------------------*/
+ if (haveCurl)
+ return clientXmlTransportPtr(new clientXmlTransport_curl());
+ else if (haveLibwww)
+ return clientXmlTransportPtr(new clientXmlTransport_libwww());
+ else if (haveWininet)
+ return clientXmlTransportPtr(new clientXmlTransport_wininet());
+ else
+ throwf("This XML-RPC client library contains no HTTP XML transports");
}
-#if MUST_BUILD_LIBWWW_CLIENT
+clientTransaction::clientTransaction() {}
-clientXmlTransport_libwww::clientXmlTransport_libwww(
- string const appname,
- string const appversion) {
- this->c_transportOpsP = &xmlrpc_libwww_transport_ops;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+clientTransactionPtr::clientTransactionPtr() {}
- xmlrpc_libwww_transport_ops.create(
- &env, 0, appname.c_str(), appversion.c_str(), NULL, 0,
- &this->c_transportP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
-}
-#else // MUST_BUILD_LIBWWW_CLIENT
- clientXmlTransport_libwww::clientXmlTransport_libwww(string, string) {
+clientTransactionPtr::clientTransactionPtr(
+ clientTransaction * const transP) : autoObjectPtr(transP) {}
- throw(error("There is no Libwww client XML transport "
- "in this XML-RPC client library"));
-}
-#endif
+
+clientTransactionPtr::~clientTransactionPtr() {}
-clientXmlTransport_libwww::~clientXmlTransport_libwww() {
- this->c_transportOpsP->destroy(this->c_transportP);
+clientTransaction *
+clientTransactionPtr::operator->() const {
+ autoObject * const p(this->objectP);
+ return dynamic_cast<clientTransaction *>(p);
}
-#if MUST_BUILD_WININET_CLIENT
-
-clientXmlTransport_wininet::clientXmlTransport_wininet(
- bool const allowInvalidSslCerts
- ) {
+client::~client() {}
- struct xmlrpc_wininet_xportparms transportParms;
- transportParms.allowInvalidSSLCerts = allowInvalidSslCerts;
- this->c_transportOpsP = &xmlrpc_wininet_transport_ops;
+void
+client::start(carriageParm * const carriageParmP,
+ string const& methodName,
+ paramList const& paramList,
+ clientTransactionPtr const& tranP) {
+/*----------------------------------------------------------------------------
+ Start an RPC, wait for it to complete, and finish it.
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ Usually, a derived class overrides this with something that does
+ not wait for the RPC to complete, but rather arranges for something
+ to finish the RPC later when the RPC does complete.
+-----------------------------------------------------------------------------*/
+ rpcOutcome outcome;
- xmlrpc_wininet_transport_ops.create(
- &env, 0, "", "", &transportParms, XMLRPC_WXPSIZE(allowInvalidSSLCerts),
- &this->c_transportP);
+ this->call(carriageParmP, methodName, paramList, &outcome);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ tranP->finish(outcome);
}
-#else // MUST_BUILD_WININET_CLIENT
-clientXmlTransport_wininet::clientXmlTransport_wininet(bool const) {
- throw(error("There is no Wininet client XML transport "
- "in this XML-RPC client library"));
+void
+client::finishAsync(xmlrpc_c::timeout) {
+
+ // Since our start() does the whole thing, there's nothing for
+ // us to do.
+
+ // A derived class that overrides start() with something properly
+ // asynchronous had better also override finishAsync() with something
+ // substantial.
}
-#endif
-
-clientXmlTransport_wininet::~clientXmlTransport_wininet() {
+void
+client::setInterrupt(int *) {
- this->c_transportOpsP->destroy(this->c_transportP);
+ throwf("Clients of this type are not interruptible");
}
-clientTransaction::clientTransaction() {}
+clientPtr::clientPtr() {
+ // Base class constructor will construct pointer that points to nothing
+}
-clientTransactionPtr::clientTransactionPtr() {}
+clientPtr::clientPtr(
+ client * const clientP) : autoObjectPtr(clientP) {}
-clientTransactionPtr::~clientTransactionPtr() {}
+client *
+clientPtr::operator->() const {
+ autoObject * const p(this->objectP);
+ return dynamic_cast<client *>(p);
+}
-clientTransaction *
-clientTransactionPtr::operator->() const {
- autoObject * const p(this->objectP);
- return dynamic_cast<clientTransaction *>(p);
+
+client *
+clientPtr::get() const {
+ return dynamic_cast<client *>(objectP);
}
-client::~client() {}
+client_xml::client_xml(clientXmlTransport * const transportP) {
+ this->implP = new client_xml_impl(transportP);
+}
-void
-client::start(carriageParm * const carriageParmP,
- string const methodName,
- paramList const& paramList,
- clientTransactionPtr const& tranP) {
-/*----------------------------------------------------------------------------
- Start an RPC, wait for it to complete, and finish it.
- Usually, a derived class overrides this with something that does
- not wait for the RPC to complete, but rather arranges for something
- to finish the RPC later when the RPC does complete.
------------------------------------------------------------------------------*/
- rpcOutcome outcome;
- this->call(carriageParmP, methodName, paramList, &outcome);
+client_xml::client_xml(clientXmlTransportPtr const transportPtr) {
- tranP->finish(outcome);
+ this->implP = new client_xml_impl(transportPtr, transportPtr.get());
}
-client_xml::client_xml(clientXmlTransport * const transportP) :
- transportP(transportP) {}
-
+client_xml::client_xml(clientXmlTransport * const transportP,
+ xmlrpc_dialect const dialect) {
+
+ this->implP = new client_xml_impl(transportP, dialect);
+}
+
+
+
+client_xml::client_xml(clientXmlTransportPtr const transportPtr,
+ xmlrpc_dialect const dialect) {
+
+ this->implP = new client_xml_impl(transportPtr, transportPtr.get(),
+ dialect);
+}
+
+
+
+client_xml::~client_xml() {
+
+ delete(this->implP);
+}
+
void
client_xml::call(carriageParm * const carriageParmP,
- string const methodName,
+ string const& methodName,
paramList const& paramList,
rpcOutcome * const outcomeP) {
string callXml;
string responseXml;
- xml::generateCall(methodName, paramList, &callXml);
+ xml::generateCall(methodName, paramList, this->implP->dialect, &callXml);
xml::trace("XML-RPC CALL", callXml);
- this->transportP->call(carriageParmP, callXml, &responseXml);
-
+ try {
+ this->implP->transportP->call(carriageParmP, callXml, &responseXml);
+ } catch (error const& error) {
+ throwf("Unable to transport XML to server and "
+ "get XML response back. %s", error.what());
+ }
xml::trace("XML-RPC RESPONSE", responseXml);
-
- xml::parseResponse(responseXml, outcomeP);
+
+ try {
+ xml::parseResponse(responseXml, outcomeP);
+ } catch (error const& error) {
+ throwf("Response XML from server is not valid XML-RPC response. %s",
+ error.what());
+ }
}
void
client_xml::start(carriageParm * const carriageParmP,
- string const methodName,
+ string const& methodName,
paramList const& paramList,
clientTransactionPtr const& tranP) {
string callXml;
- xml::generateCall(methodName, paramList, &callXml);
+ xml::generateCall(methodName, paramList, this->implP->dialect, &callXml);
xml::trace("XML-RPC CALL", callXml);
xmlTransaction_clientPtr const xmlTranP(tranP);
- this->transportP->start(carriageParmP, callXml, xmlTranP);
+ this->implP->transportP->start(carriageParmP, callXml, xmlTranP);
}
@@ -580,11 +889,66 @@
void
client_xml::finishAsync(xmlrpc_c::timeout const timeout) {
- transportP->finishAsync(timeout);
+ this->implP->transportP->finishAsync(timeout);
}
+void
+client_xml::setInterrupt(int * const interruptP) {
+
+ this->implP->transportP->setInterrupt(interruptP);
+}
+
+
+
+serverAccessor::serverAccessor(clientPtr const clientP,
+ carriageParmPtr const carriageParmP) :
+
+ clientP(clientP), carriageParmP(carriageParmP) {};
+
+
+
+void
+serverAccessor::call(std::string const& methodName,
+ xmlrpc_c::paramList const& paramList,
+ xmlrpc_c::rpcOutcome * const outcomeP) const {
+
+ this->clientP->call(this->carriageParmP.get(),
+ methodName,
+ paramList,
+ outcomeP);
+}
+
+
+
+serverAccessorPtr::serverAccessorPtr() {
+ // Base class constructor will construct pointer that points to nothing
+}
+
+
+
+serverAccessorPtr::serverAccessorPtr(
+ serverAccessor * const serverAccessorParmP) :
+ autoObjectPtr(serverAccessorParmP) {}
+
+
+
+serverAccessor *
+serverAccessorPtr::operator->() const {
+
+ autoObject * const p(this->objectP);
+ return dynamic_cast<serverAccessor *>(p);
+}
+
+
+
+serverAccessor *
+serverAccessorPtr::get() const {
+ return dynamic_cast<serverAccessor *>(objectP);
+}
+
+
connection::connection(client * const clientP,
carriageParm * const carriageParmP) :
@@ -596,20 +960,43 @@
-rpc::rpc(string const methodName,
- xmlrpc_c::paramList const& paramList) {
+struct rpc_impl {
+ enum state {
+ STATE_UNFINISHED, // RPC is running or not started yet
+ STATE_ERROR, // We couldn't execute the RPC
+ STATE_FAILED, // RPC executed successfully, but failed per XML-RPC
+ STATE_SUCCEEDED // RPC is done, no exception
+ };
+ enum state state;
+ girerr::error * errorP; // Defined only in STATE_ERROR
+ rpcOutcome outcome;
+ // Defined only in STATE_FAILED and STATE_SUCCEEDED
+ string methodName;
+ xmlrpc_c::paramList paramList;
+
+ rpc_impl(string const& methodName,
+ xmlrpc_c::paramList const& paramList) :
+ state(STATE_UNFINISHED),
+ methodName(methodName),
+ paramList(paramList) {}
+};
+
+
+
+rpc::rpc(string const methodName,
+ paramList const& paramList) {
- this->state = STATE_UNFINISHED;
- this->methodName = methodName;
- this->paramList = paramList;
+ this->implP = new rpc_impl(methodName, paramList);
}
rpc::~rpc() {
+
+ if (this->implP->state == rpc_impl::STATE_ERROR)
+ delete(this->implP->errorP);
- if (this->state == STATE_ERROR)
- delete(this->errorP);
+ delete(this->implP);
}
@@ -618,16 +1005,17 @@
rpc::call(client * const clientP,
carriageParm * const carriageParmP) {
- if (this->state != STATE_UNFINISHED)
+ if (this->implP->state != rpc_impl::STATE_UNFINISHED)
throw(error("Attempt to execute an RPC that has already been "
"executed"));
clientP->call(carriageParmP,
- this->methodName,
- this->paramList,
- &this->outcome);
+ this->implP->methodName,
+ this->implP->paramList,
+ &this->implP->outcome);
- this->state = outcome.succeeded() ? STATE_SUCCEEDED : STATE_FAILED;
+ this->implP->state = this->implP->outcome.succeeded() ?
+ rpc_impl::STATE_SUCCEEDED : rpc_impl::STATE_FAILED;
}
@@ -645,13 +1033,13 @@
rpc::start(client * const clientP,
carriageParm * const carriageParmP) {
- if (this->state != STATE_UNFINISHED)
+ if (this->implP->state != rpc_impl::STATE_UNFINISHED)
throw(error("Attempt to execute an RPC that has already been "
"executed"));
clientP->start(carriageParmP,
- this->methodName,
- this->paramList,
+ this->implP->methodName,
+ this->implP->paramList,
rpcPtr(this));
}
@@ -668,9 +1056,11 @@
void
rpc::finish(rpcOutcome const& outcome) {
- this->state = outcome.succeeded() ? STATE_SUCCEEDED : STATE_FAILED;
+ this->implP->state =
+ outcome.succeeded() ?
+ rpc_impl::STATE_SUCCEEDED : rpc_impl::STATE_FAILED;
- this->outcome = outcome;
+ this->implP->outcome = outcome;
this->notifyComplete();
}
@@ -680,8 +1070,8 @@
void
rpc::finishErr(error const& error) {
- this->state = STATE_ERROR;
- this->errorP = new girerr::error(error);
+ this->implP->state = rpc_impl::STATE_ERROR;
+ this->implP->errorP = new girerr::error(error);
this->notifyComplete();
}
@@ -710,23 +1100,23 @@
value
rpc::getResult() const {
- switch (this->state) {
- case STATE_UNFINISHED:
+ switch (this->implP->state) {
+ case rpc_impl::STATE_UNFINISHED:
throw(error("Attempt to get result of RPC that is not finished."));
break;
- case STATE_ERROR:
- throw(*this->errorP);
+ case rpc_impl::STATE_ERROR:
+ throw(*this->implP->errorP);
break;
- case STATE_FAILED:
- throw(error("RPC failed. " +
- this->outcome.getFault().getDescription()));
+ case rpc_impl::STATE_FAILED:
+ throw(error("RPC response indicates failure. " +
+ this->implP->outcome.getFault().getDescription()));
break;
- case STATE_SUCCEEDED: {
+ case rpc_impl::STATE_SUCCEEDED: {
// All normal
}
}
- return this->outcome.getResult();
+ return this->implP->outcome.getResult();
}
@@ -735,36 +1125,36 @@
fault
rpc::getFault() const {
- switch (this->state) {
- case STATE_UNFINISHED:
+ switch (this->implP->state) {
+ case rpc_impl::STATE_UNFINISHED:
throw(error("Attempt to get fault from RPC that is not finished"));
break;
- case STATE_ERROR:
- throw(*this->errorP);
+ case rpc_impl::STATE_ERROR:
+ throw(*this->implP->errorP);
break;
- case STATE_SUCCEEDED:
+ case rpc_impl::STATE_SUCCEEDED:
throw(error("Attempt to get fault from an RPC that succeeded"));
break;
- case STATE_FAILED: {
+ case rpc_impl::STATE_FAILED: {
// All normal
}
}
- return this->outcome.getFault();
+ return this->implP->outcome.getFault();
}
bool
rpc::isFinished() const {
- return (this->state != STATE_UNFINISHED);
+ return (this->implP->state != rpc_impl::STATE_UNFINISHED);
}
bool
rpc::isSuccessful() const {
- return (this->state == STATE_SUCCEEDED);
+ return (this->implP->state == rpc_impl::STATE_SUCCEEDED);
}
@@ -773,17 +1163,13 @@
-rpcPtr::rpcPtr(rpc * const rpcP) {
- this->instantiate(rpcP);
-}
+rpcPtr::rpcPtr(rpc * const rpcP) : clientTransactionPtr(rpcP) {}
rpcPtr::rpcPtr(string const methodName,
- xmlrpc_c::paramList const& paramList) {
-
- this->instantiate(new rpc(methodName, paramList));
-}
+ xmlrpc_c::paramList const& paramList) :
+ clientTransactionPtr(new rpc(methodName, paramList)) {}
@@ -813,8 +1199,8 @@
xml::parseResponse(responseXml, &outcome);
this->tranP->finish(outcome);
- } catch (error const caughtError) {
- this->tranP->finishErr(caughtError);
+ } catch (error const& error) {
+ this->tranP->finishErr(error);
}
}
@@ -833,10 +1219,8 @@
xmlTransaction_clientPtr::xmlTransaction_clientPtr(
- clientTransactionPtr const& tranP) {
-
- this->instantiate(new xmlTransaction_client(tranP));
-}
+ clientTransactionPtr const& tranP) :
+ xmlTransactionPtr(new xmlTransaction_client(tranP)) {}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client_simple.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client_simple.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/client_simple.cpp Mon May 26 12:59:57 2008
@@ -1,16 +1,13 @@
#include <string>
+#include <cstring>
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
+#include "env_wrap.hpp"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base.hpp"
#include "xmlrpc-c/client.hpp"
#include <xmlrpc-c/client.hpp>
-/* transport_config.h defines XMLRPC_DEFAULT_TRANSPORT,
- MUST_BUILD_WININET_CLIENT, MUST_BUILD_CURL_CLIENT,
- MUST_BUILD_LIBWWW_CLIENT
-*/
-#include "transport_config.h"
#include "xmlrpc-c/client_simple.hpp"
@@ -21,12 +18,21 @@
namespace {
+
+void
+throwIfError(env_wrap const& env) {
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+class cValueWrapper {
/*----------------------------------------------------------------------------
Use an object of this class to set up to remove a reference to an
xmlrpc_value object (a C object with manual reference management)
at then end of a scope -- even if the scope ends with a throw.
-----------------------------------------------------------------------------*/
-class cValueWrapper {
xmlrpc_value * valueP;
public:
cValueWrapper(xmlrpc_value * valueP) : valueP(valueP) {}
@@ -39,25 +45,9 @@
clientSimple::clientSimple() {
- if (string(XMLRPC_DEFAULT_TRANSPORT) == string("curl"))
- this->transportP = new clientXmlTransport_curl;
- else if (string(XMLRPC_DEFAULT_TRANSPORT) == string("libwww"))
- this->transportP = new clientXmlTransport_libwww;
- else if (string(XMLRPC_DEFAULT_TRANSPORT) == string("wininet"))
- this->transportP = new clientXmlTransport_wininet;
- else
- throw(error("INTERNAL ERROR: "
- "Default client XML transport is not one we recognize"));
-
- this->clientP = new client_xml(transportP);
-}
-
-
-
-clientSimple::~clientSimple() {
+ clientXmlTransportPtr const transportP(clientXmlTransport_http::create());
- delete this->clientP;
- delete this->transportP;
+ this->clientP = clientPtr(new client_xml(transportP));
}
@@ -71,7 +61,7 @@
rpcPtr rpcPtr(methodName, paramList());
- rpcPtr->call(this->clientP, &carriageParm);
+ rpcPtr->call(this->clientP.get(), &carriageParm);
*resultP = rpcPtr->getResult();
}
@@ -84,8 +74,7 @@
xmlrpc_value ** const paramArrayPP,
va_list args) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
/* The format is a sequence of parameter specifications, such as
"iiii" for 4 integer parameters. We add parentheses to make it
@@ -94,11 +83,11 @@
string const arrayFormat("(" + string(format) + ")");
const char * tail;
- xmlrpc_build_value_va(&env, arrayFormat.c_str(),
+ xmlrpc_build_value_va(&env.env_c, arrayFormat.c_str(),
args, paramArrayPP, &tail);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
if (strlen(tail) != 0) {
/* xmlrpc_build_value_va() parses off a single value specification
@@ -125,8 +114,7 @@
carriageParm_http0 carriageParm(serverUrl);
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
xmlrpc_value * paramArrayP;
va_list args;
@@ -134,28 +122,29 @@
makeParamArray(format, ¶mArrayP, args);
va_end(args);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
else {
cValueWrapper paramArrayWrapper(paramArrayP); // ensure destruction
- unsigned int const paramCount = xmlrpc_array_size(&env, paramArrayP);
+ unsigned int const paramCount(
+ xmlrpc_array_size(&env.env_c, paramArrayP));
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
paramList paramList;
for (unsigned int i = 0; i < paramCount; ++i) {
xmlrpc_value * paramP;
- xmlrpc_array_read_item(&env, paramArrayP, i, ¶mP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_array_read_item(&env.env_c, paramArrayP, i, ¶mP);
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
else {
cValueWrapper paramWrapper(paramP); // ensure destruction
paramList.add(value(paramP));
}
}
rpcPtr rpcPtr(methodName, paramList);
- rpcPtr->call(this->clientP, &carriageParm);
+ rpcPtr->call(this->clientP.get(), &carriageParm);
*resultP = rpcPtr->getResult();
}
}
@@ -172,7 +161,7 @@
rpcPtr rpcPtr(methodName, paramList);
- rpcPtr->call(this->clientP, &carriageParm);
+ rpcPtr->call(this->clientP.get(), &carriageParm);
*resultP = rpcPtr->getResult();
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/girmem.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/girmem.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/girmem.cpp Mon May 26 12:59:57 2008
@@ -64,6 +64,22 @@
autoObjectPtr::autoObjectPtr(autoObject * const objectP) {
+
+ // Note: When someone attempts to use this constructor with a null
+ // argument, it's normally because a 'new' of the autoObject
+ // failed, before calling the autoObject's constructor, thus
+ // generating a null pointer.
+
+ // E.g. the following code, where the system is out of memory:
+ //
+ // class client : public autoObject { ... }
+ // class clientPtr : public autoObjectPtr { ... }
+ // clientPtr clientP(new client);
+
+ if (objectP == NULL)
+ throw(error("Object creation failed; trying to create autoObjectPtr "
+ "with a null autoObject pointer"));
+
this->objectP = objectP;
objectP->incref();
}
@@ -81,33 +97,54 @@
autoObjectPtr::~autoObjectPtr() {
- if (this->objectP) {
- bool dead;
- this->objectP->decref(&dead);
- if (dead)
- delete(this->objectP);
- }
+
+ this->unpoint();
}
void
-autoObjectPtr::instantiate(autoObject * const objectP) {
+autoObjectPtr::point(autoObject * const objectP) {
+ if (this->objectP != NULL)
+ throw(error("Already pointing"));
this->objectP = objectP;
objectP->incref();
}
-autoObjectPtr
-autoObjectPtr::operator=(autoObjectPtr const& autoObjectPtr) {
+void
+autoObjectPtr::unpoint() {
- if (this->objectP != NULL)
- throw(error("Already instantiated"));
- this->objectP = autoObjectPtr.objectP;
- this->objectP->incref();
+ if (this->objectP) {
+ bool dead;
+ this->objectP->decref(&dead);
+ if (dead) {
+ delete(this->objectP);
+ this->objectP = NULL;
+ }
+ }
+}
+
+
+
+autoObjectPtr
+autoObjectPtr::operator=(autoObjectPtr const& source) {
+ // If we're overwriting a variable that already points to something,
+ // we have to unpoint it from what it points to now before we can point
+ // it to what 'source' points to. But if the source and destination
+ // are the same object, we just want to leave the pointing alone.
+
+ if (this == &source) {
+ // Assignment of variable to itself; no-op
+ } else {
+ this->unpoint();
+ this->objectP = source.objectP;
+ if (this->objectP)
+ this->objectP->incref();
+ }
return *this;
}
@@ -115,9 +152,18 @@
autoObject *
autoObjectPtr::operator->() const {
+ if (this->objectP == NULL)
+ throw(error("attempt to dereference autoObjectPtr "
+ "which does not point to anything"));
return this->objectP;
}
+autoObject *
+autoObjectPtr::get() const {
+
+ return this->objectP;
+}
+
} // namespace
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/outcome.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/outcome.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/outcome.cpp Mon May 26 12:59:57 2008
@@ -6,7 +6,7 @@
namespace xmlrpc_c {
- rpcOutcome::rpcOutcome() : valid(false) {}
+rpcOutcome::rpcOutcome() : valid(false) {}
rpcOutcome::rpcOutcome(xmlrpc_c::value const result) :
valid(true), _succeeded(true), result(result)
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/param_list.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/param_list.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/param_list.cpp Mon May 26 12:59:57 2008
@@ -21,10 +21,28 @@
-void
+paramList&
paramList::add(xmlrpc_c::value const param) {
+ // Note: Before Xmlrpc-c 1.10, the return value was void. Old programs
+ // using this new add() won't notice the difference. New programs
+ // using this new add() against an old library will, since the old
+ // add() will not return anything. A new program that wants to get
+ // a link error instead of a crash in this case can use addx() instead.
+
this->paramVector.push_back(param);
+
+ return *this;
+}
+
+
+
+paramList&
+paramList::addx(xmlrpc_c::value const param) {
+
+ // See add() for an explanation of why this exists.
+
+ return this->add(param);
}
@@ -50,8 +68,8 @@
int
paramList::getInt(unsigned int const paramNumber,
- int const minimum,
- int const maximum) const {
+ int const minimum,
+ int const maximum) const {
if (paramNumber >= this->paramVector.size())
throw(fault("Not enough parameters", fault::CODE_TYPE));
@@ -91,8 +109,8 @@
double
paramList::getDouble(unsigned int const paramNumber,
- double const minimum,
- double const maximum) const {
+ double const minimum,
+ double const maximum) const {
if (paramNumber >= this->paramVector.size())
throw(fault("Not enough parameters", fault::CODE_TYPE));
@@ -247,6 +265,32 @@
+long long
+paramList::getI8(unsigned int const paramNumber,
+ long long const minimum,
+ long long const maximum) const {
+
+ if (paramNumber >= this->paramVector.size())
+ throw(fault("Not enough parameters", fault::CODE_TYPE));
+
+ if (this->paramVector[paramNumber].type() != value::TYPE_I8)
+ throw(fault("Parameter that is supposed to be 64-bit integer is not",
+ fault::CODE_TYPE));
+
+ long long const longlongvalue(static_cast<long long>(
+ value_i8(this->paramVector[paramNumber])));
+
+ if (longlongvalue < minimum)
+ throw(fault("64-bit integer parameter too low", fault::CODE_TYPE));
+
+ if (longlongvalue > maximum)
+ throw(fault("64-bit integer parameter too high", fault::CODE_TYPE));
+
+ return longlongvalue;
+}
+
+
+
void
paramList::verifyEnd(unsigned int const paramNumber) const {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/registry.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/registry.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/registry.cpp Mon May 26 12:59:57 2008
@@ -1,19 +1,35 @@
+#include <cassert>
#include <string>
#include <memory>
#include <algorithm>
#include "xmlrpc-c/girerr.hpp"
-using girerr::error;
+using girerr::throwf;
#include "xmlrpc-c/girmem.hpp"
using girmem::autoObject;
using girmem::autoObjectPtr;
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base.hpp"
+#include "env_wrap.hpp"
+
#include "xmlrpc-c/registry.hpp"
using namespace std;
using namespace xmlrpc_c;
+
+namespace {
+
+void
+throwIfError(env_wrap const& env) {
+
+ if (env.env_c.fault_occurred)
+ throw(girerr::error(env.env_c.fault_string));
+}
+
+
+} // namespace
+
namespace xmlrpc_c {
@@ -24,20 +40,12 @@
-method *
-method::self() {
-
- return this;
-}
-
-
-
method::~method() {}
methodPtr::methodPtr(method * const methodP) {
- this->instantiate(methodP);
+ this->point(methodP);
}
@@ -59,7 +67,7 @@
defaultMethodPtr::defaultMethodPtr(defaultMethod * const methodP) {
- this->instantiate(methodP);
+ this->point(methodP);
}
@@ -74,23 +82,21 @@
defaultMethod *
-defaultMethod::self() {
+defaultMethodPtr::get() const {
- return this;
+ autoObject * const p(this->objectP);
+ return dynamic_cast<defaultMethod *>(p);
}
registry::registry() {
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->c_registryP = xmlrpc_registry_new(&env);
+ this->c_registryP = xmlrpc_registry_new(&env.env_c);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
@@ -102,6 +108,34 @@
+registryPtr::registryPtr() {}
+
+
+
+registryPtr::registryPtr(registry * const registryP) {
+ this->point(registryP);
+}
+
+
+
+registry *
+registryPtr::operator->() const {
+
+ autoObject * const p(this->objectP);
+ return dynamic_cast<registry *>(p);
+}
+
+
+
+registry *
+registryPtr::get() const {
+
+ autoObject * const p(this->objectP);
+ return dynamic_cast<registry *>(p);
+}
+
+
+
static xmlrpc_c::paramList
pListFromXmlrpcArray(xmlrpc_value * const arrayP) {
/*----------------------------------------------------------------------------
@@ -111,19 +145,21 @@
This is glue code to allow us to hook up C++ Xmlrpc-c code to
C Xmlrpc-c code.
-----------------------------------------------------------------------------*/
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+ env_wrap env;
XMLRPC_ASSERT_ARRAY_OK(arrayP);
- unsigned int const arraySize = xmlrpc_array_size(&env, arrayP);
+ unsigned int const arraySize = xmlrpc_array_size(&env.env_c, arrayP);
+
+ assert(!env.env_c.fault_occurred);
xmlrpc_c::paramList paramList(arraySize);
for (unsigned int i = 0; i < arraySize; ++i) {
xmlrpc_value * arrayItemP;
- xmlrpc_array_read_item(&env, arrayP, i, &arrayItemP);
+
+ xmlrpc_array_read_item(&env.env_c, arrayP, i, &arrayItemP);
+ assert(!env.env_c.fault_occurred);
paramList.add(xmlrpc_c::value(arrayItemP));
@@ -164,23 +200,30 @@
try {
methodP->execute(paramList, &result);
- } catch (xmlrpc_c::fault caughtFault) {
- xmlrpc_env_set_fault(envP, caughtFault.getCode(),
- caughtFault.getDescription().c_str());
- } catch (girerr::error caughtError) {
- xmlrpc_env_set_fault(envP, 0, caughtError.what());
+ } catch (xmlrpc_c::fault const& fault) {
+ xmlrpc_env_set_fault(envP, fault.getCode(),
+ fault.getDescription().c_str());
}
- if (envP->fault_occurred)
- retval = NULL;
- else
- retval = result.cValue();
+ if (!envP->fault_occurred) {
+ if (result.isInstantiated())
+ retval = result.cValue();
+ else
+ throwf("Xmlrpc-c user's xmlrpc_c::method object's "
+ "'execute method' failed to set the RPC result "
+ "value.");
+ }
+ } catch (exception const& e) {
+ xmlrpc_faultf(envP, "Unexpected error executing code for "
+ "particular method, detected by Xmlrpc-c "
+ "method registry code. Method did not "
+ "fail; rather, it did not complete at all. %s",
+ e.what());
} catch (...) {
xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR,
- "Unexpected error executing the code for this "
- "particular method, detected by the Xmlrpc-c "
- "method registry code. The method did not "
+ "Unexpected error executing code for "
+ "particular method, detected by Xmlrpc-c "
+ "method registry code. Method did not "
"fail; rather, it did not complete at all.");
- retval = NULL;
}
return retval;
}
@@ -208,34 +251,41 @@
XML-RPC method failure. This will cause a leak if the execute()
method actually created a result, since it will not get destroyed.
-----------------------------------------------------------------------------*/
- xmlrpc_c::defaultMethod * const methodP =
- static_cast<xmlrpc_c::defaultMethod *>(methodPtr);
- xmlrpc_c::paramList const paramList(pListFromXmlrpcArray(paramArrayP));
+ defaultMethod * const methodP =
+ static_cast<defaultMethod *>(methodPtr);
+ paramList const paramList(pListFromXmlrpcArray(paramArrayP));
xmlrpc_value * retval;
try {
xmlrpc_c::value result;
-
+
try {
methodP->execute(methodName, paramList, &result);
- } catch (xmlrpc_c::fault caughtFault) {
- xmlrpc_env_set_fault(envP, caughtFault.getCode(),
- caughtFault.getDescription().c_str());
- } catch (girerr::error caughtError) {
- xmlrpc_env_set_fault(envP, 0, caughtError.what());
+ } catch (xmlrpc_c::fault const& fault) {
+ xmlrpc_env_set_fault(envP, fault.getCode(),
+ fault.getDescription().c_str());
+ }
+ if (!envP->fault_occurred) {
+ if (result.isInstantiated())
+ retval = result.cValue();
+ else
+ throwf("Xmlrpc-c user's xmlrpc_c::defaultMethod object's "
+ "'execute method' failed to set the RPC result "
+ "value.");
}
- if (envP->fault_occurred)
- retval = NULL;
- else
- retval = result.cValue();
+ } catch (exception const& e) {
+ xmlrpc_faultf(envP, "Unexpected error executing default "
+ "method code, detected by Xmlrpc-c "
+ "method registry code. Method did not "
+ "fail; rather, it did not complete at all. %s",
+ e.what());
} catch (...) {
xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR,
- "Unexpected error executing the default "
- "method code, detected by the Xmlrpc-c "
- "method registry code. The method did not "
+ "Unexpected error executing default "
+ "method code, detected by Xmlrpc-c "
+ "method registry code. Method did not "
"fail; rather, it did not complete at all.");
- retval = NULL;
}
return retval;
}
@@ -243,46 +293,36 @@
void
-registry::addMethod(string const name,
- xmlrpc_c::methodPtr const methodPtr) {
+registry::addMethod(string const name,
+ methodPtr const methodP) {
+ this->methodList.push_back(methodP);
- this->methodList.push_back(methodPtr);
-
- xmlrpc_env env;
+ env_wrap env;
- xmlrpc_env_init(&env);
-
- xmlrpc_c::method * const methodP(methodPtr->self());
-
xmlrpc_registry_add_method_w_doc(
- &env, this->c_registryP, NULL,
+ &env.env_c, this->c_registryP, NULL,
name.c_str(), &c_executeMethod,
- (void*) methodP,
+ (void*) methodP.get(),
methodP->signature().c_str(), methodP->help().c_str());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
void
-registry::setDefaultMethod(defaultMethodPtr const methodPtr) {
-
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+registry::setDefaultMethod(defaultMethodPtr const methodP) {
- this->defaultMethodP = methodPtr;
-
- xmlrpc_c::defaultMethod * const methodP(methodPtr->self());
+ this->defaultMethodP = methodP;
+ env_wrap env;
+
xmlrpc_registry_set_default_method(
- &env, this->c_registryP, &c_executeDefaultMethod, (void*) methodP);
+ &env.env_c, this->c_registryP,
+ &c_executeDefaultMethod, (void*) methodP.get());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
@@ -295,6 +335,52 @@
+static xmlrpc_server_shutdown_fn shutdownServer;
+
+static void
+shutdownServer(xmlrpc_env * const envP,
+ void * const context,
+ const char * const comment,
+ void * const callInfo) {
+
+ registry::shutdown * const shutdownP(
+ static_cast<registry::shutdown *>(context));
+
+ assert(shutdownP != NULL);
+
+ try {
+ shutdownP->doit(string(comment), callInfo);
+ } catch (exception const& e) {
+ xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR, e.what());
+ }
+}
+
+
+
+void
+registry::setShutdown(const registry::shutdown * const shutdownP) {
+
+ void * const context(const_cast<registry::shutdown *>(shutdownP));
+
+ xmlrpc_registry_set_shutdown(this->c_registryP,
+ &shutdownServer,
+ context);
+}
+
+
+
+void
+registry::setDialect(xmlrpc_dialect const dialect) {
+
+ env_wrap env;
+
+ xmlrpc_registry_set_dialect(&env.env_c, this->c_registryP, dialect);
+
+ throwIfError(env);
+}
+
+
+
void
registry::processCall(string const& callXml,
string * const responseXmlP) const {
@@ -307,11 +393,9 @@
the call executes and the method merely fails in an XML-RPC sense, we
don't. In that case, *responseXmlP indicates the failure.
-----------------------------------------------------------------------------*/
- xmlrpc_env env;
+ env_wrap env;
xmlrpc_mem_block * output;
- xmlrpc_env_init(&env);
-
// For the pure C++ version, this will have to parse 'callXml'
// into a method name and parameters, look up the method name in
// the registry, call the method's execute() method, then marshall
@@ -321,10 +405,10 @@
// xmlrpc_registry_process_call() does.
output = xmlrpc_registry_process_call(
- &env, this->c_registryP, NULL, callXml.c_str(), callXml.length());
+ &env.env_c, this->c_registryP, NULL,
+ callXml.c_str(), callXml.length());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
*responseXmlP = string(XMLRPC_MEMBLOCK_CONTENTS(char, output),
XMLRPC_MEMBLOCK_SIZE(char, output));
@@ -339,3 +423,6 @@
}
} // namespace
+
+
+registry::shutdown::~shutdown() {}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/server_abyss.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/server_abyss.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/server_abyss.cpp Mon May 26 12:59:57 2008
@@ -1,11 +1,18 @@
-#include <cassert>
+#include <cstdlib>
#include <string>
#include <memory>
#include <signal.h>
+#include <errno.h>
+#include <iostream>
+#ifndef _WIN32
#include <sys/wait.h>
+#endif
+#include "assertx.hpp"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
+using girerr::throwf;
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base.hpp"
#include "xmlrpc-c/server_abyss.h"
@@ -17,47 +24,21 @@
namespace xmlrpc_c {
-serverAbyss::serverAbyss(
- xmlrpc_c::registry const& registry,
- unsigned int const portNumber,
- string const& logFileName,
- unsigned int const keepaliveTimeout,
- unsigned int const keepaliveMaxConn,
- unsigned int const timeout,
- bool const dontAdvertise) {
-
- this->registryP = ®istry;
- this->logFileName = logFileName;
- this->keepaliveTimeout = keepaliveTimeout;
- this->keepaliveMaxConn = keepaliveMaxConn;
- this->timeout = timeout;
- this->dontAdvertise = dontAdvertise;
-
- if (portNumber > 0xffff)
- throw(error("Port number exceeds the maximum possible port number "
- "(65535)"));
- else {
- this->portNumber = portNumber;
- }
-}
-
-
-serverAbyss::~serverAbyss() {
-}
-
-
-
namespace {
static void
-sigterm(int const sig) {
- TraceExit("Signal %d received. Exiting...\n",sig);
+sigterm(int const signalClass) {
+
+ cerr << "Signal of Class " << signalClass << " received. Exiting" << endl;
+
+ exit(1);
}
+
static void
-sigchld(int const sig) {
+sigchld(int const ASSERT_ONLY_ARG(signalClass)) {
/*----------------------------------------------------------------------------
This is a signal handler for a SIGCHLD signal (which informs us that
one of our child processes has terminated).
@@ -65,7 +46,8 @@
We respond by reaping the zombie process.
Implementation note: In some systems, just setting the signal handler
- to SIG_IGN (ignore signal) does this. In others, it doesn't.
+ to SIG_IGN (ignore signal) does this. In some, the system does this
+ automatically if the signal is blocked.
-----------------------------------------------------------------------------*/
#ifndef _WIN32
/* Reap zombie children until there aren't any more. */
@@ -73,7 +55,7 @@
bool zombiesExist;
bool error;
- assert(sig == SIGCHLD);
+ assert(signalClass == SIGCHLD);
zombiesExist = true; // initial assumption
error = false; // no error yet
@@ -94,8 +76,25 @@
#endif /* _WIN32 */
}
+
+
+struct signalHandlers {
+#ifndef WIN32
+ struct sigaction term;
+ struct sigaction int_;
+ struct sigaction hup;
+ struct sigaction usr1;
+ struct sigaction pipe;
+ struct sigaction chld;
+#else
+ int dummy;
+#endif
+};
+
+
+
void
-setupSignalHandlers(void) {
+setupSignalHandlers(struct signalHandlers * const oldHandlersP) {
#ifndef _WIN32
struct sigaction mysigaction;
@@ -104,93 +103,366 @@
/* These signals abort the program, with tracing */
mysigaction.sa_handler = sigterm;
- sigaction(SIGTERM, &mysigaction, NULL);
- sigaction(SIGINT, &mysigaction, NULL);
- sigaction(SIGHUP, &mysigaction, NULL);
- sigaction(SIGUSR1, &mysigaction, NULL);
+ sigaction(SIGTERM, &mysigaction, &oldHandlersP->term);
+ sigaction(SIGINT, &mysigaction, &oldHandlersP->int_);
+ sigaction(SIGHUP, &mysigaction, &oldHandlersP->hup);
+ sigaction(SIGUSR1, &mysigaction, &oldHandlersP->usr1);
/* This signal indicates connection closed in the middle */
mysigaction.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &mysigaction, NULL);
+ sigaction(SIGPIPE, &mysigaction, &oldHandlersP->pipe);
/* This signal indicates a child process (request handler) has died */
mysigaction.sa_handler = sigchld;
- sigaction(SIGCHLD, &mysigaction, NULL);
+ sigaction(SIGCHLD, &mysigaction, &oldHandlersP->chld);
#endif
}
-static void
-setAdditionalServerParms(
- unsigned int const keepaliveTimeout,
- unsigned int const keepaliveMaxConn,
- unsigned int const timeout,
- bool const dontAdvertise,
- TServer * const srvP) {
+
+void
+restoreSignalHandlers(struct signalHandlers const& oldHandlers) {
+
+#ifndef _WIN32
+ sigaction(SIGCHLD, &oldHandlers.chld, NULL);
+ sigaction(SIGPIPE, &oldHandlers.pipe, NULL);
+ sigaction(SIGUSR1, &oldHandlers.usr1, NULL);
+ sigaction(SIGHUP, &oldHandlers.hup, NULL);
+ sigaction(SIGINT, &oldHandlers.int_, NULL);
+ sigaction(SIGTERM, &oldHandlers.term, NULL);
+#endif
+}
+
+
+
+// We need 'global' because methods of class serverAbyss call
+// functions in the Abyss C library. By virtue of global's static
+// storage class, the program loader will call its constructor and
+// destructor and thus initialize and terminate the Abyss C library.
+
+class abyssGlobalState {
+public:
+ abyssGlobalState() {
+ const char * error;
+ AbyssInit(&error);
+ if (error) {
+ string const e(error);
+ xmlrpc_strfree(error);
+ throwf("AbyssInit() failed. %s", e.c_str());
+ }
+ }
+ ~abyssGlobalState() {
+ AbyssTerm();
+ }
+} const global;
+
+} // namespace
+
+
+
+serverAbyss::shutdown::shutdown(serverAbyss * const serverAbyssP) :
+ serverAbyssP(serverAbyssP) {}
+
+
+
+serverAbyss::shutdown::~shutdown() {}
+
+
+
+void
+serverAbyss::shutdown::doit(string const&,
+ void * const) const {
+
+ this->serverAbyssP->terminate();
+}
+
+
+
+serverAbyss::constrOpt::constrOpt() {
+ present.registryPtr = false;
+ present.registryP = false;
+ present.socketFd = false;
+ present.portNumber = false;
+ present.logFileName = false;
+ present.keepaliveTimeout = false;
+ present.keepaliveMaxConn = false;
+ present.timeout = false;
+ present.dontAdvertise = false;
+ present.uriPath = false;
+ present.chunkResponse = false;
+
+ // Set default values
+ value.dontAdvertise = false;
+ value.uriPath = string("/RPC2");
+ value.chunkResponse = false;
+}
+
+
+
+#define DEFINE_OPTION_SETTER(OPTION_NAME, TYPE) \
+serverAbyss::constrOpt & \
+serverAbyss::constrOpt::OPTION_NAME(TYPE const& arg) { \
+ this->value.OPTION_NAME = arg; \
+ this->present.OPTION_NAME = true; \
+ return *this; \
+}
+
+DEFINE_OPTION_SETTER(registryPtr, xmlrpc_c::registryPtr);
+DEFINE_OPTION_SETTER(registryP, const registry *);
+DEFINE_OPTION_SETTER(socketFd, XMLRPC_SOCKET);
+DEFINE_OPTION_SETTER(portNumber, unsigned int);
+DEFINE_OPTION_SETTER(logFileName, string);
+DEFINE_OPTION_SETTER(keepaliveTimeout, unsigned int);
+DEFINE_OPTION_SETTER(keepaliveMaxConn, unsigned int);
+DEFINE_OPTION_SETTER(timeout, unsigned int);
+DEFINE_OPTION_SETTER(dontAdvertise, bool);
+DEFINE_OPTION_SETTER(uriPath, string);
+DEFINE_OPTION_SETTER(chunkResponse, bool);
+
+
+
+void
+serverAbyss::setAdditionalServerParms(constrOpt const& opt) {
/* The following ought to be parameters on ServerCreate(), but it
looks like plugging them straight into the TServer structure is
the only way to set them.
*/
+ if (opt.present.keepaliveTimeout)
+ ServerSetKeepaliveTimeout(&this->cServer, opt.value.keepaliveTimeout);
+ if (opt.present.keepaliveMaxConn)
+ ServerSetKeepaliveMaxConn(&this->cServer, opt.value.keepaliveMaxConn);
+ if (opt.present.timeout)
+ ServerSetTimeout(&this->cServer, opt.value.timeout);
+ ServerSetAdvertise(&this->cServer, !opt.value.dontAdvertise);
+}
+
+
+
+static void
+createServer(bool const logFileNameGiven,
+ string const& logFileName,
+ bool const socketFdGiven,
+ int const socketFd,
+ bool const portNumberGiven,
+ unsigned int const portNumber,
+ TServer * const srvPP) {
+
+ const char * const logfileArg(logFileNameGiven ?
+ logFileName.c_str() : NULL);
+
+ const char * const serverName("XmlRpcServer");
+
+ abyss_bool created;
+
+ if (socketFdGiven)
+ created =
+ ServerCreateSocket(srvPP, serverName, socketFd,
+ DEFAULT_DOCS, logfileArg);
+ else if (portNumberGiven) {
+ if (portNumber > 0xffff)
+ throwf("Port number %u exceeds the maximum possible port number "
+ "(65535)", portNumber);
+
+ created =
+ ServerCreate(srvPP, serverName, portNumber,
+ DEFAULT_DOCS, logfileArg);
+ } else
+ created =
+ ServerCreateNoAccept(srvPP, serverName,
+ DEFAULT_DOCS, logfileArg);
+
+ if (!created)
+ throw(error("Failed to create Abyss server. See Abyss error log for "
+ "reason."));
+}
+
+
+
+void
+serverAbyss::initialize(constrOpt const& opt) {
+
+ const registry * registryP;
+
+ if (!opt.present.registryP && !opt.present.registryPtr)
+ throwf("You must specify the 'registryP' or 'registryPtr' option");
+ else if (opt.present.registryP && opt.present.registryPtr)
+ throwf("You may not specify both the 'registryP' and "
+ "the 'registryPtr' options");
+ else {
+ if (opt.present.registryP)
+ registryP = opt.value.registryP;
+ else {
+ this->registryPtr = opt.value.registryPtr;
+ registryP = this->registryPtr.get();
+ }
+ }
+ if (opt.present.portNumber && opt.present.socketFd)
+ throwf("You can't specify both portNumber and socketFd options");
+
+ DateInit();
+
+ createServer(opt.present.logFileName, opt.value.logFileName,
+ opt.present.socketFd, opt.value.socketFd,
+ opt.present.portNumber, opt.value.portNumber,
+ &this->cServer);
+
+ try {
+ setAdditionalServerParms(opt);
+
+ // chunked response implementation is incomplete. We must
+ // eventually get away from libxmlrpc_server_abyss and
+ // register our own handler with the Abyss server. At that
+ // time, we'll have some place to pass
+ // opt.value.chunkResponse.
+
+ xmlrpc_c::server_abyss_set_handlers(&this->cServer,
+ registryP,
+ opt.value.uriPath);
+
+ if (opt.present.portNumber || opt.present.socketFd)
+ ServerInit(&this->cServer);
+ } catch (...) {
+ ServerFree(&this->cServer);
+ throw;
+ }
+}
+
+
+
+serverAbyss::serverAbyss(constrOpt const& opt) {
+
+ initialize(opt);
+}
+
+
+
+serverAbyss::serverAbyss(
+ xmlrpc_c::registry const& registry,
+ unsigned int const portNumber,
+ string const& logFileName,
+ unsigned int const keepaliveTimeout,
+ unsigned int const keepaliveMaxConn,
+ unsigned int const timeout,
+ bool const dontAdvertise,
+ bool const socketBound,
+ XMLRPC_SOCKET const socketFd) {
+/*----------------------------------------------------------------------------
+ This is a backward compatibility interface. This used to be the only
+ constructor.
+-----------------------------------------------------------------------------*/
+ serverAbyss::constrOpt opt;
+
+ opt.registryP(®istry);
+ if (logFileName.length() > 0)
+ opt.logFileName(logFileName);
if (keepaliveTimeout > 0)
- srvP->keepalivetimeout = keepaliveTimeout;
+ opt.keepaliveTimeout(keepaliveTimeout);
if (keepaliveMaxConn > 0)
- srvP->keepalivemaxconn = keepaliveMaxConn;
+ opt.keepaliveMaxConn(keepaliveMaxConn);
if (timeout > 0)
- srvP->timeout = timeout;
- srvP->advertise = !dontAdvertise;
+ opt.timeout(timeout);
+ opt.dontAdvertise(dontAdvertise);
+ if (socketBound)
+ opt.socketFd(socketFd);
+ else
+ opt.portNumber(portNumber);
+
+ initialize(opt);
}
-} // namespace
+
+serverAbyss::~serverAbyss() {
+
+ ServerFree(&this->cServer);
+}
void
serverAbyss::run() {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
- DateInit();
- MIMETypeInit();
-
- TServer srv;
+ /* We do some pretty ugly stuff for an object method: we set signal
+ handlers, which are process-global.
- const char * const logfileArg(this->logFileName.length() == 0 ?
- NULL : this->logFileName.c_str());
+ One example of where this can be hairy is: Caller has a child
+ process unrelated to the Abyss server. That child dies. We
+ get his death of a child signal and Caller never knows.
+
+ We really expect to be the only thing in the process, at least
+ for the time we're running. If you want the Abyss Server
+ to behave more like an object and own the signals yourself,
+ use runOnce() in a loop instead of run().
+ */
+ signalHandlers oldHandlers;
- ServerCreate(&srv, "XmlRpcServer", this->portNumber,
- DEFAULT_DOCS, logfileArg);
+ setupSignalHandlers(&oldHandlers);
- setAdditionalServerParms(
- this->keepaliveTimeout, this->keepaliveMaxConn, this->timeout,
- this->dontAdvertise, &srv);
-
- xmlrpc_c::server_abyss_set_handlers(&srv, *this->registryP);
-
- ServerInit(&srv);
-
- setupSignalHandlers();
-
- ServerRun(&srv);
+ ServerRun(&this->cServer);
- /* We can't exist here because ServerRun doesn't return */
- assert(false);
+ restoreSignalHandlers(oldHandlers);
}
void
-server_abyss_set_handlers(TServer * const srvP,
- xmlrpc_c::registry const& registry) {
-
+serverAbyss::runOnce() {
- xmlrpc_server_abyss_set_handlers(srvP, registry.c_registry());
+ ServerRunOnce(&this->cServer);
}
-} // namespace
+void
+serverAbyss::runConn(int const socketFd) {
+
+ ServerRunConn(&this->cServer, socketFd);
+}
+
+
+
+void
+serverAbyss::terminate() {
+ ServerTerminate(&this->cServer);
+}
+
+void
+server_abyss_set_handlers(TServer * const srvP,
+ registry const& registry,
+ string const& uriPath) {
+
+ xmlrpc_server_abyss_set_handlers2(srvP,
+ uriPath.c_str(),
+ registry.c_registry());
+}
+
+
+
+void
+server_abyss_set_handlers(TServer * const srvP,
+ const registry * const registryP,
+ string const& uriPath) {
+
+ xmlrpc_server_abyss_set_handlers2(srvP,
+ uriPath.c_str(),
+ registryP->c_registry());
+}
+
+
+
+void
+server_abyss_set_handlers(TServer * const srvP,
+ registryPtr const registryPtr,
+ string const& uriPath) {
+
+ xmlrpc_server_abyss_set_handlers2(srvP,
+ uriPath.c_str(),
+ registryPtr->c_registry());
+}
+
+
+
+} // namespace
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/value.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/value.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/value.cpp Mon May 26 12:59:57 2008
@@ -1,9 +1,9 @@
/*****************************************************************************
- xmlrpc_value.cpp
+ value.cpp
******************************************************************************
- This module provides services for dealwith XML-RPC values. Each type
- of XML-RPC value is a C++ class. An object represents a particular
- XML-RPC value.
+ This module provides services for dealing with XML-RPC values. Each
+ type of XML-RPC value is a C++ class. An object represents a
+ particular XML-RPC value.
Everything is based on the C services in libxmlrpc.
@@ -25,34 +25,44 @@
class members had to be declared public so that other components of
the library could see them, but the user is not supposed to access
those members.
-
*****************************************************************************/
+#include <cstdlib>
#include <string>
#include <vector>
-#include <time.h>
+#include <ctime>
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "env_wrap.hpp"
+
#include "xmlrpc-c/base.hpp"
using namespace std;
+using namespace xmlrpc_c;
namespace {
+void
+throwIfError(env_wrap const& env) {
+
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
class cDatetimeValueWrapper {
public:
xmlrpc_value * valueP;
cDatetimeValueWrapper(time_t const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_datetime_new_sec(&env, cppvalue);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_datetime_new_sec(&env.env_c, cppvalue);
+ throwIfError(env);
}
~cDatetimeValueWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -65,18 +75,17 @@
const char * str;
size_t length;
cStringWrapper(xmlrpc_value * valueP) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_read_string_lp(&env, valueP, &length, &str);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_string_lp(&env.env_c, valueP, &length, &str);
+ throwIfError(env);
}
~cStringWrapper() {
free((char*)str);
}
};
-
+
+
} // namespace
@@ -123,6 +132,17 @@
+bool
+value::isInstantiated() const {
+/*----------------------------------------------------------------------------
+ Return whether the value is actually a value, as opposed to a placeholder
+ variable waiting to be assigned a value.
+-----------------------------------------------------------------------------*/
+ return (this->cValueP != NULL);
+}
+
+
+
void
value::instantiate(xmlrpc_value * const valueP) {
@@ -148,13 +168,11 @@
/*----------------------------------------------------------------------------
Append this value to the C array 'arrayP'.
----------------------------------------------------------------------------*/
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_array_append_item(&env, arrayP, this->cValueP);
-
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_array_append_item(&env.env_c, arrayP, this->cValueP);
+
+ throwIfError(env);
}
@@ -165,15 +183,13 @@
/*----------------------------------------------------------------------------
Add this value to the C array 'arrayP' with key 'key'.
----------------------------------------------------------------------------*/
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_struct_set_value_n(&env, structP,
+ xmlrpc_struct_set_value_n(&env.env_c, structP,
key.c_str(), key.length(),
this->cValueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
@@ -203,12 +219,10 @@
xmlrpc_value * valueP;
cWrapper(int const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_int_new(&env, cppvalue);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_int_new(&env.env_c, cppvalue);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -236,13 +250,10 @@
value_int::operator int() const {
int retval;
+ env_wrap env;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
- xmlrpc_read_int(&env, this->cValueP, &retval);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_int(&env.env_c, this->cValueP, &retval);
+ throwIfError(env);
return retval;
}
@@ -256,12 +267,10 @@
xmlrpc_value * valueP;
cWrapper(double const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_double_new(&env, cppvalue);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_double_new(&env.env_c, cppvalue);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -288,12 +297,10 @@
double retval;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_read_double(&env, this->cValueP, &retval);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_double(&env.env_c, this->cValueP, &retval);
+ throwIfError(env);
return retval;
}
@@ -307,12 +314,10 @@
xmlrpc_value * valueP;
cWrapper(xmlrpc_bool const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_bool_new(&env, cppvalue);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_bool_new(&env.env_c, cppvalue);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -330,14 +335,12 @@
xmlrpc_bool retval;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_read_bool(&env, this->cValueP, &retval);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_bool(&env.env_c, this->cValueP, &retval);
+ throwIfError(env);
- return (bool)retval;
+ return (retval != false);
}
@@ -360,12 +363,11 @@
xmlrpc_value * valueP;
cWrapper(string const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_datetime_new_str(&env, cppvalue.c_str());
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_datetime_new_str(&env.env_c,
+ cppvalue.c_str());
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -388,21 +390,25 @@
+#if XMLRPC_HAVE_TIMEVAL
value_datetime::value_datetime(struct timeval const& cppvalue) {
cDatetimeValueWrapper wrapper(cppvalue.tv_sec);
this->instantiate(wrapper.valueP);
}
+#endif
+#if XMLRPC_HAVE_TIMESPEC
value_datetime::value_datetime(struct timespec const& cppvalue) {
cDatetimeValueWrapper wrapper(cppvalue.tv_sec);
this->instantiate(wrapper.valueP);
}
+#endif
@@ -420,45 +426,68 @@
value_datetime::operator time_t() const {
time_t retval;
+ env_wrap env;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
- xmlrpc_read_datetime_sec(&env, this->cValueP, &retval);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_datetime_sec(&env.env_c, this->cValueP, &retval);
+ throwIfError(env);
return retval;
}
-value_string::value_string(string const& cppvalue) {
-
- class cWrapper {
- public:
- xmlrpc_value * valueP;
+class cNewStringWrapper {
+public:
+ xmlrpc_value * valueP;
- cWrapper(string const cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ cNewStringWrapper(string const cppvalue,
+ value_string::nlCode const nlCode) {
+ env_wrap env;
- this->valueP = xmlrpc_string_new(&env, cppvalue.c_str());
- if (env.fault_occurred)
- throw(error(env.fault_string));
- }
- ~cWrapper() {
- xmlrpc_DECREF(this->valueP);
+ switch (nlCode) {
+ case value_string::nlCode_all:
+ this->valueP = xmlrpc_string_new_lp(&env.env_c,
+ cppvalue.length(),
+ cppvalue.c_str());
+ break;
+ case value_string::nlCode_lf:
+ this->valueP = xmlrpc_string_new_lp_cr(&env.env_c,
+ cppvalue.length(),
+ cppvalue.c_str());
+ break;
+ default:
+ throw(error("Newline encoding argument to value_string "
+ "constructor is not one of the defined "
+ "enumerations of value_string::nlCode"));
}
- };
+ throwIfError(env);
+ }
+ ~cNewStringWrapper() {
+ xmlrpc_DECREF(this->valueP);
+ }
+};
- cWrapper wrapper(cppvalue);
+
+
+value_string::value_string(std::string const& cppvalue,
+ value_string::nlCode const nlCode) {
+
+ cNewStringWrapper wrapper(cppvalue, nlCode);
this->instantiate(wrapper.valueP);
}
+value_string::value_string(std::string const& cppvalue) {
+
+ cNewStringWrapper wrapper(cppvalue, nlCode_all);
+
+ this->instantiate(wrapper.valueP);
+}
+
+
+
value_string::value_string(xmlrpc_c::value const baseValue) {
if (baseValue.type() != xmlrpc_c::value::TYPE_STRING)
@@ -470,10 +499,34 @@
+std::string
+value_string::crlfValue() const {
+
+ class cWrapper {
+ public:
+ const char * str;
+ size_t length;
+ cWrapper(xmlrpc_value * valueP) {
+ env_wrap env;
+
+ xmlrpc_read_string_lp_crlf(&env.env_c, valueP, &length, &str);
+ throwIfError(env);
+ }
+ ~cWrapper() {
+ free((char*)str);
+ }
+ };
+
+ cWrapper wrapper(this->cValueP);
+
+ return string(wrapper.str, wrapper.length);
+}
+
+
+
value_string::operator string() const {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
cStringWrapper adapter(this->cValueP);
@@ -490,13 +543,11 @@
xmlrpc_value * valueP;
cWrapper(vector<unsigned char> const& cppvalue) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
this->valueP =
- xmlrpc_base64_new(&env, cppvalue.size(), &cppvalue[0]);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_base64_new(&env.env_c, cppvalue.size(), &cppvalue[0]);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -519,12 +570,10 @@
size_t length;
cWrapper(xmlrpc_value * const valueP) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_read_base64(&env, valueP, &length, &contents);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ xmlrpc_read_base64(&env.env_c, valueP, &length, &contents);
+ throwIfError(env);
}
~cWrapper() {
free((void*)contents);
@@ -542,13 +591,11 @@
size_t
value_bytestring::length() const {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
+ env_wrap env;
size_t length;
- xmlrpc_read_base64_size(&env, this->cValueP, &length);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+
+ xmlrpc_read_base64_size(&env.env_c, this->cValueP, &length);
+ throwIfError(env);
return length;
}
@@ -573,12 +620,10 @@
xmlrpc_value * valueP;
cWrapper() {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_array_new(&env);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_array_new(&env.env_c);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -610,14 +655,12 @@
vector<xmlrpc_c::value>
value_array::vectorValueValue() const {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
unsigned int arraySize;
- arraySize = xmlrpc_array_size(&env, this->cValueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ arraySize = xmlrpc_array_size(&env.env_c, this->cValueP);
+ throwIfError(env);
vector<xmlrpc_c::value> retval(arraySize);
@@ -629,14 +672,11 @@
cWrapper(xmlrpc_value * const arrayP,
unsigned int const index) {
+ env_wrap env;
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
- xmlrpc_array_read_item(&env, arrayP, index, &valueP);
+ xmlrpc_array_read_item(&env.env_c, arrayP, index, &valueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(valueP);
@@ -656,14 +696,11 @@
size_t
value_array::size() const {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
+ env_wrap env;
unsigned int arraySize;
- arraySize = xmlrpc_array_size(&env, this->cValueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ arraySize = xmlrpc_array_size(&env.env_c, this->cValueP);
+ throwIfError(env);
return arraySize;
}
@@ -678,12 +715,10 @@
xmlrpc_value * valueP;
cWrapper() {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_struct_new(&env);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_struct_new(&env.env_c);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -717,14 +752,11 @@
value_struct::operator map<string, xmlrpc_c::value>() const {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
-
+ env_wrap env;
unsigned int structSize;
- structSize = xmlrpc_struct_size(&env, this->cValueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ structSize = xmlrpc_struct_size(&env.env_c, this->cValueP);
+ throwIfError(env);
map<string, xmlrpc_c::value> retval;
@@ -737,14 +769,12 @@
cMemberWrapper(xmlrpc_value * const structP,
unsigned int const index) {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- xmlrpc_struct_read_member(&env, structP, index,
+ xmlrpc_struct_read_member(&env.env_c, structP, index,
&keyP, &valueP);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ throwIfError(env);
}
~cMemberWrapper() {
xmlrpc_DECREF(keyP);
@@ -773,12 +803,10 @@
xmlrpc_value * valueP;
cWrapper() {
- xmlrpc_env env;
- xmlrpc_env_init(&env);
+ env_wrap env;
- this->valueP = xmlrpc_nil_new(&env);
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ this->valueP = xmlrpc_nil_new(&env.env_c);
+ throwIfError(env);
}
~cWrapper() {
xmlrpc_DECREF(this->valueP);
@@ -803,5 +831,52 @@
-} // namespace
+value_i8::value_i8(xmlrpc_int64 const cppvalue) {
+ class cWrapper {
+ public:
+ xmlrpc_value * valueP;
+
+ cWrapper(xmlrpc_int64 const cppvalue) {
+ env_wrap env;
+
+ this->valueP = xmlrpc_i8_new(&env.env_c, cppvalue);
+ throwIfError(env);
+ }
+ ~cWrapper() {
+ xmlrpc_DECREF(this->valueP);
+ }
+ };
+
+ cWrapper wrapper(cppvalue);
+
+ this->instantiate(wrapper.valueP);
+}
+
+
+
+value_i8::value_i8(xmlrpc_c::value const baseValue) {
+
+ if (baseValue.type() != xmlrpc_c::value::TYPE_I8)
+ throw(error("Not 64 bit integer type. See type() method"));
+ else {
+ this->instantiate(baseValue.cValueP);
+ }
+}
+
+
+
+value_i8::operator xmlrpc_int64() const {
+
+ xmlrpc_int64 retval;
+ env_wrap env;
+
+ xmlrpc_read_i8(&env.env_c, this->cValueP, &retval);
+ throwIfError(env);
+
+ return retval;
+}
+
+
+
+} // namespace
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/xml.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/xml.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/cpp/xml.cpp Mon May 26 12:59:57 2008
@@ -2,9 +2,13 @@
#include "xmlrpc-c/girerr.hpp"
using girerr::error;
+using girerr::throwf;
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/base.hpp"
+#include "env_wrap.hpp"
+
#include "xmlrpc-c/xml.hpp"
using namespace std;
@@ -28,25 +32,23 @@
xmlrpc_value *
cArrayFromParamList(paramList const& paramList) {
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+ env_wrap env;
xmlrpc_value * paramArrayP;
- paramArrayP = xmlrpc_array_new(&env);
- if (!env.fault_occurred) {
+ paramArrayP = xmlrpc_array_new(&env.env_c);
+ if (!env.env_c.fault_occurred) {
for (unsigned int i = 0;
- i < paramList.size() && !env.fault_occurred;
+ i < paramList.size() && !env.env_c.fault_occurred;
++i) {
cValueWrapper const param(paramList[i].cValue());
- xmlrpc_array_append_item(&env, paramArrayP, param.valueP);
+ xmlrpc_array_append_item(&env.env_c, paramArrayP, param.valueP);
}
}
- if (env.fault_occurred) {
+ if (env.env_c.fault_occurred) {
xmlrpc_DECREF(paramArrayP);
- throw(error(env.fault_string));
+ throw(error(env.env_c.fault_string));
}
return paramArrayP;
}
@@ -59,12 +61,15 @@
void
-generateCall(string const& methodName,
- paramList const& paramList,
- string * const callXmlP) {
+generateCall(string const& methodName,
+ paramList const& paramList,
+ xmlrpc_dialect const dialect,
+ string * const callXmlP) {
/*----------------------------------------------------------------------------
Generate the XML for an XML-RPC call, given a method name and parameter
list.
+
+ Use dialect 'dialect' of XML-RPC.
-----------------------------------------------------------------------------*/
class memblockWrapper {
xmlrpc_mem_block * const memblockP;
@@ -78,27 +83,36 @@
};
xmlrpc_mem_block * callXmlMP;
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+ env_wrap env;
- callXmlMP = XMLRPC_MEMBLOCK_NEW(char, &env, 0);
- if (!env.fault_occurred) {
+ callXmlMP = XMLRPC_MEMBLOCK_NEW(char, &env.env_c, 0);
+ if (!env.env_c.fault_occurred) {
memblockWrapper callXmlHolder(callXmlMP);
// Makes callXmlMP get freed at end of scope
xmlrpc_value * const paramArrayP(cArrayFromParamList(paramList));
- xmlrpc_serialize_call(&env, callXmlMP, methodName.c_str(),
- paramArrayP);
+ xmlrpc_serialize_call2(&env.env_c, callXmlMP, methodName.c_str(),
+ paramArrayP, dialect);
*callXmlP = string(XMLRPC_MEMBLOCK_CONTENTS(char, callXmlMP),
XMLRPC_MEMBLOCK_SIZE(char, callXmlMP));
xmlrpc_DECREF(paramArrayP);
}
- if (env.fault_occurred)
- throw(error(env.fault_string));
+ if (env.env_c.fault_occurred)
+ throw(error(env.env_c.fault_string));
+}
+
+
+
+void
+generateCall(string const& methodName,
+ paramList const& paramList,
+ string * const callXmlP) {
+
+ generateCall(methodName, paramList, xmlrpc_dialect_i8, callXmlP);
+
}
@@ -109,27 +123,29 @@
/*----------------------------------------------------------------------------
Parse the XML for an XML-RPC response into an XML-RPC result value.
-----------------------------------------------------------------------------*/
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
+ env_wrap env;
xmlrpc_value * c_resultP;
+ int faultCode;
+ const char * faultString;
- c_resultP =
- xmlrpc_parse_response(&env, responseXml.c_str(), responseXml.size());
+ xmlrpc_parse_response2(&env.env_c, responseXml.c_str(), responseXml.size(),
+ &c_resultP, &faultCode, &faultString);
- /* Unfortunately, xmlrpc_parse_response() does not distinguish between
- unparseable XML and XML that cleanly indicates an RPC failure or
- other failure on the server end. We'll fix that some day, but for
- now, we just assume any failure is an XML-RPC RPC failure.
- */
- if (env.fault_occurred)
- *outcomeP =
- rpcOutcome(fault(env.fault_string,
- static_cast<fault::code_t>(env.fault_code)));
+ if (env.env_c.fault_occurred)
+ throwf("Unable to find XML-RPC response in what server sent back. %s",
+ env.env_c.fault_string);
else {
- *outcomeP = rpcOutcome(value(c_resultP));
- xmlrpc_DECREF(c_resultP);
+ if (faultString) {
+ *outcomeP =
+ rpcOutcome(fault(faultString,
+ static_cast<fault::code_t>(faultCode)));
+ xmlrpc_strfree(faultString);
+ } else {
+ XMLRPC_ASSERT_VALUE_OK(c_resultP);
+ *outcomeP = rpcOutcome(value(c_resultP));
+ xmlrpc_DECREF(c_resultP);
+ }
}
}
@@ -147,7 +163,8 @@
parseResponse(responseXml, &outcome);
if (!outcome.succeeded())
- throw(error("RPC failed. " + outcome.getFault().getDescription()));
+ throwf("RPC response indicates it failed. %s",
+ outcome.getFault().getDescription().c_str());
*resultP = outcome.getResult();
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/cgi.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/cgi.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/cgi.c Mon May 26 12:59:57 2008
@@ -21,6 +21,8 @@
"</methodResponse>\r\n";
+#define TESTDATA_DIR "data"
+#define DIRSEP DIRECTORY_SEPARATOR
void
test_server_cgi(void) {
@@ -36,7 +38,8 @@
"CONTENT_TYPE=text/xml "
"CONTENT_LENGTH=211 "
"./cgitest1 "
- "<sample_add_call.xml",
+ "<"
+ TESTDATA_DIR DIRSEP "sample_add_call.xml",
"r");
if (cgiOutputP == NULL)
@@ -51,6 +54,7 @@
TEST(memcmp(cgiResponse, cgiResponse1, bytesRead) == 0);
}
+ fclose(cgiOutputP);
printf("\n");
printf("CGI tests done.\n");
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/client.c Mon May 26 12:59:57 2008
@@ -4,17 +4,285 @@
#include <errno.h>
#include "xmlrpc_config.h"
+#include "transport_config.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/client.h"
+#include "xmlrpc-c/transport.h"
#include "test.h"
#include "client.h"
+static void
+testGlobalConst(void) {
+
+ xmlrpc_env env;
+ xmlrpc_env_init(&env);
+
+ xmlrpc_client_setup_global_const(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_teardown_global_const();
+
+ xmlrpc_client_setup_global_const(&env);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_setup_global_const(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_teardown_global_const();
+ xmlrpc_client_teardown_global_const();
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testCreateCurlParms(void) {
+
+#if MUST_BUILD_CURL_CLIENT
+
+ xmlrpc_env env;
+ xmlrpc_client * clientP;
+ struct xmlrpc_clientparms clientParms1;
+ struct xmlrpc_curl_xportparms curlTransportParms1;
+
+ xmlrpc_env_init(&env);
+
+ clientParms1.transport = "curl";
+ clientParms1.transportparmsP = &curlTransportParms1;
+
+ curlTransportParms1.network_interface = "eth0";
+ clientParms1.transportparm_size = XMLRPC_CXPSIZE(network_interface);
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparm_size),
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ curlTransportParms1.no_ssl_verifypeer = 1;
+ curlTransportParms1.no_ssl_verifyhost = 1;
+ clientParms1.transportparm_size = XMLRPC_CXPSIZE(no_ssl_verifyhost);
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparm_size),
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ curlTransportParms1.user_agent = "testprog/1.0";
+ clientParms1.transportparm_size = XMLRPC_CXPSIZE(user_agent);
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparm_size),
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ xmlrpc_env_clean(&env);
+#endif /* MUST_BUILD_CURL_CLIENT */
+}
+
+
+
+static void
+testCreateSeparateXport(void) {
+
+#if MUST_BUILD_CURL_CLIENT
+ xmlrpc_env env;
+ xmlrpc_client * clientP;
+ struct xmlrpc_clientparms clientParms1;
+ struct xmlrpc_curl_xportparms curlTransportParms1;
+ struct xmlrpc_client_transport * transportP;
+
+ xmlrpc_env_init(&env);
+
+ xmlrpc_curl_transport_ops.create(
+ &env, 0, "", "", &curlTransportParms1, 0,
+ &transportP);
+
+ TEST_NO_FAULT(&env);
+
+ clientParms1.transport = NULL;
+ clientParms1.transportparmsP = NULL;
+ clientParms1.transportparm_size = 0;
+ clientParms1.transportOpsP = NULL;
+ clientParms1.transportP = NULL;
+
+ xmlrpc_client_create(&env, 0, "", "",
+ &clientParms1, XMLRPC_CPSIZE(transportP),
+ &clientP);
+ TEST_NO_FAULT(&env);
+
+ clientParms1.transport = "curl";
+ clientParms1.transportparmsP = &curlTransportParms1;
+ clientParms1.transportparm_size = 0;
+ clientParms1.transportOpsP = NULL;
+ clientParms1.transportP = NULL;
+
+ xmlrpc_client_create(&env, 0, "", "",
+ &clientParms1, XMLRPC_CPSIZE(transportP),
+ &clientP);
+ TEST_NO_FAULT(&env);
+
+ clientParms1.transportP = transportP;
+ xmlrpc_client_create(&env, 0, "", "",
+ &clientParms1, XMLRPC_CPSIZE(transportP),
+ &clientP);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+ /* Both transportP and transport specified */
+
+ clientParms1.transport = NULL;
+ clientParms1.transportparmsP = NULL;
+ clientParms1.transportparm_size = 0;
+ clientParms1.transportOpsP = &xmlrpc_curl_transport_ops;
+ clientParms1.transportP = transportP;
+
+ xmlrpc_client_create(&env, 0, "", "",
+ &clientParms1, XMLRPC_CPSIZE(transportOpsP),
+ &clientP);
+
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+ /* transportOpsP but no transportP */
+
+ xmlrpc_client_create(&env, 0, "", "",
+ &clientParms1, XMLRPC_CPSIZE(transportP),
+ &clientP);
+
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_curl_transport_ops.destroy(transportP);
+
+ xmlrpc_env_clean(&env);
+
+#endif /* MUST_BUILD_CURL_CLIENT */
+}
+
+
+
+static void
+testCreateDestroy(void) {
+
+ xmlrpc_env env;
+ xmlrpc_client * clientP;
+ struct xmlrpc_clientparms clientParms1;
+ struct xmlrpc_curl_xportparms curlTransportParms1;
+ int interrupt;
+
+ xmlrpc_env_init(&env);
+
+ xmlrpc_client_create(&env, 0, "testprog", "1.0", NULL, 0, &clientP);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+ /* Didn't set up global const */
+
+ xmlrpc_client_setup_global_const(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_create(&env, 0, "testprog", "1.0", NULL, 0, &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ xmlrpc_client_create(&env, 0, "testprog", "1.0", &clientParms1, 0,
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ clientParms1.transport = "curl";
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transport), &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ clientParms1.transportparmsP = NULL;
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparmsP),
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ clientParms1.transportOpsP = NULL;
+ clientParms1.transportP = NULL;
+ clientParms1.dialect = xmlrpc_dialect_apache;
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(dialect),
+ &clientP);
+ TEST_NO_FAULT(&env);
+ xmlrpc_client_destroy(clientP);
+
+ clientParms1.transportparmsP = &curlTransportParms1;
+
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparmsP),
+ &clientP);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ clientParms1.transportparm_size = 0;
+ xmlrpc_client_create(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparm_size),
+ &clientP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_set_interrupt(clientP, &interrupt);
+ xmlrpc_client_set_interrupt(clientP, NULL);
+
+ xmlrpc_client_destroy(clientP);
+
+ testCreateCurlParms();
+
+ testCreateSeparateXport();
+
+ xmlrpc_client_teardown_global_const();
+
+ xmlrpc_env_clean(&env);
+}
+
+
static void
-test_init_cleanup(void) {
+testSynchCall(void) {
+
+ xmlrpc_env env;
+ xmlrpc_client * clientP;
+ xmlrpc_value * resultP;
+ xmlrpc_value * emptyArrayP;
+ xmlrpc_server_info * noSuchServerInfoP;
+
+ xmlrpc_env_init(&env);
+
+ emptyArrayP = xmlrpc_array_new(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_setup_global_const(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_create(&env, 0, "testprog", "1.0", NULL, 0, &clientP);
+ TEST_NO_FAULT(&env);
+
+ noSuchServerInfoP = xmlrpc_server_info_new(&env, "nosuchserver");
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_client_call2(&env, clientP, noSuchServerInfoP, "nosuchmethod",
+ emptyArrayP, &resultP);
+ TEST_FAULT(&env, XMLRPC_NETWORK_ERROR); /* No such server */
+
+ xmlrpc_client_call2f(&env, clientP, "nosuchserver", "nosuchmethod",
+ &resultP, "(i)", 7);
+ TEST_FAULT(&env, XMLRPC_NETWORK_ERROR); /* No such server */
+
+ xmlrpc_server_info_free(noSuchServerInfoP);
+
+ xmlrpc_client_destroy(clientP);
+
+ xmlrpc_DECREF(emptyArrayP);
+
+ xmlrpc_client_teardown_global_const();
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testInitCleanup(void) {
xmlrpc_env env;
struct xmlrpc_clientparms clientParms1;
@@ -42,15 +310,13 @@
TEST_NO_FAULT(&env);
xmlrpc_client_cleanup();
- clientParms1.transportparmsP = (struct xmlrpc_xportparms *)
- &curlTransportParms1;
- {
- xmlrpc_env env2;
- xmlrpc_env_init(&env2);
- xmlrpc_client_init2(&env2, 0, "testprog", "1.0",
- &clientParms1, XMLRPC_CPSIZE(transportparmsP));
- TEST_FAULT(&env2, XMLRPC_INTERNAL_ERROR);
- }
+ clientParms1.transportparmsP = &curlTransportParms1;
+
+ /* Fails because we didn't include transportparm_size: */
+ xmlrpc_client_init2(&env, 0, "testprog", "1.0",
+ &clientParms1, XMLRPC_CPSIZE(transportparmsP));
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
clientParms1.transportparm_size = 0;
xmlrpc_client_init2(&env, 0, "testprog", "1.0",
&clientParms1, XMLRPC_CPSIZE(transportparm_size));
@@ -82,6 +348,69 @@
xmlrpc_client_init(0, "testprog", "1.0");
TEST_NO_FAULT(&env);
xmlrpc_client_cleanup();
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testServerInfo(void) {
+
+ xmlrpc_env env;
+ xmlrpc_server_info * serverInfoP;
+ xmlrpc_server_info * serverInfo2P;
+
+ printf(" Running serverInfo tests...\n");
+
+ xmlrpc_env_init(&env);
+
+ serverInfoP = xmlrpc_server_info_new(&env, "testurl");
+ TEST_NO_FAULT(&env);
+
+ serverInfo2P = xmlrpc_server_info_copy(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_free(serverInfo2P);
+
+ /* Fails because we haven't set user/password yet: */
+ xmlrpc_server_info_allow_auth_basic(&env, serverInfoP);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_server_info_set_basic_auth(&env, serverInfoP,
+ "username", "password");
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_set_user(&env, serverInfoP, "username", "password");
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_allow_auth_basic(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_disallow_auth_basic(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_allow_auth_digest(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_disallow_auth_digest(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_allow_auth_negotiate(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_disallow_auth_negotiate(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_allow_auth_ntlm(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_disallow_auth_ntlm(&env, serverInfoP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_info_free(serverInfoP);
+
+ xmlrpc_env_clean(&env);
}
@@ -91,7 +420,11 @@
printf("Running client tests.");
- test_init_cleanup();
+ testGlobalConst();
+ testCreateDestroy();
+ testInitCleanup();
+ testServerInfo();
+ testSynchCall();
printf("\n");
printf("Client tests done.\n");
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/parse_xml.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/parse_xml.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/parse_xml.c Mon May 26 12:59:57 2008
@@ -3,6 +3,8 @@
#include "xmlrpc_config.h"
+#include "girstring.h"
+#include "casprintf.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/xmlparser.h"
@@ -22,24 +24,24 @@
xmlrpc_env_init(&env);
/* Parse a moderately complex XML document. */
- elem = xml_parse(&env, expat_data, strlen(expat_data));
+ xml_parse(&env, expat_data, strlen(expat_data), &elem);
TEST_NO_FAULT(&env);
TEST(elem != NULL);
/* Verify our results. */
- TEST(strcmp(xml_element_name(elem), "value") == 0);
+ TEST(streq(xml_element_name(elem), "value"));
TEST(xml_element_children_size(elem) == 1);
array = xml_element_children(elem)[0];
- TEST(strcmp(xml_element_name(array), "array") == 0);
+ TEST(streq(xml_element_name(array), "array"));
TEST(xml_element_children_size(array) == 1);
data = xml_element_children(array)[0];
- TEST(strcmp(xml_element_name(data), "data") == 0);
+ TEST(streq(xml_element_name(data), "data"));
TEST(xml_element_children_size(data) > 1);
value1 = xml_element_children(data)[0];
- TEST(strcmp(xml_element_name(value1), "value") == 0);
+ TEST(streq(xml_element_name(value1), "value"));
TEST(xml_element_children_size(value1) == 1);
i4 = xml_element_children(value1)[0];
- TEST(strcmp(xml_element_name(i4), "i4") == 0);
+ TEST(streq(xml_element_name(i4), "i4"));
TEST(xml_element_children_size(i4) == 0);
cdata = xml_element_cdata(i4);
size = xml_element_cdata_size(i4);
@@ -49,11 +51,9 @@
/* Test cleanup code (w/memprof). */
xml_element_free(elem);
- /* Try to parse broken XML. We want to know that a proper error occurs,
- ** AND that we don't leak any memory (w/memprof). */
- elem = xml_parse(&env, expat_error_data, strlen(expat_error_data));
+ /* Test broken XML */
+ xml_parse(&env, expat_error_data, strlen(expat_error_data), &elem);
TEST(env.fault_occurred);
- TEST(elem == NULL);
xmlrpc_env_clean(&env);
}
@@ -61,180 +61,444 @@
static void
-test_parse_xml_value(void) {
+testParseNumberValue(void) {
- xmlrpc_env env, env2;
- xmlrpc_value *s, *sval;
- xmlrpc_int32 int_max, int_min, int_one;
- xmlrpc_bool bool_false, bool_true;
- char *str_hello, *str_untagged, *datetime;
- unsigned char *b64_data;
- size_t b64_len;
- double negone, zero, one;
- int size, sval_int;
- const char **bad_value;
+char const xmldata[] =
+ XML_PROLOGUE
+ "<methodCall>\r\n"
+ "<methodName>test</methodName>\r\n"
+ "<params>\r\n"
+ "<param><value><int>2147483647</int></value></param>\r\n" \
+ "<param><value><int>-2147483648</int></value></param>\r\n" \
+ "<param><value><i1>10</i1></value></param>\r\n"
+ "<param><value><i2>10</i2></value></param>\r\n"
+ "<param><value><i4>10</i4></value></param>\r\n"
+ "<param><value><i8>10</i8></value></param>\r\n"
+ "<param><value><ex.i8>10</ex.i8></value></param>\r\n"
+ "<param><value><double>10</double></value></param>\r\n"
+ "<param><value><double>10.1</double></value></param>\r\n"
+ "<param><value><double>-10.1</double></value></param>\r\n"
+ "<param><value><double>+10.1</double></value></param>\r\n"
+ "<param><value><double>0</double></value></param>\r\n"
+ "<param><value><double>.01</double></value></param>\r\n"
+ "<param><value><double>5.</double></value></param>\r\n"
+ "<param><value><double>5.3E6</double></value></param>\r\n"
+ "<param><value><double> 1</double></value></param>\r\n"
+ "</params>\r\n"
+ "</methodCall>\r\n";
+ xmlrpc_env env;
+ xmlrpc_value * paramArrayP;
+ const char * methodName;
+ int arraySize;
+ xmlrpc_int int_max, int_min;
+ xmlrpc_int32 i_i1, i_i2, i_i4;
+ xmlrpc_int64 i_i8, i_ex_i8;
+ double d1, d2, d3, d4, d5, d6, d7, d8, d9;
+
xmlrpc_env_init(&env);
+
+ xmlrpc_parse_call(&env, xmldata, strlen(xmldata),
+ &methodName, ¶mArrayP);
+ TEST_NO_FAULT(&env);
+
+ arraySize = xmlrpc_array_size(&env, paramArrayP);
+ TEST_NO_FAULT(&env);
+
+ TEST(arraySize == 16);
+
+ xmlrpc_decompose_value(
+ &env, paramArrayP, "(iiiiiIIddddddddd)",
+ &int_max, &int_min, &i_i1, &i_i2, &i_i4, &i_i8, &i_ex_i8,
+ &d1, &d2, &d3, &d4, &d5, &d6, &d7, &d8, &d9);
+
+ TEST_NO_FAULT(&env);
+
+ TEST(int_max == INT_MAX);
+ TEST(int_min == INT_MIN);
+ TEST(i_i1 == 10);
+ TEST(i_i2 == 10);
+ TEST(i_i4 == 10);
+ TEST(i_i8 == 10);
+ TEST(i_ex_i8 == 10);
+ TESTFLOATEQUAL(d1, 10.0);
+ TESTFLOATEQUAL(d2, 10.1);
+ TESTFLOATEQUAL(d3, -10.1);
+ TESTFLOATEQUAL(d4, +10.1);
+ TESTFLOATEQUAL(d5, 0.0);
+ TESTFLOATEQUAL(d6, 0.01);
+ TESTFLOATEQUAL(d7, 5.0);
+ TESTFLOATEQUAL(d8, 5.3E6);
+ TESTFLOATEQUAL(d9, 1.0);
+
+ xmlrpc_DECREF(paramArrayP);
+ strfree(methodName);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testParseMiscSimpleValue(void) {
+
+char const xmldata[] =
+ XML_PROLOGUE
+ "<methodCall>\r\n"
+ "<methodName>test</methodName>\r\n"
+ "<params>\r\n"
+ "<param><value><string>hello</string></value></param>\r\n"
+ "<param><value><boolean>0</boolean></value></param>\r\n"
+ "<param><value><boolean>1</boolean></value></param>\r\n"
+ "<param><value><dateTime.iso8601>19980717T14:08:55</dateTime.iso8601>"
+ "</value></param>\r\n"
+ "<param><value><base64>YmFzZTY0IGRhdGE=</base64></value></param>\r\n"
+ "<param><value><nil/></value></param>\r\n"
+ "<param><value><ex.nil/></value></param>\r\n"
+ "</params>\r\n"
+ "</methodCall>\r\n";
- {
- xmlrpc_value * valueP;
+ xmlrpc_env env;
+ xmlrpc_value * paramArrayP;
+ const char * methodName;
+ int arraySize;
+ const char * str_hello;
+ xmlrpc_bool b_false, b_true;
+ const char * datetime;
+ unsigned char * b64_data;
+ size_t b64_len;
- /* Parse a correctly-formed response. */
- valueP = xmlrpc_parse_response(&env, correct_value,
- strlen(correct_value));
- TEST_NO_FAULT(&env);
- TEST(valueP != NULL);
-
- /* Analyze it and make sure it contains the correct values. */
- xmlrpc_decompose_value(
- &env, valueP, "((iibbs68())idddSs)",
- &int_max, &int_min,
- &bool_false, &bool_true, &str_hello,
- &b64_data, &b64_len, &datetime,
- &int_one, &negone, &zero, &one, &s, &str_untagged);
+ xmlrpc_env_init(&env);
+
+ xmlrpc_parse_call(&env, xmldata, strlen(xmldata),
+ &methodName, ¶mArrayP);
+ TEST_NO_FAULT(&env);
+
+ arraySize = xmlrpc_array_size(&env, paramArrayP);
+ TEST_NO_FAULT(&env);
+
+ TEST(arraySize == 7);
+
+ xmlrpc_decompose_value(
+ &env, paramArrayP, "(sbb86nn)",
+ &str_hello, &b_false, &b_true, &datetime, &b64_data, &b64_len);
+
+ TEST_NO_FAULT(&env);
+
+ TEST(streq(str_hello, "hello"));
+ TEST(!b_false);
+ TEST(b_true);
+ TEST(streq(datetime, "19980717T14:08:55"));
+ TEST(b64_len == 11);
+ TEST(memcmp(b64_data, "base64 data", b64_len) == 0);
+
+ free(b64_data);
+ strfree(str_hello);
+ strfree(datetime);
+ xmlrpc_DECREF(paramArrayP);
+ strfree(methodName);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+validateParseResponseResult(xmlrpc_value * const valueP) {
+
+ xmlrpc_env env;
+
+ xmlrpc_value * s;
+ xmlrpc_int32 int_max;
+ xmlrpc_int32 int_min;
+ xmlrpc_int32 int_one;
+ xmlrpc_bool bool_false;
+ xmlrpc_bool bool_true;
+ char * str_hello;
+ char * str_untagged;
+ char * datetime;
+ unsigned char * b64_data;
+ size_t b64_len;
+ double negone;
+ double zero;
+ double one;
+
+ xmlrpc_env_init(&env);
+
+ xmlrpc_decompose_value(
+ &env, valueP, "((iibbs68())idddSs)",
+ &int_max, &int_min,
+ &bool_false, &bool_true, &str_hello,
+ &b64_data, &b64_len, &datetime,
+ &int_one, &negone, &zero, &one, &s, &str_untagged);
- xmlrpc_DECREF(valueP);
- }
TEST_NO_FAULT(&env);
TEST(int_max == INT_MAX);
TEST(int_min == INT_MIN);
TEST(!bool_false);
TEST(bool_true);
TEST(strlen(str_hello) == strlen("Hello, world! <&>"));
- TEST(strcmp(str_hello, "Hello, world! <&>") == 0);
+ TEST(streq(str_hello, "Hello, world! <&>"));
TEST(b64_len == 11);
TEST(memcmp(b64_data, "base64 data", b64_len) == 0);
- TEST(strcmp(datetime, "19980717T14:08:55") == 0);
+ TEST(streq(datetime, "19980717T14:08:55"));
TEST(int_one == 1);
TEST(negone == -1.0);
TEST(zero == 0.0);
TEST(one == 1.0);
- TEST(strcmp(str_untagged, "Untagged string") == 0);
+ TEST(streq(str_untagged, "Untagged string"));
free(str_hello);
free(b64_data);
free(datetime);
free(str_untagged);
-
- /* Analyze the contents of our struct. */
- TEST(s != NULL);
- size = xmlrpc_struct_size(&env, s);
- TEST_NO_FAULT(&env);
- TEST(size == 2);
- sval = xmlrpc_struct_get_value(&env, s, "ten <&>");
- TEST_NO_FAULT(&env);
- xmlrpc_decompose_value(&env, sval, "i", &sval_int);
- TEST_NO_FAULT(&env);
- TEST(sval_int == 10);
- sval = xmlrpc_struct_get_value(&env, s, "twenty");
+
+ {
+ /* Analyze the contents of our struct. */
+
+ xmlrpc_value * sval;
+ int size, sval_int;
+
+ TEST(s != NULL);
+ size = xmlrpc_struct_size(&env, s);
+ TEST_NO_FAULT(&env);
+ TEST(size == 2);
+ sval = xmlrpc_struct_get_value(&env, s, "ten <&>");
+ TEST_NO_FAULT(&env);
+ xmlrpc_decompose_value(&env, sval, "i", &sval_int);
+ TEST_NO_FAULT(&env);
+ TEST(sval_int == 10);
+ sval = xmlrpc_struct_get_value(&env, s, "twenty");
+ TEST_NO_FAULT(&env);
+ xmlrpc_decompose_value(&env, sval, "i", &sval_int);
+ TEST_NO_FAULT(&env);
+ TEST(sval_int == 20);
+ xmlrpc_DECREF(s);
+ }
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testParseGoodResponse(void) {
+
+ xmlrpc_env env;
+ xmlrpc_value * valueP;
+ int faultCode;
+ const char * faultString;
+
+ xmlrpc_env_init(&env);
+
+ xmlrpc_parse_response2(&env, good_response_xml, strlen(good_response_xml),
+ &valueP, &faultCode, &faultString);
+
TEST_NO_FAULT(&env);
- xmlrpc_decompose_value(&env, sval, "i", &sval_int);
+ TEST(faultString == NULL);
+
+ validateParseResponseResult(valueP);
+
+ xmlrpc_DECREF(valueP);
+
+ /* Try it again with old interface */
+
+ valueP = xmlrpc_parse_response(&env,
+ good_response_xml,
+ strlen(good_response_xml));
TEST_NO_FAULT(&env);
- TEST(sval_int == 20);
- xmlrpc_DECREF(s);
+ TEST(valueP != NULL);
+
+ validateParseResponseResult(valueP);
+
+ xmlrpc_DECREF(valueP);
+
+ xmlrpc_env_clean(&env);
+
+}
+
+
+
+static void
+testParseBadResponseXml(void) {
+/*----------------------------------------------------------------------------
+ Test parsing of data that is supposed to be a response, but in not
+ even valid XML.
+-----------------------------------------------------------------------------*/
+ xmlrpc_env env;
+ xmlrpc_value * valueP;
+ int faultCode;
+ const char * faultString;
+
+ xmlrpc_env_init(&env);
+
+ xmlrpc_parse_response2(&env,
+ unparseable_value, strlen(unparseable_value),
+ &valueP, &faultCode, &faultString);
+
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
+ xmlrpc_env_clean(&env);
+
+ xmlrpc_env_init(&env);
+
+ /* And again with the old interface */
+ valueP = xmlrpc_parse_response(&env, unparseable_value,
+ strlen(unparseable_value));
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
+ xmlrpc_env_clean(&env);
+ TEST(valueP == NULL);
+}
+
+
+
+static void
+testParseBadResponseXmlRpc(void) {
+/*----------------------------------------------------------------------------
+ Test parsing of data that is supposed to be a response, and is valid
+ XML, but is not valid XML-RPC.
+-----------------------------------------------------------------------------*/
+ unsigned int i;
+
+ /* For this test, we test up to but not including the <value> in a
+ successful RPC response.
+ */
+
+ /* Next, check for bogus responses. These are all well-formed XML, but
+ ** they aren't legal XML-RPC. */
+ for (i = 15; bad_responses[i] != NULL; ++i) {
+ const char * const bad_resp = bad_responses[i];
+ xmlrpc_env env;
+ xmlrpc_value * v;
+ xml_element *elem;
+
+ xmlrpc_env_init(&env);
- /* Test our error-checking code. This is exposed to potentially-malicious
- ** network data, so we need to handle evil data gracefully, without
- ** barfing or leaking memory. (w/memprof) */
+ /* First, check to make sure that our test case is well-formed XML.
+ ** (It's easy to make mistakes when writing the test cases!) */
+ xml_parse(&env, bad_resp, strlen(bad_resp), &elem);
+ TEST_NO_FAULT(&env);
+ xml_element_free(elem);
- {
- xmlrpc_value * valueP;
-
- /* First, test some poorly-formed XML data. */
- xmlrpc_env_init(&env2);
- valueP = xmlrpc_parse_response(&env2, unparseable_value,
- strlen(unparseable_value));
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
- TEST(valueP == NULL);
- xmlrpc_env_clean(&env2);
+ /* Now, make sure the higher-level routine barfs appropriately. */
+ v = xmlrpc_parse_response(&env, bad_resp, strlen(bad_resp));
+ TEST(env.fault_occurred);
+ TEST(env.fault_code != 0); /* We use 0 as a code in our bad faults. */
+ TEST(v == NULL);
+ xmlrpc_env_clean(&env);
}
- /* Next, check for bogus values. These are all well-formed XML, but
- ** they aren't legal XML-RPC. */
- for (bad_value = bad_values; *bad_value != NULL; bad_value++) {
+}
+
+
+
+static void
+testParseBadResult(void) {
+/*----------------------------------------------------------------------------
+ Test parsing of data that is supposed to be a response, but is not
+ valid. It looks like a valid success response, but the result value
+ is not valid XML-RPC.
+-----------------------------------------------------------------------------*/
+ unsigned int i;
+
+ for (i = 0; bad_values[i] != NULL; ++i) {
+ const char * const bad_resp = bad_values[i];
+ xmlrpc_env env;
xmlrpc_value * valueP;
xml_element *elem;
+ int faultCode;
+ const char * faultString;
+ xmlrpc_env_init(&env);
+
/* First, check to make sure that our test case is well-formed XML.
** (It's easy to make mistakes when writing the test cases!) */
- elem = xml_parse(&env, *bad_value, strlen(*bad_value));
+ xml_parse(&env, bad_resp, strlen(bad_resp), &elem);
TEST_NO_FAULT(&env);
xml_element_free(elem);
/* Now, make sure the higher-level routine barfs appropriately. */
- xmlrpc_env_init(&env2);
- valueP = xmlrpc_parse_response(&env2, *bad_value, strlen(*bad_value));
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
+
+ xmlrpc_parse_response2(&env, bad_resp, strlen(bad_resp),
+ &valueP, &faultCode, &faultString);
+
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
+ xmlrpc_env_clean(&env);
+
+ xmlrpc_env_init(&env);
+
+ /* And again with the old interface */
+
+ valueP = xmlrpc_parse_response(&env, bad_resp, strlen(bad_resp));
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
TEST(valueP == NULL);
- xmlrpc_env_clean(&env2);
+ xmlrpc_env_clean(&env);
}
-
- xmlrpc_env_clean(&env);
}
-static void test_parse_xml_response (void)
-{
- xmlrpc_env env, env2;
- int i1;
- const char **bad_resp;
+
+
+static void
+testParseBadResponse(void) {
+/*----------------------------------------------------------------------------
+ Test parsing of data that is supposed to be a response, but is not
+ valid. Either not valid XML or not valid XML-RPC.
+-----------------------------------------------------------------------------*/
+ testParseBadResponseXml();
+
+ testParseBadResponseXmlRpc();
+
+ testParseBadResult();
+}
+
+
+
+static void
+testParseFaultResponse(void) {
+/*----------------------------------------------------------------------------
+ Test parsing of a valid response that indicates the RPC failed.
+-----------------------------------------------------------------------------*/
+ xmlrpc_env env;
xmlrpc_env_init(&env);
{
- xmlrpc_value * v;
- /* Parse a valid response. */
- v = xmlrpc_parse_response(&env, serialized_response,
- strlen(serialized_response));
+ xmlrpc_value * resultP;
+ int faultCode;
+ const char * faultString;
+
+ xmlrpc_parse_response2(&env,
+ serialized_fault, strlen(serialized_fault),
+ &resultP, &faultCode, &faultString);
+
TEST_NO_FAULT(&env);
- TEST(v != NULL);
- xmlrpc_decompose_value(&env, v, "i", &i1);
- xmlrpc_DECREF(v);
+ TEST(faultString != NULL);
+ TEST(faultCode == 6);
+ TEST(streq(faultString, "A fault occurred"));
+ strfree(faultString);
}
- TEST_NO_FAULT(&env);
- TEST(i1 == 30);
-
+ /* Now with the old interface */
{
- xmlrpc_value * v;
+ xmlrpc_value * valueP;
xmlrpc_env fault;
/* Parse a valid fault. */
xmlrpc_env_init(&fault);
- v = xmlrpc_parse_response(&fault, serialized_fault,
- strlen(serialized_fault));
+ valueP = xmlrpc_parse_response(&fault, serialized_fault,
+ strlen(serialized_fault));
TEST(fault.fault_occurred);
TEST(fault.fault_code == 6);
- TEST(strcmp(fault.fault_string, "A fault occurred") == 0);
+ TEST(streq(fault.fault_string, "A fault occurred"));
xmlrpc_env_clean(&fault);
}
- /* We don't need to test our handling of poorly formatted XML here,
- ** because we already did that in test_parse_xml_value. */
- /* Next, check for bogus responses. These are all well-formed XML, but
- ** they aren't legal XML-RPC. */
- for (bad_resp = bad_responses; *bad_resp != NULL; bad_resp++) {
- xmlrpc_value * v;
- xml_element *elem;
-
- /* First, check to make sure that our test case is well-formed XML.
- ** (It's easy to make mistakes when writing the test cases!) */
- elem = xml_parse(&env, *bad_resp, strlen(*bad_resp));
- TEST_NO_FAULT(&env);
- xml_element_free(elem);
-
- /* Now, make sure the higher-level routine barfs appropriately. */
- xmlrpc_env_init(&env2);
- v = xmlrpc_parse_response(&env2, *bad_resp, strlen(*bad_resp));
- TEST(env2.fault_occurred);
- TEST(env2.fault_code != 0); /* We use 0 as a code in our bad faults. */
- TEST(v == NULL);
- xmlrpc_env_clean(&env2);
- }
-
xmlrpc_env_clean(&env);
}
-static void test_parse_xml_call (void)
-{
- xmlrpc_env env, env2;
+
+
+static void
+test_parse_xml_call(void) {
+
+ xmlrpc_env env;
const char *method_name;
xmlrpc_value *params;
int i1, i2;
@@ -251,37 +515,33 @@
xmlrpc_decompose_value(&env, params, "(ii)", &i1, &i2);
xmlrpc_DECREF(params);
TEST_NO_FAULT(&env);
- TEST(strcmp(method_name, "gloom&doom") == 0);
+ TEST(streq(method_name, "gloom&doom"));
TEST(i1 == 10 && i2 == 20);
strfree(method_name);
/* Test some poorly-formed XML data. */
- xmlrpc_env_init(&env2);
- xmlrpc_parse_call(&env2, unparseable_value, strlen(unparseable_value),
+ xmlrpc_parse_call(&env, unparseable_value, strlen(unparseable_value),
&method_name, ¶ms);
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
TEST(method_name == NULL && params == NULL);
- xmlrpc_env_clean(&env2);
/* Next, check for bogus values. These are all well-formed XML, but
- ** they aren't legal XML-RPC. */
- for (bad_call = bad_calls; *bad_call != NULL; bad_call++) {
+ they aren't legal XML-RPC.
+ */
+ for (bad_call = bad_calls; *bad_call != NULL; ++bad_call) {
/* First, check to make sure that our test case is well-formed XML.
** (It's easy to make mistakes when writing the test cases!) */
- elem = xml_parse(&env, *bad_call, strlen(*bad_call));
+ xml_parse(&env, *bad_call, strlen(*bad_call), &elem);
TEST_NO_FAULT(&env);
xml_element_free(elem);
/* Now, make sure the higher-level routine barfs appropriately. */
- xmlrpc_env_init(&env2);
- xmlrpc_parse_call(&env2, *bad_call, strlen(*bad_call),
+ xmlrpc_parse_call(&env, *bad_call, strlen(*bad_call),
&method_name, ¶ms);
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
TEST(method_name == NULL && params == NULL);
- xmlrpc_env_clean(&env2);
}
-
xmlrpc_env_clean(&env);
}
@@ -290,8 +550,14 @@
void
test_parse_xml(void) {
+ printf("Running XML parsing tests.\n");
test_expat();
- test_parse_xml_value();
- test_parse_xml_response();
+ testParseNumberValue();
+ testParseMiscSimpleValue();
+ testParseGoodResponse();
+ testParseFaultResponse();
+ testParseBadResponse();
test_parse_xml_call();
+ printf("\n");
+ printf("XML parsing tests done.\n");
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/serialize.c Mon May 26 12:59:57 2008
@@ -8,8 +8,10 @@
#include "test.h"
#include "xml_data.h"
-#include "serialize.h"
+#include "girstring.h"
+#include "serialize_value.h"
+#include "serialize.h"
static void
@@ -60,57 +62,41 @@
static void
-test_serialize_double(void) {
+test_serialize_methodResponse(void) {
+
+ /* Serialize a methodResponse. */
- /* Test serialize of a double. */
+ char const serialized_response[] =
+ XML_PROLOGUE
+ "<methodResponse>\r\n"
+ "<params>\r\n"
+ "<param><value><i4>30</i4></value></param>\r\n"
+ "</params>\r\n"
+ "</methodResponse>\r\n";
xmlrpc_env env;
xmlrpc_value * v;
xmlrpc_mem_block *output;
- char * result;
- /* serialized result, as asciiz string */
- size_t resultLength;
- /* Length in characters of the serialized result */
- float serializedValue;
- char nextChar;
- int itemsMatched;
+ size_t size;
xmlrpc_env_init(&env);
- /* Build a double to serialize */
- v = xmlrpc_build_value(&env, "d", 3.14159);
- TEST_NO_FAULT(&env);
-
- /* Serialize the value. */
output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
TEST_NO_FAULT(&env);
- xmlrpc_serialize_value(&env, output, v);
+ v = xmlrpc_build_value(&env, "i", (xmlrpc_int32) 30);
+ TEST_NO_FAULT(&env);
+ xmlrpc_serialize_response(&env, output, v);
TEST_NO_FAULT(&env);
- /* Make sure we serialized the correct value. Note that because
- doubles aren't precise, this might serialize as 3.1415899999
- or something like that. So we check it arithmetically.
- */
- resultLength = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
- result = malloc(resultLength + 1);
-
- memcpy(result, XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
- resultLength);
- result[resultLength] = '\0';
-
- itemsMatched = sscanf(result,
- "<value><double>%f</double></value>\r\n%c",
- &serializedValue, &nextChar);
-
- TEST(itemsMatched == 1);
- TEST(serializedValue - 3.14159 < .000001);
- /* We'd like to test more precision, but sscanf doesn't do doubles */
+ /* Make sure we serialized the correct value. */
+ size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
+ TEST(size == strlen(serialized_response));
+ TEST(memcmp(XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
+ serialized_response, size) == 0);
- free(result);
-
- /* Clean up our value. */
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
+ /* Clean up our methodResponse. */
xmlrpc_DECREF(v);
+ XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
xmlrpc_env_clean(&env);
}
@@ -118,16 +104,10 @@
static void
-test_serialize_struct(void) {
+test_serialize_methodCall(void) {
- /* Serialize a simple struct. */
+ /* Serialize a methodCall. */
- char const serialized_struct[] =
- "<value><struct>\r\n" \
- "<member><name><&></name>\r\n" \
- "<value><i4>10</i4></value></member>\r\n" \
- "</struct></value>";
-
xmlrpc_env env;
xmlrpc_value * v;
xmlrpc_mem_block *output;
@@ -135,22 +115,22 @@
xmlrpc_env_init(&env);
- v = xmlrpc_build_value(&env, "{s:i}", "<&>", (xmlrpc_int32) 10);
- TEST_NO_FAULT(&env);
output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
TEST_NO_FAULT(&env);
- xmlrpc_serialize_value(&env, output, v);
+ v = xmlrpc_build_value(&env, "(ii)", (xmlrpc_int32) 10, (xmlrpc_int32) 20);
+ TEST_NO_FAULT(&env);
+ xmlrpc_serialize_call(&env, output, "gloom&doom", v);
TEST_NO_FAULT(&env);
/* Make sure we serialized the correct value. */
size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
- TEST(size == strlen(serialized_struct));
+ TEST(size == strlen(serialized_call));
TEST(memcmp(XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
- serialized_struct, size) == 0);
-
- /* Clean up our struct. */
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
+ serialized_call, size) == 0);
+
+ /* Clean up our methodCall. */
xmlrpc_DECREF(v);
+ XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
xmlrpc_env_clean(&env);
}
@@ -158,12 +138,11 @@
static void
-test_serialize_methodResponse(void) {
-
- /* Serialize a methodResponse. */
+test_serialize_fault(void) {
+ /* Serialize a fault. */
xmlrpc_env env;
- xmlrpc_value * v;
+ xmlrpc_env fault;
xmlrpc_mem_block *output;
size_t size;
@@ -171,19 +150,19 @@
output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
TEST_NO_FAULT(&env);
- v = xmlrpc_build_value(&env, "i", (xmlrpc_int32) 30);
- TEST_NO_FAULT(&env);
- xmlrpc_serialize_response(&env, output, v);
+ xmlrpc_env_init(&fault);
+ xmlrpc_env_set_fault(&fault, 6, "A fault occurred");
+ xmlrpc_serialize_fault(&env, output, &fault);
TEST_NO_FAULT(&env);
/* Make sure we serialized the correct value. */
size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
- TEST(size == strlen(serialized_response));
+ TEST(size == strlen(serialized_fault));
TEST(memcmp(XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
- serialized_response, size) == 0);
+ serialized_fault, size) == 0);
- /* Clean up our methodResponse. */
- xmlrpc_DECREF(v);
+ /* Clean up our fault. */
+ xmlrpc_env_clean(&fault);
XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
xmlrpc_env_clean(&env);
@@ -192,33 +171,37 @@
static void
-test_serialize_methodCall(void) {
+test_serialize_apache_value(void) {
- /* Serialize a methodCall. */
+ char const serializedData[] =
+ "<value><array><data>\r\n"
+ "<value><i4>7</i4></value>\r\n"
+ "<value><ex.i8>8</ex.i8></value>\r\n"
+ "<value><ex.nil/></value>\r\n"
+ "</data></array></value>";
xmlrpc_env env;
- xmlrpc_value * v;
- xmlrpc_mem_block *output;
+ xmlrpc_value * valueP;
+ xmlrpc_mem_block * outputP;
size_t size;
-
+
xmlrpc_env_init(&env);
- output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
+ valueP = xmlrpc_build_value(&env, "(iIn)", 7, (xmlrpc_int64)8);
TEST_NO_FAULT(&env);
- v = xmlrpc_build_value(&env, "(ii)", (xmlrpc_int32) 10, (xmlrpc_int32) 20);
+
+ outputP = XMLRPC_MEMBLOCK_NEW(char, &env, 0);
TEST_NO_FAULT(&env);
- xmlrpc_serialize_call(&env, output, "gloom&doom", v);
+ xmlrpc_serialize_value2(&env, outputP, valueP, xmlrpc_dialect_apache);
TEST_NO_FAULT(&env);
- /* Make sure we serialized the correct value. */
- size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
- TEST(size == strlen(serialized_call));
- TEST(memcmp(XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
- serialized_call, size) == 0);
+ size = XMLRPC_MEMBLOCK_SIZE(char, outputP);
- /* Clean up our methodCall. */
- xmlrpc_DECREF(v);
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
+ TEST(size == strlen(serializedData));
+ TEST(memeq(XMLRPC_MEMBLOCK_CONTENTS(char, outputP), serializedData, size));
+
+ XMLRPC_MEMBLOCK_FREE(char, outputP);
+ xmlrpc_DECREF(valueP);
xmlrpc_env_clean(&env);
}
@@ -226,49 +209,107 @@
static void
-test_serialize_fault(void) {
- /* Serialize a fault. */
+test_serialize_apache_params(void) {
+
+ char const serializedData[] =
+ "<params>\r\n"
+ "<param><value><i4>7</i4></value></param>\r\n"
+ "<param><value><ex.i8>8</ex.i8></value></param>\r\n"
+ "</params>\r\n";
xmlrpc_env env;
- xmlrpc_env fault;
- xmlrpc_mem_block *output;
+ xmlrpc_value * paramArrayP;
+ xmlrpc_mem_block * outputP;
size_t size;
+
+ xmlrpc_env_init(&env);
+
+ paramArrayP = xmlrpc_build_value(&env, "(iI)", 7, (xmlrpc_int64)8);
+ TEST_NO_FAULT(&env);
+
+ outputP = XMLRPC_MEMBLOCK_NEW(char, &env, 0);
+ TEST_NO_FAULT(&env);
+ xmlrpc_serialize_params2(&env, outputP, paramArrayP,
+ xmlrpc_dialect_apache);
+ TEST_NO_FAULT(&env);
+
+ size = XMLRPC_MEMBLOCK_SIZE(char, outputP);
+
+ TEST(size == strlen(serializedData));
+ TEST(memeq(XMLRPC_MEMBLOCK_CONTENTS(char, outputP), serializedData, size));
+ XMLRPC_MEMBLOCK_FREE(char, outputP);
+ xmlrpc_DECREF(paramArrayP);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_serialize_apache_response(void) {
+
+ char const serializedData[] =
+ XML_PROLOGUE
+ "<methodResponse>\r\n"
+ "<params>\r\n"
+ "<param><value><ex.i8>8</ex.i8></value></param>\r\n"
+ "</params>\r\n"
+ "</methodResponse>\r\n";
+
+ xmlrpc_env env;
+ xmlrpc_value * resultP;
+ xmlrpc_mem_block * outputP;
+ size_t size;
+
xmlrpc_env_init(&env);
- output = XMLRPC_TYPED_MEM_BLOCK_NEW(char, &env, 0);
+ resultP = xmlrpc_i8_new(&env, 8);
TEST_NO_FAULT(&env);
- xmlrpc_env_init(&fault);
- xmlrpc_env_set_fault(&fault, 6, "A fault occurred");
- xmlrpc_serialize_fault(&env, output, &fault);
+
+ outputP = XMLRPC_MEMBLOCK_NEW(char, &env, 0);
+ TEST_NO_FAULT(&env);
+ xmlrpc_serialize_response2(&env, outputP, resultP,
+ xmlrpc_dialect_apache);
TEST_NO_FAULT(&env);
- /* Make sure we serialized the correct value. */
- size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
- TEST(size == strlen(serialized_fault));
- TEST(memcmp(XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output),
- serialized_fault, size) == 0);
+ size = XMLRPC_MEMBLOCK_SIZE(char, outputP);
- /* Clean up our fault. */
- xmlrpc_env_clean(&fault);
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, output);
+ TEST(size == strlen(serializedData));
+ TEST(memeq(XMLRPC_MEMBLOCK_CONTENTS(char, outputP), serializedData, size));
+
+ XMLRPC_MEMBLOCK_FREE(char, outputP);
+ xmlrpc_DECREF(resultP);
xmlrpc_env_clean(&env);
}
+static void
+test_serialize_apache(void) {
+
+ /* Serialize various things using the Apache dialect of XML-RPC */
+
+ test_serialize_apache_value();
+ test_serialize_apache_params();
+ test_serialize_apache_response();
+}
+
+
+
void
test_serialize(void) {
printf("Running serialize tests.");
test_serialize_basic();
- test_serialize_double();
- test_serialize_struct();
+ printf("\n");
+ test_serialize_value();
test_serialize_methodResponse();
test_serialize_methodCall();
test_serialize_fault();
+ test_serialize_apache();
printf("\n");
printf("Serialize tests done.\n");
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/server_abyss.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/server_abyss.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/server_abyss.c Mon May 26 12:59:57 2008
@@ -1,3 +1,4 @@
+#include "unistdx.h"
#include <stdio.h>
#include "xmlrpc_config.h"
@@ -12,33 +13,137 @@
#include "server_abyss.h"
-void
-test_server_abyss(void) {
-
+static void
+testSetHandlers(TServer * const abyssServerP) {
xmlrpc_env env;
xmlrpc_registry * registryP;
- TServer abyssServer;
- printf("Running Abyss server tests...\n");
+ xmlrpc_env_init(&env);
+
+ registryP = xmlrpc_registry_new(&env);
+ TEST_NO_FAULT(&env);
+ TEST(registryP != NULL);
+
+ xmlrpc_server_abyss_set_handler(&env, abyssServerP, "/RPC3", registryP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_abyss_set_handlers2(abyssServerP, "/RPC4", registryP);
+
+ xmlrpc_registry_free(registryP);
+
+ {
+ xmlrpc_registry * registryP;
+ registryP = xmlrpc_registry_new(&env);
+ xmlrpc_server_abyss_set_handlers(abyssServerP, registryP);
+ xmlrpc_registry_free(registryP);
+ }
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+testServerParms(void) {
+ xmlrpc_server_abyss_parms parms;
+
+ parms.config_file_name = NULL;
+ parms.registryP = NULL;
+ parms.port_number = 1000;
+ parms.log_file_name = "/tmp/xmlrpc_logfile";
+ parms.keepalive_timeout = 5;
+ parms.keepalive_max_conn = 4;
+ parms.timeout = 50;
+ parms.dont_advertise = TRUE;
+ parms.uri_path = "/RPC9";
+ parms.chunk_response = TRUE;
+};
+
+
+
+static void
+testObject(void) {
+
+ xmlrpc_env env;
+ xmlrpc_server_abyss_parms parms;
+ xmlrpc_server_abyss_t * serverP;
+ xmlrpc_registry * registryP;
+ xmlrpc_server_abyss_sig * oldHandlersP;
xmlrpc_env_init(&env);
registryP = xmlrpc_registry_new(&env);
+ TEST_NO_FAULT(&env);
+
+ parms.config_file_name = NULL;
+ parms.registryP = registryP;
+
+ serverP = NULL;
+
+ xmlrpc_server_abyss_create(&env, &parms, XMLRPC_APSIZE(registryP),
+ &serverP);
+
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR); /* Global init not done */
+
+ xmlrpc_server_abyss_global_init(&env);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_abyss_create(&env, &parms, XMLRPC_APSIZE(registryP),
+ &serverP);
+
+ TEST_NO_FAULT(&env);
+ TEST(serverP != NULL);
+
+ xmlrpc_server_abyss_terminate(&env, serverP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_abyss_reset_terminate(&env, serverP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_abyss_setup_sig(&env, serverP, &oldHandlersP);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_server_abyss_use_sigchld(serverP);
- TEST(registryP != NULL);
+ xmlrpc_server_abyss_restore_sig(oldHandlersP);
TEST_NO_FAULT(&env);
- ServerCreate(&abyssServer, "testserver", 8080, NULL, NULL);
+ xmlrpc_server_abyss_destroy(serverP);
- xmlrpc_server_abyss_set_handlers(&abyssServer, registryP);
+ xmlrpc_registry_free(registryP);
- xmlrpc_server_abyss_set_handler(&env, &abyssServer, "/RPC3", registryP);
+ xmlrpc_server_abyss_global_term();
- TEST_NO_FAULT(&env);
+ xmlrpc_server_abyss_setup_sig(&env, serverP, &oldHandlersP);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR); /* Not globally initialized */
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+void
+test_server_abyss(void) {
+
+ TServer abyssServer;
+
+ printf("Running Abyss XML-RPC server tests...\n");
+
+ ServerCreate(&abyssServer, "testserver", 8080, NULL, NULL);
+
+ testSetHandlers(&abyssServer);
+
+ ServerSetKeepaliveTimeout(&abyssServer, 60);
+ ServerSetKeepaliveMaxConn(&abyssServer, 10);
+ ServerSetTimeout(&abyssServer, 0);
+ ServerSetAdvertise(&abyssServer, FALSE);
ServerFree(&abyssServer);
+ testServerParms();
+
+ testObject();
+
printf("\n");
- printf("Abyss server tests done.\n");
+ printf("Abyss XML-RPC server tests done.\n");
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.c Mon May 26 12:59:57 2008
@@ -1,16 +1,24 @@
/* Copyright information is at the end of the file. */
+#ifdef WIN32
+#include <direct.h>
+#else
+#include <unistd.h>
+#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
+#include "casprintf.h"
+
#include "xmlrpc_config.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/server.h"
+#include "bool.h"
#include "test.h"
#include "value.h"
#include "serialize.h"
@@ -18,7 +26,9 @@
#include "cgi.h"
#include "xml_data.h"
#include "client.h"
+#include "abyss.h"
#include "server_abyss.h"
+#include "method_registry.h"
/*=========================================================================
** Test Harness
@@ -40,6 +50,13 @@
int total_tests = 0;
int total_failures = 0;
+bool const runningUnderWindows =
+#ifdef WIN32
+ true;
+#else
+ false;
+#endif
+
/*=========================================================================
** Test Data
@@ -62,7 +79,6 @@
static void test_env(void)
{
xmlrpc_env env, env2;
- char *s;
/* Test xmlrpc_env_init. */
xmlrpc_env_init(&env);
@@ -89,13 +105,6 @@
TEST(env.fault_code == 3);
TEST(strcmp(env.fault_string, "abar9") == 0);
- /* Set a fault with an oversized string. */
- s = "12345678901234567890123456789012345678901234567890";
- xmlrpc_env_set_fault_formatted(&env, 4, "%s%s%s%s%s%s", s, s, s, s, s, s);
- TEST(env.fault_occurred);
- TEST(env.fault_code == 4);
- TEST(strlen(env.fault_string) == 255);
-
/* Test cleanup code (with help from memprof). */
xmlrpc_env_clean(&env);
@@ -195,15 +204,19 @@
"ZmdoaWprbG1ub3BxcnN0dXZ3eHl6QUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVo=\r\n",
NULL};
-static void test_base64_conversion (void)
-{
- xmlrpc_env env, env2;
- char **triplet, *bin_data, *nocrlf_ascii_data, *ascii_data;
- xmlrpc_mem_block *output;
+static void
+test_base64_conversion(void) {
+ xmlrpc_env env;
+ char ** triplet;
xmlrpc_env_init(&env);
for (triplet = base64_triplets; *triplet != NULL; triplet += 3) {
+ char * bin_data;
+ char * nocrlf_ascii_data;
+ char * ascii_data;
+ xmlrpc_mem_block * output;
+
bin_data = *triplet;
nocrlf_ascii_data = *(triplet + 1);
ascii_data = *(triplet + 2);
@@ -242,19 +255,26 @@
}
/* Now for something broken... */
- xmlrpc_env_init(&env2);
- output = xmlrpc_base64_decode(&env2, "====", 4);
- TEST(output == NULL);
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
- xmlrpc_env_clean(&env2);
+ {
+ xmlrpc_env env2;
+ xmlrpc_mem_block * output;
+ xmlrpc_env_init(&env2);
+ output = xmlrpc_base64_decode(&env2, "====", 4);
+ TEST(output == NULL);
+ TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
+ xmlrpc_env_clean(&env2);
+ }
/* Now for something broken in a really sneaky way... */
- xmlrpc_env_init(&env2);
- output = xmlrpc_base64_decode(&env2, "a==", 4);
- TEST(output == NULL);
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
- xmlrpc_env_clean(&env2);
-
+ {
+ xmlrpc_env env2;
+ xmlrpc_mem_block * output;
+ xmlrpc_env_init(&env2);
+ output = xmlrpc_base64_decode(&env2, "a==", 4);
+ TEST(output == NULL);
+ TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
+ xmlrpc_env_clean(&env2);
+ }
xmlrpc_env_clean(&env);
}
@@ -290,249 +310,6 @@
-/*=========================================================================
-** test_method_registry
-**=========================================================================
-** We need to define some static callbacks to test this code.
-*/
-
-#define FOO_USER_DATA ((void*) 0xF00)
-#define BAR_USER_DATA ((void*) 0xBAF)
-
-static xmlrpc_value *test_foo (xmlrpc_env *env,
- xmlrpc_value *param_array,
- void *user_data)
-{
- xmlrpc_int32 x, y;
-
- TEST_NO_FAULT(env);
- TEST(param_array != NULL);
- TEST(user_data == FOO_USER_DATA);
-
- xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
- TEST_NO_FAULT(env);
- TEST(x == 25);
- TEST(y == 17);
-
- return xmlrpc_build_value(env, "i", (xmlrpc_int32) x + y);
-}
-
-static xmlrpc_value *test_bar (xmlrpc_env *env,
- xmlrpc_value *param_array,
- void *user_data)
-{
- xmlrpc_int32 x, y;
-
- TEST_NO_FAULT(env);
- TEST(param_array != NULL);
- TEST(user_data == BAR_USER_DATA);
-
- xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
- TEST_NO_FAULT(env);
- TEST(x == 25);
- TEST(y == 17);
-
- xmlrpc_env_set_fault(env, 123, "Test fault");
- return NULL;
-}
-
-static xmlrpc_value *
-test_default(xmlrpc_env * const env,
- const char * const host ATTR_UNUSED,
- const char * const method_name ATTR_UNUSED,
- xmlrpc_value * const param_array,
- void * const user_data) {
-
- xmlrpc_int32 x, y;
-
- TEST_NO_FAULT(env);
- TEST(param_array != NULL);
- TEST(user_data == FOO_USER_DATA);
-
- xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
- TEST_NO_FAULT(env);
- TEST(x == 25);
- TEST(y == 17);
-
- return xmlrpc_build_value(env, "i", 2 * (x + y));
-}
-
-static xmlrpc_value *
-process_call_helper (xmlrpc_env *env,
- xmlrpc_registry *registry,
- const char *method_name,
- xmlrpc_value *arg_array)
-{
- xmlrpc_mem_block *call, *response;
- xmlrpc_value *value;
-
- /* Build a call, and tell the registry to handle it. */
- call = xmlrpc_mem_block_new(env, 0);
- TEST_NO_FAULT(env);
- xmlrpc_serialize_call(env, call, method_name, arg_array);
- TEST_NO_FAULT(env);
- response = xmlrpc_registry_process_call(env, registry, NULL,
- xmlrpc_mem_block_contents(call),
- xmlrpc_mem_block_size(call));
- TEST_NO_FAULT(env);
- TEST(response != NULL);
-
- /* Parse the response. */
- value = xmlrpc_parse_response(env, xmlrpc_mem_block_contents(response),
- xmlrpc_mem_block_size(response));
-
- xmlrpc_mem_block_free(call);
- xmlrpc_mem_block_free(response);
- return value;
-}
-
-
-
-static void
-test_method_registry(void) {
-
- xmlrpc_env env, env2;
- xmlrpc_value *arg_array, *value;
- xmlrpc_registry *registry;
- xmlrpc_mem_block *response;
- xmlrpc_int32 i;
-
- xmlrpc_value *multi;
- xmlrpc_int32 foo1_result, foo2_result;
- xmlrpc_int32 bar_code, nosuch_code, multi_code, bogus1_code, bogus2_code;
- char *bar_string, *nosuch_string, *multi_string;
- char *bogus1_string, *bogus2_string;
-
- xmlrpc_env_init(&env);
-
- /* Create a new registry. */
- registry = xmlrpc_registry_new(&env);
- TEST(registry != NULL);
- TEST_NO_FAULT(&env);
-
- /* Add some test methods. */
- xmlrpc_registry_add_method(&env, registry, NULL, "test.foo",
- test_foo, FOO_USER_DATA);
- TEST_NO_FAULT(&env);
- xmlrpc_registry_add_method(&env, registry, NULL, "test.bar",
- test_bar, BAR_USER_DATA);
- TEST_NO_FAULT(&env);
-
- /* Build an argument array for our calls. */
- arg_array = xmlrpc_build_value(&env, "(ii)",
- (xmlrpc_int32) 25, (xmlrpc_int32) 17);
- TEST_NO_FAULT(&env);
-
- /* Call test.foo and check the result. */
- value = process_call_helper(&env, registry, "test.foo", arg_array);
- TEST_NO_FAULT(&env);
- TEST(value != NULL);
- xmlrpc_decompose_value(&env, value, "i", &i);
- xmlrpc_DECREF(value);
- TEST_NO_FAULT(&env);
- TEST(i == 42);
-
- /* Call test.bar and check the result. */
- xmlrpc_env_init(&env2);
- value = process_call_helper(&env2, registry, "test.bar", arg_array);
- TEST_FAULT(&env2, 123);
- TEST(env2.fault_string && strcmp(env2.fault_string, "Test fault") == 0);
- xmlrpc_env_clean(&env2);
-
- /* Call a non-existant method and check the result. */
- xmlrpc_env_init(&env2);
- value = process_call_helper(&env2, registry, "test.nosuch", arg_array);
- TEST(value == NULL);
- TEST_FAULT(&env2, XMLRPC_NO_SUCH_METHOD_ERROR);
- xmlrpc_env_clean(&env2);
-
- /* Test system.multicall. */
- multi = xmlrpc_build_value(&env,
- "(({s:s,s:V}{s:s,s:V}{s:s,s:V}"
- "{s:s,s:()}s{}{s:s,s:V}))",
- "methodName", "test.foo",
- "params", arg_array,
- "methodName", "test.bar",
- "params", arg_array,
- "methodName", "test.nosuch",
- "params", arg_array,
- "methodName", "system.multicall",
- "params",
- "bogus_entry",
- "methodName", "test.foo",
- "params", arg_array);
- TEST_NO_FAULT(&env);
- value = process_call_helper(&env, registry, "system.multicall", multi);
- TEST_NO_FAULT(&env);
- xmlrpc_decompose_value(&env, value,
- "((i){s:i,s:s,*}{s:i,s:s,*}"
- "{s:i,s:s,*}{s:i,s:s,*}{s:i,s:s,*}(i))",
- &foo1_result,
- "faultCode", &bar_code,
- "faultString", &bar_string,
- "faultCode", &nosuch_code,
- "faultString", &nosuch_string,
- "faultCode", &multi_code,
- "faultString", &multi_string,
- "faultCode", &bogus1_code,
- "faultString", &bogus1_string,
- "faultCode", &bogus2_code,
- "faultString", &bogus2_string,
- &foo2_result);
- xmlrpc_DECREF(value);
- TEST_NO_FAULT(&env);
- TEST(foo1_result == 42);
- TEST(bar_code == 123);
- TEST(strcmp(bar_string, "Test fault") == 0);
- TEST(nosuch_code == XMLRPC_NO_SUCH_METHOD_ERROR);
- TEST(multi_code == XMLRPC_REQUEST_REFUSED_ERROR);
- TEST(foo2_result == 42);
- xmlrpc_DECREF(multi);
- free(bar_string);
- free(nosuch_string);
- free(multi_string);
- free(bogus1_string);
- free(bogus2_string);
-
- /* PASS bogus XML data and make sure our parser pukes gracefully.
- ** (Because of the way the code is laid out, and the presence of other
- ** test suites, this lets us skip tests for invalid XML-RPC data.) */
- xmlrpc_env_init(&env2);
- response = xmlrpc_registry_process_call(&env, registry, NULL,
- expat_error_data,
- strlen(expat_error_data));
- TEST_NO_FAULT(&env);
- TEST(response != NULL);
- value = xmlrpc_parse_response(&env2, xmlrpc_mem_block_contents(response),
- xmlrpc_mem_block_size(response));
- TEST(value == NULL);
- TEST_FAULT(&env2, XMLRPC_PARSE_ERROR);
- xmlrpc_mem_block_free(response);
- xmlrpc_env_clean(&env2);
-
- xmlrpc_registry_set_default_method(&env, registry, &test_default,
- FOO_USER_DATA);
- TEST_NO_FAULT(&env);
- value = process_call_helper(&env, registry, "test.nosuch", arg_array);
- TEST_NO_FAULT(&env);
- TEST(value != NULL);
- xmlrpc_decompose_value(&env, value, "i", &i);
- xmlrpc_DECREF(value);
- TEST_NO_FAULT(&env);
- TEST(i == 84);
-
- /* Change the default method. */
- xmlrpc_registry_set_default_method(&env, registry, &test_default,
- BAR_USER_DATA);
- TEST_NO_FAULT(&env);
-
- /* Test cleanup code (w/memprof). */
- xmlrpc_registry_free(registry);
- xmlrpc_DECREF(arg_array);
-
- xmlrpc_env_clean(&env);
-}
-
static void test_nesting_limit (void)
{
xmlrpc_env env;
@@ -540,16 +317,21 @@
xmlrpc_env_init(&env);
- /* Test with an adequate limit for (...(...()...)...). */
- xmlrpc_limit_set(XMLRPC_NESTING_LIMIT_ID, 2);
- val = xmlrpc_parse_response(&env, correct_value, strlen(correct_value));
+ /* Test with an adequate limit for a result value which is an
+ array which contains an element which is a struct, whose values
+ are simple: 3.
+ */
+ xmlrpc_limit_set(XMLRPC_NESTING_LIMIT_ID, 3);
+ val = xmlrpc_parse_response(&env,
+ good_response_xml, strlen(good_response_xml));
TEST_NO_FAULT(&env);
TEST(val != NULL);
xmlrpc_DECREF(val);
/* Test with an inadequate limit. */
- xmlrpc_limit_set(XMLRPC_NESTING_LIMIT_ID, 1);
- val = xmlrpc_parse_response(&env, correct_value, strlen(correct_value));
+ xmlrpc_limit_set(XMLRPC_NESTING_LIMIT_ID, 2);
+ val = xmlrpc_parse_response(&env,
+ good_response_xml, strlen(good_response_xml));
TEST_FAULT(&env, XMLRPC_PARSE_ERROR); /* BREAKME - Will change. */
TEST(val == NULL);
@@ -561,16 +343,19 @@
xmlrpc_env_clean(&env);
}
-static void test_xml_size_limit (void)
-{
+
+
+static void
+test_xml_size_limit(void) {
+
xmlrpc_env env;
- const char *method_name;
- xmlrpc_value *params, *val;
+ const char * methodName;
+ xmlrpc_value * paramsP;
-
/* NOTE - This test suite only verifies the last-ditch size-checking
- ** code. There should also be matching code in all server (and
- ** preferably all client) modules as well. */
+ code. There should also be matching code in all server (and
+ preferably all client) modules as well.
+ */
/* Set our XML size limit to something ridiculous. */
xmlrpc_limit_set(XMLRPC_XML_SIZE_LIMIT_ID, 6);
@@ -578,23 +363,29 @@
/* Attempt to parse a call. */
xmlrpc_env_init(&env);
xmlrpc_parse_call(&env, serialized_call, strlen(serialized_call),
- &method_name, ¶ms);
+ &methodName, ¶msP);
TEST_FAULT(&env, XMLRPC_LIMIT_EXCEEDED_ERROR);
- TEST(method_name == NULL);
- TEST(params == NULL);
- xmlrpc_env_clean(&env);
-
- /* Attempt to parse a response. */
- xmlrpc_env_init(&env);
- val = xmlrpc_parse_response(&env, correct_value, strlen(correct_value));
- TEST_FAULT(&env, XMLRPC_LIMIT_EXCEEDED_ERROR);
- TEST(val == NULL);
xmlrpc_env_clean(&env);
+ {
+ xmlrpc_value * resultP;
+ int faultCode;
+ const char * faultString;
+
+ /* Attempt to parse a response. */
+ xmlrpc_env_init(&env);
+ xmlrpc_parse_response2(&env,
+ good_response_xml, strlen(good_response_xml),
+ &resultP, &faultCode, &faultString);
+ TEST_FAULT(&env, XMLRPC_LIMIT_EXCEEDED_ERROR);
+ xmlrpc_env_clean(&env);
+ }
/* Reset the default limit. */
xmlrpc_limit_set(XMLRPC_XML_SIZE_LIMIT_ID, XMLRPC_XML_SIZE_LIMIT_DEFAULT);
}
+
+
/*=========================================================================
** test_sample_files
**=========================================================================
@@ -602,67 +393,105 @@
** results.
**
** We use these files to test strange-but-legal encodings, illegal-but-
-** supported encodings, etc.
+** allowed-by-Xmlrpc-c encodings, etc.
*/
+#ifdef WIN32
+/* usually compiled in 'Windows' folder */
+#define TESTDATA_DIR ".." DIRECTORY_SEPARATOR "bin" DIRECTORY_SEPARATOR "data"
+#else
+#define TESTDATA_DIR "data"
+#endif
-static char *good_requests[] = {
- "req_out_of_order.xml",
- "req_no_params.xml",
- "req_value_name.xml",
+static const char * goodRequests[] = {
+ TESTDATA_DIR DIRECTORY_SEPARATOR "req_out_of_order.xml",
+ TESTDATA_DIR DIRECTORY_SEPARATOR "req_no_params.xml",
+ TESTDATA_DIR DIRECTORY_SEPARATOR "req_value_name.xml",
NULL
};
#define MAX_SAMPLE_FILE_LEN (16 * 1024)
-static char file_buff [MAX_SAMPLE_FILE_LEN];
+
static void
-read_file (char *path, char **out_data, size_t *out_size)
-{
- FILE *f;
- size_t bytes_read;
+reportFileOpenError(const char * const path,
+ int const openErrno) {
+
+ if (runningUnderWindows) {
+ char cwdname[1024];
+ char * succeeded;
+
+ succeeded = getcwd(cwdname, sizeof(cwdname));
+ if (succeeded)
+ fprintf(stderr, "Running in current work directory '%s'\n",
+ cwdname);
+ }
+ fprintf(stderr, "Could not open file '%s'. errno=%d (%s)\n",
+ path, openErrno, strerror(openErrno));
+}
+
+
- /* Open the file. */
- f = fopen(path, "r");
- if (f == NULL) {
+static void
+readFile(const char * const path,
+ const char ** const outDataP,
+ size_t * const outSizeP) {
+
+ static char fileBuff[MAX_SAMPLE_FILE_LEN];
+
+ FILE * fileP;
+ size_t bytesRead;
+
+ fileP = fopen(path, "r");
+
+ if (fileP == NULL) {
/* Since this error is fairly likely to happen, give an
- ** informative error message... */
- fflush(stdout);
- fprintf(stderr, "Could not open file '%s'. errno=%d (%s)\n",
- path, errno, strerror(errno));
- abort();
+ informative error message...
+ */
+ reportFileOpenError(path, errno);
+ exit(1);
}
/* Read in one buffer full of data, and make sure that everything
- ** fit. (We perform a lazy error/no-eof/zero-length-file test using
- ** bytes_read.) */
- bytes_read = fread(file_buff, sizeof(char), MAX_SAMPLE_FILE_LEN, f);
- TEST(0 < bytes_read && bytes_read < MAX_SAMPLE_FILE_LEN);
-
- /* Close the file and return our data. */
- fclose(f);
- *out_data = file_buff;
- *out_size = bytes_read;
+ fit. (We perform a lazy error/no-eof/zero-length-file test using
+ 'bytesRead'.)
+ */
+ bytesRead = fread(fileBuff, sizeof(char), MAX_SAMPLE_FILE_LEN, fileP);
+ TEST(0 < bytesRead && bytesRead < MAX_SAMPLE_FILE_LEN);
+
+ fclose(fileP);
+
+ *outDataP = fileBuff;
+ *outSizeP = bytesRead;
}
-static void test_sample_files (void)
-{
+
+
+static void
+testSampleFiles(void) {
+
xmlrpc_env env;
- char **paths, *path;
- char *data;
- size_t data_len;
- const char *method_name;
- xmlrpc_value *params;
+ const char ** pathP;
xmlrpc_env_init(&env);
/* Test our good requests. */
- for (paths = good_requests; *paths != NULL; paths++) {
- path = *paths;
- read_file(path, &data, &data_len);
- xmlrpc_parse_call(&env, data, data_len, &method_name, ¶ms);
+
+ for (pathP = goodRequests; *pathP != NULL; ++pathP) {
+ const char * const path = *pathP;
+
+ const char * data;
+ size_t dataLen;
+ const char * methodName;
+ xmlrpc_value * params;
+
+ readFile(path, &data, &dataLen);
+
+ xmlrpc_parse_call(&env, data, dataLen, &methodName, ¶ms);
+
TEST_NO_FAULT(&env);
- strfree(method_name);
+
+ strfree(methodName);
xmlrpc_DECREF(params);
}
@@ -679,7 +508,7 @@
** http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
*/
-#ifdef HAVE_UNICODE_WCHAR
+#if HAVE_UNICODE_WCHAR
typedef struct {
char *utf8;
@@ -760,6 +589,7 @@
NULL
};
+#endif /* HAVE_UNICODE_WCHAR */
/* This routine is missing on certain platforms. This implementation
** *appears* to be correct. */
@@ -782,8 +612,10 @@
#endif /* HAVE_WCSNCMP */
#endif
-static void test_utf8_coding (void)
-{
+static void
+test_utf8_coding(void) {
+
+#if HAVE_UNICODE_WCHAR
xmlrpc_env env, env2;
utf8_and_wcs *good_data;
char **bad_data;
@@ -841,72 +673,87 @@
TEST(output == NULL);
xmlrpc_env_clean(&env2);
}
-
xmlrpc_env_clean(&env);
+#endif /* HAVE_UNICODE_WCHAR */
}
-#endif /* HAVE_UNICODE_WCHAR */
-
-
-/*=========================================================================
-** Test Driver
-**=========================================================================
-*/
-int
-main(int argc,
- char ** argv ATTR_UNUSED) {
- if (argc-1 > 0) {
- fprintf(stderr, "There are no arguments.");
- exit(1);
- }
+static void
+test_server_cgi_maybe(void) {
- /* Add your test suites here. */
- test_env();
- test_mem_block();
- test_base64_conversion();
- printf("\n");
- test_value();
- test_bounds_checks();
- printf("\n");
- test_serialize();
- test_parse_xml();
-
- test_method_registry();
- test_nesting_limit();
- test_xml_size_limit();
- test_sample_files();
- printf("\n");
+#ifndef WIN32
-#ifndef WIN32 /* CGI unsupported in Windows */
test_server_cgi();
+
#endif
- test_server_abyss();
+}
+
-#ifdef HAVE_UNICODE_WCHAR
- test_utf8_coding();
-#endif /* HAVE_UNICODE_WCHAR */
- printf("\n");
+static void
+test_client_maybe(void) {
+
+#ifndef WIN32 /* Must get Windows Curl transport working for this to work */
-#ifndef WIN32 /* TODO: Client test uses curl... */
test_client();
+
#endif
+}
- /* Summarize our test run. */
- printf("\nRan %d tests, %d failed, %.1f%% passed\n",
- total_tests, total_failures,
- 100.0 - (100.0 * total_failures) / total_tests);
-
- /* Print the final result. */
- if (total_failures == 0) {
- printf("OK\n");
- return 0;
- }
- printf("FAILED\n");
- return 1;
+
+int
+main(int argc,
+ char ** argv ATTR_UNUSED) {
+
+ int retval;
+
+ if (argc-1 > 0) {
+ fprintf(stderr, "There are no arguments.\n");
+ retval = 1;
+ } else {
+ test_env();
+ test_mem_block();
+ test_base64_conversion();
+ printf("\n");
+ test_value();
+ test_bounds_checks();
+ printf("\n");
+ test_serialize();
+ test_parse_xml();
+ test_method_registry();
+ test_nesting_limit();
+ test_xml_size_limit();
+ testSampleFiles();
+ printf("\n");
+ test_server_cgi_maybe();
+ test_abyss();
+ test_server_abyss();
+
+ test_utf8_coding();
+
+ printf("\n");
+
+ test_client_maybe();
+
+ printf("\n");
+
+ /* Summarize our test run. */
+ printf("Ran %d tests, %d failed, %.1f%% passed\n",
+ total_tests, total_failures,
+ 100.0 - (100.0 * total_failures) / total_tests);
+
+ /* Print the final result. */
+ if (total_failures == 0) {
+ printf("OK\n");
+ retval = 0;
+ } else {
+ retval = 1;
+ printf("FAILED\n");
+ }
+ }
+ return retval;
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/test.h Mon May 26 12:59:57 2008
@@ -1,19 +1,17 @@
#include <stdlib.h>
#include <stdio.h>
+#include <math.h>
+
+#include "xmlrpc_config.h"
+#include "xmlrpc-c/util.h"
+#include "xmlrpc-c/util_int.h"
extern int total_tests;
extern int total_failures;
-static __inline void
-strfree(const char * const string) {
- free((char*)string);
-}
-
-
-
/* This is a good place to set a breakpoint. */
-static __inline void
+static __inline__ void
test_failure(const char * const file,
unsigned int const line,
const char * const label,
@@ -47,21 +45,65 @@
} \
} while (0)
-#define TEST_FAULT(env, code) \
-do { \
- ++total_tests; \
- if ((env)->fault_occurred && (env)->fault_code == (code)) { \
- printf("."); \
- } else { \
- test_failure(__FILE__, __LINE__, "wrong/no fault occurred", \
- (env)->fault_string); \
- } \
- } while (0)
+#define TEST_EPSILON 1E-5
+
+#define FORCENONZERO(x) (MAX(fabs(x), TEST_EPSILON))
+#define FLOATEQUAL(comparand, comparator) \
+ ((fabs((comparand)-(comparator)))/FORCENONZERO(comparand) < TEST_EPSILON)
+#define TESTFLOATEQUAL(comparand, comparator) \
+ TEST(FLOATEQUAL(comparand, comparator))
+
+static __inline__ void
+test_fault(xmlrpc_env * const envP,
+ int const expectedCode,
+ const char * const fileName,
+ unsigned int const lineNumber) {
+
+ ++total_tests;
+
+ if (!envP->fault_occurred)
+ test_failure(fileName, lineNumber, "no fault occurred", "");
+ else if (envP->fault_code != expectedCode)
+ test_failure(fileName, lineNumber, "wrong fault occurred",
+ envP->fault_string);
+ else
+ printf(".");
+ xmlrpc_env_clean(envP);
+ xmlrpc_env_init(envP);
+}
+
+
+#define TEST_FAULT(envP, code) \
+ do { test_fault(envP, code, __FILE__, __LINE__); } while(0)
+
+;
+
+
+static __inline__ void
+test_null_string(const char * const string,
+ const char * const fileName,
+ unsigned int const lineNumber) {
+
+ ++total_tests;
+
+ if (string != NULL)
+ test_failure(fileName, lineNumber, "string not null", string);
+ else
+ printf(".");
+}
+
+
+#define TEST_NULL_STRING(string) \
+ do { test_null_string(string, __FILE__, __LINE__); } while(0)
+
+;
#define TEST_ERROR(reason) \
do { \
printf("Unable to test at %s/%u. %s", __FILE__, __LINE__, reason); \
abort(); \
} while (0)
+
+;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/value.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/value.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/value.c Mon May 26 12:59:57 2008
@@ -5,24 +5,29 @@
#include <string.h>
#include <errno.h>
+#include "casprintf.h"
+#include "girstring.h"
+
#include "xmlrpc_config.h"
#include "xmlrpc-c/base.h"
+#include "xmlrpc-c/string_int.h"
#include "test.h"
#include "value.h"
+#if HAVE_UNICODE_WCHAR
-/*=========================================================================
-** Test Data
-**=========================================================================
-** Some common test data which need to be allocated at a fixed address,
-** or which are inconvenient to allocate inline.
-*/
-static char* test_string_1 = "foo";
+static bool
+wcsneq(const wchar_t * const comparand,
+ const wchar_t * const comparator,
+ size_t const length) {
+ return(wcsncmp(comparand, comparator, length) == 0);
+}
+#endif /* HAVE_UNICODE_WCHAR */
static void
test_value_alloc_dealloc(void) {
@@ -45,7 +50,7 @@
static void
-test_value_integer(void) {
+test_value_int(void) {
xmlrpc_value * v;
xmlrpc_env env;
@@ -53,18 +58,28 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_INT), "INT"));
+
v = xmlrpc_int_new(&env, (xmlrpc_int32) 25);
TEST_NO_FAULT(&env);
- TEST(XMLRPC_TYPE_INT == xmlrpc_value_type(v));
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_INT);
xmlrpc_read_int(&env, v, &i);
TEST_NO_FAULT(&env);
TEST(i == 25);
xmlrpc_DECREF(v);
+ v = xmlrpc_int_new(&env, (xmlrpc_int32) -25);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_INT);
+ xmlrpc_read_int(&env, v, &i);
+ TEST_NO_FAULT(&env);
+ TEST(i == -25);
+ xmlrpc_DECREF(v);
+
v = xmlrpc_build_value(&env, "i", (xmlrpc_int32) 10);
TEST_NO_FAULT(&env);
TEST(v != NULL);
- TEST(XMLRPC_TYPE_INT == xmlrpc_value_type(v));
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_INT);
xmlrpc_decompose_value(&env, v, "i", &i);
xmlrpc_DECREF(v);
TEST_NO_FAULT(&env);
@@ -86,6 +101,8 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_BOOL), "BOOL"));
+
v = xmlrpc_bool_new(&env, (xmlrpc_bool) 1);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_BOOL == xmlrpc_value_type(v));
@@ -117,6 +134,8 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_DOUBLE), "DOUBLE"));
+
v = xmlrpc_double_new(&env, -3.25);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_DOUBLE == xmlrpc_value_type(v));
@@ -140,10 +159,8 @@
static void
-test_value_datetime(void) {
-
- const char * datestring = "19980717T14:08:55";
- time_t const datetime = 900684535;
+test_value_datetime_varytime(const char * const datestring,
+ time_t const datetime) {
xmlrpc_value * v;
xmlrpc_env env;
@@ -156,11 +173,6 @@
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_DATETIME == xmlrpc_value_type(v));
- xmlrpc_read_datetime_str(&env, v, &ds);
- TEST_NO_FAULT(&env);
- TEST(strcmp(ds, datestring) == 0);
- strfree(ds);
-
xmlrpc_read_datetime_sec(&env, v, &dt);
TEST_NO_FAULT(&env);
TEST(dt == datetime);
@@ -173,23 +185,118 @@
xmlrpc_read_datetime_str(&env, v, &ds);
TEST_NO_FAULT(&env);
- TEST(strcmp(ds, datestring) == 0);
+ TEST(streq(ds, datestring));
strfree(ds);
+ xmlrpc_DECREF(v);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_value_datetime_not_unix(const char * const datestring) {
+
+ xmlrpc_value * v;
+ xmlrpc_env env;
+ time_t dt;
+
+ xmlrpc_env_init(&env);
+
+ v = xmlrpc_datetime_new_str(&env, datestring);
+ TEST_NO_FAULT(&env);
+
xmlrpc_read_datetime_sec(&env, v, &dt);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_DECREF(v);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_value_datetime_invalid(const char * const datestring) {
+
+ /* Ideally, xmlrpc_datetime_new_str() would fail on these, but
+ the code doesn't implement that today. However,
+ xmlrpc_read_datetime_sec() does catch many cases, so we
+ use that.
+
+ Note that xmlrpc_read_datetime_sec() doesn't catch them all.
+ Sometimes it just returns garbage, e.g. returns July 1 for
+ June 31.
+ */
+
+ xmlrpc_value * v;
+ xmlrpc_env env;
+ time_t dt;
+
+ xmlrpc_env_init(&env);
+
+ v = xmlrpc_datetime_new_str(&env, datestring);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_read_datetime_sec(&env, v, &dt);
+ TEST_FAULT(&env, XMLRPC_PARSE_ERROR);
+
+ xmlrpc_DECREF(v);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_build_decomp_datetime(void) {
+
+ const char * datestring = "19980717T14:08:55";
+ time_t const datetime = 900684535;
+
+ xmlrpc_env env;
+ xmlrpc_value * v;
+ time_t dt;
+ const char * ds;
+
+ xmlrpc_env_init(&env);
+
+ v = xmlrpc_build_value(&env, "t", datetime);
TEST_NO_FAULT(&env);
+ TEST(v != NULL);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_DATETIME);
+
+ dt = 0;
+ xmlrpc_read_datetime_sec(&env, v, &dt);
TEST(dt == datetime);
+ dt = 0;
+ xmlrpc_decompose_value(&env, v, "t", &dt);
+ xmlrpc_DECREF(v);
+ TEST_NO_FAULT(&env);
+ TEST(dt == datetime);
+
+ v = xmlrpc_int_new(&env, 9);
+ TEST_NO_FAULT(&env);
+ xmlrpc_decompose_value(&env, v, "t", &dt);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+ xmlrpc_env_clean(&env);
+ xmlrpc_env_init(&env);
+ xmlrpc_decompose_value(&env, v, "8", &ds);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+ xmlrpc_env_clean(&env);
+ xmlrpc_env_init(&env);
xmlrpc_DECREF(v);
v = xmlrpc_build_value(&env, "8", datestring);
TEST_NO_FAULT(&env);
TEST(v != NULL);
- TEST(XMLRPC_TYPE_DATETIME == xmlrpc_value_type(v));
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_DATETIME);
xmlrpc_decompose_value(&env, v, "8", &ds);
xmlrpc_DECREF(v);
TEST_NO_FAULT(&env);
- TEST(strcmp(ds, datestring) == 0);
+ TEST(streq(ds, datestring));
strfree(ds);
xmlrpc_env_clean(&env);
@@ -198,38 +305,129 @@
static void
+test_value_datetime(void) {
+
+ const char * datestring = "19980717T14:08:55";
+ time_t const datetime = 900684535;
+
+ xmlrpc_env env;
+
+ xmlrpc_env_init(&env);
+
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_DATETIME), "DATETIME"));
+
+ /* Valid datetime, generated from XML-RPC string */
+
+ test_value_datetime_varytime(datestring, datetime);
+
+ /* Leap years */
+ test_value_datetime_varytime("20000229T23:59:59", 951868799);
+ test_value_datetime_varytime("20000301T00:00:00", 951868800);
+ test_value_datetime_varytime("20010228T23:59:59", 983404799);
+ test_value_datetime_varytime("20010301T00:00:00", 983404800);
+ test_value_datetime_varytime("20040229T23:59:59", 1078099199);
+ test_value_datetime_varytime("20040301T00:00:00", 1078099200);
+
+ /* Datetimes that can't be represented as time_t */
+ test_value_datetime_not_unix("19691231T23:59:59");
+
+ /* Invalid datetimes */
+ /* Note that the code today does a pretty weak job of validating datetimes,
+ so we test only the validation that we know is implemented.
+ */
+ test_value_datetime_invalid("19700101T25:00:00");
+ test_value_datetime_invalid("19700101T10:61:01");
+ test_value_datetime_invalid("19700101T10:59:61");
+ test_value_datetime_invalid("19700001T10:00:00");
+ test_value_datetime_invalid("19701301T10:00:00");
+ test_value_datetime_invalid("19700132T10:00:00");
+
+ test_build_decomp_datetime();
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static xmlrpc_value *
+test_string_new_va(xmlrpc_env * const envP,
+ const char * const format,
+ ...) {
+
+ va_list args;
+
+ xmlrpc_value * v;
+
+ va_start(args, format);
+
+ v = xmlrpc_string_new_va(envP, format, args);
+
+ va_end(args);
+
+ return v;
+}
+
+
+
+static void
test_value_string_no_null(void) {
+ /* Test strings (without '\0' bytes). */
+
xmlrpc_value * v;
xmlrpc_env env;
const char * str;
size_t len;
- /* Test strings (without '\0' bytes). */
xmlrpc_env_init(&env);
- v = xmlrpc_string_new(&env, test_string_1);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_STRING), "STRING"));
+
+ v = xmlrpc_string_new(&env, "foo");
TEST_NO_FAULT(&env);
- TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_STRING);
xmlrpc_read_string(&env, v, &str);
TEST_NO_FAULT(&env);
- TEST(strcmp(str, test_string_1) == 0);
+ TEST(streq(str, "foo"));
xmlrpc_DECREF(v);
strfree(str);
- v = xmlrpc_build_value(&env, "s", test_string_1);
+ v = xmlrpc_string_new_f(&env, "String %s, number %d", "xyz", 7);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_STRING);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "String xyz, number 7"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = test_string_new_va(&env, "String %s, number %d", "xyz", 7);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_STRING);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "String xyz, number 7"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_build_value(&env, "s", "foo");
TEST_NO_FAULT(&env);
TEST(v != NULL);
TEST(XMLRPC_TYPE_STRING == xmlrpc_value_type(v));
+
xmlrpc_decompose_value(&env, v, "s", &str);
TEST_NO_FAULT(&env);
- TEST(strcmp(str, test_string_1) == 0);
+ TEST(streq(str, "foo"));
+ strfree(str);
+
xmlrpc_decompose_value(&env, v, "s#", &str, &len);
TEST_NO_FAULT(&env);
- TEST(memcmp(str, test_string_1, strlen(test_string_1)) == 0);
- TEST(strlen(str) == strlen(test_string_1));
+ TEST(len == strlen("foo"));
+ TEST(xmlrpc_streq(str, "foo"));
+ TEST(strlen(str) == strlen("foo"));
strfree(str);
+
xmlrpc_DECREF(v);
xmlrpc_env_clean(&env);
@@ -256,7 +454,7 @@
xmlrpc_read_string_lp(&env, v, &len, &str);
TEST_NO_FAULT(&env);
TEST(len == 7);
- TEST(memcmp(str, "foo\0bar", 7) == 0);
+ TEST(memeq(str, "foo\0bar", 7));
xmlrpc_DECREF(v);
strfree(str);
@@ -267,7 +465,7 @@
xmlrpc_decompose_value(&env, v, "s#", &str, &len);
TEST_NO_FAULT(&env);
- TEST(memcmp(str, "foo\0bar", 7) == 0);
+ TEST(memeq(str, "foo\0bar", 7));
TEST(len == 7);
strfree(str);
@@ -284,7 +482,214 @@
-#ifdef HAVE_UNICODE_WCHAR
+static void
+test_value_string_multiline(void) {
+
+ xmlrpc_env env;
+ xmlrpc_value * v;
+ const char * str;
+ size_t len;
+
+ xmlrpc_env_init(&env);
+
+ /* LF line ending */
+
+ v = xmlrpc_string_new(&env, "foo\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n"));
+ strfree(str);
+ xmlrpc_read_string_crlf(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\n"));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_string_new(&env, "foo\n\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n\n"));
+ strfree(str);
+ xmlrpc_read_string_crlf(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\n\r\n"));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_string_new(&env, "foo\nbar");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar"));
+ strfree(str);
+ xmlrpc_read_string_crlf(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\nbar"));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_string_new(&env, "foo\nbar\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\n"));
+ strfree(str);
+ xmlrpc_read_string_crlf(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\nbar\r\n"));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_string_new(&env, "foo\nbar\nbaz");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\nbaz"));
+ strfree(str);
+ xmlrpc_read_string_crlf(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\nbar\r\nbaz"));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ /* CR line ending */
+
+ v = xmlrpc_string_new(&env, "foo\r");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\r\r");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\rbar");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\rbar\r");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\rbar\rbaz");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\nbaz"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ /* CRLF line ending */
+
+ v = xmlrpc_string_new(&env, "foo\r\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\r\n\r\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\n\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\r\nbar");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\r\nbar\r\n");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\n"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new(&env, "foo\r\nbar\r\nbaz");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\nbar\nbaz"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ /* Embedded null */
+
+ v = xmlrpc_string_new_lp(&env, 14, "foo\r\n\0bar\r\nbaz");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string_lp(&env, v, &len, &str);
+ TEST_NO_FAULT(&env);
+ TEST(len == 12);
+ TEST(memeq(str, "foo\n\0bar\nbaz", len));
+ strfree(str);
+ xmlrpc_read_string_lp_crlf(&env, v, &len, &str);
+ TEST_NO_FAULT(&env);
+ TEST(len == 14);
+ TEST(memeq(str, "foo\r\n\0bar\r\nbaz", len));
+ strfree(str);
+ xmlrpc_DECREF(v);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_value_string_cr(void) {
+
+ xmlrpc_env env;
+ xmlrpc_value * v;
+ const char * str;
+ size_t len;
+
+ xmlrpc_env_init(&env);
+ v = xmlrpc_string_new_cr(&env, "foo\r\nbar\r\nbaz");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string(&env, v, &str);
+ TEST_NO_FAULT(&env);
+ TEST(streq(str, "foo\r\nbar\r\nbaz"));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ v = xmlrpc_string_new_lp_cr(&env, 7, "\0foo\rbar");
+ TEST_NO_FAULT(&env);
+ xmlrpc_read_string_lp(&env, v, &len, &str);
+ TEST_NO_FAULT(&env);
+ TEST(len == 7);
+ TEST(memeq(str, "\0foo\rbar", len));
+ xmlrpc_DECREF(v);
+ strfree(str);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+#if HAVE_UNICODE_WCHAR
/* Here is a 3-character, NUL-terminated string, once in UTF-8 chars,
and once in UTF-16 wchar_ts. Note that 2 of the UTF-16 characters
@@ -316,7 +721,7 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_DECREF(valueP);
@@ -332,16 +737,72 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
+ free((void*)wcs);
+
+ xmlrpc_DECREF(valueP);
+}
+#endif /* HAVE_UNICODE_WCHAR */
+
+
+static void
+test_value_string_wide_line(void) {
+ /* Test with various line delimiters */
+
+#if HAVE_UNICODE_WCHAR
+ xmlrpc_env env;
+ xmlrpc_value * valueP;
+ const wchar_t * wcs;
+ size_t len;
+
+ wchar_t const wcs_lines[] = {'\n', '\r', '\r', '\n', '\0'};
+ wchar_t const wcs_lines_lf[] = {'\n', '\n', '\n'};
+ wchar_t const wcs_lines_crlf[] = {
+ '\r', '\n', '\r', '\n', '\r', '\n' };
+
+ xmlrpc_env_init(&env);
+
+ valueP = xmlrpc_string_w_new(&env, wcs_lines);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_read_string_w_lp(&env, valueP, &len, &wcs);
+ TEST_NO_FAULT(&env);
+ TEST(len == 3);
+ TEST(wcs[len] == '\0');
+ TEST(wcsneq(wcs, wcs_lines_lf, len));
+ free((void*)wcs);
+
+ xmlrpc_read_string_w_lp_crlf(&env, valueP, &len, &wcs);
+ TEST_NO_FAULT(&env);
+ TEST(len == 6);
+ TEST(wcs[len] == '\0');
+ TEST(wcsneq(wcs, wcs_lines_crlf, len));
free((void*)wcs);
xmlrpc_DECREF(valueP);
+
+ valueP = xmlrpc_string_w_new_cr(&env, wcs_lines);
+ TEST_NO_FAULT(&env);
+
+ xmlrpc_read_string_w_lp(&env, valueP, &len, &wcs);
+ TEST_NO_FAULT(&env);
+ TEST(len == 4);
+ TEST(wcs[len] == '\0');
+ TEST(wcsneq(wcs, wcs_lines, len));
+ free((void*)wcs);
+
+ xmlrpc_DECREF(valueP);
+
+ xmlrpc_env_clean(&env);
+#endif /* HAVE_UNICODE_WCHAR */
}
static void
test_value_string_wide(void) {
+
+#if HAVE_UNICODE_WCHAR
xmlrpc_env env;
xmlrpc_value * valueP;
const wchar_t * wcs;
@@ -360,14 +821,14 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_read_string_w(&env, valueP, &wcs);
TEST_NO_FAULT(&env);
TEST(wcs != NULL);
TEST(wcs[3] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, 3));
+ TEST(wcsneq(wcs, wcs_data, 3));
free((void*)wcs);
xmlrpc_decompose_value(&env, valueP, "w#", &wcs, &len);
@@ -375,7 +836,7 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
{
@@ -405,7 +866,7 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_DECREF(valueP);
@@ -423,8 +884,9 @@
TEST(wcs != NULL);
TEST(len == 3);
TEST(wcs[len] == 0x0000);
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
+ xmlrpc_DECREF(valueP);
/* Test with embedded NUL. We use a length of 4 so that the terminating
NUL actually becomes part of the string.
@@ -439,16 +901,19 @@
TEST(wcs != NULL);
TEST(len == 4);
TEST(wcs[len] == '\0');
- TEST(0 == wcsncmp(wcs, wcs_data, len));
+ TEST(wcsneq(wcs, wcs_data, len));
free((void*)wcs);
xmlrpc_read_string_w(&env, valueP, &wcs);
TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+
+ xmlrpc_DECREF(valueP);
+
+ test_value_string_wide_line();
+
+ xmlrpc_env_clean(&env);
+#endif /* HAVE_UNICODE_WCHAR */
}
-#else
-static void
-test_value_string_wide(void) {}
-#endif
@@ -467,12 +932,14 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_BASE64), "BASE64"));
+
v = xmlrpc_base64_new(&env, sizeof(data1), data1);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_BASE64 == xmlrpc_value_type(v));
xmlrpc_read_base64(&env, v, &len, &data);
TEST_NO_FAULT(&env);
- TEST(memcmp(data, data1, sizeof(data1)) == 0);
+ TEST(memeq(data, data1, sizeof(data1)));
TEST(len == sizeof(data1));
xmlrpc_DECREF(v);
free((void*)data);
@@ -484,7 +951,7 @@
xmlrpc_DECREF(v);
TEST_NO_FAULT(&env);
TEST(len == sizeof(data2));
- TEST(memcmp(data, data1, sizeof(data2)) == 0);
+ TEST(memeq(data, data1, sizeof(data2)));
strfree(data);
xmlrpc_env_clean(&env);
@@ -530,6 +997,8 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_ARRAY), "ARRAY"));
+
v = xmlrpc_array_new(&env);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(v));
@@ -596,19 +1065,17 @@
/* Test typechecks for 'A' and 'S'. */
xmlrpc_env_init(&env);
+ xmlrpc_env_init(&env2);
v = xmlrpc_build_value(&env, "s", "foo");
TEST_NO_FAULT(&env);
- xmlrpc_env_init(&env2);
xmlrpc_decompose_value(&env2, v, "A", &v2);
TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
- xmlrpc_env_init(&env2);
xmlrpc_decompose_value(&env2, v, "S", &v2);
TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
xmlrpc_DECREF(v);
+ xmlrpc_env_clean(&env2);
xmlrpc_env_clean(&env);
}
@@ -619,7 +1086,7 @@
xmlrpc_value * arrayP;
xmlrpc_env env;
- xmlrpc_int32 i, i1, i2, i3, i4;
+ xmlrpc_int32 i, i1, i2, i3, i4, i5;
xmlrpc_value * itemP;
xmlrpc_value * subarrayP;
size_t len;
@@ -671,22 +1138,42 @@
xmlrpc_decompose_value(&env, arrayP, "(i(ii*)i)", &i1, &i2, &i3, &i4);
TEST_NO_FAULT(&env);
+ xmlrpc_decompose_value(&env, arrayP, "(i(iii)i)", &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(i(i)i)", &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(i(ii)i*i)",
+ &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(i(iiQ)i*i)",
+ &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(",
+ &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(i",
+ &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, arrayP, "(i*",
+ &i1, &i2, &i3, &i4, &i5);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
/* Test bounds check on xmlrpc_array_get_item. */
xmlrpc_array_read_item(&env, arrayP, 3, &itemP);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
xmlrpc_array_get_item(&env, arrayP, 3);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
xmlrpc_array_get_item(&env, arrayP, -1);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
xmlrpc_DECREF(arrayP);
@@ -732,44 +1219,14 @@
TEST_NO_FAULT(&env);
TEST(i1 == 10 && i2 == 20);
- /* Test bounds check on xmlrpc_array_get_item. */
- xmlrpc_array_read_item(&env, arrayP, 4, &itemP);
- TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
-
- xmlrpc_array_get_item(&env, arrayP, 4);
- TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
-
- xmlrpc_DECREF(arrayP);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-test_value_type_mismatch(void) {
-
- xmlrpc_value * v;
- xmlrpc_env env;
- xmlrpc_env env2;
- char * str;
-
- /* Test for one, simple kind of type mismatch error. We assume that
- ** if one of these typechecks works, the rest work fine. */
-
- xmlrpc_env_init(&env);
+ /* Test bounds check on xmlrpc_array_get_item. */
+ xmlrpc_array_read_item(&env, arrayP, 4, &itemP);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- v = xmlrpc_build_value(&env, "i", (xmlrpc_int32) 5);
- TEST_NO_FAULT(&env);
- xmlrpc_env_init(&env2);
- xmlrpc_decompose_value(&env2, v, "s", &str);
- xmlrpc_DECREF(v);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
+ xmlrpc_array_get_item(&env, arrayP, 4);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
+
+ xmlrpc_DECREF(arrayP);
xmlrpc_env_clean(&env);
}
@@ -789,6 +1246,8 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_C_PTR), "C_PTR"));
+
v = xmlrpc_build_value(&env, "p", (void*) 0x00000017);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_C_PTR == xmlrpc_value_type(v));
@@ -810,6 +1269,8 @@
xmlrpc_env_init(&env);
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_NIL), "NIL"));
+
v = xmlrpc_nil_new(&env);
TEST_NO_FAULT(&env);
TEST(XMLRPC_TYPE_NIL == xmlrpc_value_type(v));
@@ -828,6 +1289,81 @@
static void
+test_value_i8(void) {
+
+ xmlrpc_value * v;
+ xmlrpc_env env;
+ xmlrpc_int64 i;
+
+ xmlrpc_env_init(&env);
+
+ TEST(streq(xmlrpc_type_name(XMLRPC_TYPE_I8), "I8"));
+
+ v = xmlrpc_i8_new(&env, (xmlrpc_int64) 25);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_I8);
+ xmlrpc_read_i8(&env, v, &i);
+ TEST_NO_FAULT(&env);
+ TEST(i == 25);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_i8_new(&env, (xmlrpc_int64) -25);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_I8);
+ xmlrpc_read_i8(&env, v, &i);
+ TEST_NO_FAULT(&env);
+ TEST(i == -25);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_i8_new(&env, (xmlrpc_int64)1 << 40);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_I8);
+ xmlrpc_read_i8(&env, v, &i);
+ TEST_NO_FAULT(&env);
+ TEST(i == (xmlrpc_int64)1 << 40);
+ xmlrpc_DECREF(v);
+
+ v = xmlrpc_build_value(&env, "I", (xmlrpc_int64) 10);
+ TEST_NO_FAULT(&env);
+ TEST(v != NULL);
+ TEST(xmlrpc_value_type(v) == XMLRPC_TYPE_I8);
+ xmlrpc_decompose_value(&env, v, "I", &i);
+ xmlrpc_DECREF(v);
+ TEST_NO_FAULT(&env);
+ TEST(i == 10);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_value_type_mismatch(void) {
+
+ xmlrpc_value * v;
+ xmlrpc_env env;
+ xmlrpc_env env2;
+ char * str;
+
+ /* Test for one, simple kind of type mismatch error. We assume that
+ ** if one of these typechecks works, the rest work fine. */
+
+ xmlrpc_env_init(&env);
+ xmlrpc_env_init(&env2);
+
+ v = xmlrpc_build_value(&env, "i", (xmlrpc_int32) 5);
+ TEST_NO_FAULT(&env);
+ xmlrpc_decompose_value(&env2, v, "s", &str);
+ xmlrpc_DECREF(v);
+ TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
+
+ xmlrpc_env_clean(&env2);
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
test_value_invalid_type(void) {
xmlrpc_value * v;
@@ -854,13 +1390,13 @@
/* Test missing close parenthesis on array */
xmlrpc_env_init(&env);
+
v = xmlrpc_build_value(&env, "(");
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
v = xmlrpc_build_value(&env, "(i");
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
xmlrpc_env_clean(&env);
}
@@ -875,18 +1411,16 @@
/* Test missing closing brace on struct */
xmlrpc_env_init(&env);
+
v = xmlrpc_build_value(&env, "{");
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
v = xmlrpc_build_value(&env, "{s:i", "key1", 7);
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
v = xmlrpc_build_value(&env, "{s:i,s:i", "key1", 9, "key2", -4);
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
xmlrpc_env_clean(&env);
}
@@ -897,20 +1431,24 @@
xmlrpc_value * v;
xmlrpc_env env;
+
+ /* Note that even though the format strings are invalid, we have
+ to supply the variable arguments that xmlrpc_build_value() will
+ be looking for as it tries to parse it. Otherwise, we get wild
+ memory references and consequent Valgrind flags.
+ */
xmlrpc_env_init(&env);
- v = xmlrpc_build_value(&env, "{s:ii");
+
+ v = xmlrpc_build_value(&env, "{s:ii", "key1", 9, 9);
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- v = xmlrpc_build_value(&env, "{si:");
+ v = xmlrpc_build_value(&env, "{si:", "key1", 9);
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- v = xmlrpc_build_value(&env, "{s");
+ v = xmlrpc_build_value(&env, "{s", "key1");
TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
xmlrpc_env_clean(&env);
}
@@ -958,12 +1496,12 @@
TEST(i == 7);
TEST(d == 3.14);
TEST(b == (xmlrpc_bool)1);
- TEST(strcmp(dt_str, datestring) == 0);
- TEST(strcmp(s1, "hello world") == 0);
+ TEST(streq(dt_str, datestring));
+ TEST(streq(s1, "hello world"));
TEST(s2_len == 3);
- TEST(memcmp(s2, "a\0b", 3) == 0);
+ TEST(memeq(s2, "a\0b", 3));
TEST(b64_len == strlen("base64 data"));
- TEST(memcmp(b64, "base64 data", b64_len) == 0);
+ TEST(memeq(b64, "base64 data", b64_len));
TEST(XMLRPC_TYPE_ARRAY == xmlrpc_value_type(arrayP));
TEST(XMLRPC_TYPE_STRUCT == xmlrpc_value_type(structP));
TEST(cptr == &valueP);
@@ -978,21 +1516,21 @@
static void
test_struct_get_element(xmlrpc_value * const structP,
- xmlrpc_value * const i1,
- xmlrpc_value * const i2,
+ xmlrpc_value * const fooValueP,
+ xmlrpc_value * const weirdValueP,
const char * const weirdKey,
unsigned int const weirdKeyLen) {
xmlrpc_env env;
xmlrpc_value * valueP;
- xmlrpc_value * aasStringP;
+ xmlrpc_value * fooStringP;
xmlrpc_value * bogusKeyStringP;
xmlrpc_env_init(&env);
/* build test tools */
- aasStringP = xmlrpc_build_value(&env, "s", "aas");
+ fooStringP = xmlrpc_build_value(&env, "s", "foo");
TEST_NO_FAULT(&env);
bogusKeyStringP = xmlrpc_build_value(&env, "s", "doesn't_exist");
@@ -1000,78 +1538,69 @@
/* "find" interface */
- xmlrpc_struct_find_value(&env, structP, "aas", &valueP);
+ xmlrpc_struct_find_value(&env, structP, "foo", &valueP);
TEST_NO_FAULT(&env);
- TEST(valueP == i1);
+ TEST(valueP == fooValueP);
+ xmlrpc_DECREF(valueP);
xmlrpc_struct_find_value(&env, structP, "doesn't_exist", &valueP);
TEST_NO_FAULT(&env);
TEST(valueP == NULL);
- xmlrpc_struct_find_value_v(&env, structP, aasStringP, &valueP);
+ xmlrpc_struct_find_value_v(&env, structP, fooStringP, &valueP);
TEST_NO_FAULT(&env);
- TEST(valueP == i1);
+ TEST(valueP == fooValueP);
xmlrpc_DECREF(valueP);
xmlrpc_struct_find_value_v(&env, structP, bogusKeyStringP, &valueP);
TEST_NO_FAULT(&env);
TEST(valueP == NULL);
- xmlrpc_struct_find_value(&env, i1, "aas", &valueP);
+ xmlrpc_struct_find_value(&env, fooValueP, "foo", &valueP);
TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
/* "read" interface */
- xmlrpc_struct_read_value(&env, structP, "aas", &valueP);
+ xmlrpc_struct_read_value(&env, structP, "foo", &valueP);
TEST_NO_FAULT(&env);
- TEST(valueP == i1);
+ TEST(valueP == fooValueP);
xmlrpc_DECREF(valueP);
xmlrpc_struct_read_value(&env, structP, "doesn't_exist", &valueP);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- xmlrpc_struct_read_value_v(&env, structP, aasStringP, &valueP);
+ xmlrpc_struct_read_value_v(&env, structP, fooStringP, &valueP);
TEST_NO_FAULT(&env);
- TEST(valueP == i1);
+ TEST(valueP == fooValueP);
xmlrpc_DECREF(valueP);
xmlrpc_struct_read_value_v(&env, structP, bogusKeyStringP, &valueP);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- xmlrpc_struct_read_value(&env, i1, "aas", &valueP);
+ xmlrpc_struct_read_value(&env, fooValueP, "foo", &valueP);
TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- /* obsolete "get" interface */
+ /* obsolete "get" interface. Note that it does not update the
+ reference count of the xmlrpc_value it returns.
+ */
- valueP = xmlrpc_struct_get_value(&env, structP, "aas");
+ valueP = xmlrpc_struct_get_value(&env, structP, "foo");
TEST_NO_FAULT(&env);
- TEST(valueP == i1);
+ TEST(valueP == fooValueP);
valueP = xmlrpc_struct_get_value(&env, structP, "doesn't_exist");
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
- valueP = xmlrpc_struct_get_value(&env, i1, "foo");
+ valueP = xmlrpc_struct_get_value(&env, fooValueP, "foo");
TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
valueP = xmlrpc_struct_get_value_n(&env, structP, weirdKey, weirdKeyLen);
TEST_NO_FAULT(&env);
- TEST(valueP == i2);
+ TEST(valueP == weirdValueP);
/* Clean up */
- xmlrpc_DECREF(aasStringP);
+ xmlrpc_DECREF(fooStringP);
xmlrpc_DECREF(bogusKeyStringP);
xmlrpc_env_clean(&env);
@@ -1100,8 +1629,6 @@
xmlrpc_struct_read_member(&env, structP, expectedSize, &keyP, &valueP);
TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env);
- xmlrpc_env_init(&env);
for (index = 0; index < expectedSize; ++index) {
xmlrpc_struct_get_key_and_value(&env, structP, index, &keyP, &valueP);
@@ -1113,15 +1640,161 @@
static void
+test_struct_decompose_invalid_format_string(
+ xmlrpc_value * const testStructP) {
+
+ xmlrpc_env env;
+ xmlrpc_int32 ival;
+ xmlrpc_bool bval;
+ char * sval;
+
+ xmlrpc_env_init(&env);
+
+ /* Premature end of format string: */
+
+ xmlrpc_decompose_value(&env, testStructP, "{");
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s", "baz");
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s:", "baz");
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s:", "baz");
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s:b", "baz", &bval);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,", "baz", &bval);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,*", "baz", &bval);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ /* Key not 's' */
+ xmlrpc_decompose_value(&env, testStructP, "{i:s,s:i,*}",
+ "baz", &sval,
+ "foo", &ival);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ /* Missing colon */
+ xmlrpc_decompose_value(&env, testStructP, "{is,s:i,*}",
+ "baz", &sval,
+ "foo", &ival);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ /* Missing comma */
+ xmlrpc_decompose_value(&env, testStructP, "{i:ss:i,*}",
+ "baz", &sval,
+ "foo", &ival);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ /* Undefined format specifier */
+ xmlrpc_decompose_value(&env, testStructP, "{s:Q,*}",
+ "baz", &sval);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ /* No * at end */
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,s:s,s:i}",
+ "baz", &bval,
+ "foo", &sval,
+ "bar", &ival);
+ TEST_FAULT(&env, XMLRPC_INTERNAL_ERROR);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+test_struct_decompose(xmlrpc_value * const testStructP) {
+
+ xmlrpc_env env;
+
+ xmlrpc_int32 ival;
+ xmlrpc_bool bval;
+ char * sval;
+ xmlrpc_value * topStructP;
+ xmlrpc_value * value1P;
+
+ xmlrpc_env_init(&env);
+
+ /* Make a test struct */
+ topStructP = xmlrpc_build_value(&env, "{s:S,s:s}",
+ "key1", testStructP,
+ "key2", "my_string_value");
+ TEST_NO_FAULT(&env);
+
+ test_struct_decompose_invalid_format_string(testStructP);
+
+ /* Decompose a struct */
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,s:s,s:i,*}",
+ "baz", &bval,
+ "foo", &sval,
+ "bar", &ival);
+ TEST_NO_FAULT(&env);
+ TEST(ival == 1);
+ TEST(!bval);
+ TEST(streq(sval, "Hello!"));
+ free(sval);
+
+ /* Decompose a deep struct */
+
+ xmlrpc_decompose_value(&env, topStructP, "{s:S,*}", "key1", &value1P);
+ TEST_NO_FAULT(&env);
+ TEST(xmlrpc_value_type(value1P) == XMLRPC_TYPE_STRUCT);
+ xmlrpc_DECREF(value1P);
+
+ xmlrpc_decompose_value(&env, topStructP, "{s:{s:b,s:s,s:i,*},*}",
+ "key1",
+ "baz", &bval,
+ "foo", &sval,
+ "bar", &ival);
+ TEST_NO_FAULT(&env);
+
+ /* First value of wrong type */
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,s:i,*}",
+ "baz", &sval,
+ "foo", &ival);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+
+ /* Subsequent value of wrong type */
+ xmlrpc_decompose_value(&env, testStructP, "{s:s,s:i,*}",
+ "foo", &sval,
+ "baz", &bval);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+
+ /* Nonexistent key */
+ xmlrpc_decompose_value(&env, testStructP, "{s:b,s:i,*}",
+ "baz", &bval,
+ "nosuch", &sval);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
+
+ /* Error subsequent to nested value */
+ xmlrpc_decompose_value(&env, topStructP, "{s:{s:s,*},s:i,*}",
+ "key1",
+ "foo", &sval,
+ "key2", &ival);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
+
+ xmlrpc_DECREF(topStructP);
+
+ xmlrpc_env_clean(&env);
+}
+
+
+
+static void
test_struct (void) {
- xmlrpc_env env, env2;
+ xmlrpc_env env;
+ xmlrpc_value * value1P;
xmlrpc_value *s, *i, *i1, *i2, *i3, *key, *value;
size_t size;
int present;
- xmlrpc_int32 ival;
xmlrpc_bool bval;
- char *sval;
char const weirdKey[] = {'f', 'o', 'o', '\0', 'b', 'a', 'r'};
xmlrpc_env_init(&env);
@@ -1150,44 +1823,53 @@
TEST_NO_FAULT(&env);
TEST(size == 1);
- /* Insert two more items with conflicting hash codes. (We assume that
- ** nobody has changed the hash function.) */
- xmlrpc_struct_set_value(&env, s, "bar", i2);
- TEST_NO_FAULT(&env);
- xmlrpc_struct_set_value(&env, s, "aas", i3);
+ /* Insert an item whose key has the same hash value as "foo". */
+ xmlrpc_struct_set_value(&env, s, "qmdebdw", i2);
TEST_NO_FAULT(&env);
size = xmlrpc_struct_size(&env, s);
TEST_NO_FAULT(&env);
- TEST(size == 3);
+ TEST(size == 2);
+ i = xmlrpc_struct_get_value(&env, s, "foo");
+ TEST_NO_FAULT(&env);
+ TEST(i == i1);
+ i = xmlrpc_struct_get_value(&env, s, "qmdebdw");
+ TEST_NO_FAULT(&env);
+ TEST(i == i2);
/* Replace an existing element with a different element. */
- xmlrpc_struct_set_value(&env, s, "aas", i1);
+ xmlrpc_struct_set_value(&env, s, "foo", i3);
TEST_NO_FAULT(&env);
size = xmlrpc_struct_size(&env, s);
TEST_NO_FAULT(&env);
- TEST(size == 3);
+ TEST(size == 2);
+ i = xmlrpc_struct_get_value(&env, s, "foo");
+ TEST_NO_FAULT(&env);
+ TEST(i == i3);
/* Insert an item with a NUL in the key */
xmlrpc_struct_set_value_n(&env, s, weirdKey, sizeof(weirdKey), i2);
TEST_NO_FAULT(&env);
size = xmlrpc_struct_size(&env, s);
TEST_NO_FAULT(&env);
- TEST(size == 4);
+ TEST(size == 3);
- test_struct_get_element(s, i1, i2, weirdKey, sizeof(weirdKey));
+ test_struct_get_element(s, i3, i2, weirdKey, sizeof(weirdKey));
/* Replace an existing element with the same element (tricky). */
- xmlrpc_struct_set_value(&env, s, "aas", i1);
+ xmlrpc_struct_set_value(&env, s, "foo", i3);
TEST_NO_FAULT(&env);
size = xmlrpc_struct_size(&env, s);
TEST_NO_FAULT(&env);
- TEST(size == 4);
- i = xmlrpc_struct_get_value(&env, s, "aas");
+ TEST(size == 3);
+ i = xmlrpc_struct_get_value(&env, s, "foo");
TEST_NO_FAULT(&env);
- TEST(i == i1);
+ TEST(i == i3);
/* Test for the presence and absence of elements. */
- present = xmlrpc_struct_has_key(&env, s, "aas");
+ present = xmlrpc_struct_has_key(&env, s, "foo");
+ TEST_NO_FAULT(&env);
+ TEST(present);
+ present = xmlrpc_struct_has_key(&env, s, "qmdebdw");
TEST_NO_FAULT(&env);
TEST(present);
present = xmlrpc_struct_has_key(&env, s, "bogus");
@@ -1195,37 +1877,28 @@
TEST(!present);
/* Make sure our typechecks work correctly. */
- xmlrpc_env_init(&env2);
- xmlrpc_struct_size(&env2, i1);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
+ xmlrpc_struct_size(&env, i1);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_init(&env2);
- xmlrpc_struct_has_key(&env2, i1, "foo");
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
+ xmlrpc_struct_has_key(&env, i1, "foo");
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_init(&env2);
- xmlrpc_struct_set_value(&env2, i1, "foo", i2);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
+ xmlrpc_struct_set_value(&env, i1, "foo", i2);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
- xmlrpc_env_init(&env2);
- xmlrpc_struct_set_value_v(&env2, s, s, i2);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
+ xmlrpc_struct_set_value_v(&env, s, s, i2);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
/* Test cleanup code (w/memprof). */
xmlrpc_DECREF(s);
- /* Build a struct using our automagic struct builder. */
s = xmlrpc_build_value(&env, "{s:s,s:i,s:b}",
"foo", "Hello!",
"bar", (xmlrpc_int32) 1,
"baz", (xmlrpc_bool) 0);
TEST_NO_FAULT(&env);
TEST(s != NULL);
- TEST(XMLRPC_TYPE_STRUCT == xmlrpc_value_type(s));
+ TEST(xmlrpc_value_type(s) == XMLRPC_TYPE_STRUCT);
size = xmlrpc_struct_size(&env, s);
TEST_NO_FAULT(&env);
TEST(size == 3);
@@ -1238,60 +1911,30 @@
present = xmlrpc_struct_has_key(&env, s, "baz");
TEST_NO_FAULT(&env);
TEST(present);
- i = xmlrpc_struct_get_value(&env, s, "baz");
+ xmlrpc_struct_read_value(&env, s, "baz", &value1P);
TEST_NO_FAULT(&env);
- xmlrpc_decompose_value(&env, i, "b", &bval);
+ xmlrpc_read_bool(&env, value1P, &bval);
TEST_NO_FAULT(&env);
TEST(!bval);
+ xmlrpc_DECREF(value1P);
testStructReadout(s, 3);
- /* Test our automagic struct parser. */
- xmlrpc_decompose_value(&env, s, "{s:b,s:s,s:i,*}",
- "baz", &bval,
- "foo", &sval,
- "bar", &ival);
- TEST_NO_FAULT(&env);
- TEST(ival == 1);
- TEST(!bval);
- TEST(strcmp(sval, "Hello!") == 0);
- free(sval);
-
- /* Test automagic struct parser with value of wrong type. */
- xmlrpc_env_init(&env2);
- xmlrpc_decompose_value(&env2, s, "{s:b,s:i,*}",
- "baz", &bval,
- "foo", &sval);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
- xmlrpc_env_clean(&env2);
-
- /* Test automagic struct parser with bad key. */
- xmlrpc_env_init(&env2);
- xmlrpc_decompose_value(&env2, s, "{s:b,s:i,*}",
- "baz", &bval,
- "nosuch", &sval);
- TEST_FAULT(&env2, XMLRPC_INDEX_ERROR);
- xmlrpc_env_clean(&env2);
+ test_struct_decompose(s);
/* Test type check. */
- xmlrpc_env_init(&env2);
- xmlrpc_struct_get_key_and_value(&env2, i1, 0, &key, &value);
- TEST_FAULT(&env2, XMLRPC_TYPE_ERROR);
+ xmlrpc_struct_get_key_and_value(&env, i1, 0, &key, &value);
+ TEST_FAULT(&env, XMLRPC_TYPE_ERROR);
TEST(key == NULL && value == NULL);
- xmlrpc_env_clean(&env2);
/* Test bounds checks. */
- xmlrpc_env_init(&env2);
- xmlrpc_struct_get_key_and_value(&env2, s, -1, &key, &value);
- TEST_FAULT(&env2, XMLRPC_INDEX_ERROR);
+ xmlrpc_struct_get_key_and_value(&env, s, -1, &key, &value);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
TEST(key == NULL && value == NULL);
- xmlrpc_env_clean(&env2);
- xmlrpc_env_init(&env2);
- xmlrpc_struct_get_key_and_value(&env2, s, 3, &key, &value);
- TEST_FAULT(&env2, XMLRPC_INDEX_ERROR);
+ xmlrpc_struct_get_key_and_value(&env, s, 3, &key, &value);
+ TEST_FAULT(&env, XMLRPC_INDEX_ERROR);
TEST(key == NULL && value == NULL);
- xmlrpc_env_clean(&env2);
/* Test cleanup code (w/memprof). */
xmlrpc_DECREF(s);
@@ -1304,19 +1947,20 @@
-
void
test_value(void) {
printf("Running value tests.");
test_value_alloc_dealloc();
- test_value_integer();
+ test_value_int();
test_value_bool();
test_value_double();
test_value_datetime();
test_value_string_no_null();
test_value_string_null();
+ test_value_string_multiline();
+ test_value_string_cr();
test_value_string_wide();
test_value_base64();
test_value_array();
@@ -1327,6 +1971,7 @@
test_value_AS_typecheck();
test_value_cptr();
test_value_nil();
+ test_value_i8();
test_value_type_mismatch();
test_value_invalid_type();
test_value_missing_array_delim();
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.c Mon May 26 12:59:57 2008
@@ -1,6 +1,6 @@
#include <stddef.h>
-#define XML_PROLOGUE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+#include "xml_data.h"
#define RAW_STRING_DATA \
"<value><array><data>\r\n" \
@@ -31,14 +31,6 @@
"</params>\r\n"
"</methodCall>\r\n";
-char const serialized_response[] =
- XML_PROLOGUE
- "<methodResponse>\r\n"
- "<params>\r\n"
- "<param><value><i4>30</i4></value></param>\r\n"
- "</params>\r\n"
- "</methodResponse>\r\n";
-
char const serialized_fault[] =
XML_PROLOGUE
"<methodResponse>\r\n"
@@ -56,8 +48,10 @@
char const expat_error_data[] =
XML_PROLOGUE \
"<foo><bar>abc</bar><baz></baz>\r\n";
+ /* Invalid because there's no closing </foo> */
+
-char const correct_value[] =
+char const good_response_xml[] =
XML_PROLOGUE
"<methodResponse><params><param>\r\n"
"<value><array><data>\r\n"
@@ -100,8 +94,12 @@
VALUE_HEADER"<i4>0 </i4>"VALUE_FOOTER,
VALUE_HEADER"<boolean>2</boolean>"VALUE_FOOTER,
VALUE_HEADER"<boolean>-1</boolean>"VALUE_FOOTER,
- VALUE_HEADER"<double> 0.0</double>"VALUE_FOOTER,
+ VALUE_HEADER"<double></double>"VALUE_FOOTER,
VALUE_HEADER"<double>0.0 </double>"VALUE_FOOTER,
+ VALUE_HEADER"<double>a</double>"VALUE_FOOTER,
+ VALUE_HEADER"<double>1.1.1</double>"VALUE_FOOTER,
+ VALUE_HEADER"<double>1a</double>"VALUE_FOOTER,
+ VALUE_HEADER"<double>1.1a</double>"VALUE_FOOTER,
VALUE_HEADER"<array></array>"VALUE_FOOTER,
VALUE_HEADER"<array><data></data><data></data></array>"VALUE_FOOTER,
VALUE_HEADER"<array><data></data><data></data></array>"VALUE_FOOTER,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/test/xml_data.h Mon May 26 12:59:57 2008
@@ -1,15 +1,18 @@
+#ifndef XML_DATA_H_INCLUDED
+#define XML_DATA_H_INCLUDED
+
+#define XML_PROLOGUE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"
+
extern char const serialized_data[];
extern char const serialized_call[];
-extern char const serialized_response[];
-
extern char const serialized_fault[];
extern char const expat_data[];
extern char const expat_error_data[];
-extern char const correct_value[];
+extern char const good_response_xml[];
extern char const unparseable_value[];
@@ -18,3 +21,5 @@
extern const char *(bad_responses[]);
extern const char *(bad_calls[]);
+
+#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_array.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_array.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_array.c Mon May 26 12:59:57 2008
@@ -10,10 +10,12 @@
#include <stddef.h>
#include <stdlib.h>
+#include "xmlrpc-c/util.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+
void
xmlrpc_abort_if_array_bad(xmlrpc_value * const arrayP) {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_authcookie.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_authcookie.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_authcookie.c Mon May 26 12:59:57 2008
@@ -68,7 +68,7 @@
/* Set HTTP_COOKIE_AUTH to the character representation of the
encoded string.
*/
-#ifdef HAVE_SETENV
+#if HAVE_SETENV
setenv("HTTP_COOKIE_AUTH",
XMLRPC_MEMBLOCK_CONTENTS(char, token),
1);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_client.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_client.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_client.c Mon May 26 12:59:57 2008
@@ -1,33 +1,11 @@
-/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE. */
+/* Copyright information is at end of file */
#include "xmlrpc_config.h"
#undef PACKAGE
#undef VERSION
+#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
@@ -37,8 +15,10 @@
#include "bool.h"
#include "mallocvar.h"
+
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/client.h"
#include "xmlrpc-c/client_int.h"
/* transport_config.h defines XMLRPC_DEFAULT_TRANSPORT,
@@ -46,203 +26,426 @@
MUST_BUILD_LIBWWW_CLIENT
*/
#include "transport_config.h"
-
-#if MUST_BUILD_WININET_CLIENT
-#include "xmlrpc_wininet_transport.h"
-#endif
-#if MUST_BUILD_CURL_CLIENT
-#include "xmlrpc_curl_transport.h"
-#endif
-#if MUST_BUILD_LIBWWW_CLIENT
-#include "xmlrpc_libwww_transport.h"
-#endif
+#include "version.h"
struct xmlrpc_client {
/*----------------------------------------------------------------------------
This represents a client object.
-----------------------------------------------------------------------------*/
+ bool myTransport;
+ /* The transport described below was created by this object;
+ No one else knows it exists and this object is responsible
+ for destroying it.
+ */
struct xmlrpc_client_transport * transportP;
- struct xmlrpc_client_transport_ops clientTransportOps;
+ struct xmlrpc_client_transport_ops transportOps;
+ xmlrpc_dialect dialect;
};
-typedef struct xmlrpc_call_info
-{
- /* These fields are used when performing asynchronous calls.
- ** The _asynch_data_holder contains server_url, method_name and
- ** param_array, so it's the only thing we need to free. */
- xmlrpc_value *_asynch_data_holder;
- char *server_url;
- char *method_name;
- xmlrpc_value *param_array;
- xmlrpc_response_handler callback;
- void *user_data;
+struct xmlrpc_call_info {
+ /* This is all the information needed to finish executing a started
+ RPC.
+
+ You don't need this for an RPC the user executes synchronously,
+ because then you can just use the storage in which the user passed
+ his arguments. But for asynchronous, the user will take back his
+ storage, and we need to keep this info in our own.
+ */
+
+ struct {
+ /* This are arguments to pass to the completion function. It
+ doesn't make sense to use them for anything else. In fact, it
+ really doesn't make sense for them to be arguments to the
+ completion function, but they are historically. */
+ const char * serverUrl;
+ const char * methodName;
+ xmlrpc_value * paramArrayP;
+ void * userData;
+ } completionArgs;
+ xmlrpc_response_handler completionFn;
+
/* The serialized XML data passed to this call. We keep this around
** for use by our source_anchor field. */
xmlrpc_mem_block *serialized_xml;
-} xmlrpc_call_info;
+};
+
-static bool clientInitialized = FALSE;
/*=========================================================================
-** Initialization and Shutdown
-**=========================================================================
-*/
+ Global Constant Setup/Teardown
+=========================================================================*/
-static struct xmlrpc_client client;
- /* Some day, we need to make this dynamically allocated, so there can
- be more than one client per program and just generally to provide
- a cleaner interface.
- */
+static void
+callTransportSetup(xmlrpc_env * const envP,
+ xmlrpc_transport_setup setupFn) {
-extern void
-xmlrpc_client_init(int const flags,
- const char * const appname,
- const char * const appversion) {
+ if (setupFn)
+ setupFn(envP);
+}
- struct xmlrpc_clientparms clientparms;
- /* As our interface does not allow for failure, we just fail silently ! */
-
- xmlrpc_env env;
- xmlrpc_env_init(&env);
- clientparms.transport = XMLRPC_DEFAULT_TRANSPORT;
+static void
+setupTransportGlobalConst(xmlrpc_env * const envP) {
+
+#if MUST_BUILD_WININET_CLIENT
+ if (!envP->fault_occurred)
+ callTransportSetup(envP,
+ xmlrpc_wininet_transport_ops.setup_global_const);
+#endif
+#if MUST_BUILD_CURL_CLIENT
+ if (!envP->fault_occurred)
+ callTransportSetup(envP,
+ xmlrpc_curl_transport_ops.setup_global_const);
+#endif
+#if MUST_BUILD_LIBWWW_CLIENT
+ if (!envP->fault_occurred)
+ callTransportSetup(envP,
+ xmlrpc_libwww_transport_ops.setup_global_const);
+#endif
+}
- xmlrpc_client_init2(&env, flags,
- appname, appversion,
- &clientparms, XMLRPC_CPSIZE(transport));
- xmlrpc_env_clean(&env);
+
+static void
+callTransportTeardown(xmlrpc_transport_teardown teardownFn) {
+
+ if (teardownFn)
+ teardownFn();
}
-const char *
-xmlrpc_client_get_default_transport(xmlrpc_env * const env ATTR_UNUSED) {
+static void
+teardownTransportGlobalConst(void) {
- return XMLRPC_DEFAULT_TRANSPORT;
+#if MUST_BUILD_WININET_CLIENT
+ callTransportTeardown(
+ xmlrpc_wininet_transport_ops.teardown_global_const);
+#endif
+#if MUST_BUILD_CURL_CLIENT
+ callTransportTeardown(
+ xmlrpc_curl_transport_ops.teardown_global_const);
+#endif
+#if MUST_BUILD_LIBWWW_CLIENT
+ callTransportTeardown(
+ xmlrpc_libwww_transport_ops.teardown_global_const);
+#endif
}
+/*=========================================================================
+ Global stuff (except the global client)
+=========================================================================*/
+
+static unsigned int constSetupCount = 0;
+
+
+void
+xmlrpc_client_setup_global_const(xmlrpc_env * const envP) {
+/*----------------------------------------------------------------------------
+ Set up pseudo-constant global variables (they'd be constant, except that
+ the library loader doesn't set them. An explicit call from the loaded
+ program does).
+
+ This function is not thread-safe. The user is supposed to call it
+ (perhaps cascaded down from a multitude of higher level libraries)
+ as part of early program setup, when the program is only one thread.
+-----------------------------------------------------------------------------*/
+ if (constSetupCount == 0)
+ setupTransportGlobalConst(envP);
+
+ ++constSetupCount;
+}
+
+
+
+void
+xmlrpc_client_teardown_global_const(void) {
+/*----------------------------------------------------------------------------
+ Complement to xmlrpc_client_setup_global_const().
+
+ This function is not thread-safe. The user is supposed to call it
+ (perhaps cascaded down from a multitude of higher level libraries)
+ as part of final program cleanup, when the program is only one thread.
+-----------------------------------------------------------------------------*/
+ assert(constSetupCount > 0);
+
+ --constSetupCount;
+
+ if (constSetupCount == 0)
+ teardownTransportGlobalConst();
+}
+
+
+
+unsigned int const xmlrpc_client_version_major = XMLRPC_VERSION_MAJOR;
+unsigned int const xmlrpc_client_version_minor = XMLRPC_VERSION_MINOR;
+unsigned int const xmlrpc_client_version_point = XMLRPC_VERSION_POINT;
+
+
+/*=========================================================================
+ Client Create/Destroy
+=========================================================================*/
+
static void
-setupTransport(xmlrpc_env * const envP,
- const char * const transportName) {
+getTransportOps(
+ xmlrpc_env * const envP,
+ const char * const transportName,
+ const struct xmlrpc_client_transport_ops ** const opsPP) {
- if (FALSE) {
+ if (false) {
}
#if MUST_BUILD_WININET_CLIENT
else if (strcmp(transportName, "wininet") == 0)
- client.clientTransportOps = xmlrpc_wininet_transport_ops;
+ *opsPP = &xmlrpc_wininet_transport_ops;
#endif
#if MUST_BUILD_CURL_CLIENT
else if (strcmp(transportName, "curl") == 0)
- client.clientTransportOps = xmlrpc_curl_transport_ops;
+ *opsPP = &xmlrpc_curl_transport_ops;
#endif
#if MUST_BUILD_LIBWWW_CLIENT
else if (strcmp(transportName, "libwww") == 0)
- client.clientTransportOps = xmlrpc_libwww_transport_ops;
+ *opsPP = &xmlrpc_libwww_transport_ops;
#endif
else
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unrecognized XML transport name '%s'", transportName);
+ xmlrpc_faultf(envP, "Unrecognized XML transport name '%s'",
+ transportName);
}
+struct xportParms {
+ const void * parmsP;
+ size_t size;
+};
+
+
+
static void
getTransportParmsFromClientParms(
xmlrpc_env * const envP,
const struct xmlrpc_clientparms * const clientparmsP,
- unsigned int const parm_size,
- const struct xmlrpc_xportparms ** const transportparmsPP,
- size_t * const transportparm_sizeP) {
+ unsigned int const parmSize,
+ struct xportParms * const xportParmsP) {
- if (parm_size < XMLRPC_CPSIZE(transportparmsP) ||
+ if (parmSize < XMLRPC_CPSIZE(transportparmsP) ||
clientparmsP->transportparmsP == NULL) {
- *transportparmsPP = NULL;
- *transportparm_sizeP = 0;
+ xportParmsP->parmsP = NULL;
+ xportParmsP->size = 0;
} else {
- *transportparmsPP = clientparmsP->transportparmsP;
- if (parm_size < XMLRPC_CPSIZE(transportparm_size))
+ xportParmsP->parmsP = clientparmsP->transportparmsP;
+ if (parmSize < XMLRPC_CPSIZE(transportparm_size))
xmlrpc_faultf(envP, "Your 'clientparms' argument contains the "
"transportparmsP member, "
"but no transportparms_size member");
else
- *transportparm_sizeP = clientparmsP->transportparm_size;
+ xportParmsP->size = clientparmsP->transportparm_size;
}
}
static void
-getTransportInfo(xmlrpc_env * const envP,
- const struct xmlrpc_clientparms * const clientparmsP,
- unsigned int const parm_size,
- const char ** const transportNameP,
- const struct xmlrpc_xportparms ** const transportparmsPP,
- size_t * const transportparm_sizeP) {
-
- getTransportParmsFromClientParms(
- envP, clientparmsP, parm_size,
- transportparmsPP, transportparm_sizeP);
+getTransportInfo(
+ xmlrpc_env * const envP,
+ const struct xmlrpc_clientparms * const clientparmsP,
+ unsigned int const parmSize,
+ const char ** const transportNameP,
+ struct xportParms * const transportParmsP,
+ const struct xmlrpc_client_transport_ops ** const transportOpsPP,
+ xmlrpc_client_transport ** const transportPP) {
+
+ const char * transportNameParm;
+ xmlrpc_client_transport * transportP;
+ const struct xmlrpc_client_transport_ops * transportOpsP;
+
+ if (parmSize < XMLRPC_CPSIZE(transport))
+ transportNameParm = NULL;
+ else
+ transportNameParm = clientparmsP->transport;
- if (!envP->fault_occurred) {
- if (parm_size < XMLRPC_CPSIZE(transport) ||
- clientparmsP->transport == NULL) {
+ if (parmSize < XMLRPC_CPSIZE(transportP))
+ transportP = NULL;
+ else
+ transportP = clientparmsP->transportP;
- /* He didn't specify a transport. Use the default */
+ if (parmSize < XMLRPC_CPSIZE(transportOpsP))
+ transportOpsP = NULL;
+ else
+ transportOpsP = clientparmsP->transportOpsP;
- *transportNameP = xmlrpc_client_get_default_transport(envP);
- if (*transportparmsPP)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
+ if ((transportOpsP && !transportP) || (transportP && ! transportOpsP))
+ xmlrpc_faultf(envP, "'transportOpsP' and 'transportP' go together. "
+ "You must specify both or neither");
+ else if (transportNameParm && transportP)
+ xmlrpc_faultf(envP, "You cannot specify both 'transport' and "
+ "'transportP' transport parameters.");
+ else if (transportP)
+ *transportNameP = NULL;
+ else if (transportNameParm)
+ *transportNameP = transportNameParm;
+ else
+ *transportNameP = xmlrpc_client_get_default_transport(envP);
+
+ *transportOpsPP = transportOpsP;
+ *transportPP = transportP;
+
+ if (!envP->fault_occurred) {
+ getTransportParmsFromClientParms(
+ envP, clientparmsP, parmSize, transportParmsP);
+
+ if (!envP->fault_occurred) {
+ if (transportParmsP->parmsP && !transportNameParm)
+ xmlrpc_faultf(
+ envP,
"You specified transport parameters, but did not "
- "specify a transport type. Parameters are specific to "
- "a particular type.");
- } else
- *transportNameP = clientparmsP->transport;
+ "specify a transport type. Parameters are specific "
+ "to a particular type.");
+ }
}
}
-void
-xmlrpc_client_init2(xmlrpc_env * const envP,
- int const flags,
- const char * const appname,
- const char * const appversion,
- const struct xmlrpc_clientparms * const clientparmsP,
- unsigned int const parm_size) {
+static void
+getDialectFromClientParms(
+ const struct xmlrpc_clientparms * const clientparmsP,
+ unsigned int const parmSize,
+ xmlrpc_dialect * const dialectP) {
+
+ if (parmSize < XMLRPC_CPSIZE(dialect))
+ *dialectP = xmlrpc_dialect_i8;
+ else
+ *dialectP = clientparmsP->dialect;
+}
+
- if (clientInitialized)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has already been initialized "
- "(need to call xmlrpc_client_cleanup() before you can "
- "reinitialize).");
- else {
- const char * transportName;
- const struct xmlrpc_xportparms * transportparmsP;
- size_t transportparm_size;
- getTransportInfo(envP, clientparmsP, parm_size, &transportName,
- &transportparmsP, &transportparm_size);
+static void
+clientCreate(
+ xmlrpc_env * const envP,
+ bool const myTransport,
+ const struct xmlrpc_client_transport_ops * const transportOpsP,
+ struct xmlrpc_client_transport * const transportP,
+ xmlrpc_dialect const dialect,
+ xmlrpc_client ** const clientPP) {
+
+ XMLRPC_ASSERT_PTR_OK(transportOpsP);
+ XMLRPC_ASSERT_PTR_OK(transportP);
+ XMLRPC_ASSERT_PTR_OK(clientPP);
+
+ if (constSetupCount == 0) {
+ xmlrpc_faultf(envP,
+ "You have not called "
+ "xmlrpc_client_setup_global_const().");
+ /* Impl note: We can't just call it now because it isn't
+ thread-safe.
+ */
+ } else {
+ xmlrpc_client * clientP;
+
+ MALLOCVAR(clientP);
+ if (clientP == NULL)
+ xmlrpc_faultf(envP, "Unable to allocate memory for "
+ "client descriptor.");
+ else {
+ clientP->myTransport = myTransport;
+ clientP->transportOps = *transportOpsP;
+ clientP->transportP = transportP;
+ clientP->dialect = dialect;
+
+ *clientPP = clientP;
+ }
+ }
+}
+
+
+
+static void
+createTransportAndClient(
+ xmlrpc_env * const envP,
+ const char * const transportName,
+ const void * const transportparmsP,
+ size_t const transportparmSize,
+ int const flags,
+ const char * const appname,
+ const char * const appversion,
+ xmlrpc_dialect const dialect,
+ xmlrpc_client ** const clientPP) {
+
+ const struct xmlrpc_client_transport_ops * transportOpsP;
+
+ getTransportOps(envP, transportName, &transportOpsP);
+ if (!envP->fault_occurred) {
+ xmlrpc_client_transport * transportP;
+
+ /* The following call is not thread-safe */
+ transportOpsP->create(
+ envP, flags, appname, appversion,
+ transportparmsP, transportparmSize,
+ &transportP);
if (!envP->fault_occurred) {
- setupTransport(envP, transportName);
- if (!envP->fault_occurred) {
- client.clientTransportOps.create(
- envP, flags, appname, appversion,
- transportparmsP, transportparm_size,
- &client.transportP);
- if (!envP->fault_occurred)
- clientInitialized = TRUE;
+ bool const myTransportTrue = true;
+
+ clientCreate(envP, myTransportTrue, transportOpsP, transportP,
+ dialect, clientPP);
+
+ if (envP->fault_occurred)
+ transportOpsP->destroy(transportP);
+ }
+ }
+}
+
+
+
+void
+xmlrpc_client_create(xmlrpc_env * const envP,
+ int const flags,
+ const char * const appname,
+ const char * const appversion,
+ const struct xmlrpc_clientparms * const clientparmsP,
+ unsigned int const parmSize,
+ xmlrpc_client ** const clientPP) {
+
+ XMLRPC_ASSERT_PTR_OK(clientPP);
+
+ if (constSetupCount == 0) {
+ xmlrpc_faultf(envP,
+ "You have not called "
+ "xmlrpc_client_setup_global_const().");
+ /* Impl note: We can't just call it now because it isn't
+ thread-safe.
+ */
+ } else {
+ const char * transportName;
+ struct xportParms transportparms;
+ const struct xmlrpc_client_transport_ops * transportOpsP;
+ xmlrpc_client_transport * transportP;
+ xmlrpc_dialect dialect;
+
+ getTransportInfo(envP, clientparmsP, parmSize, &transportName,
+ &transportparms, &transportOpsP, &transportP);
+
+ getDialectFromClientParms(clientparmsP, parmSize, &dialect);
+
+ if (!envP->fault_occurred) {
+ if (transportName)
+ createTransportAndClient(envP, transportName,
+ transportparms.parmsP,
+ transportparms.size,
+ flags, appname, appversion, dialect,
+ clientPP);
+ else {
+ bool myTransportFalse = false;
+ clientCreate(envP, myTransportFalse,
+ transportOpsP, transportP, dialect, clientPP);
}
}
}
@@ -251,36 +454,41 @@
void
-xmlrpc_client_cleanup() {
+xmlrpc_client_destroy(xmlrpc_client * const clientP) {
- XMLRPC_ASSERT(clientInitialized);
+ XMLRPC_ASSERT_PTR_OK(clientP);
- client.clientTransportOps.destroy(client.transportP);
-
- clientInitialized = FALSE;
+ if (clientP->myTransport)
+ clientP->transportOps.destroy(clientP->transportP);
+
+ free(clientP);
}
+/*=========================================================================
+ Call/Response Utilities
+=========================================================================*/
+
static void
makeCallXml(xmlrpc_env * const envP,
const char * const methodName,
xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect,
xmlrpc_mem_block ** const callXmlPP) {
XMLRPC_ASSERT_VALUE_OK(paramArrayP);
XMLRPC_ASSERT_PTR_OK(callXmlPP);
if (methodName == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "method name argument is NULL pointer");
+ xmlrpc_faultf(envP, "method name argument is NULL pointer");
else {
xmlrpc_mem_block * callXmlP;
callXmlP = XMLRPC_MEMBLOCK_NEW(char, envP, 0);
if (!envP->fault_occurred) {
- xmlrpc_serialize_call(envP, callXmlP, methodName, paramArrayP);
+ xmlrpc_serialize_call2(envP, callXmlP, methodName, paramArrayP,
+ dialect);
*callXmlPP = callXmlP;
@@ -292,49 +500,75 @@
+/*=========================================================================
+ Synchronous Call
+=========================================================================*/
+
void
-xmlrpc_client_transport_call(
+xmlrpc_client_transport_call2(
xmlrpc_env * const envP,
- void * const reserved ATTR_UNUSED,
- /* for client handle */
+ xmlrpc_client * const clientP,
const xmlrpc_server_info * const serverP,
xmlrpc_mem_block * const callXmlP,
xmlrpc_mem_block ** const respXmlPP) {
- if (!clientInitialized)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has not been initialized "
- "(need to call xmlrpc_client_init2()).");
- else {
- struct xmlrpc_client * const clientP = &client;
- /* Some day, the library will be re-entrant and this will be
- passed in.
- */
-
- XMLRPC_ASSERT_PTR_OK(serverP);
- XMLRPC_ASSERT_PTR_OK(callXmlP);
- XMLRPC_ASSERT_PTR_OK(respXmlPP);
-
- clientP->clientTransportOps.call(
- envP, clientP->transportP, serverP, callXmlP,
- respXmlPP);
- }
+ XMLRPC_ASSERT_PTR_OK(clientP);
+ XMLRPC_ASSERT_PTR_OK(serverP);
+ XMLRPC_ASSERT_PTR_OK(callXmlP);
+ XMLRPC_ASSERT_PTR_OK(respXmlPP);
+
+ clientP->transportOps.call(
+ envP, clientP->transportP, serverP, callXmlP,
+ respXmlPP);
}
-
+
static void
-clientCallServerParams(xmlrpc_env * const envP,
- struct xmlrpc_client * const clientP,
- const xmlrpc_server_info * const serverP,
- const char * const methodName,
- xmlrpc_value * const paramArrayP,
- xmlrpc_value ** const resultPP) {
+parseResponse(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const respXmlP,
+ xmlrpc_value ** const resultPP,
+ int * const faultCodeP,
+ const char ** const faultStringP) {
+
+ xmlrpc_env respEnv;
+
+ xmlrpc_env_init(&respEnv);
+
+ xmlrpc_parse_response2(
+ &respEnv,
+ XMLRPC_MEMBLOCK_CONTENTS(char, respXmlP),
+ XMLRPC_MEMBLOCK_SIZE(char, respXmlP),
+ resultPP, faultCodeP, faultStringP);
+
+ if (respEnv.fault_occurred)
+ xmlrpc_env_set_fault_formatted(
+ envP, respEnv.fault_code,
+ "Unable to make sense of XML-RPC response from server. "
+ "%s. Use XMLRPC_TRACE_XML to see for yourself",
+ respEnv.fault_string);
+
+ xmlrpc_env_clean(&respEnv);
+}
+
+
+
+void
+xmlrpc_client_call2(xmlrpc_env * const envP,
+ struct xmlrpc_client * const clientP,
+ const xmlrpc_server_info * const serverInfoP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_value ** const resultPP) {
xmlrpc_mem_block * callXmlP;
- makeCallXml(envP, methodName, paramArrayP, &callXmlP);
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT_PTR_OK(clientP);
+ XMLRPC_ASSERT_PTR_OK(serverInfoP);
+ XMLRPC_ASSERT_PTR_OK(paramArrayP);
+
+ makeCallXml(envP, methodName, paramArrayP, clientP->dialect, &callXmlP);
if (!envP->fault_occurred) {
xmlrpc_mem_block * respXmlP;
@@ -343,17 +577,27 @@
XMLRPC_MEMBLOCK_CONTENTS(char, callXmlP),
XMLRPC_MEMBLOCK_SIZE(char, callXmlP));
- clientP->clientTransportOps.call(
- envP, clientP->transportP, serverP, callXmlP, &respXmlP);
+ clientP->transportOps.call(
+ envP, clientP->transportP, serverInfoP, callXmlP, &respXmlP);
if (!envP->fault_occurred) {
+ int faultCode;
+ const char * faultString;
+
xmlrpc_traceXml("XML-RPC RESPONSE",
XMLRPC_MEMBLOCK_CONTENTS(char, respXmlP),
XMLRPC_MEMBLOCK_SIZE(char, respXmlP));
- *resultPP = xmlrpc_parse_response(
- envP,
- XMLRPC_MEMBLOCK_CONTENTS(char, respXmlP),
- XMLRPC_MEMBLOCK_SIZE(char, respXmlP));
+ parseResponse(envP, respXmlP, resultPP, &faultCode, &faultString);
+
+ if (!envP->fault_occurred) {
+ if (faultString) {
+ xmlrpc_env_set_fault_formatted(
+ envP, faultCode,
+ "RPC failed at server. %s", faultString);
+ xmlrpc_strfree(faultString);
+ } else
+ XMLRPC_ASSERT_VALUE_OK(*resultPP);
+ }
XMLRPC_MEMBLOCK_FREE(char, respXmlP);
}
XMLRPC_MEMBLOCK_FREE(char, callXmlP);
@@ -362,425 +606,142 @@
-xmlrpc_value *
-xmlrpc_client_call_params(xmlrpc_env * const envP,
- const char * const serverUrl,
- const char * const methodName,
- xmlrpc_value * const paramArrayP) {
-
- xmlrpc_value *retval;
-
- XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT_PTR_OK(serverUrl);
-
- if (!clientInitialized)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has not been initialized "
- "(need to call xmlrpc_client_init2()).");
- else {
- struct xmlrpc_client * const clientP = &client;
- /* Some day, the library will be re-entrant and this will be
- passed in.
- */
-
- xmlrpc_server_info * serverP;
-
- /* Build a server info object and make our call. */
- serverP = xmlrpc_server_info_new(envP, serverUrl);
- if (!envP->fault_occurred) {
- clientCallServerParams(envP, clientP, serverP,
- methodName, paramArrayP,
- &retval);
-
- xmlrpc_server_info_free(serverP);
- }
- }
-
- if (!envP->fault_occurred)
- XMLRPC_ASSERT_VALUE_OK(retval);
-
- return retval;
-}
-
-
-
-xmlrpc_value *
-xmlrpc_client_call_server_params(
- xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- const char * const methodName,
- xmlrpc_value * const paramArrayP) {
-
- xmlrpc_value *retval;
-
- XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT_PTR_OK(serverP);
-
- if (!clientInitialized)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has not been initialized "
- "(need to call xmlrpc_client_init2()).");
- else {
- struct xmlrpc_client * const clientP = &client;
- /* Some day, the library will be re-entrant and this will be
- passed in.
- */
-
- clientCallServerParams(envP, clientP, serverP, methodName, paramArrayP,
- &retval);
- }
- if (!envP->fault_occurred)
- XMLRPC_ASSERT_VALUE_OK(retval);
-
- return retval;
-}
-
-
-
-static xmlrpc_value *
-xmlrpc_client_call_va(xmlrpc_env * const envP,
- const char * const server_url,
- const char * const methodName,
- const char * const format,
- va_list args) {
+static void
+clientCall2f_va(xmlrpc_env * const envP,
+ xmlrpc_client * const clientP,
+ const char * const serverUrl,
+ const char * const methodName,
+ const char * const format,
+ xmlrpc_value ** const resultPP,
+ va_list args) {
xmlrpc_value * argP;
- xmlrpc_value * retval;
xmlrpc_env argenv;
const char * suffix;
XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT_PTR_OK(serverUrl);
+ XMLRPC_ASSERT_PTR_OK(methodName);
XMLRPC_ASSERT_PTR_OK(format);
+ XMLRPC_ASSERT_PTR_OK(resultPP);
/* Build our argument value. */
xmlrpc_env_init(&argenv);
xmlrpc_build_value_va(&argenv, format, args, &argP, &suffix);
- if (argenv.fault_occurred) {
+ if (argenv.fault_occurred)
xmlrpc_env_set_fault_formatted(
envP, argenv.fault_code, "Invalid RPC arguments. "
"The format argument must indicate a single array, and the "
"following arguments must correspond to that format argument. "
"The failure is: %s",
argenv.fault_string);
- retval = NULL; /* just to quiet compiler warning */
- } else {
+ else {
XMLRPC_ASSERT_VALUE_OK(argP);
- if (*suffix != '\0') {
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Junk after the argument "
- "specifier: '%s'. There must be exactly one arument.",
- suffix);
- retval = NULL; /* just to quiet compiler warning */
- } else {
- /* Perform the actual XML-RPC call. */
- retval = xmlrpc_client_call_params(
- envP, server_url, methodName, argP);
- if (!envP->fault_occurred)
- XMLRPC_ASSERT_VALUE_OK(retval);
+ if (*suffix != '\0')
+ xmlrpc_faultf(envP, "Junk after the argument specifier: '%s'. "
+ "There must be exactly one argument.",
+ suffix);
+ else {
+ xmlrpc_server_info * serverInfoP;
+
+ serverInfoP = xmlrpc_server_info_new(envP, serverUrl);
+
+ if (!envP->fault_occurred) {
+ /* Perform the actual XML-RPC call. */
+ xmlrpc_client_call2(envP, clientP,
+ serverInfoP, methodName, argP, resultPP);
+ if (!envP->fault_occurred)
+ XMLRPC_ASSERT_VALUE_OK(*resultPP);
+ xmlrpc_server_info_free(serverInfoP);
+ }
}
xmlrpc_DECREF(argP);
}
xmlrpc_env_clean(&argenv);
- return retval;
}
-xmlrpc_value *
-xmlrpc_client_call(xmlrpc_env * const envP,
- const char * const serverUrl,
- const char * const methodName,
- const char * const format,
- ...) {
+void
+xmlrpc_client_call2f(xmlrpc_env * const envP,
+ xmlrpc_client * const clientP,
+ const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_value ** const resultPP,
+ const char * const format,
+ ...) {
- xmlrpc_value * result;
va_list args;
va_start(args, format);
- result = xmlrpc_client_call_va(envP, serverUrl,
- methodName, format, args);
+ clientCall2f_va(envP, clientP, serverUrl,
+ methodName, format, resultPP, args);
va_end(args);
-
- return result;
}
-xmlrpc_value *
-xmlrpc_client_call_server(xmlrpc_env * const envP,
- const xmlrpc_server_info * const serverP,
- const char * const methodName,
- const char * const format,
- ...) {
-
- va_list args;
- xmlrpc_value * paramArrayP;
- xmlrpc_value * retval;
- const char * suffix;
-
- XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT_PTR_OK(format);
+/*=========================================================================
+ Asynchronous Call
+=========================================================================*/
- if (!clientInitialized)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has not been initialized "
- "(need to call xmlrpc_client_init2()).");
+static void
+callInfoSetCompletion(xmlrpc_env * const envP,
+ struct xmlrpc_call_info * const callInfoP,
+ const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_response_handler completionFn,
+ void * const userData) {
+
+ callInfoP->completionFn = completionFn;
+ callInfoP->completionArgs.userData = userData;
+ callInfoP->completionArgs.serverUrl = strdup(serverUrl);
+ if (callInfoP->completionArgs.serverUrl == NULL)
+ xmlrpc_faultf(envP, "Couldn't get memory to store server URL");
else {
- struct xmlrpc_client * const clientP = &client;
- /* Some day, the library will be re-entrant and this will be
- passed in.
- */
-
- /* Build our argument */
- va_start(args, format);
- xmlrpc_build_value_va(envP, format, args, ¶mArrayP, &suffix);
- va_end(args);
-
- if (!envP->fault_occurred) {
- if (*suffix != '\0')
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Junk after the argument "
- "specifier: '%s'. There must be exactly one arument.",
- suffix);
- else
- clientCallServerParams(envP, clientP, serverP,
- methodName, paramArrayP,
- &retval);
-
- xmlrpc_DECREF(paramArrayP);
+ callInfoP->completionArgs.methodName = strdup(methodName);
+ if (callInfoP->completionArgs.methodName == NULL)
+ xmlrpc_faultf(envP, "Couldn't get memory to store method name");
+ else {
+ callInfoP->completionArgs.paramArrayP = paramArrayP;
+ xmlrpc_INCREF(paramArrayP);
}
+ if (envP->fault_occurred)
+ xmlrpc_strfree(callInfoP->completionArgs.serverUrl);
}
- return retval;
-}
-
-
-void
-xmlrpc_client_event_loop_finish_asynch(void) {
- XMLRPC_ASSERT(clientInitialized);
- client.clientTransportOps.finish_asynch(
- client.transportP, timeout_no, 0);
-}
-
-
-
-void
-xmlrpc_client_event_loop_finish_asynch_timeout(xmlrpc_timeout const timeout) {
- XMLRPC_ASSERT(clientInitialized);
- client.clientTransportOps.finish_asynch(
- client.transportP, timeout_yes, timeout);
-}
-
-
-
-static void
-call_info_set_asynch_data(xmlrpc_env * const env,
- xmlrpc_call_info * const info,
- const char * const server_url,
- const char * const method_name,
- xmlrpc_value * const argP,
- xmlrpc_response_handler callback,
- void * const user_data) {
-
- xmlrpc_value *holder;
-
- /* Error-handling preconditions. */
- holder = NULL;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT_PTR_OK(info);
- XMLRPC_ASSERT(info->_asynch_data_holder == NULL);
- XMLRPC_ASSERT_PTR_OK(server_url);
- XMLRPC_ASSERT_PTR_OK(method_name);
- XMLRPC_ASSERT_VALUE_OK(argP);
-
- /* Install our callback and user_data.
- ** (We're not responsible for destroying the user_data.) */
- info->callback = callback;
- info->user_data = user_data;
-
- /* Build an XML-RPC data structure to hold our other data. This makes
- ** copies of server_url and method_name, and increments the reference
- ** to the argument *argP. */
- holder = xmlrpc_build_value(env, "(ssV)",
- server_url, method_name, argP);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Parse the newly-allocated structure into our public member variables.
- ** This doesn't make any new references, so we can dispose of the whole
- ** thing by DECREF'ing the one master reference. Nifty, huh? */
- xmlrpc_parse_value(env, holder, "(ssV)",
- &info->server_url,
- &info->method_name,
- &info->param_array);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Hand over ownership of the holder to the call_info struct. */
- info->_asynch_data_holder = holder;
- holder = NULL;
-
- cleanup:
- if (env->fault_occurred) {
- if (holder)
- xmlrpc_DECREF(holder);
- }
-}
-
-/*=========================================================================
-** xmlrpc_server_info
-**=========================================================================
-*/
-
-xmlrpc_server_info *
-xmlrpc_server_info_new (xmlrpc_env * const env,
- const char * const server_url) {
-
- xmlrpc_server_info *server;
- char *url_copy;
-
- /* Error-handling preconditions. */
- server = NULL;
- url_copy = NULL;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT_PTR_OK(server_url);
-
- /* Allocate our memory blocks. */
- server = (xmlrpc_server_info*) malloc(sizeof(xmlrpc_server_info));
- XMLRPC_FAIL_IF_NULL(server, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for xmlrpc_server_info");
- memset(server, 0, sizeof(xmlrpc_server_info));
- url_copy = (char*) malloc(strlen(server_url) + 1);
- XMLRPC_FAIL_IF_NULL(url_copy, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for server URL");
-
- /* Build our object. */
- strcpy(url_copy, server_url);
- server->_server_url = url_copy;
- server->_http_basic_auth = NULL;
-
- cleanup:
- if (env->fault_occurred) {
- if (url_copy)
- free(url_copy);
- if (server)
- free(server);
- return NULL;
- }
- return server;
-}
-
-xmlrpc_server_info * xmlrpc_server_info_copy(xmlrpc_env *env,
- xmlrpc_server_info *aserver)
-{
- xmlrpc_server_info *server;
- char *url_copy, *auth_copy;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT_PTR_OK(aserver);
-
- /* Error-handling preconditions. */
- server = NULL;
- url_copy = NULL;
- auth_copy = NULL;
-
- /* Allocate our memory blocks. */
- server = (xmlrpc_server_info*) malloc(sizeof(xmlrpc_server_info));
- XMLRPC_FAIL_IF_NULL(server, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for xmlrpc_server_info");
- url_copy = (char*) malloc(strlen(aserver->_server_url) + 1);
- XMLRPC_FAIL_IF_NULL(url_copy, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for server URL");
- auth_copy = (char*) malloc(strlen(aserver->_http_basic_auth) + 1);
- XMLRPC_FAIL_IF_NULL(auth_copy, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for authentication info");
-
- /* Build our object. */
- strcpy(url_copy, aserver->_server_url);
- server->_server_url = url_copy;
- strcpy(auth_copy, aserver->_http_basic_auth);
- server->_http_basic_auth = auth_copy;
-
- cleanup:
- if (env->fault_occurred) {
- if (url_copy)
- free(url_copy);
- if (auth_copy)
- free(auth_copy);
- if (server)
- free(server);
- return NULL;
- }
- return server;
-
-}
-
-void xmlrpc_server_info_free (xmlrpc_server_info *server)
-{
- XMLRPC_ASSERT_PTR_OK(server);
- XMLRPC_ASSERT(server->_server_url != XMLRPC_BAD_POINTER);
-
- if (server->_http_basic_auth)
- free(server->_http_basic_auth);
- free(server->_server_url);
- server->_server_url = XMLRPC_BAD_POINTER;
- free(server);
-}
-
-/*=========================================================================
-** xmlrpc_client_call_asynch
-**=========================================================================
-*/
-
-static void
-call_info_free(xmlrpc_call_info * const callInfoP) {
-
- /* Assume the worst.. That only parts of the call_info are valid. */
-
- XMLRPC_ASSERT_PTR_OK(callInfoP);
-
- /* If this has been allocated, we're responsible for destroying it. */
- if (callInfoP->_asynch_data_holder)
- xmlrpc_DECREF(callInfoP->_asynch_data_holder);
-
- /* Now we can blow away the XML data. */
- if (callInfoP->serialized_xml)
- xmlrpc_mem_block_free(callInfoP->serialized_xml);
-
- free(callInfoP);
}
static void
-call_info_new(xmlrpc_env * const envP,
- const char * const methodName,
- xmlrpc_value * const paramArrayP,
- xmlrpc_call_info ** const callInfoPP) {
+callInfoCreate(xmlrpc_env * const envP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect,
+ const char * const serverUrl,
+ xmlrpc_response_handler completionFn,
+ void * const userData,
+ struct xmlrpc_call_info ** const callInfoPP) {
/*----------------------------------------------------------------------------
Create a call_info object. A call_info object represents an XML-RPC
call.
-----------------------------------------------------------------------------*/
struct xmlrpc_call_info * callInfoP;
- XMLRPC_ASSERT_PTR_OK(paramArrayP);
+ XMLRPC_ASSERT_PTR_OK(serverUrl);
+ XMLRPC_ASSERT_PTR_OK(methodName);
+ XMLRPC_ASSERT_VALUE_OK(paramArrayP);
XMLRPC_ASSERT_PTR_OK(callInfoPP);
MALLOCVAR(callInfoP);
if (callInfoP == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for xmlrpc_call_info");
+ xmlrpc_faultf(envP, "Couldn't allocate memory for xmlrpc_call_info");
else {
xmlrpc_mem_block * callXmlP;
- /* Clear contents. */
- memset(callInfoP, 0, sizeof(*callInfoP));
-
- makeCallXml(envP, methodName, paramArrayP, &callXmlP);
+ makeCallXml(envP, methodName, paramArrayP, dialect, &callXmlP);
if (!envP->fault_occurred) {
xmlrpc_traceXml("XML-RPC CALL",
@@ -791,6 +752,9 @@
*callInfoPP = callInfoP;
+ callInfoSetCompletion(envP, callInfoP, serverUrl, methodName,
+ paramArrayP, completionFn, userData);
+
if (envP->fault_occurred)
free(callInfoP);
}
@@ -799,145 +763,43 @@
-void
-xmlrpc_client_call_asynch(const char * const serverUrl,
- const char * const methodName,
- xmlrpc_response_handler callback,
- void * const userData,
- const char * const format,
- ...) {
-
- xmlrpc_env env;
- va_list args;
- xmlrpc_value * paramArrayP;
- const char * suffix;
-
- xmlrpc_env_init(&env);
+static void
+callInfoDestroy(struct xmlrpc_call_info * const callInfoP) {
- XMLRPC_ASSERT_PTR_OK(serverUrl);
- XMLRPC_ASSERT_PTR_OK(format);
+ XMLRPC_ASSERT_PTR_OK(callInfoP);
- /* Build our argument array. */
- va_start(args, format);
- xmlrpc_build_value_va(&env, format, args, ¶mArrayP, &suffix);
- va_end(args);
- if (env.fault_occurred) {
- /* Unfortunately, we have no way to return an error and the
- regular callback for a failed RPC is designed to have the
- parameter array passed to it. This was probably an oversight
- of the original asynch design, but now we have to be as
- backward compatible as possible, so we do this:
- */
- (*callback)(serverUrl, methodName, NULL, userData, &env, NULL);
- } else {
- if (*suffix != '\0')
- xmlrpc_env_set_fault_formatted(
- &env, XMLRPC_INTERNAL_ERROR, "Junk after the argument "
- "specifier: '%s'. There must be exactly one arument.",
- suffix);
- else {
- xmlrpc_server_info * serverP;
- serverP = xmlrpc_server_info_new(&env, serverUrl);
- if (!env.fault_occurred) {
- xmlrpc_client_call_server_asynch_params(
- serverP, methodName, callback, userData,
- paramArrayP);
- }
- xmlrpc_server_info_free(serverP);
- }
- if (env.fault_occurred)
- (*callback)(serverUrl, methodName, paramArrayP, userData,
- &env, NULL);
- xmlrpc_DECREF(paramArrayP);
+ if (callInfoP->completionFn) {
+ xmlrpc_DECREF(callInfoP->completionArgs.paramArrayP);
+ xmlrpc_strfree(callInfoP->completionArgs.methodName);
+ xmlrpc_strfree(callInfoP->completionArgs.serverUrl);
}
+ if (callInfoP->serialized_xml)
+ xmlrpc_mem_block_free(callInfoP->serialized_xml);
- xmlrpc_env_clean(&env);
+ free(callInfoP);
}
-void
-xmlrpc_client_call_asynch_params(const char * const serverUrl,
- const char * const methodName,
- xmlrpc_response_handler callback,
- void * const userData,
- xmlrpc_value * const paramArrayP) {
-
- xmlrpc_env env;
- xmlrpc_server_info *serverP;
-
- xmlrpc_env_init(&env);
-
- XMLRPC_ASSERT_PTR_OK(serverUrl);
-
- serverP = xmlrpc_server_info_new(&env, serverUrl);
- if (!env.fault_occurred) {
- xmlrpc_client_call_server_asynch_params(
- serverP, methodName, callback, userData, paramArrayP);
-
- xmlrpc_server_info_free(serverP);
- }
+void
+xmlrpc_client_event_loop_finish(xmlrpc_client * const clientP) {
- if (env.fault_occurred)
- /* We have no way to return failure; we report the failure
- as it happened after we successfully started the RPC.
- */
- (*callback)(serverUrl, methodName, paramArrayP, userData,
- &env, NULL);
+ XMLRPC_ASSERT_PTR_OK(clientP);
- xmlrpc_env_clean(&env);
+ clientP->transportOps.finish_asynch(
+ clientP->transportP, timeout_no, 0);
}
void
-xmlrpc_client_call_server_asynch(xmlrpc_server_info * const serverP,
- const char * const methodName,
- xmlrpc_response_handler callback,
- void * const userData,
- const char * const format,
- ...) {
+xmlrpc_client_event_loop_finish_timeout(xmlrpc_client * const clientP,
+ xmlrpc_timeout const timeout) {
- xmlrpc_env env;
- va_list args;
- xmlrpc_value * paramArrayP;
- const char * suffix;
+ XMLRPC_ASSERT_PTR_OK(clientP);
- xmlrpc_env_init(&env);
-
- XMLRPC_ASSERT_PTR_OK(format);
-
- /* Build our parameter array. */
- va_start(args, format);
- xmlrpc_build_value_va(&env, format, args, ¶mArrayP, &suffix);
- va_end(args);
- if (env.fault_occurred) {
- /* Unfortunately, we have no way to return an error and the
- regular callback for a failed RPC is designed to have the
- parameter array passed to it. This was probably an oversight
- of the original asynch design, but now we have to be as
- backward compatible as possible, so we do this:
- */
- (*callback)(serverP->_server_url, methodName, NULL, userData,
- &env, NULL);
- } else {
- if (*suffix != '\0')
- xmlrpc_env_set_fault_formatted(
- &env, XMLRPC_INTERNAL_ERROR, "Junk after the argument "
- "specifier: '%s'. There must be exactly one arument.",
- suffix);
- else {
- xmlrpc_client_call_server_asynch_params(
- serverP, methodName, callback, userData, paramArrayP);
- }
- xmlrpc_DECREF(paramArrayP);
- }
-
- if (env.fault_occurred)
- (*callback)(serverP->_server_url, methodName, paramArrayP, userData,
- &env, NULL);
-
- xmlrpc_env_clean(&env);
+ clientP->transportOps.finish_asynch(
+ clientP->transportP, timeout_yes, timeout);
}
@@ -959,190 +821,178 @@
failed the request.
-----------------------------------------------------------------------------*/
xmlrpc_env env;
- xmlrpc_value * responseP;
+ xmlrpc_value * resultP;
xmlrpc_env_init(&env);
+ resultP = NULL; /* Just to quiet compiler warning */
+
if (transportEnv.fault_occurred)
xmlrpc_env_set_fault_formatted(
&env, transportEnv.fault_code,
"Client transport failed to execute the RPC. %s",
transportEnv.fault_string);
- if (!env.fault_occurred)
- responseP = xmlrpc_parse_response(
- &env,
- XMLRPC_MEMBLOCK_CONTENTS(char, responseXmlP),
- XMLRPC_MEMBLOCK_SIZE(char, responseXmlP));
- else
- responseP = NULL;
- /* just to quiet compiler warning; value undefined when env
- indicates an error.
- */
+ if (!env.fault_occurred) {
+ int faultCode;
+ const char * faultString;
- /* Call the user's callback function with the result */
- (*callInfoP->callback)(callInfoP->server_url,
- callInfoP->method_name,
- callInfoP->param_array,
- callInfoP->user_data, &env, responseP);
+ xmlrpc_parse_response2(&env,
+ XMLRPC_MEMBLOCK_CONTENTS(char, responseXmlP),
+ XMLRPC_MEMBLOCK_SIZE(char, responseXmlP),
+ &resultP, &faultCode, &faultString);
+
+ if (!env.fault_occurred) {
+ if (faultString) {
+ xmlrpc_env_set_fault_formatted(
+ &env, faultCode,
+ "RPC failed at server. %s", faultString);
+ xmlrpc_strfree(faultString);
+ }
+ }
+ }
+ /* Call the user's completion function with the RPC result */
+ (*callInfoP->completionFn)(callInfoP->completionArgs.serverUrl,
+ callInfoP->completionArgs.methodName,
+ callInfoP->completionArgs.paramArrayP,
+ callInfoP->completionArgs.userData,
+ &env, resultP);
if (!env.fault_occurred)
- xmlrpc_DECREF(responseP);
+ xmlrpc_DECREF(resultP);
- call_info_free(callInfoP);
+ callInfoDestroy(callInfoP);
xmlrpc_env_clean(&env);
}
-static void
-sendRequest(xmlrpc_env * const envP,
- struct xmlrpc_client * const clientP,
- xmlrpc_server_info * const serverP,
- const char * const methodName,
- xmlrpc_response_handler responseHandler,
- void * const userData,
- xmlrpc_value * const argP) {
+void
+xmlrpc_client_start_rpc(xmlrpc_env * const envP,
+ struct xmlrpc_client * const clientP,
+ xmlrpc_server_info * const serverInfoP,
+ const char * const methodName,
+ xmlrpc_value * const argP,
+ xmlrpc_response_handler completionFn,
+ void * const userData) {
+
+ struct xmlrpc_call_info * callInfoP;
- xmlrpc_call_info * callInfoP;
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT_PTR_OK(clientP);
+ XMLRPC_ASSERT_PTR_OK(serverInfoP);
+ XMLRPC_ASSERT_PTR_OK(methodName);
+ XMLRPC_ASSERT_VALUE_OK(argP);
- call_info_new(envP, methodName, argP, &callInfoP);
- if (!envP->fault_occurred) {
- call_info_set_asynch_data(envP, callInfoP,
- serverP->_server_url, methodName,
- argP, responseHandler, userData);
- if (!envP->fault_occurred)
- clientP->clientTransportOps.send_request(
- envP, clientP->transportP, serverP, callInfoP->serialized_xml,
- &asynchComplete, callInfoP);
+ callInfoCreate(envP, methodName, argP, clientP->dialect,
+ serverInfoP->serverUrl, completionFn, userData,
+ &callInfoP);
- if (envP->fault_occurred)
- call_info_free(callInfoP);
- else {
- /* asynchComplete() will free *callInfoP */
- }
- }
- if (envP->fault_occurred) {
- /* Transport did not start the call. Report the call complete
- (with error) now.
- */
- (*responseHandler)(serverP->_server_url, methodName, argP, userData,
- envP, NULL);
- } else {
- /* The transport will call *responseHandler() when it has completed
- the call
- */
+ if (!envP->fault_occurred)
+ clientP->transportOps.send_request(
+ envP, clientP->transportP, serverInfoP,
+ callInfoP->serialized_xml,
+ &asynchComplete, callInfoP);
+
+ if (envP->fault_occurred)
+ callInfoDestroy(callInfoP);
+ else {
+ /* asynchComplete() will destroy *callInfoP */
}
}
void
-xmlrpc_client_call_server_asynch_params(
- xmlrpc_server_info * const serverP,
- const char * const methodName,
- xmlrpc_response_handler responseHandler,
- void * const userData,
- xmlrpc_value * const argP) {
- xmlrpc_env env;
+xmlrpc_client_start_rpcf(xmlrpc_env * const envP,
+ xmlrpc_client * const clientP,
+ const char * const serverUrl,
+ const char * const methodName,
+ xmlrpc_response_handler responseHandler,
+ void * const userData,
+ const char * const format,
+ ...) {
- xmlrpc_env_init(&env);
+ va_list args;
+ xmlrpc_value * paramArrayP;
+ const char * suffix;
- XMLRPC_ASSERT_PTR_OK(serverP);
- XMLRPC_ASSERT_PTR_OK(methodName);
- XMLRPC_ASSERT_PTR_OK(responseHandler);
- XMLRPC_ASSERT_VALUE_OK(argP);
+ XMLRPC_ASSERT_PTR_OK(serverUrl);
+ XMLRPC_ASSERT_PTR_OK(format);
- if (!clientInitialized)
- xmlrpc_env_set_fault_formatted(
- &env, XMLRPC_INTERNAL_ERROR,
- "Xmlrpc-c client instance has not been initialized "
- "(need to call xmlrpc_client_init2()).");
- else {
- struct xmlrpc_client * const clientP = &client;
- /* Some day, the library will be re-entrant and this will be
- passed in.
- */
-
- sendRequest(&env, clientP, serverP,
- methodName, responseHandler, userData,
- argP);
+ /* Build our argument array. */
+ va_start(args, format);
+ xmlrpc_build_value_va(envP, format, args, ¶mArrayP, &suffix);
+ va_end(args);
+ if (!envP->fault_occurred) {
+ if (*suffix != '\0')
+ xmlrpc_faultf(envP, "Junk after the argument "
+ "specifier: '%s'. "
+ "There must be exactly one arument.",
+ suffix);
+ else {
+ xmlrpc_server_info * serverInfoP;
+ serverInfoP = xmlrpc_server_info_new(envP, serverUrl);
+ if (!envP->fault_occurred) {
+ xmlrpc_client_start_rpc(
+ envP, clientP,
+ serverInfoP, methodName, paramArrayP,
+ responseHandler, userData);
+ }
+ xmlrpc_server_info_free(serverInfoP);
+ }
+ xmlrpc_DECREF(paramArrayP);
}
- xmlrpc_env_clean(&env);
}
-void
-xmlrpc_server_info_set_basic_auth(xmlrpc_env * const envP,
- xmlrpc_server_info * const serverP,
- const char * const username,
- const char * const password) {
-
- size_t username_len, password_len, raw_token_len;
- char *raw_token;
- xmlrpc_mem_block *token;
- char *token_data, *auth_type, *auth_header;
- size_t token_len, auth_type_len, auth_header_len;
-
- /* Error-handling preconditions. */
- raw_token = NULL;
- token = NULL;
- token_data = auth_type = auth_header = NULL;
+/*=========================================================================
+ Miscellaneous
+=========================================================================*/
- XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT_PTR_OK(serverP);
- XMLRPC_ASSERT_PTR_OK(username);
- XMLRPC_ASSERT_PTR_OK(password);
+const char *
+xmlrpc_client_get_default_transport(xmlrpc_env * const envP ATTR_UNUSED) {
- /* Calculate some lengths. */
- username_len = strlen(username);
- password_len = strlen(password);
- raw_token_len = username_len + password_len + 1;
-
- /* Build a raw token of the form 'username:password'. */
- raw_token = (char*) malloc(raw_token_len + 1);
- XMLRPC_FAIL_IF_NULL(raw_token, envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for auth token");
- strcpy(raw_token, username);
- raw_token[username_len] = ':';
- strcpy(&raw_token[username_len + 1], password);
-
- /* Encode our raw token using Base64. */
- token = xmlrpc_base64_encode_without_newlines(envP,
- (unsigned char*) raw_token,
- raw_token_len);
- XMLRPC_FAIL_IF_FAULT(envP);
- token_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, token);
- token_len = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, token);
-
- /* Build our actual header value. (I hate string processing in C.) */
- auth_type = "Basic ";
- auth_type_len = strlen(auth_type);
- auth_header_len = auth_type_len + token_len;
- auth_header = (char*) malloc(auth_header_len + 1);
- XMLRPC_FAIL_IF_NULL(auth_header, envP, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for auth header");
- memcpy(auth_header, auth_type, auth_type_len);
- memcpy(&auth_header[auth_type_len], token_data, token_len);
- auth_header[auth_header_len] = '\0';
-
- /* Clean up any pre-existing authentication information, and install
- ** the new value. */
- if (serverP->_http_basic_auth)
- free(serverP->_http_basic_auth);
- serverP->_http_basic_auth = auth_header;
-
- cleanup:
- if (raw_token)
- free(raw_token);
- if (token)
- xmlrpc_mem_block_free(token);
- if (envP->fault_occurred) {
- if (auth_header)
- free(auth_header);
- }
+ return XMLRPC_DEFAULT_TRANSPORT;
}
+
+
+void
+xmlrpc_client_set_interrupt(xmlrpc_client * const clientP,
+ int * const interruptP) {
+
+ if (clientP->transportOps.set_interrupt)
+ clientP->transportOps.set_interrupt(clientP->transportP, interruptP);
+}
+
+
+
+/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE.
+*/
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_data.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_data.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_data.c Mon May 26 12:59:57 2008
@@ -14,7 +14,6 @@
#include "xmlrpc-c/base_int.h"
-
static void
destroyValue(xmlrpc_value * const valueP) {
@@ -34,11 +33,7 @@
break;
case XMLRPC_TYPE_STRING:
-#ifdef HAVE_UNICODE_WCHAR
- if (valueP->_wcs_block)
- xmlrpc_mem_block_free(valueP->_wcs_block);
-#endif /* HAVE_UNICODE_WCHAR */
- xmlrpc_mem_block_clean(&valueP->_block);
+ xmlrpc_destroyString(valueP);
break;
case XMLRPC_TYPE_BASE64:
@@ -59,11 +54,14 @@
case XMLRPC_TYPE_NIL:
break;
+ case XMLRPC_TYPE_I8:
+ break;
+
case XMLRPC_TYPE_DEAD:
- XMLRPC_ASSERT(FALSE); /* Can't happen, per entry conditions */
+ XMLRPC_ASSERT(false); /* Can't happen, per entry conditions */
default:
- XMLRPC_ASSERT(FALSE); /* There are no other possible values */
+ XMLRPC_ASSERT(false); /* There are no other possible values */
}
/* Next, we mark this value as invalid, to help catch refcount
@@ -115,9 +113,9 @@
=========================================================================*/
const char *
-xmlrpc_typeName(xmlrpc_type const type) {
+xmlrpc_type_name(xmlrpc_type const type) {
- switch(type) {
+ switch (type) {
case XMLRPC_TYPE_INT: return "INT";
case XMLRPC_TYPE_BOOL: return "BOOL";
@@ -129,53 +127,12 @@
case XMLRPC_TYPE_STRUCT: return "STRUCT";
case XMLRPC_TYPE_C_PTR: return "C_PTR";
case XMLRPC_TYPE_NIL: return "NIL";
+ case XMLRPC_TYPE_I8: return "I8";
case XMLRPC_TYPE_DEAD: return "DEAD";
default: return "???";
- }
-}
-
-
-
-static void
-verifyNoNulls(xmlrpc_env * const envP,
- const char * const contents,
- unsigned int const len) {
-/*----------------------------------------------------------------------------
- Verify that the character array 'contents', which is 'len' bytes long,
- does not contain any NUL characters, which means it can be made into
- a passable ASCIIZ string just by adding a terminating NUL.
-
- Fail if the array contains a NUL.
------------------------------------------------------------------------------*/
- unsigned int i;
-
- for (i = 0; i < len && !envP->fault_occurred; i++)
- if (contents[i] == '\0')
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_TYPE_ERROR,
- "String must not contain NUL characters");
-}
-
-
-
-#ifdef HAVE_UNICODE_WCHAR
-
-static void
-verifyNoNullsW(xmlrpc_env * const envP,
- const wchar_t * const contents,
- unsigned int const len) {
-/*----------------------------------------------------------------------------
- Same as verifyNoNulls(), but for wide characters.
------------------------------------------------------------------------------*/
- unsigned int i;
- for (i = 0; i < len && !envP->fault_occurred; i++)
- if (contents[i] == '\0')
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_TYPE_ERROR,
- "String must not contain NUL characters");
+ }
}
-#endif
@@ -188,7 +145,7 @@
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_TYPE_ERROR, "Value of type %s supplied where "
"type %s was expected.",
- xmlrpc_typeName(valueP->_type), xmlrpc_typeName(expectedType));
+ xmlrpc_type_name(valueP->_type), xmlrpc_type_name(expectedType));
}
}
@@ -239,270 +196,10 @@
}
-/* datetime stuff is in xmlrpc_datetime.c */
-
-static void
-accessStringValue(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- size_t * const lengthP,
- const char ** const contentsP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- unsigned int const size =
- XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block);
- const char * const contents =
- XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
- unsigned int const len = size - 1;
- /* The memblock has a null character added to the end */
-
- verifyNoNulls(envP, contents, len);
-
- *lengthP = len;
- *contentsP = contents;
- }
-}
-
-
-
-void
-xmlrpc_read_string(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- const char ** const stringValueP) {
-/*----------------------------------------------------------------------------
- Read the value of an XML-RPC string as an ASCIIZ string.
-
- Return the string in newly malloc'ed storage that Caller must free.
-
- Fail if the string contains null characters (which means it wasn't
- really a string, but XML-RPC doesn't seem to understand what a string
- is, and such values are possible).
------------------------------------------------------------------------------*/
- size_t length;
- const char * contents;
-
- accessStringValue(envP, valueP, &length, &contents);
-
- if (!envP->fault_occurred) {
- char * stringValue;
-
- stringValue = malloc(length+1);
- if (stringValue == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Unable to allocate space "
- "for %u-character string", length);
- else {
- memcpy(stringValue, contents, length);
- stringValue[length] = '\0';
-
- *stringValueP = stringValue;
- }
- }
-}
-
-
-
-void
-xmlrpc_read_string_old(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- const char ** const stringValueP) {
-
- size_t length;
- accessStringValue(envP, valueP, &length, stringValueP);
-}
-
-
-
-void
-xmlrpc_read_string_lp(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- size_t * const lengthP,
- const char ** const stringValueP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- unsigned int const size =
- XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block);
- const char * const contents =
- XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
-
- char * stringValue;
-
- stringValue = malloc(size);
- if (stringValue == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR, "Unable to allocate %u bytes "
- "for string.", size);
- else {
- memcpy(stringValue, contents, size);
- *stringValueP = stringValue;
- *lengthP = size - 1; /* Size includes terminating NUL */
- }
- }
-}
-
-
-
-void
-xmlrpc_read_string_lp_old(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- size_t * const lengthP,
- const char ** const stringValueP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- *lengthP = XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block) - 1;
- *stringValueP = XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
- }
-}
-
-
-
-#ifdef HAVE_UNICODE_WCHAR
-static void
-setupWcsBlock(xmlrpc_env * const envP,
- xmlrpc_value * const valueP) {
-/*----------------------------------------------------------------------------
- Add a wcs block (wchar_t string) to the indicated xmlrpc_value if it
- doesn't have one already.
------------------------------------------------------------------------------*/
- if (!valueP->_wcs_block) {
- char * const contents =
- XMLRPC_MEMBLOCK_CONTENTS(char, &valueP->_block);
- size_t const len =
- XMLRPC_MEMBLOCK_SIZE(char, &valueP->_block) - 1;
- valueP->_wcs_block =
- xmlrpc_utf8_to_wcs(envP, contents, len + 1);
- }
-}
-
-
-
-static void
-accessStringValueW(xmlrpc_env * const envP,
- xmlrpc_value * const valueP,
- size_t * const lengthP,
- const wchar_t ** const stringValueP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- setupWcsBlock(envP, valueP);
-
- if (!envP->fault_occurred) {
- wchar_t * const wcontents =
- XMLRPC_MEMBLOCK_CONTENTS(wchar_t, valueP->_wcs_block);
- size_t const len =
- XMLRPC_MEMBLOCK_SIZE(wchar_t, valueP->_wcs_block) - 1;
-
- verifyNoNullsW(envP, wcontents, len);
-
- *lengthP = len;
- *stringValueP = wcontents;
- }
- }
-}
-
-
-
-void
-xmlrpc_read_string_w(xmlrpc_env * const envP,
- xmlrpc_value * const valueP,
- const wchar_t ** const stringValueP) {
-
- size_t length;
- const wchar_t * wcontents;
-
- accessStringValueW(envP, valueP, &length, &wcontents);
-
- if (!envP->fault_occurred) {
- wchar_t * stringValue;
- stringValue = malloc((length + 1) * sizeof(wchar_t));
- if (stringValue == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unable to allocate space for %u-byte string",
- length);
- else {
- memcpy(stringValue, wcontents, length * sizeof(wchar_t));
- stringValue[length] = '\0';
-
- *stringValueP = stringValue;
- }
- }
-}
-
-
-
-void
-xmlrpc_read_string_w_old(xmlrpc_env * const envP,
- xmlrpc_value * const valueP,
- const wchar_t ** const stringValueP) {
-
- size_t length;
-
- accessStringValueW(envP, valueP, &length, stringValueP);
-}
-
-
-
-void
-xmlrpc_read_string_w_lp(xmlrpc_env * const envP,
- xmlrpc_value * const valueP,
- size_t * const lengthP,
- const wchar_t ** const stringValueP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- setupWcsBlock(envP, valueP);
-
- if (!envP->fault_occurred) {
- wchar_t * const wcontents =
- XMLRPC_MEMBLOCK_CONTENTS(wchar_t, valueP->_wcs_block);
- size_t const size =
- XMLRPC_MEMBLOCK_SIZE(wchar_t, valueP->_wcs_block);
-
- wchar_t * stringValue;
-
- stringValue = malloc(size * sizeof(wchar_t));
- if (stringValue == NULL)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Unable to allocate space for %u-byte string",
- size);
- else {
- memcpy(stringValue, wcontents, size * sizeof(wchar_t));
-
- *lengthP = size - 1; /* size includes terminating NUL */
- *stringValueP = stringValue;
- }
- }
- }
-}
-
+/* datetime stuff is in xmlrpc_datetime.c */
-void
-xmlrpc_read_string_w_lp_old(xmlrpc_env * const envP,
- xmlrpc_value * const valueP,
- size_t * const lengthP,
- const wchar_t ** const stringValueP) {
-
- validateType(envP, valueP, XMLRPC_TYPE_STRING);
- if (!envP->fault_occurred) {
- setupWcsBlock(envP, valueP);
-
- if (!envP->fault_occurred) {
- wchar_t * const wcontents =
- XMLRPC_MEMBLOCK_CONTENTS(wchar_t, valueP->_wcs_block);
- size_t const size =
- XMLRPC_MEMBLOCK_SIZE(wchar_t, valueP->_wcs_block);
-
- *lengthP = size - 1; /* size includes terminatnig NUL */
- *stringValueP = wcontents;
- }
- }
-}
-#endif
+/* string stuff is in xmlrpc_string.c */
@@ -566,6 +263,18 @@
void
+xmlrpc_read_cptr(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ void ** const ptrValueP) {
+
+ validateType(envP, valueP, XMLRPC_TYPE_C_PTR);
+ if (!envP->fault_occurred)
+ *ptrValueP = valueP->_value.c_ptr;
+}
+
+
+
+void
xmlrpc_read_nil(xmlrpc_env * const envP,
xmlrpc_value * const valueP) {
/*----------------------------------------------------------------------------
@@ -578,19 +287,19 @@
-void
-xmlrpc_read_cptr(xmlrpc_env * const envP,
- const xmlrpc_value * const valueP,
- void ** const ptrValueP) {
+void
+xmlrpc_read_i8(xmlrpc_env * const envP,
+ const xmlrpc_value * const valueP,
+ xmlrpc_int64 * const intValueP) {
- validateType(envP, valueP, XMLRPC_TYPE_C_PTR);
+ validateType(envP, valueP, XMLRPC_TYPE_I8);
if (!envP->fault_occurred)
- *ptrValueP = valueP->_value.c_ptr;
+ *intValueP = valueP->_value.i8;
}
-xmlrpc_type xmlrpc_value_type (xmlrpc_value* value)
+xmlrpc_type xmlrpc_value_type (xmlrpc_value* const value)
{
XMLRPC_ASSERT_VALUE_OK(value);
return value->_type;
@@ -638,16 +347,16 @@
xmlrpc_value *
-xmlrpc_bool_new(xmlrpc_env * const envP,
- xmlrpc_bool const value) {
+xmlrpc_i8_new(xmlrpc_env * const envP,
+ xmlrpc_int64 const value) {
xmlrpc_value * valP;
xmlrpc_createXmlrpcValue(envP, &valP);
if (!envP->fault_occurred) {
- valP->_type = XMLRPC_TYPE_BOOL;
- valP->_value.b = value;
+ valP->_type = XMLRPC_TYPE_I8;
+ valP->_value.i8 = value;
}
return valP;
}
@@ -655,51 +364,16 @@
xmlrpc_value *
-xmlrpc_double_new(xmlrpc_env * const envP,
- double const value) {
-
- xmlrpc_value * valP;
-
- xmlrpc_createXmlrpcValue(envP, &valP);
-
- if (!envP->fault_occurred) {
- valP->_type = XMLRPC_TYPE_DOUBLE;
- valP->_value.d = value;
- }
- return valP;
-}
-
-
-
-#ifdef HAVE_UNICODE_WCHAR
-#define MAKE_WCS_BLOCK_NULL(val) ((val)->_wcs_block = NULL)
-#else
-#define MAKE_WCS_BLOCK_NULL(val) while (0) do {};
-#endif
-
-
-
-xmlrpc_value *
-xmlrpc_string_new_lp(xmlrpc_env * const envP,
- size_t const length,
- const char * const value) {
+xmlrpc_bool_new(xmlrpc_env * const envP,
+ xmlrpc_bool const value) {
xmlrpc_value * valP;
xmlrpc_createXmlrpcValue(envP, &valP);
if (!envP->fault_occurred) {
- valP->_type = XMLRPC_TYPE_STRING;
- MAKE_WCS_BLOCK_NULL(valP);
- XMLRPC_MEMBLOCK_INIT(char, envP, &valP->_block, length + 1);
- if (!envP->fault_occurred) {
- char * const contents =
- XMLRPC_MEMBLOCK_CONTENTS(char, &valP->_block);
- memcpy(contents, value, length);
- contents[length] = '\0';
- }
- if (envP->fault_occurred)
- free(valP);
+ valP->_type = XMLRPC_TYPE_BOOL;
+ valP->_value.b = value;
}
return valP;
}
@@ -707,60 +381,16 @@
xmlrpc_value *
-xmlrpc_string_new(xmlrpc_env * const envP,
- const char * const value) {
-
- return xmlrpc_string_new_lp(envP, strlen(value), value);
-}
-
-
-#ifdef HAVE_UNICODE_WCHAR
-xmlrpc_value *
-xmlrpc_string_w_new_lp(xmlrpc_env * const envP,
- size_t const length,
- const wchar_t * const value) {
+xmlrpc_double_new(xmlrpc_env * const envP,
+ double const value) {
xmlrpc_value * valP;
- /* Initialize our XML-RPC value. */
xmlrpc_createXmlrpcValue(envP, &valP);
if (!envP->fault_occurred) {
- valP->_type = XMLRPC_TYPE_STRING;
-
- /* Build our wchar_t block first. */
- valP->_wcs_block =
- XMLRPC_MEMBLOCK_NEW(wchar_t, envP, length + 1);
- if (!envP->fault_occurred) {
- wchar_t * const wcs_contents =
- XMLRPC_MEMBLOCK_CONTENTS(wchar_t, valP->_wcs_block);
-
- xmlrpc_mem_block * utf8_block;
-
- memcpy(wcs_contents, value, length * sizeof(wchar_t));
- wcs_contents[length] = '\0';
-
- /* Convert the wcs block to UTF-8. */
- utf8_block = xmlrpc_wcs_to_utf8(envP, wcs_contents, length + 1);
- if (!envP->fault_occurred) {
- char * const utf8_contents =
- XMLRPC_MEMBLOCK_CONTENTS(char, utf8_block);
- size_t const utf8_len = XMLRPC_MEMBLOCK_SIZE(char, utf8_block);
-
- /* XXX - We need an extra memcopy to initialize _block. */
- XMLRPC_MEMBLOCK_INIT(char, envP, &valP->_block, utf8_len);
- if (!envP->fault_occurred) {
- char * contents;
- contents = XMLRPC_MEMBLOCK_CONTENTS(char, &valP->_block);
- memcpy(contents, utf8_contents, utf8_len);
- }
- XMLRPC_MEMBLOCK_FREE(char, utf8_block);
- }
- if (envP->fault_occurred)
- XMLRPC_MEMBLOCK_FREE(wchar_t, valP->_wcs_block);
- }
- if (envP->fault_occurred)
- free(valP);
+ valP->_type = XMLRPC_TYPE_DOUBLE;
+ valP->_value.d = value;
}
return valP;
}
@@ -768,13 +398,6 @@
xmlrpc_value *
-xmlrpc_string_w_new(xmlrpc_env * const envP,
- const wchar_t * const value) {
- return xmlrpc_string_w_new_lp(envP, wcslen(value), value);
-}
-#endif
-
-xmlrpc_value *
xmlrpc_base64_new(xmlrpc_env * const envP,
size_t const length,
const unsigned char * const value) {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_datetime.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_datetime.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_datetime.c Mon May 26 12:59:57 2008
@@ -5,15 +5,21 @@
#include <string.h>
#include <ctype.h>
#include <assert.h>
+#if MSVCRT
+#include <windows.h>
+#endif
#include "bool.h"
+
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/time_int.h"
/* Future work: the XMLRPC_TYPE_DATETIME xmlrpc_value should store the
datetime as something computation-friendly, not as a string. The
- client library should parse the string value and reject the XML if
+ XML-RPC XML parser should parse the string value and reject the XML if
it isn't valid.
But this file should remain the authority on datetimes, so the XML
@@ -24,58 +30,70 @@
*/
-#ifdef WIN32
+#if MSVCRT
static const __int64 SECS_BETWEEN_EPOCHS = 11644473600;
static const __int64 SECS_TO_100NS = 10000000; /* 10^7 */
-void UnixTimeToFileTime(const time_t t, LPFILETIME pft)
-{
- // Note that LONGLONG is a 64-bit value
- LONGLONG ll;
- ll = Int32x32To64(t, SECS_TO_100NS) + SECS_BETWEEN_EPOCHS * SECS_TO_100NS;
- pft->dwLowDateTime = (DWORD)ll;
- pft->dwHighDateTime = ll >> 32;
+void
+UnixTimeToFileTime(time_t const t,
+ LPFILETIME const pft) {
+
+ int64_t const ll =
+ Int32x32To64(t, SECS_TO_100NS) + SECS_BETWEEN_EPOCHS * SECS_TO_100NS;
+
+ pft->dwLowDateTime = (DWORD)ll;
+ pft->dwHighDateTime = (DWORD)(ll >> 32);
}
-void UnixTimeToSystemTime(const time_t t, LPSYSTEMTIME pst)
-{
+
+
+void
+UnixTimeToSystemTime(time_t const t,
+ LPSYSTEMTIME const pst) {
FILETIME ft;
UnixTimeToFileTime(t, &ft);
FileTimeToSystemTime(&ft, pst);
}
-static void UnixTimeFromFileTime(xmlrpc_env * const envP, LPFILETIME pft, time_t * const timeValueP)
-{
- LONGLONG ll;
-
- ll = ((LONGLONG)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
- /* convert to the Unix epoch */
- ll -= (SECS_BETWEEN_EPOCHS * SECS_TO_100NS);
- /* now convert to seconds */
- ll /= SECS_TO_100NS;
-
- if ( (time_t)ll != ll )
- {
- //fail - value is too big for a time_t
+
+
+static void
+UnixTimeFromFileTime(xmlrpc_env * const envP,
+ LPFILETIME const pft,
+ time_t * const timeValueP) {
+
+ int64_t const WinEpoch100Ns =
+ ((int64_t)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
+ int64_t const unixEpoch100Ns =
+ WinEpoch100Ns - (SECS_BETWEEN_EPOCHS * SECS_TO_100NS);
+ int64_t const unixEpochSeconds =
+ unixEpoch100Ns / SECS_TO_100NS;
+
+ if ((time_t)unixEpochSeconds != unixEpochSeconds) {
+ /* Value is too big for a time_t; fail. */
xmlrpc_faultf(envP, "Does not indicate a valid date");
- *timeValueP = (time_t)-1;
- return;
- }
- *timeValueP = (time_t)ll;
+ *timeValueP = (time_t)(-1);
+ } else
+ *timeValueP = (time_t)unixEpochSeconds;
}
-static void UnixTimeFromSystemTime(xmlrpc_env * const envP, LPSYSTEMTIME pst, time_t * const timeValueP)
-{
+
+
+static void
+UnixTimeFromSystemTime(xmlrpc_env * const envP,
+ LPSYSTEMTIME const pst,
+ time_t * const timeValueP) {
FILETIME filetime;
SystemTimeToFileTime(pst, &filetime);
UnixTimeFromFileTime(envP, &filetime, timeValueP);
}
-#endif
+#endif /* MSVCRT */
+
static void
@@ -86,8 +104,8 @@
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_TYPE_ERROR, "Value of type %s supplied where "
"type %s was expected.",
- xmlrpc_typeName(valueP->_type),
- xmlrpc_typeName(XMLRPC_TYPE_DATETIME));
+ xmlrpc_type_name(valueP->_type),
+ xmlrpc_type_name(XMLRPC_TYPE_DATETIME));
}
}
@@ -184,125 +202,6 @@
}
-#ifdef HAVE_SETENV
-xmlrpc_bool const haveSetenv = TRUE;
-#else
-xmlrpc_bool const haveSetenv = FALSE;
-static void
-setenv(const char * const name ATTR_UNUSED,
- const char * const value ATTR_UNUSED,
- int const replace ATTR_UNUSED) {
- assert(FALSE);
-}
-#endif
-
-static void
-makeTimezoneUtc(xmlrpc_env * const envP,
- const char ** const oldTzP) {
-
- const char * const tz = getenv("TZ");
-
-#ifdef WIN32
- /* Windows implementation does not exist */
- assert(TRUE);
-#endif
-
- if (haveSetenv) {
- if (tz) {
- *oldTzP = strdup(tz);
- if (*oldTzP == NULL)
- xmlrpc_faultf(envP, "Unable to get memory to save TZ "
- "environment variable.");
- } else
- *oldTzP = NULL;
-
- if (!envP->fault_occurred)
- setenv("TZ", "", 1);
- } else {
- if (tz && strlen(tz) == 0) {
- /* Everything's fine. Nothing to change or restore */
- } else {
- /* Note that putenv() is not sufficient. You can't restore
- the original value with that, because it sets a pointer into
- your own storage.
- */
- xmlrpc_faultf(envP, "Your TZ environment variable is not a "
- "null string and your C library does not have "
- "setenv(), so we can't change it.");
- }
- }
-}
-
-
-
-static void
-restoreTimezone(const char * const oldTz) {
-
- if (haveSetenv) {
- setenv("TZ", oldTz, 1);
- free((char*)oldTz);
- }
-}
-
-
-
-static void
-mkAbsTime(xmlrpc_env * const envP,
- struct tm const brokenTime,
- time_t * const timeValueP) {
-
-#ifdef WIN32
- /* Windows Implementation */
- SYSTEMTIME stbrokenTime;
-
- stbrokenTime.wHour = brokenTime.tm_hour;
- stbrokenTime.wMinute = brokenTime.tm_min;
- stbrokenTime.wSecond = brokenTime.tm_sec;
- stbrokenTime.wMonth = brokenTime.tm_mon;
- stbrokenTime.wDay = brokenTime.tm_mday;
- stbrokenTime.wYear = brokenTime.tm_year;
- stbrokenTime.wMilliseconds = 0;
-
- /* When the date string is parsed into the tm structure, it was
- modified to decrement the month count by one and convert the
- 4 digit year to a two digit year. We undo what the parser
- did to make it a true SYSTEMTIME structure, then convert this
- structure into a UNIX time_t structure
- */
- stbrokenTime.wYear+=1900;
- stbrokenTime.wMonth+=1;
-
- UnixTimeFromSystemTime(envP, &stbrokenTime,timeValueP);
-
-#else
-
- time_t mktimeResult;
- const char * oldTz;
- struct tm mktimeWork;
-
- /* We use mktime() to create the time_t because it's the
- best we have available, but mktime() takes a local time
- argument, and we have absolute time. So we fake it out
- by temporarily setting the timezone to UTC.
- */
- makeTimezoneUtc(envP, &oldTz);
-
- if (!envP->fault_occurred) {
- mktimeWork = brokenTime;
- mktimeResult = mktime(&mktimeWork);
-
- restoreTimezone(oldTz);
-
- if (mktimeResult == (time_t)-1)
- xmlrpc_faultf(envP, "Does not indicate a valid date");
- else
- *timeValueP = mktimeResult;
- }
-#endif
-
-}
-
-
static void
validateFormat(xmlrpc_env * const envP,
@@ -353,6 +252,13 @@
Example of the format we parse: "19980717T14:08:55"
Note that this is not quite ISO 8601. It's a bizarre combination of
two ISO 8601 formats.
+
+ The input is capable of representing datetimes that cannot be expressed
+ as a time_t. In that case, we fail, with fault code
+ XMLRPC_INTERNAL_ERROR.
+
+ And of course the input may not validly represent a datetime at all.
+ In that case too, we fail with fault code XMLRPC_PARSE_ERROR.
-----------------------------------------------------------------------------*/
validateFormat(envP, t);
@@ -361,20 +267,27 @@
parseDateNumbers(t, &Y, &M, &D, &h, &m, &s);
- if (Y < 1900)
- xmlrpc_faultf(envP, "Year is too early to represent as "
- "a standard Unix time");
+ if (Y < 1970)
+ xmlrpc_env_set_fault(envP, XMLRPC_INTERNAL_ERROR,
+ "Year is too early to represent as "
+ "a standard Unix time");
else {
struct tm brokenTime;
+ const char * error;
- brokenTime.tm_sec = s;
- brokenTime.tm_min = m;
- brokenTime.tm_hour = h;
- brokenTime.tm_mday = D;
- brokenTime.tm_mon = M - 1;
- brokenTime.tm_year = Y - 1900;
+ brokenTime.tm_sec = s;
+ brokenTime.tm_min = m;
+ brokenTime.tm_hour = h;
+ brokenTime.tm_mday = D;
+ brokenTime.tm_mon = M - 1;
+ brokenTime.tm_year = Y - 1900;
- mkAbsTime(envP, brokenTime, timeValueP);
+ xmlrpc_timegm(&brokenTime, timeValueP, &error);
+
+ if (error) {
+ xmlrpc_env_set_fault(envP, XMLRPC_PARSE_ERROR, error);
+ xmlrpc_strfree(error);
+ }
}
}
}
@@ -435,7 +348,7 @@
valP->_type = XMLRPC_TYPE_DATETIME;
- gmtime_r(&value, &brokenTime);
+ xmlrpc_gmtime(value, &brokenTime);
/* Note that this format is NOT ISO 8601 -- it's a bizarre
hybrid of two ISO 8601 formats.
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_expat.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_expat.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_expat.c Mon May 26 12:59:57 2008
@@ -1,37 +1,18 @@
-/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE. */
+/* Copyright information is at end of file */
#include "xmlrpc_config.h"
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
-#include <xmlparse.h>
+
+#include <xmlparse.h> /* Expat */
+
+#include "bool.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/xmlparser.h"
/* Define the contents of our internal structure. */
@@ -64,8 +45,10 @@
** arguments are implementation-dependent.
*/
-static xml_element *xml_element_new (xmlrpc_env *env, char *name)
-{
+static xml_element *
+xml_element_new (xmlrpc_env * const env,
+ const char * const name) {
+
xml_element *retval;
int name_valid, cdata_valid, children_valid;
@@ -79,7 +62,7 @@
/* Allocate our xml_element structure. */
retval = (xml_element*) malloc(sizeof(xml_element));
XMLRPC_FAIL_IF_NULL(retval, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for XML element");
+ "Couldn't allocate memory for XML element");
/* Set our parent field to NULL. */
retval->_parent = NULL;
@@ -87,7 +70,7 @@
/* Copy over the element name. */
retval->_name = (char*) malloc(strlen(name) + 1);
XMLRPC_FAIL_IF_NULL(retval->_name, env, XMLRPC_INTERNAL_ERROR,
- "Couldn't allocate memory for XML element");
+ "Couldn't allocate memory for XML element");
name_valid = 1;
strcpy(retval->_name, name);
@@ -103,18 +86,18 @@
cleanup:
if (env->fault_occurred) {
- if (retval) {
- if (name_valid)
- free(retval->_name);
- if (cdata_valid)
- xmlrpc_mem_block_clean(&retval->_cdata);
- if (children_valid)
- xmlrpc_mem_block_clean(&retval->_children);
- free(retval);
- }
- return NULL;
+ if (retval) {
+ if (name_valid)
+ free(retval->_name);
+ if (cdata_valid)
+ xmlrpc_mem_block_clean(&retval->_cdata);
+ if (children_valid)
+ xmlrpc_mem_block_clean(&retval->_children);
+ free(retval);
+ }
+ return NULL;
} else {
- return retval;
+ return retval;
}
}
@@ -124,9 +107,9 @@
**=========================================================================
** Blow away an existing element & all of its child elements.
*/
+void
+xml_element_free(xml_element * const elem) {
-void xml_element_free (xml_element *elem)
-{
xmlrpc_mem_block *children;
int size, i;
xml_element **contents;
@@ -142,7 +125,7 @@
contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(xml_element*, children);
size = XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element*, children);
for (i = 0; i < size; i++)
- xml_element_free(contents[i]);
+ xml_element_free(contents[i]);
xmlrpc_mem_block_clean(&elem->_children);
free(elem);
@@ -156,12 +139,17 @@
** documentation on each function works.
*/
-char *xml_element_name (xml_element *elem)
-{
- XMLRPC_ASSERT_ELEM_OK(elem);
- return elem->_name;
+
+
+const char *
+xml_element_name(const xml_element * const elemP) {
+
+ XMLRPC_ASSERT_ELEM_OK(elemP);
+ return elemP->_name;
}
+
+
/* The result of this function is NOT VALID until the end_element handler
** has been called! */
size_t xml_element_cdata_size (xml_element *elem)
@@ -176,28 +164,33 @@
return XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, &elem->_cdata);
}
-size_t xml_element_children_size (xml_element *elem)
-{
- XMLRPC_ASSERT_ELEM_OK(elem);
- return XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element*, &elem->_children);
+
+
+size_t
+xml_element_children_size(const xml_element * const elemP) {
+ XMLRPC_ASSERT_ELEM_OK(elemP);
+ return XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element *, &elemP->_children);
}
-xml_element **xml_element_children (xml_element *elem)
-{
- XMLRPC_ASSERT_ELEM_OK(elem);
- return XMLRPC_TYPED_MEM_BLOCK_CONTENTS(xml_element*, &elem->_children);
+
+
+xml_element **
+xml_element_children(const xml_element * const elemP) {
+ XMLRPC_ASSERT_ELEM_OK(elemP);
+ return XMLRPC_TYPED_MEM_BLOCK_CONTENTS(xml_element *, &elemP->_children);
}
+
/*=========================================================================
** Internal xml_element Utility Functions
**=========================================================================
*/
static void xml_element_append_cdata (xmlrpc_env *env,
- xml_element *elem,
- char *cdata,
- size_t size)
+ xml_element *elem,
+ char *cdata,
+ size_t size)
{
XMLRPC_ASSERT_ENV_OK(env);
XMLRPC_ASSERT_ELEM_OK(elem);
@@ -210,8 +203,8 @@
** WARNING - This is the exact opposite of the usual memory ownership
** rules for xmlrpc_value! So please pay attention. */
static void xml_element_append_child (xmlrpc_env *env,
- xml_element *elem,
- xml_element *child)
+ xml_element *elem,
+ xml_element *child)
{
XMLRPC_ASSERT_ENV_OK(env);
XMLRPC_ASSERT_ELEM_OK(elem);
@@ -221,7 +214,7 @@
XMLRPC_TYPED_MEM_BLOCK_APPEND(xml_element*, env, &elem->_children,
&child, 1);
if (!env->fault_occurred)
- child->_parent = elem;
+ child->_parent = elem;
else
xml_element_free(child);
}
@@ -233,10 +226,10 @@
*/
typedef struct {
- xmlrpc_env *env;
- xml_element *root;
- xml_element *current;
-} parse_context;
+ xmlrpc_env env;
+ xml_element * rootP;
+ xml_element * currentP;
+} parseContext;
/*=========================================================================
@@ -245,151 +238,250 @@
*/
static void
-start_element (void *user_data, XML_Char *name, XML_Char **atts ATTR_UNUSED)
-{
- parse_context *context;
- xml_element *elem, *new_current;
+startElement(void * const userData,
+ XML_Char * const name,
+ XML_Char ** const atts ATTR_UNUSED) {
- XMLRPC_ASSERT(user_data != NULL && name != NULL);
+ parseContext * const contextP = userData;
- /* Get our context and see if an error has already occured. */
- context = (parse_context*) user_data;
- if (!context->env->fault_occurred) {
-
- /* Set up our error-handling preconditions. */
- elem = NULL;
-
- /* Build a new element. */
- elem = xml_element_new(context->env, name);
- XMLRPC_FAIL_IF_FAULT(context->env);
-
- /* Insert it in the appropriate place. */
- if (!context->root) {
- context->root = elem;
- context->current = elem;
- elem = NULL;
- } else {
- XMLRPC_ASSERT(context->current != NULL);
-
- /* (We need to watch our error handling invariants very carefully
- ** here. Read the docs for xml_element_append_child. */
- new_current = elem;
- xml_element_append_child(context->env, context->current, elem);
- elem = NULL;
- XMLRPC_FAIL_IF_FAULT(context->env);
- context->current = new_current;
- }
+ XMLRPC_ASSERT(contextP != NULL);
+ XMLRPC_ASSERT(name != NULL);
- cleanup:
- if (elem)
- xml_element_free(elem);
+ if (!contextP->env.fault_occurred) {
+ xml_element * elemP;
+
+ elemP = xml_element_new(&contextP->env, name);
+ if (!contextP->env.fault_occurred) {
+ XMLRPC_ASSERT(elemP != NULL);
+
+ /* Insert the new element in the appropriate place. */
+ if (!contextP->rootP) {
+ /* No root yet, so this element must be the root. */
+ contextP->rootP = elemP;
+ contextP->currentP = elemP;
+ } else {
+ XMLRPC_ASSERT(contextP->currentP != NULL);
+
+ /* (We need to watch our error handling invariants
+ very carefully here. Read the docs for
+ xml_element_append_child.
+ */
+ xml_element_append_child(&contextP->env, contextP->currentP,
+ elemP);
+ if (!contextP->env.fault_occurred)
+ contextP->currentP = elemP;
+ }
+ if (contextP->env.fault_occurred)
+ xml_element_free(elemP);
+ }
+ if (contextP->env.fault_occurred) {
+ /* Having changed *contextP to reflect failure, we are responsible
+ for undoing everything that has been done so far in this
+ context.
+ */
+ if (contextP->rootP)
+ xml_element_free(contextP->rootP);
+ }
}
}
-static void end_element (void *user_data, XML_Char *name)
-{
- parse_context *context;
- XMLRPC_ASSERT(user_data != NULL && name != NULL);
- /* Get our context and see if an error has already occured. */
- context = (parse_context*) user_data;
- if (!context->env->fault_occurred) {
-
- /* XXX - I think expat enforces these facts, but I want to be sure.
- ** If one of these assertion ever fails, it should be replaced by a
- ** non-assertion runtime error check. */
- XMLRPC_ASSERT(strcmp(name, context->current->_name) == 0);
- XMLRPC_ASSERT(context->current->_parent != NULL ||
- context->current == context->root);
-
- /* Add a trailing '\0' to our cdata. */
- xml_element_append_cdata(context->env, context->current, "\0", 1);
- XMLRPC_FAIL_IF_FAULT(context->env);
+static void
+endElement(void * const userData,
+ XML_Char * const name ATTR_UNUSED) {
+
+ parseContext * const contextP = userData;
- /* Pop our "stack" of elements. */
- context->current = context->current->_parent;
+ XMLRPC_ASSERT(contextP != NULL);
+ XMLRPC_ASSERT(name != NULL);
- cleanup:
- return;
+ if (!contextP->env.fault_occurred) {
+ /* I think Expat enforces these facts: */
+ XMLRPC_ASSERT(xmlrpc_streq(name, contextP->currentP->_name));
+ XMLRPC_ASSERT(contextP->currentP->_parent != NULL ||
+ contextP->currentP == contextP->rootP);
+
+ /* Add a trailing NUL to our cdata. */
+ xml_element_append_cdata(&contextP->env, contextP->currentP, "\0", 1);
+ if (!contextP->env.fault_occurred)
+ /* Pop our "stack" of elements. */
+ contextP->currentP = contextP->currentP->_parent;
+
+ if (contextP->env.fault_occurred) {
+ /* Having changed *contextP to reflect failure, we are responsible
+ for undoing everything that has been done so far in this
+ context.
+ */
+ if (contextP->rootP)
+ xml_element_free(contextP->rootP);
+ }
}
}
-static void character_data (void *user_data, XML_Char *s, int len)
-{
- parse_context *context;
- XMLRPC_ASSERT(user_data != NULL && s != NULL && len >= 0);
- /* Get our context and see if an error has already occured. */
- context = (parse_context*) user_data;
- if (!context->env->fault_occurred) {
-
- XMLRPC_ASSERT(context->current != NULL);
-
- xml_element_append_cdata(context->env, context->current, s, len);
- XMLRPC_FAIL_IF_FAULT(context->env);
+static void
+characterData(void * const userData,
+ XML_Char * const s,
+ int const len) {
+/*----------------------------------------------------------------------------
+ This is an Expat character data (cdata) handler. When an Expat
+ parser comes across cdata, he calls one of these with the cdata as
+ argument. He can call it multiple times for consecutive cdata.
+
+ We simply append the cdata to the cdata buffer for whatever XML
+ element the parser is presently parsing.
+-----------------------------------------------------------------------------*/
+ parseContext * const contextP = userData;
+
+ XMLRPC_ASSERT(contextP != NULL);
+ XMLRPC_ASSERT(s != NULL);
+ XMLRPC_ASSERT(len >= 0);
- cleanup:
- return;
+ if (!contextP->env.fault_occurred) {
+ XMLRPC_ASSERT(contextP->currentP != NULL);
+
+ xml_element_append_cdata(&contextP->env, contextP->currentP, s, len);
}
}
-/*=========================================================================
-** Expat Driver
-**=========================================================================
-** XXX - We should allow the user to specify the encoding of our xml_data.
-*/
-xml_element *xml_parse (xmlrpc_env *env, const char *xml_data, int xml_len)
-{
- parse_context context;
+static void
+createParser(xmlrpc_env * const envP,
+ parseContext * const contextP,
+ XML_Parser * const parserP) {
+/*----------------------------------------------------------------------------
+ Create an Expat parser to parse our XML.
+-----------------------------------------------------------------------------*/
XML_Parser parser;
- int ok;
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(xml_data != NULL && xml_len >= 0);
+ parser = xmlrpc_XML_ParserCreate(NULL);
+ if (parser == NULL)
+ xmlrpc_faultf(envP, "Could not create expat parser");
+ else {
+ /* Initialize our parse context. */
+ xmlrpc_env_init(&contextP->env);
+ contextP->rootP = NULL;
+ contextP->currentP = NULL;
+
+ xmlrpc_XML_SetUserData(parser, contextP);
+ xmlrpc_XML_SetElementHandler(
+ parser,
+ (XML_StartElementHandler) startElement,
+ (XML_EndElementHandler) endElement);
+ xmlrpc_XML_SetCharacterDataHandler(
+ parser,
+ (XML_CharacterDataHandler) characterData);
+
+ *parserP = parser;
+ }
+}
- /* Set up our error-handling preconditions. */
- parser = NULL;
- context.root = NULL;
-
- /* Set up the rest of our parse context. */
- context.env = env;
- context.current = NULL;
-
- /* Set up our XML parser. */
- parser = XML_ParserCreate(NULL);
- XMLRPC_FAIL_IF_NULL(parser, env, XMLRPC_INTERNAL_ERROR,
- "Could not create expat parser");
- XML_SetUserData(parser, &context);
- XML_SetElementHandler(parser,
- (XML_StartElementHandler) start_element,
- (XML_EndElementHandler) end_element);
- XML_SetCharacterDataHandler(parser,
- (XML_CharacterDataHandler) character_data);
-
- /* Parse our data. */
- ok = XML_Parse(parser, xml_data, xml_len, 1);
- if (!ok)
- XMLRPC_FAIL(env, XMLRPC_PARSE_ERROR,
- (char*) XML_ErrorString(XML_GetErrorCode(parser)));
- XMLRPC_FAIL_IF_FAULT(env);
- /* Perform some sanity checks. */
- XMLRPC_ASSERT(context.root != NULL);
- XMLRPC_ASSERT(context.current == NULL);
- cleanup:
- if (parser)
- XML_ParserFree(parser);
+static void
+destroyParser(XML_Parser const parser,
+ parseContext * const contextP) {
- if (env->fault_occurred) {
- if (context.root)
- xml_element_free(context.root);
- return NULL;
- } else {
- return context.root;
+ xmlrpc_env_clean(&contextP->env);
+
+ xmlrpc_XML_ParserFree(parser);
+}
+
+
+
+void
+xml_parse(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen,
+ xml_element ** const resultPP) {
+/*----------------------------------------------------------------------------
+ Parse the XML text 'xmlData', of length 'xmlDataLen'. Return the
+ description of the element that the XML text contains as *resultPP.
+-----------------------------------------------------------------------------*/
+ /*
+ This is an Expat driver.
+
+ We set up event-based parser handlers for Expat and set Expat loose
+ on the XML. Expat walks through the XML, calling our handlers along
+ the way. Our handlers build up the element description in our
+ 'context' variable, so that when Expat is finished, our results are
+ in 'context' and we just have to pluck them out.
+
+ We should allow the user to specify the encoding in 'xmlData', but
+ we don't.
+ */
+ XML_Parser parser;
+ parseContext context;
+
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(xmlData != NULL);
+
+ createParser(envP, &context, &parser);
+
+ if (!envP->fault_occurred) {
+ bool ok;
+
+ ok = xmlrpc_XML_Parse(parser, xmlData, xmlDataLen, 1);
+ /* sets 'context', *envP */
+ if (!ok) {
+ /* Expat failed on its own to parse it -- this is not an error
+ that our handlers detected.
+ */
+ xmlrpc_env_set_fault(
+ envP, XMLRPC_PARSE_ERROR,
+ xmlrpc_XML_GetErrorString(parser));
+ if (!context.env.fault_occurred) {
+ /* Have to clean up what our handlers built before Expat
+ barfed.
+ */
+ if (context.rootP)
+ xml_element_free(context.rootP);
+ }
+ } else {
+ /* Expat got through the XML OK, but when it called our handlers,
+ they might have detected a problem. They would have noted
+ such a problem in *contextP.
+ */
+ if (context.env.fault_occurred)
+ xmlrpc_env_set_fault_formatted(
+ envP, context.env.fault_code,
+ "XML doesn't parse. %s", context.env.fault_string);
+ else {
+ XMLRPC_ASSERT(context.rootP != NULL);
+ XMLRPC_ASSERT(context.currentP == NULL);
+
+ *resultPP = context.rootP;
+ }
+ }
+ destroyParser(parser, &context);
}
}
+
+
+/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE. */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_libxml2.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_libxml2.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_libxml2.c Mon May 26 12:59:57 2008
@@ -30,7 +30,11 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
+#ifdef WIN32
+#include <xmlparser.h>
+#else
#include <libxml/parser.h>
+#endif
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
@@ -147,7 +151,7 @@
** documentation on each function works.
*/
-char *xml_element_name (xml_element *elem)
+const char *xml_element_name (const xml_element * const elem)
{
XMLRPC_ASSERT_ELEM_OK(elem);
return elem->_name;
@@ -167,13 +171,13 @@
return XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, &elem->_cdata);
}
-size_t xml_element_children_size (xml_element *elem)
+size_t xml_element_children_size (const xml_element *const elem)
{
XMLRPC_ASSERT_ELEM_OK(elem);
return XMLRPC_TYPED_MEM_BLOCK_SIZE(xml_element*, &elem->_children);
}
-xml_element **xml_element_children (xml_element *elem)
+xml_element **xml_element_children (const xml_element *const elem)
{
XMLRPC_ASSERT_ELEM_OK(elem);
return XMLRPC_TYPED_MEM_BLOCK_CONTENTS(xml_element*, &elem->_children);
@@ -372,47 +376,52 @@
NULL /* serror */
};
-xml_element *xml_parse (xmlrpc_env *env, const char *xml_data, int xml_len)
-{
+
+
+void
+xml_parse(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen,
+ xml_element ** const resultPP) {
+
parse_context context;
xmlParserCtxt *parser;
int err;
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(xml_data != NULL && xml_len >= 0);
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(xmlData != NULL && xmlDataLen >= 0);
/* Set up our error-handling preconditions. */
parser = NULL;
context.root = NULL;
/* Set up the rest of our parse context. */
- context.env = env;
+ context.env = envP;
context.current = NULL;
/* Set up our XML parser. */
parser = xmlCreatePushParserCtxt(&sax_handler, &context, NULL, 0, NULL);
- XMLRPC_FAIL_IF_NULL(parser, env, XMLRPC_INTERNAL_ERROR,
- "Could not create expat parser");
+ XMLRPC_FAIL_IF_NULL(parser, envP, XMLRPC_INTERNAL_ERROR,
+ "Could not create expat parser");
/* Parse our data. */
- err = xmlParseChunk(parser, xml_data, xml_len, 1);
+ err = xmlParseChunk(parser, xmlData, xmlDataLen, 1);
if (err)
- XMLRPC_FAIL(env, XMLRPC_PARSE_ERROR, "XML parsing failed");
- XMLRPC_FAIL_IF_FAULT(env);
+ XMLRPC_FAIL(envP, XMLRPC_PARSE_ERROR, "XML parsing failed");
+ XMLRPC_FAIL_IF_FAULT(envP);
/* Perform some sanity checks. */
XMLRPC_ASSERT(context.root != NULL);
XMLRPC_ASSERT(context.current == NULL);
+ *resultPP = context.root;
+
cleanup:
if (parser)
xmlFreeParserCtxt(parser);
- if (env->fault_occurred) {
+ if (envP->fault_occurred) {
if (context.root)
xml_element_free(context.root);
- return NULL;
- } else {
- return context.root;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_parse.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_parse.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_parse.c Mon May 26 12:59:57 2008
@@ -1,27 +1,4 @@
-/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE. */
+/* Copyright information is at end of file. */
#include "xmlrpc_config.h"
@@ -30,44 +7,34 @@
#include <string.h>
#include <errno.h>
#include <ctype.h>
+#include <limits.h>
+
+#include "bool.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/util.h"
#include "xmlrpc-c/xmlparser.h"
+#include "parse_value.h"
-/*=========================================================================
-** Data Format
-**=========================================================================
-** All XML-RPC documents contain a single methodCall or methodResponse
-** element.
-**
-** methodCall methodName, params
-** methodResponse (params|fault)
-** params param*
-** param value
-** fault value
-** value (i4|int|boolean|string|double|dateTime.iso8601|base64|
-** nil|struct|array)
-** array data
-** data value*
-** struct member*
-** member name, value
-**
-** Contain CDATA: methodName, i4, int, boolean, string, double,
-** dateTime.iso8601, base64, name
-**
-** We attempt to validate the structure of the XML document carefully.
-** We also try *very* hard to handle malicious data gracefully, and without
-** leaking memory.
-**
-** The CHECK_NAME and CHECK_CHILD_COUNT macros examine an XML element, and
-** invoke XMLRPC_FAIL if something looks wrong.
+/* Notes about XML-RPC XML documents:
+
+ Contain CDATA: methodName, i4, int, boolean, string, double,
+ dateTime.iso8601, base64, name
+
+ We attempt to validate the structure of the XML document carefully.
+ We also try *very* hard to handle malicious data gracefully, and without
+ leaking memory.
+
+ The CHECK_NAME and CHECK_CHILD_COUNT macros examine an XML element, and
+ invoke XMLRPC_FAIL if something looks wrong.
*/
#define CHECK_NAME(env,elem,name) \
do \
- if (strcmp((name), xml_element_name(elem)) != 0) \
+ if (!xmlrpc_streq((name), xml_element_name(elem))) \
XMLRPC_FAIL2(env, XMLRPC_PARSE_ERROR, \
"Expected element of type <%s>, found <%s>", \
(name), xml_element_name(elem)); \
@@ -91,7 +58,7 @@
children = xml_element_children(parent);
child_count = xml_element_children_size(parent);
for (i = 0; i < child_count; i++) {
- if (0 == strcmp(xml_element_name(children[i]), name))
+ if (xmlrpc_streq(xml_element_name(children[i]), name))
return children[i];
}
@@ -102,694 +69,565 @@
}
+
+static void
+setParseFault(xmlrpc_env * const envP,
+ const char * const format,
+ ...) {
+
+ va_list args;
+ va_start(args, format);
+ xmlrpc_set_fault_formatted_v(envP, XMLRPC_PARSE_ERROR, format, args);
+ va_end(args);
+}
+
+
+
/*=========================================================================
-** Number-Parsing Functions
+** convert_params
**=========================================================================
-** These functions mirror atoi, atof, etc., but provide better
-** error-handling. These routines may reset errno to zero.
+** Convert an XML element representing a list of params into an
+** xmlrpc_value (of type array).
*/
-static xmlrpc_int32
-xmlrpc_atoi(xmlrpc_env *env, char *str, size_t strlen,
- xmlrpc_int32 min, xmlrpc_int32 max)
-{
- long i;
- char *end;
+static xmlrpc_value *
+convert_params(xmlrpc_env * const envP,
+ const xml_element * const elemP) {
+/*----------------------------------------------------------------------------
+ Convert an XML element representing a list of parameters (i.e. a
+ <params> element) to an xmlrpc_value of type array. Note that an
+ array is normally represented in XML by a <value> element. We use
+ type xmlrpc_value to represent the parameter list just for convenience.
+-----------------------------------------------------------------------------*/
+ xmlrpc_value *array, *item;
+ int size, i;
+ xml_element **params, *param, *value;
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT_PTR_OK(str);
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(elemP != NULL);
- /* Suppress compiler warnings. */
- i = 0;
+ /* Set up our error-handling preconditions. */
+ array = item = NULL;
- /* Check for leading white space. */
- if (isspace(str[0]))
- XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
- "\"%s\" must not contain whitespace", str);
-
- /* Convert the value. */
- end = str + strlen;
- errno = 0;
- i = strtol(str, &end, 10);
-
- /* Look for ERANGE. */
- if (errno != 0)
- /* XXX - Do all operating systems have thread-safe strerror? */
- XMLRPC_FAIL3(env, XMLRPC_PARSE_ERROR,
- "error parsing \"%s\": %s (%d)",
- str, strerror(errno), errno);
-
- /* Look for out-of-range errors which didn't produce ERANGE. */
- if (i < min || i > max)
- XMLRPC_FAIL3(env, XMLRPC_PARSE_ERROR,
- "\"%s\" must be in range %d to %d", str, min, max);
-
- /* Check for unused characters. */
- if (end != str + strlen)
- XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
- "\"%s\" contained trailing data", str);
-
- cleanup:
- errno = 0;
- if (env->fault_occurred)
- return 0;
- return (xmlrpc_int32) i;
-}
+ /* Allocate an array to hold our parameters. */
+ array = xmlrpc_build_value(envP, "()");
+ XMLRPC_FAIL_IF_FAULT(envP);
+ /* We're responsible for checking our own element name. */
+ CHECK_NAME(envP, elemP, "params");
+ /* Iterate over our children. */
+ size = xml_element_children_size(elemP);
+ params = xml_element_children(elemP);
+ for (i = 0; i < size; ++i) {
+ unsigned int const maxNest = xmlrpc_limit_get(XMLRPC_NESTING_LIMIT_ID);
-static double
-xmlrpc_atod(xmlrpc_env *env, char *str, size_t strlen)
-{
- double d;
- char *end;
+ param = params[i];
+ CHECK_NAME(envP, param, "param");
+ CHECK_CHILD_COUNT(envP, param, 1);
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT_PTR_OK(str);
+ value = xml_element_children(param)[0];
- /* Suppress compiler warnings. */
- d = 0.0;
+ CHECK_NAME(envP, value, "value");
- /* Check for leading white space. */
- if (isspace(str[0]))
- XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
- "\"%s\" must not contain whitespace", str);
-
- /* Convert the value. */
- end = str + strlen;
- errno = 0;
- d = strtod(str, &end);
-
- /* Look for ERANGE. */
- if (errno != 0)
- /* XXX - Do all operating systems have thread-safe strerror? */
- XMLRPC_FAIL3(env, XMLRPC_PARSE_ERROR,
- "error parsing \"%s\": %s (%d)",
- str, strerror(errno), errno);
-
- /* Check for unused characters. */
- if (end != str + strlen)
- XMLRPC_FAIL1(env, XMLRPC_PARSE_ERROR,
- "\"%s\" contained trailing data", str);
+ xmlrpc_parseValue(envP, maxNest, value, &item);
+ XMLRPC_FAIL_IF_FAULT(envP);
+
+ xmlrpc_array_append_item(envP, array, item);
+ xmlrpc_DECREF(item);
+ item = NULL;
+ XMLRPC_FAIL_IF_FAULT(envP);
+ }
cleanup:
- errno = 0;
- if (env->fault_occurred)
- return 0.0;
- return d;
+ if (envP->fault_occurred) {
+ if (array)
+ xmlrpc_DECREF(array);
+ if (item)
+ xmlrpc_DECREF(item);
+ return NULL;
+ }
+ return array;
}
-/*=========================================================================
-** make_string
-**=========================================================================
-** Make an XML-RPC string.
-**
-** SECURITY: We validate our UTF-8 first. This incurs a performance
-** penalty, but ensures that we will never pass maliciously malformed
-** UTF-8 data back up to the user layer, where it could wreak untold
-** damange. Don't comment out this check unless you know *exactly* what
-** you're doing. (Win32 developers who remove this check are *begging*
-** to wind up on BugTraq, because many of the Win32 filesystem routines
-** rely on an insecure UTF-8 decoder.)
-**
-** XXX - This validation is redundant if the user chooses to convert
-** UTF-8 data into a wchar_t string.
-*/
-static xmlrpc_value *
-make_string(xmlrpc_env *env, char *cdata, size_t cdata_size)
-{
-#ifdef HAVE_UNICODE_WCHAR
- xmlrpc_validate_utf8(env, cdata, cdata_size);
-#endif
+static void
+parseCallXml(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlLen,
+ xml_element ** const callElemPP) {
+/*----------------------------------------------------------------------------
+ Parse the XML of an XML-RPC call.
+-----------------------------------------------------------------------------*/
+ xml_element * callElemP;
+ xmlrpc_env env;
- if (env->fault_occurred)
- return NULL;
- return xmlrpc_build_value(env, "s#", cdata, cdata_size);
-}
+ xmlrpc_env_init(&env);
+ xml_parse(&env, xmlData, xmlLen, &callElemP);
+ if (env.fault_occurred)
+ xmlrpc_env_set_fault_formatted(
+ envP, env.fault_code, "Call is not valid XML. %s",
+ env.fault_string);
+ else {
+ if (!xmlrpc_streq(xml_element_name(callElemP), "methodCall"))
+ setParseFault(envP,
+ "XML-RPC call should be a <methodCall> element. "
+ "Instead, we have a <%s> element.",
+ xml_element_name(callElemP));
+ if (!envP->fault_occurred)
+ *callElemPP = callElemP;
+ if (envP->fault_occurred)
+ xml_element_free(callElemP);
+ }
+ xmlrpc_env_clean(&env);
+}
-/*=========================================================================
-** convert_value
-**=======================================================================*/
-static xmlrpc_value *
-convert_array (xmlrpc_env *env, unsigned *depth, xml_element *elem);
-static xmlrpc_value *
-convert_struct(xmlrpc_env *env, unsigned *depth, xml_element *elem);
+
+static void
+parseMethodNameElement(xmlrpc_env * const envP,
+ xml_element * const nameElemP,
+ const char ** const methodNameP) {
+
+ XMLRPC_ASSERT(xmlrpc_streq(xml_element_name(nameElemP), "methodName"));
+
+ if (xml_element_children_size(nameElemP) > 0)
+ setParseFault(envP, "A <methodName> element should not have "
+ "children. This one has %u of them.",
+ xml_element_children_size(nameElemP));
+ else {
+ const char * const cdata = xml_element_cdata(nameElemP);
+
+ xmlrpc_validate_utf8(envP, cdata, strlen(cdata));
+
+ if (!envP->fault_occurred) {
+ *methodNameP = strdup(cdata);
+ if (*methodNameP == NULL)
+ xmlrpc_faultf(envP,
+ "Could not allocate memory for method name");
+ }
+ }
+}
static void
-convertBase64(xmlrpc_env * const envP,
- const char * const cdata,
- size_t const cdata_size,
- xmlrpc_value ** const valuePP) {
+parseCallChildren(xmlrpc_env * const envP,
+ xml_element * const callElemP,
+ const char ** const methodNameP,
+ xmlrpc_value ** const paramArrayPP ) {
+/*----------------------------------------------------------------------------
+ Parse the children of a <methodCall> XML element *callElemP. They should
+ be <methodName> and <params>.
+-----------------------------------------------------------------------------*/
+ size_t const callChildCount = xml_element_children_size(callElemP);
+
+ xml_element * nameElemP;
+
+ XMLRPC_ASSERT(xmlrpc_streq(xml_element_name(callElemP), "methodCall"));
- xmlrpc_mem_block *decoded;
+ nameElemP = get_child_by_name(envP, callElemP, "methodName");
- decoded = xmlrpc_base64_decode(envP, cdata, cdata_size);
if (!envP->fault_occurred) {
- unsigned char * const asciiData =
- XMLRPC_MEMBLOCK_CONTENTS(unsigned char, decoded);
- size_t const asciiLen =
- XMLRPC_MEMBLOCK_SIZE(unsigned char, decoded);
-
- *valuePP = xmlrpc_build_value(envP, "6", asciiData, asciiLen);
-
- XMLRPC_MEMBLOCK_FREE(unsigned char, decoded);
+ parseMethodNameElement(envP, nameElemP, methodNameP);
+
+ if (!envP->fault_occurred) {
+ /* Convert our parameters. */
+ if (callChildCount > 1) {
+ xml_element * paramsElemP;
+
+ paramsElemP = get_child_by_name(envP, callElemP, "params");
+
+ if (!envP->fault_occurred)
+ *paramArrayPP = convert_params(envP, paramsElemP);
+ } else {
+ /* Workaround for Ruby XML-RPC and old versions of
+ xmlrpc-epi. Future improvement: Instead of looking
+ at child count, we should just check for existence
+ of <params>.
+ */
+ *paramArrayPP = xmlrpc_array_new(envP);
+ }
+ if (!envP->fault_occurred) {
+ if (callChildCount > 2)
+ setParseFault(envP, "<methodCall> has extraneous "
+ "children, other than <methodName> and "
+ "<params>. Total child count = %u",
+ callChildCount);
+
+ if (envP->fault_occurred)
+ xmlrpc_DECREF(*paramArrayPP);
+ }
+ if (envP->fault_occurred)
+ xmlrpc_strfree(*methodNameP);
+ }
}
}
-static xmlrpc_value *
-convert_value(xmlrpc_env * const envP,
- unsigned * const depthP,
- xml_element * const elem) {
+void
+xmlrpc_parse_call(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlLen,
+ const char ** const methodNameP,
+ xmlrpc_value ** const paramArrayPP) {
/*----------------------------------------------------------------------------
- Compute the xmlrpc_value represented by the XML <value> element 'elem'.
- Return that xmlrpc_value.
-
- Assume we are running at recursion depth *depthP. (TODO: this is a
- modularity violation. We have to replace this with a "maximum
- depth" argument that tells how much additional recursion depth
- we're allowed to use).
+ Given some XML text, attempt to parse it as an XML-RPC call.
+ Return as *methodNameP the name of the method identified in the call
+ and as *paramArrayPP the parameter list as an XML-RPC array.
+ Caller must free() and xmlrpc_DECREF() these, respectively).
-----------------------------------------------------------------------------*/
- int child_count;
- char * child_name;
- xmlrpc_value *retval;
-
XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT(elem != NULL);
+ XMLRPC_ASSERT(xmlData != NULL);
+ XMLRPC_ASSERT(methodNameP != NULL && paramArrayPP != NULL);
- /* Error-handling precoditions.
- ** If we haven't changed any of these from their default state, we're
- ** allowed to tail-call xmlrpc_build_value. */
- retval = NULL;
-
- /* Make sure we haven't recursed too deeply. */
- if (*depthP > xmlrpc_limit_get(XMLRPC_NESTING_LIMIT_ID))
- XMLRPC_FAIL(envP, XMLRPC_PARSE_ERROR,
- "Nested data structure too deep.");
-
- /* Validate our structure, and see whether we have a child element. */
- CHECK_NAME(envP, elem, "value");
- child_count = xml_element_children_size(elem);
-
- if (child_count == 0) {
- /* We have no type element, so treat the value as a string. */
- char * const cdata = xml_element_cdata(elem);
- size_t const cdata_size = xml_element_cdata_size(elem);
- retval = make_string(envP, cdata, cdata_size);
- } else {
- /* We should have a type tag inside our value tag. */
- xml_element *child;
-
- CHECK_CHILD_COUNT(envP, elem, 1);
- child = xml_element_children(elem)[0];
-
- /* Parse our value-containing element. */
- child_name = xml_element_name(child);
- if (strcmp(child_name, "struct") == 0) {
- retval = convert_struct(envP, depthP, child);
- } else if (strcmp(child_name, "array") == 0) {
- CHECK_CHILD_COUNT(envP, child, 1);
- retval = convert_array(envP, depthP, child);
- } else {
- char * cdata;
- size_t cdata_size;
-
- CHECK_CHILD_COUNT(envP, child, 0);
- cdata = xml_element_cdata(child);
- cdata_size = xml_element_cdata_size(child);
- if (strcmp(child_name, "i4") == 0 ||
- strcmp(child_name, "int") == 0) {
- xmlrpc_int32 const i =
- xmlrpc_atoi(envP, cdata, strlen(cdata),
- XMLRPC_INT32_MIN, XMLRPC_INT32_MAX);
- XMLRPC_FAIL_IF_FAULT(envP);
- retval = xmlrpc_build_value(envP, "i", i);
- } else if (strcmp(child_name, "string") == 0) {
- retval = make_string(envP, cdata, cdata_size);
- } else if (strcmp(child_name, "boolean") == 0) {
- xmlrpc_int32 const i =
- xmlrpc_atoi(envP, cdata, strlen(cdata), 0, 1);
- XMLRPC_FAIL_IF_FAULT(envP);
- retval = xmlrpc_build_value(envP, "b", (xmlrpc_bool) i);
- } else if (strcmp(child_name, "double") == 0) {
- double const d = xmlrpc_atod(envP, cdata, strlen(cdata));
- XMLRPC_FAIL_IF_FAULT(envP);
- retval = xmlrpc_build_value(envP, "d", d);
- } else if (strcmp(child_name, "dateTime.iso8601") == 0) {
- retval = xmlrpc_build_value(envP, "8", cdata);
- } else if (strcmp(child_name, "nil") == 0) {
- retval = xmlrpc_build_value(envP, "n");
- } else if (strcmp(child_name, "base64") == 0) {
- /* No more tail calls once we do this! */
+ /* SECURITY: Last-ditch attempt to make sure our content length is
+ legal. XXX - This check occurs too late to prevent an attacker
+ from creating an enormous memory block, so you should try to
+ enforce it *before* reading any data off the network.
+ */
+ if (xmlLen > xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_LIMIT_EXCEEDED_ERROR,
+ "XML-RPC request too large. Max allowed is %u bytes",
+ xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID));
+ else {
+ xml_element * callElemP;
+ parseCallXml(envP, xmlData, xmlLen, &callElemP);
+ if (!envP->fault_occurred) {
+ parseCallChildren(envP, callElemP, methodNameP, paramArrayPP);
- convertBase64(envP, cdata, cdata_size, &retval);
- if (envP->fault_occurred)
- /* Just for cleanup code: */
- retval = NULL;
- } else {
- XMLRPC_FAIL1(envP, XMLRPC_PARSE_ERROR,
- "Unknown value type -- XML element is named "
- "<%s>", child_name);
- }
+ xml_element_free(callElemP);
}
}
-
- cleanup:
if (envP->fault_occurred) {
- if (retval)
- xmlrpc_DECREF(retval);
- retval = NULL;
+ /* Should not be necessary, but for backward compatibility: */
+ *methodNameP = NULL;
+ *paramArrayPP = NULL;
}
- return retval;
}
-/*=========================================================================
-** convert_array
-**=========================================================================
-** Convert an XML element representing an array into an xmlrpc_value.
-*/
-
-static xmlrpc_value *
-convert_array(xmlrpc_env *env, unsigned *depth, xml_element *elem)
-{
- xml_element *data, **values, *value;
- xmlrpc_value *array, *item;
- int size, i;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(elem != NULL);
-
- /* Set up our error-handling preconditions. */
- array = item = NULL;
- (*depth)++;
-
- /* Allocate an array to hold our values. */
- array = xmlrpc_build_value(env, "()");
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* We don't need to check our element name--our callers do that. */
- CHECK_CHILD_COUNT(env, elem, 1);
- data = xml_element_children(elem)[0];
- CHECK_NAME(env, data, "data");
-
- /* Iterate over our children. */
- values = xml_element_children(data);
- size = xml_element_children_size(data);
- for (i = 0; i < size; i++) {
- value = values[i];
- item = convert_value(env, depth, value);
- XMLRPC_FAIL_IF_FAULT(env);
-
- xmlrpc_array_append_item(env, array, item);
- xmlrpc_DECREF(item);
- item = NULL;
- XMLRPC_FAIL_IF_FAULT(env);
- }
+static void
+interpretFaultCode(xmlrpc_env * const envP,
+ xmlrpc_value * const faultCodeVP,
+ int * const faultCodeP) {
+
+ xmlrpc_env fcEnv;
+ xmlrpc_env_init(&fcEnv);
+
+ xmlrpc_read_int(&fcEnv, faultCodeVP, faultCodeP);
+ if (fcEnv.fault_occurred)
+ xmlrpc_faultf(envP, "Invalid value for 'faultCode' member. %s",
+ fcEnv.fault_string);
- cleanup:
- (*depth)--;
- if (item)
- xmlrpc_DECREF(item);
- if (env->fault_occurred) {
- if (array)
- xmlrpc_DECREF(array);
- return NULL;
- }
- return array;
+ xmlrpc_env_clean(&fcEnv);
}
-/*=========================================================================
-** convert_struct
-**=========================================================================
-** Convert an XML element representing a struct into an xmlrpc_value.
-*/
+static void
+interpretFaultString(xmlrpc_env * const envP,
+ xmlrpc_value * const faultStringVP,
+ const char ** const faultStringP) {
-static xmlrpc_value *
-convert_struct(xmlrpc_env *env, unsigned *depth, xml_element *elem)
-{
- xmlrpc_value *strct, *key, *value;
- xml_element **members, *member, *name_elem, *value_elem;
- int size, i;
- char *cdata;
- size_t cdata_size;
+ xmlrpc_env fsEnv;
+ xmlrpc_env_init(&fsEnv);
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(elem != NULL);
+ xmlrpc_read_string(&fsEnv, faultStringVP, faultStringP);
- /* Set up our error-handling preconditions. */
- strct = key = value = NULL;
- (*depth)++;
+ if (fsEnv.fault_occurred)
+ xmlrpc_faultf(envP, "Invalid value for 'faultString' member. %s",
+ fsEnv.fault_string);
- /* Allocate an array to hold our members. */
- strct = xmlrpc_struct_new(env);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Iterate over our children, extracting key/value pairs. */
- /* We don't need to check our element name--our callers do that. */
- members = xml_element_children(elem);
- size = xml_element_children_size(elem);
- for (i = 0; i < size; i++) {
- member = members[i];
- CHECK_NAME(env, member, "member");
- CHECK_CHILD_COUNT(env, member, 2);
-
- /* Get our key. */
- name_elem = get_child_by_name(env, member, "name");
- XMLRPC_FAIL_IF_FAULT(env);
- CHECK_CHILD_COUNT(env, name_elem, 0);
- cdata = xml_element_cdata(name_elem);
- cdata_size = xml_element_cdata_size(name_elem);
- key = make_string(env, cdata, cdata_size);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Get our value. */
- value_elem = get_child_by_name(env, member, "value");
- XMLRPC_FAIL_IF_FAULT(env);
- value = convert_value(env, depth, value_elem);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Add the key/value pair to our struct. */
- xmlrpc_struct_set_value_v(env, strct, key, value);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Release our references & memory, and restore our invariants. */
- xmlrpc_DECREF(key);
- key = NULL;
- xmlrpc_DECREF(value);
- value = NULL;
- }
-
- cleanup:
- (*depth)--;
- if (key)
- xmlrpc_DECREF(key);
- if (value)
- xmlrpc_DECREF(value);
- if (env->fault_occurred) {
- if (strct)
- xmlrpc_DECREF(strct);
- return NULL;
- }
- return strct;
+ xmlrpc_env_clean(&fsEnv);
}
-/*=========================================================================
-** convert_params
-**=========================================================================
-** Convert an XML element representing a list of params into an
-** xmlrpc_value (of type array).
-*/
-
-static xmlrpc_value *
-convert_params(xmlrpc_env *env, unsigned *depth, xml_element *elem)
-{
- xmlrpc_value *array, *item;
- int size, i;
- xml_element **params, *param, *value;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(elem != NULL);
-
- /* Set up our error-handling preconditions. */
- array = item = NULL;
+static void
+interpretFaultValue(xmlrpc_env * const envP,
+ xmlrpc_value * const faultVP,
+ int * const faultCodeP,
+ const char ** const faultStringP) {
+
+ if (faultVP->_type != XMLRPC_TYPE_STRUCT)
+ setParseFault(envP,
+ "<value> element of <fault> response is not "
+ "of structure type");
+ else {
+ xmlrpc_value * faultCodeVP;
+ xmlrpc_env fvEnv;
+
+ xmlrpc_env_init(&fvEnv);
+
+ xmlrpc_struct_read_value(&fvEnv, faultVP, "faultCode", &faultCodeVP);
+ if (!fvEnv.fault_occurred) {
+ interpretFaultCode(&fvEnv, faultCodeVP, faultCodeP);
+
+ if (!fvEnv.fault_occurred) {
+ xmlrpc_value * faultStringVP;
+
+ xmlrpc_struct_read_value(&fvEnv, faultVP, "faultString",
+ &faultStringVP);
+ if (!fvEnv.fault_occurred) {
+ interpretFaultString(&fvEnv, faultStringVP, faultStringP);
- /* Allocate an array to hold our parameters. */
- array = xmlrpc_build_value(env, "()");
- XMLRPC_FAIL_IF_FAULT(env);
+ xmlrpc_DECREF(faultStringVP);
+ }
+ }
+ xmlrpc_DECREF(faultCodeVP);
+ }
+ if (fvEnv.fault_occurred)
+ setParseFault(envP, "Invalid struct for <fault> value. %s",
+ fvEnv.fault_string);
- /* We're responsible for checking our own element name. */
- CHECK_NAME(env, elem, "params");
+ xmlrpc_env_clean(&fvEnv);
+ }
+}
- /* Iterate over our children. */
- size = xml_element_children_size(elem);
- params = xml_element_children(elem);
- for (i = 0; i < size; i++) {
- param = params[i];
- CHECK_NAME(env, param, "param");
- CHECK_CHILD_COUNT(env, param, 1);
- value = xml_element_children(param)[0];
- item = convert_value(env, depth, value);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_array_append_item(env, array, item);
- xmlrpc_DECREF(item);
- item = NULL;
- XMLRPC_FAIL_IF_FAULT(env);
- }
+static void
+parseFaultElement(xmlrpc_env * const envP,
+ const xml_element * const faultElement,
+ int * const faultCodeP,
+ const char ** const faultStringP) {
+
+ unsigned int const maxRecursion =
+ xmlrpc_limit_get(XMLRPC_NESTING_LIMIT_ID);
+
+ XMLRPC_ASSERT(xmlrpc_streq(xml_element_name(faultElement), "fault"));
+
+ if (xml_element_children_size(faultElement) != 1)
+ setParseFault(envP, "<fault> element should have 1 child, "
+ "but it has %u.",
+ xml_element_children_size(faultElement));
+ else {
+ xml_element * const faultValueP =
+ xml_element_children(faultElement)[0];
+ const char * const elemName = xml_element_name(faultValueP);
+
+ if (!xmlrpc_streq(elemName, "value"))
+ setParseFault(envP,
+ "<fault> contains a <%s> element. "
+ "Only <value> makes sense.",
+ elemName);
+ else {
+ xmlrpc_value * faultVP;
- cleanup:
- if (env->fault_occurred) {
- if (array)
- xmlrpc_DECREF(array);
- if (item)
- xmlrpc_DECREF(item);
- return NULL;
+ xmlrpc_parseValue(envP, maxRecursion, faultValueP, &faultVP);
+
+ if (!envP->fault_occurred) {
+ interpretFaultValue(envP, faultVP, faultCodeP, faultStringP);
+
+ xmlrpc_DECREF(faultVP);
+ }
+ }
}
- return array;
}
static void
-parseCallXml(xmlrpc_env * const envP,
- const char * const xmlData,
- size_t const xmlLen,
- xml_element ** const callElemP) {
+parseParamsElement(xmlrpc_env * const envP,
+ const xml_element * const paramsElementP,
+ xmlrpc_value ** const resultPP) {
+ xmlrpc_value * paramsVP;
xmlrpc_env env;
xmlrpc_env_init(&env);
- *callElemP = xml_parse(&env, xmlData, xmlLen);
- if (env.fault_occurred)
- xmlrpc_env_set_fault_formatted(
- envP, env.fault_code, "Call is not valid XML. %s",
- env.fault_string);
- xmlrpc_env_clean(&env);
-}
+ XMLRPC_ASSERT(xmlrpc_streq(xml_element_name(paramsElementP), "params"));
+ paramsVP = convert_params(envP, paramsElementP);
-/*=========================================================================
-** xmlrpc_parse_call
-**=========================================================================
-** Given some XML text, attempt to parse it as an XML-RPC call. Return
-** a newly allocated xmlrpc_call structure (or NULL, if an error occurs).
-** The two output variables will contain either valid values (which
-** must free() and xmlrpc_DECREF(), respectively) or NULLs (if an error
-** occurs).
-*/
-
-void
-xmlrpc_parse_call(xmlrpc_env * const envP,
- const char * const xml_data,
- size_t const xml_len,
- const char ** const out_method_nameP,
- xmlrpc_value ** const out_param_arrayPP) {
-
- xml_element *call_elem, *name_elem, *params_elem;
- char *cdata;
- unsigned depth;
- size_t call_child_count;
- char * outMethodName;
- xmlrpc_value * outParamArrayP;
+ if (!envP->fault_occurred) {
+ int arraySize;
+ xmlrpc_env sizeEnv;
- XMLRPC_ASSERT_ENV_OK(envP);
- XMLRPC_ASSERT(xml_data != NULL);
- XMLRPC_ASSERT(out_method_nameP != NULL && out_param_arrayPP != NULL);
+ XMLRPC_ASSERT_ARRAY_OK(paramsVP);
+
+ xmlrpc_env_init(&sizeEnv);
- /* Set up our error-handling preconditions. */
- outMethodName = NULL;
- outParamArrayP = NULL;
- call_elem = NULL;
+ arraySize = xmlrpc_array_size(&sizeEnv, paramsVP);
+ /* Since it's a valid array, as asserted above, can't fail */
+ XMLRPC_ASSERT(!sizeEnv.fault_occurred);
+
+ if (arraySize != 1)
+ setParseFault(envP, "Contains %d items. It should have 1.",
+ arraySize);
+ else {
+ xmlrpc_array_read_item(envP, paramsVP, 0, resultPP);
+ }
+ xmlrpc_DECREF(paramsVP);
+ xmlrpc_env_clean(&sizeEnv);
+ }
+ if (env.fault_occurred)
+ xmlrpc_env_set_fault_formatted(
+ envP, env.fault_code,
+ "Invalid <params> element. %s", env.fault_string);
- /* SECURITY: Last-ditch attempt to make sure our content length is legal.
- ** XXX - This check occurs too late to prevent an attacker from creating
- ** an enormous memory block in RAM, so you should try to enforce it
- ** *before* reading any data off the network. */
- if (xml_len > xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
- XMLRPC_FAIL(envP, XMLRPC_LIMIT_EXCEEDED_ERROR,
- "XML-RPC request too large");
+ xmlrpc_env_clean(&env);
+}
- parseCallXml(envP, xml_data, xml_len, &call_elem);
- XMLRPC_FAIL_IF_FAULT(envP);
- /* Pick apart and verify our structure. */
- CHECK_NAME(envP, call_elem, "methodCall");
- call_child_count = xml_element_children_size(call_elem);
- if (call_child_count != 2 && call_child_count != 1)
- XMLRPC_FAIL1(envP, XMLRPC_PARSE_ERROR,
- "Expected <methodCall> to have 1 or 2 children, found %d",
- call_child_count);
-
- /* Extract the method name.
- ** SECURITY: We make sure the method name is valid UTF-8. */
- name_elem = get_child_by_name(envP, call_elem, "methodName");
- XMLRPC_FAIL_IF_FAULT(envP);
- CHECK_CHILD_COUNT(envP, name_elem, 0);
- cdata = xml_element_cdata(name_elem);
-#ifdef HAVE_UNICODE_WCHAR
- xmlrpc_validate_utf8(envP, cdata, strlen(cdata));
- XMLRPC_FAIL_IF_FAULT(envP);
-#endif /* HAVE_UNICODE_WCHAR */
- outMethodName = malloc(strlen(cdata) + 1);
- XMLRPC_FAIL_IF_NULL(outMethodName, envP, XMLRPC_INTERNAL_ERROR,
- "Could not allocate memory for method name");
- strcpy(outMethodName, cdata);
-
- /* Convert our parameters. */
- if (call_child_count == 1) {
- /* Workaround for Ruby XML-RPC and old versions of xmlrpc-epi. */
- outParamArrayP = xmlrpc_build_value(envP, "()");
- XMLRPC_FAIL_IF_FAULT(envP);
- } else {
- params_elem = get_child_by_name(envP, call_elem, "params");
- XMLRPC_FAIL_IF_FAULT(envP);
- depth = 0;
- outParamArrayP = convert_params(envP, &depth, params_elem);
- XMLRPC_ASSERT(depth == 0);
- XMLRPC_FAIL_IF_FAULT(envP);
- }
-cleanup:
- if (call_elem)
- xml_element_free(call_elem);
- if (envP->fault_occurred) {
- if (outMethodName)
- free(outMethodName);
- if (outParamArrayP)
- xmlrpc_DECREF(outParamArrayP);
- outMethodName = NULL;
- outParamArrayP = NULL;
- }
- *out_method_nameP = outMethodName;
- *out_param_arrayPP = outParamArrayP;
+static void
+parseMethodResponseElt(xmlrpc_env * const envP,
+ const xml_element * const methodResponseEltP,
+ xmlrpc_value ** const resultPP,
+ int * const faultCodeP,
+ const char ** const faultStringP) {
+
+ XMLRPC_ASSERT(xmlrpc_streq(xml_element_name(methodResponseEltP),
+ "methodResponse"));
+
+ if (xml_element_children_size(methodResponseEltP) == 1) {
+ xml_element * const child =
+ xml_element_children(methodResponseEltP)[0];
+
+ if (xmlrpc_streq(xml_element_name(child), "params")) {
+ /* It's a successful response */
+ parseParamsElement(envP, child, resultPP);
+ *faultStringP = NULL;
+ } else if (xmlrpc_streq(xml_element_name(child), "fault")) {
+ /* It's a failure response */
+ parseFaultElement(envP, child, faultCodeP, faultStringP);
+ } else
+ setParseFault(envP,
+ "<methodResponse> must contain <params> or <fault>, "
+ "but contains <%s>.", xml_element_name(child));
+ } else
+ setParseFault(envP,
+ "<methodResponse> has %u children, should have 1.",
+ xml_element_children_size(methodResponseEltP));
}
-/*=========================================================================
-** xmlrpc_parse_response
-**=========================================================================
-** Given some XML text, attempt to parse it as an XML-RPC response.
-** If the response is a regular, valid response, return a new reference
-** to the appropriate value. If the response is a fault, or an error
-** occurs during processing, return NULL and set up env appropriately.
-*/
+void
+xmlrpc_parse_response2(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen,
+ xmlrpc_value ** const resultPP,
+ int * const faultCodeP,
+ const char ** const faultStringP) {
+/*----------------------------------------------------------------------------
+ Given some XML text, attempt to parse it as an XML-RPC response.
-xmlrpc_value *
-xmlrpc_parse_response(xmlrpc_env *env,
- const char *xml_data,
- size_t xml_len) {
-
- xml_element *response, *child, *value;
- unsigned depth;
- xmlrpc_value *params, *retval, *fault;
- int retval_incremented;
-
- xmlrpc_value *fault_code_value, *fault_str_value;
- xmlrpc_int32 fault_code;
- char *fault_str;
+ If the response is a regular, valid response, return a new reference
+ to the appropriate value as *resultP and return NULL as
+ *faultStringP and nothing as *faultCodeP.
+
+ If the response is valid, but indicates a failure of the RPC, return the
+ fault string in newly malloc'ed space as *faultStringP and the fault
+ code as *faultCodeP and nothing as *resultP.
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(xml_data != NULL);
+ If the XML text is not a valid response or something prevents us from
+ parsing it, return a description of the error as *envP and nothing else.
+-----------------------------------------------------------------------------*/
+ xml_element * response;
- /* Set up our error-handling preconditions. */
- response = NULL;
- params = fault = NULL;
- retval_incremented = 0;
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(xmlData != NULL);
/* SECURITY: Last-ditch attempt to make sure our content length is legal.
** XXX - This check occurs too late to prevent an attacker from creating
- ** an enormous memory block in RAM, so you should try to enforce it
+ ** an enormous memory block, so you should try to enforce it
** *before* reading any data off the network. */
- if (xml_len > xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
- XMLRPC_FAIL(env, XMLRPC_LIMIT_EXCEEDED_ERROR,
- "XML-RPC response too large");
-
- /* SECURITY: Set up our recursion depth counter. */
- depth = 0;
-
- /* Parse our XML data. */
- response = xml_parse(env, xml_data, xml_len);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Pick apart and verify our structure. */
- CHECK_NAME(env, response, "methodResponse");
- CHECK_CHILD_COUNT(env, response, 1);
- child = xml_element_children(response)[0];
-
- /* Parse the response itself. */
- if (strcmp("params", xml_element_name(child)) == 0) {
-
- /* Convert our parameter list. */
- params = convert_params(env, &depth, child);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Extract the return value, and jiggle our reference counts. */
- xmlrpc_parse_value(env, params, "(V)", &retval);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_INCREF(retval);
- retval_incremented = 1;
-
- } else if (strcmp("fault", xml_element_name(child)) == 0) {
-
- /* Convert our fault structure. */
- CHECK_CHILD_COUNT(env, child, 1);
- value = xml_element_children(child)[0];
- fault = convert_value(env, &depth, value);
- XMLRPC_FAIL_IF_FAULT(env);
- XMLRPC_TYPE_CHECK(env, fault, XMLRPC_TYPE_STRUCT);
-
- /* Get our fault code. */
- fault_code_value = xmlrpc_struct_get_value(env, fault, "faultCode");
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_parse_value(env, fault_code_value, "i", &fault_code);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Get our fault string. */
- fault_str_value = xmlrpc_struct_get_value(env, fault, "faultString");
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_parse_value(env, fault_str_value, "s", &fault_str);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Return our fault. */
- XMLRPC_FAIL(env, fault_code, fault_str);
-
- } else {
- XMLRPC_FAIL(env, XMLRPC_PARSE_ERROR,
- "Expected <params> or <fault> in <methodResponse>");
+ if (xmlDataLen > xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_LIMIT_EXCEEDED_ERROR,
+ "XML-RPC response too large. Our limit is %u characters. "
+ "We got %u characters",
+ xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID), xmlDataLen);
+ else {
+ xmlrpc_env env;
+ xmlrpc_env_init(&env);
+
+ xml_parse(&env, xmlData, xmlDataLen, &response);
+
+ if (env.fault_occurred)
+ setParseFault(envP, "Not valid XML. %s", env.fault_string);
+ else {
+ /* Pick apart and verify our structure. */
+ if (xmlrpc_streq(xml_element_name(response), "methodResponse")) {
+ parseMethodResponseElt(envP, response,
+ resultPP, faultCodeP, faultStringP);
+ } else
+ setParseFault(envP, "XML-RPC response must consist of a "
+ "<methodResponse> element. "
+ "This has a <%s> instead.",
+ xml_element_name(response));
+
+ xml_element_free(response);
+ }
+ xmlrpc_env_clean(&env);
}
+}
+
+
- /* Sanity-check our depth-counting code. */
- XMLRPC_ASSERT(depth == 0);
+xmlrpc_value *
+xmlrpc_parse_response(xmlrpc_env * const envP,
+ const char * const xmlData,
+ size_t const xmlDataLen) {
+/*----------------------------------------------------------------------------
+ This exists for backward compatibility. It is like
+ xmlrpc_parse_response2(), except that it merges the concepts of a
+ failed RPC and an error in executing the RPC.
+-----------------------------------------------------------------------------*/
+ xmlrpc_value * retval;
+ xmlrpc_value * result;
+ const char * faultString;
+ int faultCode;
+
+ xmlrpc_parse_response2(envP, xmlData, xmlDataLen,
+ &result, &faultCode, &faultString);
-cleanup:
- if (response)
- xml_element_free(response);
- if (params)
- xmlrpc_DECREF(params);
- if (fault)
- xmlrpc_DECREF(fault);
-
- if (env->fault_occurred) {
- if (retval_incremented)
- xmlrpc_DECREF(retval);
- return NULL;
+ if (envP->fault_occurred)
+ retval = NULL;
+ else {
+ if (faultString) {
+ xmlrpc_env_set_fault(envP, faultCode, faultString);
+ xmlrpc_strfree(faultString);
+ retval = NULL;
+ } else
+ retval = result; /* transfer reference */
}
return retval;
}
+
+
+
+/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE. */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_serialize.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_serialize.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_serialize.c Mon May 26 12:59:57 2008
@@ -1,246 +1,246 @@
-/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE. */
+/* Copyright information is at end of file */
+
+/* Implementation note:
+
+ The printf format specifiers we use appear to be entirely standard,
+ except for the "long long" one, which is %I64 on Windows and %lld
+ everywhere else. So for that, we use the C99 standard macro PRId64,
+ which is defined by inttypes.h. Ironically, Windows doesn't have
+ inttypes.h either, but we have int.h instead.
+*/
#include "xmlrpc_config.h"
+#include <assert.h>
#include <stddef.h>
#include <stdarg.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <float.h>
+#include "int.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "double.h"
#define CRLF "\015\012"
#define SMALL_BUFFER_SZ (128)
#define XML_PROLOGUE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"CRLF
-/*=========================================================================
-** format_out
-**=========================================================================
-** A lightweight print routine for use with various serialization
-** functions. Only use this routine for printing small objects--it uses
-** a fixed-size internal buffer and returns an error on overflow.
-** In particular, do NOT use this routine to print XML-RPC string values!
-*/
+static void
+addString(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const string) {
+
+ XMLRPC_MEMBLOCK_APPEND(char, envP, outputP, string, strlen(string));
+}
+
+
static void
-format_out(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- char *format_string,
- ...) {
+formatOut(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const formatString,
+ ...) {
+/*----------------------------------------------------------------------------
+ A lightweight print routine for use with various serialization
+ functions.
+ Use this routine only for printing small objects -- it uses a
+ fixed-size internal buffer and returns an error on overflow. In
+ particular, do NOT use this routine to print XML-RPC string values!
+-----------------------------------------------------------------------------*/
va_list args;
char buffer[SMALL_BUFFER_SZ];
int count;
- XMLRPC_ASSERT_ENV_OK(env);
+ XMLRPC_ASSERT_ENV_OK(envP);
- va_start(args, format_string);
+ va_start(args, formatString);
- /* We assume that this function is present and works correctly. Right. */
- count = vsnprintf(buffer, SMALL_BUFFER_SZ, format_string, args);
+ count = XMLRPC_VSNPRINTF(buffer, SMALL_BUFFER_SZ, formatString, args);
/* Old C libraries return -1 if vsnprintf overflows its buffer.
** New C libraries return the number of characters which *would* have
** been printed if the error did not occur. This is impressively vile.
** Thank the C99 committee for this bright idea. But wait! We also
- ** need to keep track of the trailing NULL. */
- if (count < 0 || count >= (SMALL_BUFFER_SZ - 1))
- XMLRPC_FAIL(env, XMLRPC_INTERNAL_ERROR,
- "format_out overflowed internal buffer");
+ ** need to keep track of the trailing NUL. */
- /* Append our new data to our output. */
- XMLRPC_TYPED_MEM_BLOCK_APPEND(char, env, output, buffer, count);
- XMLRPC_FAIL_IF_FAULT(env);
+ if (count < 0 || count >= (SMALL_BUFFER_SZ - 1))
+ xmlrpc_faultf(envP, "formatOut() overflowed internal buffer");
+ else
+ XMLRPC_MEMBLOCK_APPEND(char, envP, outputP, buffer, count);
-cleanup:
va_end(args);
}
-/*=========================================================================
-** Warnings About Invalid UTF-8
-**=========================================================================
-** We claim to send UTF-8 data to the network. But we rely on application
-** programs to pass us correctly-formed UTF-8 data, which is very naive
-** and optimistic.
-**
-** In debudding mode, we call this routine to issue dire-sounding
-** warnings. For the sake of safety, this routine never exits the
-** program or does anything else drastic.
-**
-** This routine almost certainly slows down our output.
-*/
-
-#if !defined NDEBUG && defined HAVE_UNICODE_WCHAR
static void
-sanity_check_utf8(const char * const str,
- size_t const len) {
-
+assertValidUtf8(const char * const str ATTR_UNUSED,
+ size_t const len ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ Assert that the string 'str' of length 'len' is valid UTF-8.
+-----------------------------------------------------------------------------*/
+#if !defined NDEBUG
+ /* Check the assertion; if it's false, issue a message to
+ Standard Error, but otherwise ignore it.
+ */
xmlrpc_env env;
xmlrpc_env_init(&env);
xmlrpc_validate_utf8(&env, str, len);
if (env.fault_occurred)
fprintf(stderr, "*** xmlrpc-c WARNING ***: %s (%s)\n",
- "Application sending corrupted UTF-8 data to network",
+ "Xmlrpc-c sending corrupted UTF-8 data to network",
env.fault_string);
xmlrpc_env_clean(&env);
-}
#endif
+}
-/*=========================================================================
-** Escaping Strings
-**=========================================================================
-*/
+static size_t
+escapedSize(const char * const chars,
+ size_t const len) {
+
+ size_t size;
+ size_t i;
-static xmlrpc_mem_block *
-escape_string(xmlrpc_env * const env,
- const char * const str,
- size_t const len) {
-
- xmlrpc_mem_block *retval;
- size_t i, needed;
- char *out;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(str != NULL);
-
- /* Set up our error-handling preconditions. */
- retval = NULL;
-
- /* Sanity-check this string before we print it. */
-#if !defined NDEBUG && defined HAVE_UNICODE_WCHAR
- sanity_check_utf8(str, len);
-#endif
-
- /* Calculate the amount of space we'll need. */
- needed = 0;
- for (i = 0; i < len; i++) {
- if (str[i] == '<')
- needed += 4; /* < */
- else if (str[i] == '>')
- needed += 4; /* > */
- else if (str[i] == '&')
- needed += 5; /* & */
+ size = 0;
+ for (i = 0; i < len; ++i) {
+ if (chars[i] == '<')
+ size += 4; /* < */
+ else if (chars[i] == '>')
+ size += 4; /* > */
+ else if (chars[i] == '&')
+ size += 5; /* & */
+ else if (chars[i] == '\r')
+ size += 6; /* 
 */
else
- needed++;
+ size += 1;
}
+ return size;
+}
- /* Allocate our memory block. */
- retval = XMLRPC_TYPED_MEM_BLOCK_NEW(char, env, needed);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Copy over the newly-allocated data. */
- out = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, retval);
- for (i = 0; i < len; i++) {
- if (str[i] == '<') {
- *out++ = '&';
- *out++ = 'l';
- *out++ = 't';
- *out++ = ';';
- } else if (str[i] == '>') {
- *out++ = '&';
- *out++ = 'g';
- *out++ = 't';
- *out++ = ';';
- } else if (str[i] == '&') {
- *out++ = '&';
- *out++ = 'a';
- *out++ = 'm';
- *out++ = 'p';
- *out++ = ';';
- } else {
- *out++ = str[i];
- }
- }
- cleanup:
- if (env->fault_occurred) {
- if (retval)
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, retval);
- retval = NULL;
- }
- return retval;
-}
+static void
+escapeForXml(xmlrpc_env * const envP,
+ const char * const chars,
+ size_t const len,
+ xmlrpc_mem_block ** const outputPP) {
+/*----------------------------------------------------------------------------
+ Escape & and < in a UTF-8 string so as to make it suitable for the
+ content of an XML element. I.e. turn them into entity references
+ & and <.
+
+ Also change > to >, even though not required for XML, for
+ symmetry.
+
+ < etc. are known in XML as "entity references."
+
+ Also Escape CR as 
 . While raw CR _is_ allowed in the content
+ of an XML element, it has a special meaning -- it means line ending.
+ Our input uses LF for for line endings. Since it also means line ending
+ in XML, we just pass it through to our output like it were a regular
+ character.
+
+ 
 is known in XML as a "character reference."
+
+ We assume chars[] is is ASCII. That isn't right -- we should
+ handle all valid UTF-8. Someday, we must do something more complex
+ and copy over multibyte characters verbatim. (The code here could
+ erroneously find that e.g. the 2nd byte of a UTF-8 character is a
+ CR).
+-----------------------------------------------------------------------------*/
+ xmlrpc_mem_block * outputP;
+ size_t outputSize;
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(chars != NULL);
-static xmlrpc_mem_block*
-escape_block (xmlrpc_env *env,
- xmlrpc_mem_block *block) {
+ assertValidUtf8(chars, len);
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(block != NULL);
+ /* Note that in UTF-8, any byte that has high bit of zero is a
+ character all by itself (every byte of a multi-byte UTF-8 character
+ has the high bit set). Also, the Unicode code points < 128 are
+ identical to the ASCII ones.
+ */
- return escape_string(env,
- XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, block),
- XMLRPC_TYPED_MEM_BLOCK_SIZE(char, block));
-}
+ outputSize = escapedSize(chars, len);
+ outputP = XMLRPC_MEMBLOCK_NEW(char, envP, outputSize);
+ if (!envP->fault_occurred) {
+ char * p;
+ size_t i;
+ p = XMLRPC_MEMBLOCK_CONTENTS(char, outputP); /* Start at beginning */
+
+ for (i = 0; i < len; i++) {
+ if (chars[i] == '<') {
+ memcpy(p, "<", 4);
+ p += 4;
+ } else if (chars[i] == '>') {
+ memcpy(p, ">", 4);
+ p += 4;
+ } else if (chars[i] == '&') {
+ memcpy(p, "&", 5);
+ p += 5;
+ } else if (chars[i] == '\r') {
+ memcpy(p, "
", 6);
+ p += 6;
+ } else {
+ /* Either a plain character or a LF line delimiter */
+ *p = chars[i];
+ p += 1;
+ }
+ }
+ *outputPP = outputP;
+ assert(p == XMLRPC_MEMBLOCK_CONTENTS(char, outputP) + outputSize);
+
+ if (envP->fault_occurred)
+ XMLRPC_MEMBLOCK_FREE(char, outputP);
+ }
+}
-/*=========================================================================
-** xmlrpc_serialize_string_data
-**=========================================================================
-** Escape and print the contents of a string.
-*/
static void
-xmlrpc_serialize_string_data(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_value *string) {
+serializeUtf8MemBlock(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_mem_block * const inputP) {
+/*----------------------------------------------------------------------------
+ Append the characters in *inputP to the XML stream in *outputP.
- xmlrpc_mem_block *escaped;
- char *contents;
- size_t size;
+ *inputP contains Unicode characters in UTF-8.
- /* Since this routine can only be called internally, we only need
- ** an assertion here, not a runtime type check.
- ** XXX - Temporarily disabled because we're using this code to
- ** print <dateTime.iso8601> values as well. */
- /* XMLRPC_ASSERT(string->_type == XMLRPC_TYPE_STRING); */
-
- /* Escape any '&' and '<' characters in the string. */
- escaped = escape_block(env, &string->_block);
- XMLRPC_FAIL_IF_FAULT(env);
- contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, escaped);
- size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, escaped) - 1;
-
- /* Print the string. */
- XMLRPC_TYPED_MEM_BLOCK_APPEND(char, env, output, contents, size);
- XMLRPC_FAIL_IF_FAULT(env);
+ We assume *inputP ends with a NUL character that marks end of
+ string, and we ignore that. (There might also be NUL characters
+ inside the string, though).
+-----------------------------------------------------------------------------*/
+ xmlrpc_mem_block * escapedP;
+
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT(inputP != NULL);
+
+ escapeForXml(envP,
+ XMLRPC_MEMBLOCK_CONTENTS(const char, inputP),
+ XMLRPC_MEMBLOCK_SIZE(const char, inputP) - 1,
+ /* -1 is for the terminating NUL */
+ &escapedP);
+ if (!envP->fault_occurred) {
+ const char * const contents =
+ XMLRPC_MEMBLOCK_CONTENTS(const char, escapedP);
+ size_t const size = XMLRPC_MEMBLOCK_SIZE(char, escapedP);
- cleanup:
- if (escaped)
- XMLRPC_TYPED_MEM_BLOCK_FREE(char, escaped);
+ XMLRPC_MEMBLOCK_APPEND(char, envP, outputP, contents, size);
+
+ XMLRPC_MEMBLOCK_FREE(const char, escapedP);
+ }
}
@@ -271,43 +271,43 @@
-/*=========================================================================
-** xmlrpc_serialize_struct
-**=========================================================================
-** Dump the contents of a struct.
-*/
-
static void
-xmlrpc_serialize_struct(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_value *strct) {
-
+serializeStruct(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const structP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Add to *outputP the content of a <value> element to represent
+ the structure value *valueP. I.e. "<struct> ... </struct>".
+-----------------------------------------------------------------------------*/
size_t size;
size_t i;
- xmlrpc_value *key, *value;
+ xmlrpc_value * memberKeyP;
+ xmlrpc_value * memberValueP;
- format_out(env, output, "<struct>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
+ addString(envP, outputP, "<struct>"CRLF);
+ XMLRPC_FAIL_IF_FAULT(envP);
- size = xmlrpc_struct_size(env, strct);
- XMLRPC_FAIL_IF_FAULT(env);
- for (i = 0; i < size; i++) {
- xmlrpc_struct_get_key_and_value(env, strct, i, &key, &value);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "<member><name>");
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_string_data(env, output, key);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</name>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_value(env, output, value);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</member>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
+ size = xmlrpc_struct_size(envP, structP);
+ XMLRPC_FAIL_IF_FAULT(envP);
+ for (i = 0; i < size; ++i) {
+ xmlrpc_struct_get_key_and_value(envP, structP, i,
+ &memberKeyP, &memberValueP);
+ XMLRPC_FAIL_IF_FAULT(envP);
+ addString(envP, outputP, "<member><name>");
+ XMLRPC_FAIL_IF_FAULT(envP);
+ serializeUtf8MemBlock(envP, outputP, &memberKeyP->_block);
+ XMLRPC_FAIL_IF_FAULT(envP);
+ addString(envP, outputP, "</name>"CRLF);
+ XMLRPC_FAIL_IF_FAULT(envP);
+ xmlrpc_serialize_value2(envP, outputP, memberValueP, dialect);
+ XMLRPC_FAIL_IF_FAULT(envP);
+ addString(envP, outputP, "</member>"CRLF);
+ XMLRPC_FAIL_IF_FAULT(envP);
}
- format_out(env, output, "</struct>");
- XMLRPC_FAIL_IF_FAULT(env);
+ addString(envP, outputP, "</struct>");
+ XMLRPC_FAIL_IF_FAULT(envP);
cleanup:
return;
@@ -315,175 +315,229 @@
-/*=========================================================================
-** xmlrpc_serialize_value
-**=========================================================================
-** Dump a value in the appropriate fashion.
-*/
+static void
+serializeArray(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Add to *outputP the content of a <value> element to represent
+ the array value *valueP. I.e. "<array> ... </array>".
+-----------------------------------------------------------------------------*/
+ int const size = xmlrpc_array_size(envP, valueP);
-void
-xmlrpc_serialize_value(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_value *value) {
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "<array><data>"CRLF);
+ if (!envP->fault_occurred) {
+ int i;
+ /* Serialize each item. */
+ for (i = 0; i < size && !envP->fault_occurred; ++i) {
+ xmlrpc_value * const itemP =
+ xmlrpc_array_get_item(envP, valueP, i);
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_value2(envP, outputP, itemP, dialect);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, CRLF);
+ }
+ }
+ }
+ }
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</data></array>");
+}
- xmlrpc_value *item;
- size_t size;
- unsigned char* contents;
- size_t i;
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(output != NULL);
- XMLRPC_ASSERT_VALUE_OK(value);
-
- /* Print our ubiquitous header. */
- format_out(env, output, "<value>");
- XMLRPC_FAIL_IF_FAULT(env);
- switch (value->_type) {
+static void
+formatValueContent(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Add to *outputP the content of a <value> element to represent
+ value *valueP. E.g. "<int>42</int>"
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_ENV_OK(envP);
+ switch (valueP->_type) {
case XMLRPC_TYPE_INT:
- /* XXX - We assume that '%i' is the appropriate format specifier
- ** for an xmlrpc_int32 value. We should add some test cases to
- ** make sure this works. */
- format_out(env, output, "<i4>%i</i4>", value->_value.i);
+ formatOut(envP, outputP, "<i4>%d</i4>", valueP->_value.i);
break;
+ case XMLRPC_TYPE_I8: {
+ const char * const elemName =
+ dialect == xmlrpc_dialect_apache ? "ex.i8" : "i8";
+ formatOut(envP, outputP, "<%s>%" PRId64 "</%s>",
+ elemName, valueP->_value.i8, elemName);
+ } break;
+
case XMLRPC_TYPE_BOOL:
- /* XXX - We assume that '%i' is the appropriate format specifier
- ** for an xmlrpc_bool value. */
- format_out(env, output, "<boolean>%i</boolean>",
- (value->_value.b) ? 1 : 0);
+ formatOut(envP, outputP, "<boolean>%s</boolean>",
+ valueP->_value.b ? "1" : "0");
break;
- case XMLRPC_TYPE_DOUBLE:
- /* We must output a number of the form [+-]?\d*.\d*. */
- format_out(env, output, "<double>%.17g</double>", value->_value.d);
+ case XMLRPC_TYPE_DOUBLE: {
+ const char * serializedValue;
+ xmlrpc_formatFloat(envP, valueP->_value.d, &serializedValue);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "<double>");
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, serializedValue);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</double>");
+ }
+ xmlrpc_strfree(serializedValue);
+ }
+ } break;
+
+ case XMLRPC_TYPE_DATETIME:
+ addString(envP, outputP, "<dateTime.iso8601>");
+ if (!envP->fault_occurred) {
+ serializeUtf8MemBlock(envP, outputP, &valueP->_block);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "</dateTime.iso8601>");
+ }
+ }
break;
case XMLRPC_TYPE_STRING:
- format_out(env, output, "<string>");
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_string_data(env, output, value);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</string>");
+ addString(envP, outputP, "<string>");
+ if (!envP->fault_occurred) {
+ serializeUtf8MemBlock(envP, outputP, &valueP->_block);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</string>");
+ }
break;
- case XMLRPC_TYPE_ARRAY:
- format_out(env, output, "<array><data>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Serialize each item. */
- size = xmlrpc_array_size(env, value);
- XMLRPC_FAIL_IF_FAULT(env);
- for (i = 0; i < size; i++) {
- item = xmlrpc_array_get_item(env, value, i);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_value(env, output, item);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
+ case XMLRPC_TYPE_BASE64: {
+ unsigned char * const contents =
+ XMLRPC_MEMBLOCK_CONTENTS(unsigned char, &valueP->_block);
+ size_t const size =
+ XMLRPC_MEMBLOCK_SIZE(unsigned char, &valueP->_block);
+ addString(envP, outputP, "<base64>"CRLF);
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_base64_data(envP, outputP, contents, size);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</base64>");
}
+ } break;
- format_out(env, output, "</data></array>");
+ case XMLRPC_TYPE_ARRAY:
+ serializeArray(envP, outputP, valueP, dialect);
break;
case XMLRPC_TYPE_STRUCT:
- xmlrpc_serialize_struct(env, output, value);
- break;
-
- case XMLRPC_TYPE_BASE64:
- format_out(env, output, "<base64>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
- contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(unsigned char,
- &value->_block);
- size = XMLRPC_TYPED_MEM_BLOCK_SIZE(unsigned char, &value->_block);
- xmlrpc_serialize_base64_data(env, output, contents, size);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</base64>");
- break;
-
- case XMLRPC_TYPE_DATETIME:
- format_out(env, output, "<dateTime.iso8601>");
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_string_data(env, output, value);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</dateTime.iso8601>");
+ serializeStruct(envP, outputP, valueP, dialect);
break;
case XMLRPC_TYPE_C_PTR:
- xmlrpc_env_set_fault_formatted(
- env, XMLRPC_INTERNAL_ERROR,
- "Tried to serialize a C pointer value.");
+ xmlrpc_faultf(envP, "Tried to serialize a C pointer value.");
break;
- case XMLRPC_TYPE_NIL:
- format_out(env, output, "<nil/>");
- XMLRPC_FAIL_IF_FAULT(env);
- break;
+ case XMLRPC_TYPE_NIL: {
+ const char * const elemName =
+ dialect == xmlrpc_dialect_apache ? "ex.nil" : "nil";
+ formatOut(envP, outputP, "<%s/>", elemName);
+ } break;
case XMLRPC_TYPE_DEAD:
- xmlrpc_env_set_fault_formatted(
- env, XMLRPC_INTERNAL_ERROR,
- "Tried to serialize a deaad value.");
+ xmlrpc_faultf(envP, "Tried to serialize a dead value.");
break;
default:
- xmlrpc_env_set_fault_formatted(
- env, XMLRPC_INTERNAL_ERROR,
- "Invalid xmlrpc_value type: %d", value->_type);
+ xmlrpc_faultf(envP, "Invalid xmlrpc_value type: %d", valueP->_type);
}
- XMLRPC_FAIL_IF_FAULT(env);
+}
- /* Print our ubiquitous footer. */
- format_out(env, output, "</value>");
- XMLRPC_FAIL_IF_FAULT(env);
- cleanup:
- return;
+
+void
+xmlrpc_serialize_value2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Generate the XML to represent XML-RPC value 'valueP' in XML-RPC.
+
+ Add it to *outputP.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT_VALUE_OK(valueP);
+
+ addString(envP, outputP, "<value>");
+
+ if (!envP->fault_occurred) {
+ formatValueContent(envP, outputP, valueP, dialect);
+
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</value>");
+ }
}
-/*=========================================================================
-** xmlrpc_serialize_params
-**=========================================================================
-** Serialize a list as a set of parameters.
-*/
+void
+xmlrpc_serialize_value(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP) {
+
+ xmlrpc_serialize_value2(envP, outputP, valueP, xmlrpc_dialect_i8);
+}
+
+
void
-xmlrpc_serialize_params(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_value *param_array) {
-
- size_t size, i;
- xmlrpc_value *item;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(output != NULL);
- XMLRPC_ASSERT_VALUE_OK(param_array);
-
- format_out(env, output, "<params>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Dump each parameter. */
- size = xmlrpc_array_size(env, param_array);
- XMLRPC_FAIL_IF_FAULT(env);
- for (i = 0; i < size; i++) {
- format_out(env, output, "<param>");
- XMLRPC_FAIL_IF_FAULT(env);
- item = xmlrpc_array_get_item(env, param_array, i);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_value(env, output, item);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</param>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
+xmlrpc_serialize_params2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Serialize the parameter list of an XML-RPC call.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT_VALUE_OK(paramArrayP);
+
+ addString(envP, outputP, "<params>"CRLF);
+ if (!envP->fault_occurred) {
+ /* Serialize each parameter. */
+ size_t const paramCount = xmlrpc_array_size(envP, paramArrayP);
+ if (!envP->fault_occurred) {
+ size_t paramSeq;
+ for (paramSeq = 0;
+ paramSeq < paramCount && !envP->fault_occurred;
+ ++paramSeq) {
+
+ addString(envP, outputP, "<param>");
+ if (!envP->fault_occurred) {
+ xmlrpc_value * const itemP =
+ xmlrpc_array_get_item(envP, paramArrayP, paramSeq);
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_value2(envP, outputP, itemP, dialect);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</param>"CRLF);
+ }
+ }
+ }
+ }
}
- format_out(env, output, "</params>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</params>"CRLF);
+}
- cleanup:
- return;
+
+
+void
+xmlrpc_serialize_params(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const paramArrayP) {
+/*----------------------------------------------------------------------------
+ Serialize the parameter list of an XML-RPC call in the original
+ "i8" dialect.
+-----------------------------------------------------------------------------*/
+ xmlrpc_serialize_params2(envP, outputP, paramArrayP, xmlrpc_dialect_i8);
}
@@ -495,131 +549,166 @@
*/
void
-xmlrpc_serialize_call(xmlrpc_env * const env,
- xmlrpc_mem_block * const output,
- const char * const method_name,
- xmlrpc_value * const param_array) {
-
- xmlrpc_mem_block *escaped;
- char *contents;
- size_t size;
+xmlrpc_serialize_call2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Serialize an XML-RPC call of method named 'methodName' with parameter
+ list *paramArrayP. Use XML-RPC dialect 'dialect'.
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(output != NULL);
- XMLRPC_ASSERT(method_name != NULL);
- XMLRPC_ASSERT_VALUE_OK(param_array);
+ Append the call XML ot *outputP.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT(methodName != NULL);
+ XMLRPC_ASSERT_VALUE_OK(paramArrayP);
- /* Set up our error-handling preconditions. */
- escaped = NULL;
-
- /* Dump our header. */
- format_out(env, output, XML_PROLOGUE);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "<methodCall>"CRLF"<methodName>");
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Dump the method name. */
- escaped = escape_string(env, method_name, strlen(method_name));
- XMLRPC_FAIL_IF_FAULT(env);
- contents = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, escaped);
- size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, escaped);
- XMLRPC_TYPED_MEM_BLOCK_APPEND(char, env, output, contents, size);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Dump our parameters and footer. */
- format_out(env, output, "</methodName>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
- xmlrpc_serialize_params(env, output, param_array);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "</methodCall>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- cleanup:
- if (escaped)
- xmlrpc_mem_block_free(escaped);
+ addString(envP, outputP, XML_PROLOGUE);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "<methodCall>"CRLF"<methodName>");
+ if (!envP->fault_occurred) {
+ xmlrpc_mem_block * encodedP;
+ escapeForXml(envP, methodName, strlen(methodName), &encodedP);
+ if (!envP->fault_occurred) {
+ const char * const contents =
+ XMLRPC_MEMBLOCK_CONTENTS(char, encodedP);
+ size_t const size = XMLRPC_MEMBLOCK_SIZE(char, encodedP);
+ XMLRPC_MEMBLOCK_APPEND(char, envP, outputP, contents, size);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "</methodName>"CRLF);
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_params2(envP, outputP, paramArrayP,
+ dialect);
+ if (!envP->fault_occurred)
+ addString(envP, outputP, "</methodCall>"CRLF);
+ }
+ }
+ XMLRPC_MEMBLOCK_FREE(char, encodedP);
+ }
+ }
+ }
}
-/*=========================================================================
-** xmlrpc_serialize_response
-**=========================================================================
-** Serialize the (non-fault) response to an XML-RPC call.
-*/
+void
+xmlrpc_serialize_call(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP) {
+
+ xmlrpc_serialize_call2(envP, outputP, methodName, paramArrayP,
+ xmlrpc_dialect_i8);
+}
+
+
void
-xmlrpc_serialize_response (xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_value *value) {
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(output != NULL);
- XMLRPC_ASSERT_VALUE_OK(value);
-
- format_out(env, output, XML_PROLOGUE);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "<methodResponse>"CRLF"<params>"CRLF"<param>");
- XMLRPC_FAIL_IF_FAULT(env);
-
- xmlrpc_serialize_value(env, output, value);
- XMLRPC_FAIL_IF_FAULT(env);
-
- format_out(env, output,
- "</param>"CRLF"</params>"CRLF"</methodResponse>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- cleanup:
- return;
+xmlrpc_serialize_response2(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP,
+ xmlrpc_dialect const dialect) {
+/*----------------------------------------------------------------------------
+ Serialize a result response to an XML-RPC call.
+
+ The result is 'valueP'.
+
+ Add the response XML to *outputP.
+-----------------------------------------------------------------------------*/
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT_VALUE_OK(valueP);
+
+ addString(envP, outputP, XML_PROLOGUE);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP,
+ "<methodResponse>"CRLF"<params>"CRLF"<param>");
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_value2(envP, outputP, valueP, dialect);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP,
+ "</param>"CRLF"</params>"CRLF
+ "</methodResponse>"CRLF);
+ }
+ }
+ }
}
-/*=========================================================================
-** xmlrpc_serialize_fault
-**=========================================================================
-** Serialize an XML-RPC fault.
-**
-** If this function fails, it will set up the first env argument. You'll
-** need to take some other drastic action to produce a serialized fault
-** of your own. (This function should only fail in an out-of-memory
-** situation, AFAIK.)
-*/
+void
+xmlrpc_serialize_response(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ xmlrpc_value * const valueP) {
+
+ xmlrpc_serialize_response2(envP, outputP, valueP, xmlrpc_dialect_i8);
+}
+
+
void
-xmlrpc_serialize_fault(xmlrpc_env *env,
- xmlrpc_mem_block *output,
- xmlrpc_env *fault) {
-
- xmlrpc_value *strct;
-
- XMLRPC_ASSERT_ENV_OK(env);
- XMLRPC_ASSERT(output != NULL);
- XMLRPC_ASSERT(fault != NULL && fault->fault_occurred);
-
- /* Set up our error-handling preconditions. */
- strct = NULL;
-
- /* Build a fault structure. */
- strct = xmlrpc_build_value(env, "{s:i,s:s}",
- "faultCode", (xmlrpc_int32) fault->fault_code,
- "faultString", fault->fault_string);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Output our header. */
- format_out(env, output, XML_PROLOGUE);
- XMLRPC_FAIL_IF_FAULT(env);
- format_out(env, output, "<methodResponse>"CRLF"<fault>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Serialize our fault structure. */
- xmlrpc_serialize_value(env, output, strct);
- XMLRPC_FAIL_IF_FAULT(env);
-
- /* Output our footer. */
- format_out(env, output, CRLF"</fault>"CRLF"</methodResponse>"CRLF);
- XMLRPC_FAIL_IF_FAULT(env);
-
- cleanup:
- if (strct)
- xmlrpc_DECREF(strct);
+xmlrpc_serialize_fault(xmlrpc_env * const envP,
+ xmlrpc_mem_block * const outputP,
+ const xmlrpc_env * const faultP) {
+/*----------------------------------------------------------------------------
+ Serialize a fault response to an XML-RPC call.
+
+ 'faultP' is the fault.
+
+ Add the response XML to *outputP.
+-----------------------------------------------------------------------------*/
+ xmlrpc_value * faultStructP;
+
+ XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT(outputP != NULL);
+ XMLRPC_ASSERT(faultP != NULL);
+ XMLRPC_ASSERT(faultP->fault_occurred);
+
+ faultStructP = xmlrpc_build_value(envP, "{s:i,s:s}",
+ "faultCode",
+ (xmlrpc_int32) faultP->fault_code,
+ "faultString", faultP->fault_string);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, XML_PROLOGUE);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP, "<methodResponse>"CRLF"<fault>"CRLF);
+ if (!envP->fault_occurred) {
+ xmlrpc_serialize_value(envP, outputP, faultStructP);
+ if (!envP->fault_occurred) {
+ addString(envP, outputP,
+ CRLF"</fault>"CRLF"</methodResponse>"CRLF);
+ }
+ }
+ }
+ xmlrpc_DECREF(faultStructP);
+ }
}
+
+
+
+/* Copyright (C) 2001 by First Peer, Inc. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE. */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_abyss.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_abyss.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_abyss.c Mon May 26 12:59:57 2008
@@ -2,19 +2,43 @@
#include "xmlrpc_config.h"
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
+#include <time.h>
+#include <fcntl.h>
+#ifdef _WIN32
+# include <io.h>
+#else
+# include <signal.h>
+# include <sys/wait.h>
+# include <grp.h>
+#endif
+#include "bool.h"
+#include "int.h"
#include "mallocvar.h"
#include "xmlrpc-c/abyss.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/server.h"
#include "xmlrpc-c/base_int.h"
+#include "xmlrpc-c/string_int.h"
#include "xmlrpc-c/server_abyss.h"
+
+struct xmlrpc_server_abyss {
+ TServer abyssServer;
+ TChanSwitch * chanSwitchP;
+ bool shutdownEnabled;
+ /* User wants system.shutdown to succeed */
+};
+
+
+
/*=========================================================================
** die_if_fault_occurred
**=========================================================================
@@ -32,18 +56,110 @@
-/*=========================================================================
-** send_xml_data
-**=========================================================================
-** Blast some XML data back to the client.
-*/
+static void
+initAbyss(xmlrpc_env * const envP) {
+
+ const char * error;
+ AbyssInit(&error);
+ if (error) {
+ xmlrpc_faultf(envP, "Failed to initialize the Abyss library. %s",
+ error);
+ xmlrpc_strfree(error);
+ }
+}
+
+
+
+static void
+termAbyss(void) {
+
+ AbyssTerm();
+}
+
+
+
+static unsigned int globallyInitialized = 0;
+ /* Initialization count */
+
+
+void
+xmlrpc_server_abyss_global_init(xmlrpc_env * const envP) {
+
+ /* Note that this is specified as not thread safe; user calls it at
+ the beginning of his program, when it is only one thread.
+ */
+
+ XMLRPC_ASSERT_ENV_OK(envP);
+
+ if (globallyInitialized == 0)
+ initAbyss(envP);
+
+ ++globallyInitialized;
+}
+
+
+
+void
+xmlrpc_server_abyss_global_term(void) {
+
+ /* Note that this is specified as not thread safe; user calls it at
+ the end of his program, when it is only one thread.
+ */
+
+ XMLRPC_ASSERT(globallyInitialized > 0);
+
+ --globallyInitialized;
+
+ if (globallyInitialized == 0)
+ termAbyss();
+}
+
+
+
+static void
+validateGlobalInit(xmlrpc_env * const envP) {
+
+ if (!globallyInitialized)
+ xmlrpc_faultf(envP, "libxmlrpc_server_abyss has not been globally "
+ "initialized. See xmlrpc_server_abyss_init()");
+}
+
+
+
+static void
+addAuthCookie(xmlrpc_env * const envP,
+ TSession * const abyssSessionP,
+ const char * const authCookie) {
+
+ const char * cookieResponse;
+
+ xmlrpc_asprintf(&cookieResponse, "auth=%s", authCookie);
+
+ if (cookieResponse == xmlrpc_strsol)
+ xmlrpc_faultf(envP, "Insufficient memory to generate cookie "
+ "response header.");
+ else {
+ ResponseAddField(abyssSessionP, "Set-Cookie", cookieResponse);
+
+ xmlrpc_strfree(cookieResponse);
+ }
+}
+
+
static void
sendXmlData(xmlrpc_env * const envP,
- TSession * const r,
- char * const buffer,
- size_t const len) {
+ TSession * const abyssSessionP,
+ const char * const body,
+ size_t const len,
+ bool const chunked) {
+/*----------------------------------------------------------------------------
+ Generate an HTTP response containing body 'body' of length 'len'
+ characters.
+ This is meant to run in the context of an Abyss URI handler for
+ Abyss session 'abyssSessionP'.
+-----------------------------------------------------------------------------*/
const char * http_cookie = NULL;
/* This used to set http_cookie to getenv("HTTP_COOKIE"), but
that doesn't make any sense -- environment variables are not
@@ -51,58 +167,50 @@
- Bryan 2004.10.03.
*/
- /* fwrite(buffer, sizeof(char), len, stderr); */
+ /* Various bugs before Xmlrpc-c 1.05 caused the response to be not
+ chunked in the most basic case, but chunked if the client explicitly
+ requested keepalive. I think it's better not to chunk, because
+ it's simpler, so I removed this in 1.05. I don't know what the
+ purpose of chunking would be, and an original comment suggests
+ the author wasn't sure chunking was a good idea.
- /* XXX - Is it safe to chunk our response? */
- ResponseChunked(r);
+ In 1.06 we added the user option to chunk.
+ */
+ if (chunked)
+ ResponseChunked(abyssSessionP);
- ResponseStatus(r, 200);
-
- if (http_cookie) {
- /* There's an auth cookie, so pass it back in the response. */
+ ResponseStatus(abyssSessionP, 200);
- char *cookie_response;
-
- cookie_response = malloc(10+strlen(http_cookie));
- sprintf(cookie_response, "auth=%s", http_cookie);
-
- /* Return abyss response. */
- ResponseAddField(r, "Set-Cookie", cookie_response);
+ if (http_cookie)
+ /* There's an auth cookie, so pass it back in the response. */
+ addAuthCookie(envP, abyssSessionP, http_cookie);
- free(cookie_response);
- }
-
if ((size_t)(uint32_t)len != len)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "XML-RPC method generated a response too "
- "large for Abyss to send");
+ xmlrpc_faultf(envP, "XML-RPC method generated a response too "
+ "large for Abyss to send");
else {
uint32_t const abyssLen = (uint32_t)len;
- ResponseContentType(r, "text/xml; charset=\"utf-8\"");
- ResponseContentLength(r, abyssLen);
-
- ResponseWrite(r);
+
+ ResponseContentType(abyssSessionP, "text/xml; charset=\"utf-8\"");
+ ResponseContentLength(abyssSessionP, abyssLen);
- HTTPWrite(r, buffer, abyssLen);
- HTTPWriteEnd(r);
+ ResponseWriteStart(abyssSessionP);
+ ResponseWriteBody(abyssSessionP, body, abyssLen);
+ ResponseWriteEnd(abyssSessionP);
}
}
-/*=========================================================================
-** send_error
-**=========================================================================
-** Send an error back to the client.
-*/
-
static void
-send_error(TSession * const abyssSessionP,
- unsigned int const status) {
-
+sendError(TSession * const abyssSessionP,
+ unsigned int const status,
+ const char * const explanation) {
+/*----------------------------------------------------------------------------
+ Send an error response back to the client.
+-----------------------------------------------------------------------------*/
ResponseStatus(abyssSessionP, (uint16_t) status);
- ResponseError(abyssSessionP);
+ ResponseError2(abyssSessionP, explanation);
}
@@ -111,35 +219,7 @@
traceChunkRead(TSession * const abyssSessionP) {
fprintf(stderr, "XML-RPC handler got a chunk of %u bytes\n",
- abyssSessionP->conn->buffersize -
- abyssSessionP->conn->bufferpos);
-}
-
-
-
-/*=========================================================================
-** get_buffer_data
-**=========================================================================
-** Extract some data from the TConn's underlying input buffer. Do not
-** extract more than 'max'.
-*/
-
-static void
-get_buffer_data(TSession * const r,
- size_t const max,
- char ** const out_start,
- size_t * const out_len) {
-
- /* Point to the start of our data. */
- *out_start = &r->conn->buffer[r->conn->bufferpos];
-
- /* Decide how much data to retrieve. */
- *out_len = r->conn->buffersize - r->conn->bufferpos;
- if (*out_len > max)
- *out_len = max;
-
- /* Update our buffer position. */
- r->conn->bufferpos += *out_len;
+ (unsigned int)SessionReadDataAvail(abyssSessionP));
}
@@ -151,20 +231,10 @@
/*----------------------------------------------------------------------------
Get the next chunk of data from the connection into the buffer.
-----------------------------------------------------------------------------*/
- abyss_bool succeeded;
-
- /* Reset our read buffer & flush data from previous reads. */
- ConnReadInit(abyssSessionP->conn);
-
- /* Read more network data into our buffer. If we encounter a
- timeout, exit immediately. We're very forgiving about the
- timeout here. We allow a full timeout per network read, which
- would allow somebody to keep a connection alive nearly
- indefinitely. But it's hard to do anything intelligent here
- without very complicated code.
- */
- succeeded = ConnRead(abyssSessionP->conn,
- abyssSessionP->server->timeout);
+ bool succeeded;
+
+ succeeded = SessionRefillBuffer(abyssSessionP);
+
if (!succeeded)
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_TIMEOUT_ERROR, "Timed out waiting for "
@@ -194,21 +264,23 @@
if (trace)
fprintf(stderr, "XML-RPC handler processing body. "
- "Content Size = %u bytes\n", contentSize);
+ "Content Size = %u bytes\n", (unsigned)contentSize);
body = xmlrpc_mem_block_new(envP, 0);
if (!envP->fault_occurred) {
size_t bytesRead;
- char * chunkPtr;
+ const char * chunkPtr;
size_t chunkLen;
bytesRead = 0;
while (!envP->fault_occurred && bytesRead < contentSize) {
- get_buffer_data(abyssSessionP, contentSize - bytesRead,
- &chunkPtr, &chunkLen);
+ SessionGetReadData(abyssSessionP, contentSize - bytesRead,
+ &chunkPtr, &chunkLen);
bytesRead += chunkLen;
+ assert(bytesRead <= contentSize);
+
XMLRPC_MEMBLOCK_APPEND(char, envP, body, chunkPtr, chunkLen);
if (bytesRead < contentSize)
refillBufferFromConnection(envP, abyssSessionP, trace);
@@ -224,7 +296,7 @@
static void
storeCookies(TSession * const httpRequestP,
- unsigned int * const httpErrorP) {
+ const char ** const errorP) {
/*----------------------------------------------------------------------------
Get the cookie settings from the HTTP headers and remember them for
use in responses.
@@ -241,7 +313,7 @@
}
/* TODO: parse HTTP_COOKIE to find auth pair, if there is one */
- *httpErrorP = 0;
+ *errorP = NULL;
}
@@ -249,18 +321,19 @@
static void
validateContentType(TSession * const httpRequestP,
- unsigned int * const httpErrorP) {
+ const char ** const errorP) {
/*----------------------------------------------------------------------------
- If the client didn't specify a content-type of "text/xml", return
- "400 Bad Request". We can't allow the client to default this header,
- because some firewall software may rely on all XML-RPC requests
- using the POST method and a content-type of "text/xml".
+ If the client didn't specify a content-type of "text/xml", fail.
+ We can't allow the client to default this header, because some
+ firewall software may rely on all XML-RPC requests using the POST
+ method and a content-type of "text/xml".x
-----------------------------------------------------------------------------*/
const char * const content_type =
RequestHeaderValue(httpRequestP, "content-type");
if (content_type == NULL)
- *httpErrorP = 400;
+ xmlrpc_asprintf(errorP,
+ "You did not supply a content-type HTTP header");
else {
const char * const sempos = strchr(content_type, ';');
unsigned int baselen;
@@ -273,33 +346,39 @@
else
baselen = strlen(content_type);
- if (strncmp(content_type, "text/xml", baselen) != 0)
- *httpErrorP = 400;
+ if (!xmlrpc_strneq(content_type, "text/xml", baselen))
+ xmlrpc_asprintf(errorP, "Your content-type HTTP header value '%s' "
+ "does not have a base type of 'text/xml'",
+ content_type);
else
- *httpErrorP = 0;
+ *errorP = NULL;
}
}
static void
-processContentLength(TSession * const httpRequestP,
- size_t * const inputLenP,
- unsigned int * const httpErrorP) {
+processContentLength(TSession * const httpRequestP,
+ size_t * const inputLenP,
+ bool * const missingP,
+ const char ** const errorP) {
/*----------------------------------------------------------------------------
Make sure the content length is present and non-zero. This is
technically required by XML-RPC, but we only enforce it because we
don't want to figure out how to safely handle HTTP < 1.1 requests
- without it. If the length is missing, return "411 Length Required".
+ without it.
-----------------------------------------------------------------------------*/
const char * const content_length =
RequestHeaderValue(httpRequestP, "content-length");
- if (content_length == NULL)
- *httpErrorP = 411;
- else {
+ if (content_length == NULL) {
+ *missingP = TRUE;
+ *errorP = NULL;
+ } else {
+ *missingP = FALSE;
if (content_length[0] == '\0')
- *httpErrorP = 400;
+ xmlrpc_asprintf(errorP, "The value in your content-length "
+ "HTTP header value is a null string");
else {
unsigned long contentLengthValue;
char * tail;
@@ -307,15 +386,21 @@
contentLengthValue = strtoul(content_length, &tail, 10);
if (*tail != '\0')
- /* There's non-numeric crap in the length */
- *httpErrorP = 400;
+ xmlrpc_asprintf(errorP, "There's non-numeric crap in "
+ "the value of your content-length "
+ "HTTP header: '%s'", tail);
else if (contentLengthValue < 1)
- *httpErrorP = 400;
+ xmlrpc_asprintf(errorP, "According to your content-length "
+ "HTTP header, your request is empty (zero "
+ "length)");
else if ((unsigned long)(size_t)contentLengthValue
!= contentLengthValue)
- *httpErrorP = 400;
+ xmlrpc_asprintf(errorP, "According to your content-length "
+ "HTTP header, your request is too big to "
+ "process; we can't even do arithmetic on its "
+ "size: %s bytes", content_length);
else {
- *httpErrorP = 0;
+ *errorP = NULL;
*inputLenP = (size_t)contentLengthValue;
}
}
@@ -328,12 +413,15 @@
traceHandlerCalled(TSession * const abyssSessionP) {
const char * methodDesc;
+ const TRequestInfo * requestInfoP;
- fprintf(stderr, "xmlrpc_server_abyss RPC2 handler called.\n");
+ fprintf(stderr, "xmlrpc_server_abyss URI path handler called.\n");
- fprintf(stderr, "URI = '%s'\n", abyssSessionP->uri);
+ SessionGetRequestInfo(abyssSessionP, &requestInfoP);
- switch (abyssSessionP->method) {
+ fprintf(stderr, "URI = '%s'\n", requestInfoP->uri);
+
+ switch (requestInfoP->method) {
case m_unknown: methodDesc = "unknown"; break;
case m_get: methodDesc = "get"; break;
case m_put: methodDesc = "put"; break;
@@ -346,9 +434,9 @@
}
fprintf(stderr, "HTTP method = '%s'\n", methodDesc);
- if (abyssSessionP->query)
+ if (requestInfoP->query)
fprintf(stderr, "query (component of URL)='%s'\n",
- abyssSessionP->query);
+ requestInfoP->query);
else
fprintf(stderr, "URL has no query component\n");
}
@@ -359,17 +447,22 @@
processCall(TSession * const abyssSessionP,
size_t const contentSize,
xmlrpc_registry * const registryP,
+ bool const wantChunk,
const char * const trace) {
/*----------------------------------------------------------------------------
Handle an RPC request. This is an HTTP request that has the proper form
- to be one of our RPCs.
+ to be an XML-RPC call.
+
+ The text of the call is available through the Abyss session
+ 'abyssSessionP'.
Its content length is 'contentSize' bytes.
-----------------------------------------------------------------------------*/
xmlrpc_env env;
if (trace)
- fprintf(stderr, "xmlrpc_server_abyss RPC2 handler processing RPC.\n");
+ fprintf(stderr,
+ "xmlrpc_server_abyss URI path handler processing RPC.\n");
xmlrpc_env_init(&env);
@@ -378,21 +471,24 @@
&env, XMLRPC_LIMIT_EXCEEDED_ERROR,
"XML-RPC request too large (%d bytes)", contentSize);
else {
- xmlrpc_mem_block *body;
+ xmlrpc_mem_block * body;
/* Read XML data off the wire. */
getBody(&env, abyssSessionP, contentSize, trace, &body);
if (!env.fault_occurred) {
xmlrpc_mem_block * output;
/* Process the RPC. */
- output = xmlrpc_registry_process_call(
- &env, registryP, NULL,
+ xmlrpc_registry_process_call2(
+ &env, registryP,
XMLRPC_MEMBLOCK_CONTENTS(char, body),
- XMLRPC_MEMBLOCK_SIZE(char, body));
+ XMLRPC_MEMBLOCK_SIZE(char, body),
+ abyssSessionP,
+ &output);
if (!env.fault_occurred) {
/* Send out the result. */
sendXmlData(&env, abyssSessionP,
XMLRPC_MEMBLOCK_CONTENTS(char, output),
- XMLRPC_MEMBLOCK_SIZE(char, output));
+ XMLRPC_MEMBLOCK_SIZE(char, output),
+ wantChunk);
XMLRPC_MEMBLOCK_FREE(char, output);
}
@@ -400,10 +496,13 @@
}
}
if (env.fault_occurred) {
+ uint16_t httpResponseStatus;
if (env.fault_code == XMLRPC_TIMEOUT_ERROR)
- send_error(abyssSessionP, 408); /* 408 Request Timeout */
+ httpResponseStatus = 408; /* Request Timeout */
else
- send_error(abyssSessionP, 500); /* 500 Internal Server Error */
+ httpResponseStatus = 500; /* Internal Server Error */
+
+ sendError(abyssSessionP, httpResponseStatus, env.fault_string);
}
xmlrpc_env_clean(&env);
@@ -425,19 +524,20 @@
that is specific to the Xmlrpc-c handler.
-----------------------------------------------------------------------------*/
xmlrpc_registry * registryP;
- const char * filename; /* malloc'ed */
+ const char * uriPath; /* malloc'ed */
+ bool chunkResponse;
+ /* The handler should chunk its response whenever possible */
};
static void
-termUriHandler(URIHandler2 * const this) {
+termUriHandler(void * const arg) {
- struct uriHandlerXmlrpc * const uriHandlerXmlrpcP = this->userdata;
+ struct uriHandlerXmlrpc * const uriHandlerXmlrpcP = arg;
- free((void*)uriHandlerXmlrpcP->filename);
+ xmlrpc_strfree(uriHandlerXmlrpcP->uriPath);
free(uriHandlerXmlrpcP);
- free(this);
}
@@ -461,52 +561,68 @@
-----------------------------------------------------------------------------*/
struct uriHandlerXmlrpc * const uriHandlerXmlrpcP = this->userdata;
+ const TRequestInfo * requestInfoP;
+
if (trace_abyss)
traceHandlerCalled(abyssSessionP);
- /* Note that abyssSessionP->uri is not the whole URI. It is just
+ SessionGetRequestInfo(abyssSessionP, &requestInfoP);
+
+ /* Note that requestInfoP->uri is not the whole URI. It is just
the "file name" part of it.
*/
- if (strcmp(abyssSessionP->uri, uriHandlerXmlrpcP->filename) != 0)
- /* It's for the filename (e.g. "/RPC2") that we're supposed to
+ if (strcmp(requestInfoP->uri, uriHandlerXmlrpcP->uriPath) != 0)
+ /* It's for the path (e.g. "/RPC2") that we're supposed to
handle.
*/
*handledP = FALSE;
else {
*handledP = TRUE;
- /* We understand only the POST HTTP method. For anything else, return
- "405 Method Not Allowed".
- */
- if (abyssSessionP->method != m_post)
- send_error(abyssSessionP, 405);
+ if (requestInfoP->method != m_post)
+ sendError(abyssSessionP, 405,
+ "POST is the only HTTP method this server understands");
+ /* 405 = Method Not Allowed */
else {
- unsigned int httpError;
- storeCookies(abyssSessionP, &httpError);
- if (httpError)
- send_error(abyssSessionP, httpError);
- else {
- unsigned int httpError;
- validateContentType(abyssSessionP, &httpError);
- if (httpError)
- send_error(abyssSessionP, httpError);
- else {
- unsigned int httpError;
+ const char * error;
+ storeCookies(abyssSessionP, &error);
+ if (error) {
+ sendError(abyssSessionP, 400, error);
+ xmlrpc_strfree(error);
+ } else {
+ const char * error;
+ validateContentType(abyssSessionP, &error);
+ if (error) {
+ sendError(abyssSessionP, 400, error);
+ /* 400 = Bad Request */
+ xmlrpc_strfree(error);
+ } else {
+ const char * error;
+ bool missing;
size_t contentSize;
processContentLength(abyssSessionP,
- &contentSize, &httpError);
- if (httpError)
- send_error(abyssSessionP, httpError);
- else
- processCall(abyssSessionP, contentSize,
- uriHandlerXmlrpcP->registryP, trace_abyss);
+ &contentSize, &missing, &error);
+ if (error) {
+ sendError(abyssSessionP, 400, error);
+ xmlrpc_strfree(error);
+ } else {
+ if (missing)
+ sendError(abyssSessionP, 411, "You must send a "
+ "content-length HTTP header in an "
+ "XML-RPC call.");
+ else
+ processCall(abyssSessionP, contentSize,
+ uriHandlerXmlrpcP->registryP,
+ uriHandlerXmlrpcP->chunkResponse,
+ trace_abyss);
+ }
}
}
}
}
if (trace_abyss)
- fprintf(stderr, "xmlrpc_server_abyss RPC2 handler returning.\n");
+ fprintf(stderr, "xmlrpc_server_abyss URI path handler returning.\n");
}
@@ -519,320 +635,636 @@
*/
static xmlrpc_bool
-xmlrpc_server_abyss_default_handler (TSession * const r) {
+xmlrpc_server_abyss_default_handler(TSession * const sessionP) {
+
+ const TRequestInfo * requestInfoP;
+
+ const char * explanation;
if (trace_abyss)
fprintf(stderr, "xmlrpc_server_abyss default handler called.\n");
- send_error(r, 404);
+ SessionGetRequestInfo(sessionP, &requestInfoP);
+
+ xmlrpc_asprintf(
+ &explanation,
+ "This XML-RPC For C/C++ Abyss XML-RPC server "
+ "responds to only one URI path. "
+ "I don't know what URI path that is, "
+ "but it's not the one you requested: '%s'. (Typically, it's "
+ "'/RPC2')", requestInfoP->uri);
+
+ sendError(sessionP, 404, explanation);
+
+ xmlrpc_strfree(explanation);
return TRUE;
}
-/**************************************************************************
-**
-** The code below was adapted from the main.c file of the Abyss webserver
-** project. In addition to the other copyrights on this file, the following
-** code is also under this copyright:
-**
-** Copyright (C) 2000 by Moez Mahfoudh <mmoez(a)bigfoot.com>.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE.
-**
-**************************************************************************/
+static void
+setHandler(xmlrpc_env * const envP,
+ TServer * const srvP,
+ const char * const uriPath,
+ xmlrpc_registry * const registryP,
+ bool const chunkResponse) {
+
+ struct uriHandlerXmlrpc * uriHandlerXmlrpcP;
+ URIHandler2 uriHandler;
+ abyss_bool success;
-#include <time.h>
-#include <fcntl.h>
+ trace_abyss = getenv("XMLRPC_TRACE_ABYSS");
+
+ MALLOCVAR_NOFAIL(uriHandlerXmlrpcP);
-#ifdef _WIN32
-#include <io.h>
-#else
-#include <signal.h>
-#include <sys/wait.h>
-#include <grp.h>
-#endif /* _WIN32 */
+ uriHandlerXmlrpcP->registryP = registryP;
+ uriHandlerXmlrpcP->uriPath = strdup(uriPath);
+ uriHandlerXmlrpcP->chunkResponse = chunkResponse;
+
+ uriHandler.handleReq2 = handleXmlrpcReq;
+ uriHandler.handleReq1 = NULL;
+ uriHandler.userdata = uriHandlerXmlrpcP;
+ uriHandler.init = NULL;
+ uriHandler.term = &termUriHandler;
+ ServerAddHandler2(srvP, &uriHandler, &success);
+ if (!success)
+ xmlrpc_faultf(envP, "Abyss failed to register the Xmlrpc-c request "
+ "handler. ServerAddHandler2() failed.");
-static void
-sigterm(int const sig) {
- TraceExit("Signal %d received. Exiting...\n",sig);
+ if (envP->fault_occurred)
+ free(uriHandlerXmlrpcP);
}
-static void
-sigchld(int const sig ATTR_UNUSED) {
-/*----------------------------------------------------------------------------
- This is a signal handler for a SIGCHLD signal (which informs us that
- one of our child processes has terminated).
- We respond by reaping the zombie process.
+void
+xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP,
+ TServer * const srvP,
+ const char * const uriPath,
+ xmlrpc_registry * const registryP) {
- Implementation note: In some systems, just setting the signal handler
- to SIG_IGN (ignore signal) does this. In others, it doesn't.
------------------------------------------------------------------------------*/
-#ifndef _WIN32
- pid_t pid;
- int status;
-
- /* Reap defunct children until there aren't any more. */
- for (;;) {
- pid = waitpid( (pid_t) -1, &status, WNOHANG );
-
- /* none left */
- if (pid==0)
- break;
-
- if (pid<0) {
- /* because of ptrace */
- if (errno==EINTR)
- continue;
-
- break;
- }
- }
-#endif /* _WIN32 */
+ setHandler(envP, srvP, uriPath, registryP, false);
}
-static TServer globalSrv;
- /* When you use the old interface (xmlrpc_server_abyss_init(), etc.),
- this is the Abyss server to which they refer. Obviously, there can be
- only one Abyss server per program using this interface.
- */
+
+static void
+setHandlers(TServer * const srvP,
+ const char * const uriPath,
+ xmlrpc_registry * const registryP,
+ bool const chunkResponse) {
-void
-xmlrpc_server_abyss_init(int const flags ATTR_UNUSED,
- const char * const config_file) {
+ xmlrpc_env env;
- DateInit();
- MIMETypeInit();
+ xmlrpc_env_init(&env);
- ServerCreate(&globalSrv, "XmlRpcServer", 8080, DEFAULT_DOCS, NULL);
+ trace_abyss = getenv("XMLRPC_TRACE_ABYSS");
+
+ setHandler(&env, srvP, uriPath, registryP, chunkResponse);
- ConfReadServerFile(config_file, &globalSrv);
+ if (env.fault_occurred)
+ abort();
- xmlrpc_server_abyss_init_registry();
- /* Installs /RPC2 handler and default handler that use the
- built-in registry.
- */
+ ServerDefaultHandler(srvP, xmlrpc_server_abyss_default_handler);
- ServerInit(&globalSrv);
+ xmlrpc_env_clean(&env);
}
-static void
-setupSignalHandlers(void) {
-#ifndef _WIN32
- struct sigaction mysigaction;
-
- sigemptyset(&mysigaction.sa_mask);
- mysigaction.sa_flags = 0;
-
- /* These signals abort the program, with tracing */
- mysigaction.sa_handler = sigterm;
- sigaction(SIGTERM, &mysigaction, NULL);
- sigaction(SIGINT, &mysigaction, NULL);
- sigaction(SIGHUP, &mysigaction, NULL);
- sigaction(SIGUSR1, &mysigaction, NULL);
+void
+xmlrpc_server_abyss_set_handlers2(TServer * const srvP,
+ const char * const uriPath,
+ xmlrpc_registry * const registryP) {
- /* This signal indicates connection closed in the middle */
- mysigaction.sa_handler = SIG_IGN;
- sigaction(SIGPIPE, &mysigaction, NULL);
-
- /* This signal indicates a child process (request handler) has died */
- mysigaction.sa_handler = sigchld;
- sigaction(SIGCHLD, &mysigaction, NULL);
-#endif
-}
+ setHandlers(srvP, uriPath, registryP, false);
+}
-static void
-setGroups(void) {
+void
+xmlrpc_server_abyss_set_handlers(TServer * const srvP,
+ xmlrpc_registry * const registryP) {
-#ifdef HAVE_SETGROUPS
- if (setgroups(0, NULL) == (-1))
- TraceExit("Failed to setup the group.");
-#endif
+ setHandlers(srvP, "/RPC2", registryP, false);
}
+/*============================================================================
+ createServer()
+============================================================================*/
+
static void
-daemonize(TServer * const srvP) {
-/*----------------------------------------------------------------------------
- Turn Caller into a daemon (i.e. fork a child, then exit; the child
- returns to Caller).
+setAdditionalServerParms(const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ TServer * const serverP) {
- NOTE: It's ridiculous, but conventional, for us to do this. It's
- ridiculous because the task of daemonizing is not something
- particular to Xmlrpc-c. It ought to be done by a higher level. In
- fact, it should be done before the Xmlrpc-c server program is even
- execed. The user should run a "daemonize" program that creates a
- daemon which execs the Xmlrpc-c server program.
------------------------------------------------------------------------------*/
-#ifndef _WIN32
- /* Become a daemon */
- switch (fork()) {
- case 0:
- break;
- case -1:
- TraceExit("Unable to become a daemon");
- default:
- /* We are the parent */
- exit(0);
- };
-
- setsid();
-
- /* Change the current user if we are root */
- if (getuid()==0) {
- if (srvP->uid == (uid_t)-1)
- TraceExit("Can't run under root privileges. "
- "Please add a User option in your "
- "Abyss configuration file.");
-
- setGroups();
-
- if (srvP->gid != (gid_t)-1)
- if (setgid(srvP->gid)==(-1))
- TraceExit("Failed to change the group.");
+ /* The following ought to be parameters on ServerCreate(), but it
+ looks like plugging them straight into the TServer structure is
+ the only way to set them.
+ */
-
- if (setuid(srvP->uid) == -1)
- TraceExit("Failed to change the user.");
- };
-
- if (srvP->pidfile!=(-1)) {
- char z[16];
-
- sprintf(z,"%d",getpid());
- FileWrite(&srvP->pidfile,z,strlen(z));
- FileClose(&srvP->pidfile);
- };
-#endif /* _WIN32 */
+ if (parmSize >= XMLRPC_APSIZE(keepalive_timeout) &&
+ parmsP->keepalive_timeout > 0)
+ ServerSetKeepaliveTimeout(serverP, parmsP->keepalive_timeout);
+ if (parmSize >= XMLRPC_APSIZE(keepalive_max_conn) &&
+ parmsP->keepalive_max_conn > 0)
+ ServerSetKeepaliveMaxConn(serverP, parmsP->keepalive_max_conn);
+ if (parmSize >= XMLRPC_APSIZE(timeout) &&
+ parmsP->timeout > 0)
+ ServerSetTimeout(serverP, parmsP->timeout);
+ if (parmSize >= XMLRPC_APSIZE(dont_advertise))
+ ServerSetAdvertise(serverP, !parmsP->dont_advertise);
}
static void
-runServerDaemon(TServer * const srvP,
- runfirstFn const runfirst,
- void * const runfirstArg) {
-
- setupSignalHandlers();
+extractServerCreateParms(
+ xmlrpc_env * const envP,
+ const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ bool * const socketBoundP,
+ unsigned int * const portNumberP,
+ TOsSocket * const socketFdP,
+ const char ** const logFileNameP) {
+
- daemonize(srvP);
-
- /* We run the user supplied runfirst after forking, but before accepting
- connections (helpful when running with threads)
- */
- if (runfirst)
- runfirst(runfirstArg);
+ if (parmSize >= XMLRPC_APSIZE(socket_bound))
+ *socketBoundP = parmsP->socket_bound;
+ else
+ *socketBoundP = FALSE;
- ServerRun(srvP);
+ if (*socketBoundP) {
+ if (parmSize < XMLRPC_APSIZE(socket_handle))
+ xmlrpc_faultf(envP, "socket_bound is true, but server parameter "
+ "structure does not contain socket_handle (it's too "
+ "short)");
+ else
+ *socketFdP = parmsP->socket_handle;
+ } else {
+ if (parmSize >= XMLRPC_APSIZE(port_number))
+ *portNumberP = parmsP->port_number;
+ else
+ *portNumberP = 8080;
- /* We can't exist here because ServerRun doesn't return */
- XMLRPC_ASSERT(FALSE);
+ if (*portNumberP > 0xffff)
+ xmlrpc_faultf(envP,
+ "TCP port number %u exceeds the maximum possible "
+ "TCP port number (65535)",
+ *portNumberP);
+ }
+ if (!envP->fault_occurred) {
+ if (parmSize >= XMLRPC_APSIZE(log_file_name) &&
+ parmsP->log_file_name)
+ *logFileNameP = strdup(parmsP->log_file_name);
+ else
+ *logFileNameP = NULL;
+ }
}
-void
-xmlrpc_server_abyss_run_first(runfirstFn const runfirst,
- void * const runfirstArg) {
-
- runServerDaemon(&globalSrv, runfirst, runfirstArg);
+static void
+chanSwitchCreateOsSocket(TOsSocket const socketFd,
+ TChanSwitch ** const chanSwitchPP,
+ const char ** const errorP) {
+
+#ifdef WIN32
+ ChanSwitchWinCreateWinsock(socketFd, chanSwitchPP, errorP);
+#else
+ ChanSwitchUnixCreateFd(socketFd, chanSwitchPP, errorP);
+#endif
+
}
-void
-xmlrpc_server_abyss_run(void) {
- runServerDaemon(&globalSrv, NULL, NULL);
+static void
+createServerBoundSocket(xmlrpc_env * const envP,
+ TOsSocket const socketFd,
+ const char * const logFileName,
+ TServer * const serverP,
+ TChanSwitch ** const chanSwitchPP) {
+
+ TChanSwitch * chanSwitchP;
+ const char * error;
+
+ chanSwitchCreateOsSocket(socketFd, &chanSwitchP, &error);
+ if (error) {
+ xmlrpc_faultf(envP, "Unable to create Abyss socket out of "
+ "file descriptor %d. %s", socketFd, error);
+ xmlrpc_strfree(error);
+ } else {
+ ServerCreateSwitch(serverP, chanSwitchP, &error);
+ if (error) {
+ xmlrpc_faultf(envP, "Abyss failed to create server. %s", error);
+ xmlrpc_strfree(error);
+ } else {
+ *chanSwitchPP = chanSwitchP;
+
+ ServerSetName(serverP, "XmlRpcServer");
+
+ if (logFileName)
+ ServerSetLogFileName(serverP, logFileName);
+ }
+ if (envP->fault_occurred)
+ ChanSwitchDestroy(chanSwitchP);
+ }
}
+static void
+createServerBare(xmlrpc_env * const envP,
+ const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ TServer * const serverP,
+ TChanSwitch ** const chanSwitchPP) {
+/*----------------------------------------------------------------------------
+ Create a bare server. It will need further setup before it is ready
+ to use.
+-----------------------------------------------------------------------------*/
+ bool socketBound;
+ unsigned int portNumber;
+ TOsSocket socketFd;
+ const char * logFileName;
+
+ extractServerCreateParms(envP, parmsP, parmSize,
+ &socketBound, &portNumber, &socketFd,
+ &logFileName);
+
+ if (!envP->fault_occurred) {
+ if (socketBound)
+ createServerBoundSocket(envP, socketFd, logFileName,
+ serverP, chanSwitchPP);
+ else {
+ ServerCreate(serverP, "XmlRpcServer", portNumber, DEFAULT_DOCS,
+ logFileName);
+
+ *chanSwitchPP = NULL;
+ }
+ if (logFileName)
+ xmlrpc_strfree(logFileName);
+ }
+}
+
+
+
+static bool
+chunkResponseParm(const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize) {
+
+ return
+ parmSize >= XMLRPC_APSIZE(chunk_response) &&
+ parmsP->chunk_response;
+}
+
+
+
+static const char *
+uriPathParm(const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize) {
+
+ const char * uriPath;
+
+ if (parmSize >= XMLRPC_APSIZE(uri_path) && parmsP->uri_path)
+ uriPath = parmsP->uri_path;
+ else
+ uriPath = "/RPC2";
+
+ return uriPath;
+}
+
+
+
+static void
+createServer(xmlrpc_env * const envP,
+ const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ TServer * const abyssServerP,
+ TChanSwitch ** const chanSwitchPP) {
+
+ createServerBare(envP, parmsP, parmSize, abyssServerP, chanSwitchPP);
+
+ if (!envP->fault_occurred) {
+ setAdditionalServerParms(parmsP, parmSize, abyssServerP);
+
+ setHandlers(abyssServerP, uriPathParm(parmsP, parmSize),
+ parmsP->registryP,
+ chunkResponseParm(parmsP, parmSize));
+
+ ServerInit(abyssServerP);
+ }
+}
+
+
+
+static bool
+enableShutdownParm(const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize) {
+
+ return
+ parmSize >= XMLRPC_APSIZE(enable_shutdown) &&
+ parmsP->enable_shutdown;
+}
+
+
+
+static xmlrpc_server_shutdown_fn shutdownAbyss;
+
+static void
+shutdownAbyss(xmlrpc_env * const faultP,
+ void * const context,
+ const char * const comment ATTR_UNUSED,
+ void * const callInfo ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ Tell Abyss to wrap up whatever it's doing and shut down.
+
+ This is a server shutdown function to be registered in the method
+ registry, for use by the 'system.shutdown' system method.
+
+ After we return, Abyss will finish up the system.shutdown and any
+ other connections that are in progress, then the call to
+ ServerRun() etc. will return.
+
+ *faultP is the result of the shutdown request, not whether we
+ succeeded or failed. We are not allowed to fail.
+-----------------------------------------------------------------------------*/
+ xmlrpc_server_abyss_t * const serverP = context;
+
+ xmlrpc_env_init(faultP);
+
+ if (!serverP->shutdownEnabled)
+ xmlrpc_env_set_fault_formatted(
+ faultP, XMLRPC_REQUEST_REFUSED_ERROR,
+ "Shutdown by client is disabled on this server.");
+ else
+ ServerTerminate(&serverP->abyssServer);
+}
+
+
+
+/*=============================================================================
+ xmlrpc_server_abyss object methods
+=============================================================================*/
+
void
-xmlrpc_server_abyss_set_handler(xmlrpc_env * const envP,
- TServer * const srvP,
- const char * const filename,
- xmlrpc_registry * const registryP) {
+xmlrpc_server_abyss_create(xmlrpc_env * const envP,
+ const xmlrpc_server_abyss_parms * const parmsP,
+ unsigned int const parmSize,
+ xmlrpc_server_abyss_t ** const serverPP) {
+
+ xmlrpc_server_abyss_t * serverP;
+
+ XMLRPC_ASSERT_ENV_OK(envP);
+
+ validateGlobalInit(envP);
+
+ if (!envP->fault_occurred) {
+ if (parmSize < XMLRPC_APSIZE(registryP))
+ xmlrpc_faultf(envP,
+ "You must specify members at least up through "
+ "'registryP' in the server parameters argument. "
+ "That would mean the parameter size would be >= %lu "
+ "but you specified a size of %u",
+ XMLRPC_APSIZE(registryP), parmSize);
+ else {
+ MALLOCVAR(serverP);
+
+ if (serverP == NULL)
+ xmlrpc_faultf(envP, "Unable to allocate memory for "
+ "server descriptor.");
+ else {
+ createServer(envP, parmsP, parmSize,
+ &serverP->abyssServer, &serverP->chanSwitchP);
+
+ if (!envP->fault_occurred) {
+ serverP->shutdownEnabled =
+ enableShutdownParm(parmsP, parmSize);
+
+ xmlrpc_registry_set_shutdown(
+ parmsP->registryP, &shutdownAbyss, serverP);
+
+ if (envP->fault_occurred)
+ free(serverP);
+ else
+ *serverPP = serverP;
+ }
+ }
+ }
+ }
+}
+
+
+
+void
+xmlrpc_server_abyss_destroy(xmlrpc_server_abyss_t * const serverP) {
+
+ XMLRPC_ASSERT(globallyInitialized);
+
+ ServerFree(&serverP->abyssServer);
+
+ if (serverP->chanSwitchP)
+ ChanSwitchDestroy(serverP->chanSwitchP);
+
+ free(serverP);
+}
+
+
+
+void
+xmlrpc_server_abyss_use_sigchld(xmlrpc_server_abyss_t * const serverP) {
+
+ ServerUseSigchld(&serverP->abyssServer);
+}
+
+
+
+void
+xmlrpc_server_abyss_run_server(xmlrpc_env * const envP ATTR_UNUSED,
+ xmlrpc_server_abyss_t * const serverP) {
+
+ ServerRun(&serverP->abyssServer);
+}
+
+
+
+void
+xmlrpc_server_abyss_terminate(
+ xmlrpc_env * const envP ATTR_UNUSED,
+ xmlrpc_server_abyss_t * const serverP) {
+
+ ServerTerminate(&serverP->abyssServer);
+}
+
+
+
+void
+xmlrpc_server_abyss_reset_terminate(
+ xmlrpc_env * const envP ATTR_UNUSED,
+ xmlrpc_server_abyss_t * const serverP) {
+
+ ServerResetTerminate(&serverP->abyssServer);
+}
+
+
+
+static void
+sigchld(int const signalClass ATTR_UNUSED) {
+/*----------------------------------------------------------------------------
+ This is a signal handler for a SIGCHLD signal (which informs us that
+ one of our child processes has terminated).
+
+ The only child processes we have are those that belong to the Abyss
+ server (and then only if the Abyss server was configured to use
+ forking as a threading mechanism), so we respond by passing the
+ signal on to the Abyss server.
+-----------------------------------------------------------------------------*/
+#ifndef WIN32
+ bool childrenLeft;
+ bool error;
+
+ assert(signalClass == SIGCHLD);
+
+ error = false;
+ childrenLeft = true; /* initial assumption */
- struct uriHandlerXmlrpc * uriHandlerXmlrpcP;
- URIHandler2 * uriHandlerP;
- abyss_bool success;
+ /* Reap defunct children until there aren't any more. */
+ while (childrenLeft && !error) {
+ int status;
+ pid_t pid;
+
+ pid = waitpid((pid_t) -1, &status, WNOHANG);
+
+ if (pid == 0)
+ childrenLeft = false;
+ else if (pid < 0) {
+ /* because of ptrace */
+ if (errno != EINTR)
+ error = true;
+ } else
+ ServerHandleSigchld(pid);
+ }
+#endif /* WIN32 */
+}
- trace_abyss = getenv("XMLRPC_TRACE_ABYSS");
-
- MALLOCVAR_NOFAIL(uriHandlerP);
- uriHandlerP->handleReq2 = handleXmlrpcReq;
- uriHandlerP->handleReq1 = NULL;
- uriHandlerP->init = NULL;
- uriHandlerP->term = &termUriHandler;
+struct xmlrpc_server_abyss_sig {
- MALLOCVAR_NOFAIL(uriHandlerXmlrpcP);
+ /* A description of the state of the process' signal handlers before
+ functions in this library messed with them; useful for restoring
+ them later.
+ */
+#ifndef WIN32
+ struct sigaction pipe;
+ struct sigaction chld;
+#else
+ int dummy;
+#endif
+};
- uriHandlerXmlrpcP->registryP = registryP;
- uriHandlerXmlrpcP->filename = strdup(filename);
- uriHandlerP->userdata = uriHandlerXmlrpcP;
- ServerAddHandler2(srvP, uriHandlerP, &success);
+static void
+setupSignalHandlers(xmlrpc_server_abyss_sig * const oldHandlersP) {
+#ifndef WIN32
+ struct sigaction mysigaction;
+
+ sigemptyset(&mysigaction.sa_mask);
+ mysigaction.sa_flags = 0;
+
+ /* This signal indicates connection closed in the middle */
+ mysigaction.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &mysigaction, &oldHandlersP->pipe);
+
+ /* This signal indicates a child process (request handler) has died */
+ mysigaction.sa_handler = sigchld;
+ sigaction(SIGCHLD, &mysigaction, &oldHandlersP->chld);
+#endif
+}
- free(uriHandlerP);
- if (!success)
- xmlrpc_faultf(envP, "Abyss failed to register the Xmlrpc-c request "
- "handler. ServerAddHandler2() failed.");
+
+static void
+restoreSignalHandlers(const xmlrpc_server_abyss_sig * const oldHandlersP) {
+#ifndef WIN32
+
+ sigaction(SIGPIPE, &oldHandlersP->pipe, NULL);
+ sigaction(SIGCHLD, &oldHandlersP->chld, NULL);
+
+#endif
}
void
-xmlrpc_server_abyss_set_handlers(TServer * const srvP,
- xmlrpc_registry * const registryP) {
+xmlrpc_server_abyss_setup_sig(
+ xmlrpc_env * const envP,
+ xmlrpc_server_abyss_t * const serverP,
+ xmlrpc_server_abyss_sig ** const oldHandlersPP) {
- xmlrpc_env env;
+ xmlrpc_server_abyss_sig * oldHandlersP;
- xmlrpc_env_init(&env);
+ XMLRPC_ASSERT_ENV_OK(envP);
- trace_abyss = getenv("XMLRPC_TRACE_ABYSS");
+ validateGlobalInit(envP);
+
+ if (!envP->fault_occurred) {
+ MALLOCVAR(oldHandlersP);
+
+ if (oldHandlersP == NULL)
+ xmlrpc_faultf(envP, "Unable to allocate memory to save signal "
+ "handling state.");
+ else {
+ setupSignalHandlers(oldHandlersP);
+
+ xmlrpc_server_abyss_use_sigchld(serverP);
+ }
+ if (oldHandlersPP)
+ *oldHandlersPP = oldHandlersP;
+ else
+ free(oldHandlersP);
+ }
+}
+
+
+
+void
+xmlrpc_server_abyss_restore_sig(
+ const xmlrpc_server_abyss_sig * const oldHandlersP) {
+
+ restoreSignalHandlers(oldHandlersP);
+}
- xmlrpc_server_abyss_set_handler(&env, srvP, "/RPC2", registryP);
+
+
+static void
+runServerDaemon(TServer * const serverP,
+ runfirstFn const runfirst,
+ void * const runfirstArg) {
+
+ xmlrpc_server_abyss_sig oldHandlers;
+
+ setupSignalHandlers(&oldHandlers);
+
+ ServerUseSigchld(serverP);
+
+ ServerDaemonize(serverP);
- if (env.fault_occurred)
- abort();
+ /* We run the user supplied runfirst after forking, but before accepting
+ connections (helpful when running with threads)
+ */
+ if (runfirst)
+ runfirst(runfirstArg);
- ServerDefaultHandler(srvP, xmlrpc_server_abyss_default_handler);
+ ServerRun(serverP);
+
+ restoreSignalHandlers(&oldHandlers);
}
@@ -840,7 +1272,7 @@
static void
oldHighLevelAbyssRun(xmlrpc_env * const envP ATTR_UNUSED,
const xmlrpc_server_abyss_parms * const parmsP,
- unsigned int const parm_size) {
+ unsigned int const parmSize) {
/*----------------------------------------------------------------------------
This is the old deprecated interface, where the caller of the
xmlrpc_server_abyss API supplies an Abyss configuration file and
@@ -852,103 +1284,58 @@
Abyss parameters in memory. That's a more conventional and
flexible API.
-----------------------------------------------------------------------------*/
- TServer srv;
+ TServer server;
runfirstFn runfirst;
void * runfirstArg;
- DateInit();
- MIMETypeInit();
-
- ServerCreate(&srv, "XmlRpcServer", 8080, DEFAULT_DOCS, NULL);
+ ServerCreate(&server, "XmlRpcServer", 8080, DEFAULT_DOCS, NULL);
+
+ assert(parmSize >= XMLRPC_APSIZE(config_file_name));
- ConfReadServerFile(parmsP->config_file_name, &srv);
+ ConfReadServerFile(parmsP->config_file_name, &server);
- xmlrpc_server_abyss_set_handlers(&srv, parmsP->registryP);
+ assert(parmSize >= XMLRPC_APSIZE(registryP));
+
+ setHandlers(&server, "/RPC2", parmsP->registryP, false);
- ServerInit(&srv);
+ ServerInit(&server);
- if (parm_size >= XMLRPC_APSIZE(runfirst_arg)) {
+ if (parmSize >= XMLRPC_APSIZE(runfirst_arg)) {
runfirst = parmsP->runfirst;
runfirstArg = parmsP->runfirst_arg;
} else {
runfirst = NULL;
runfirstArg = NULL;
}
- runServerDaemon(&srv, runfirst, runfirstArg);
-}
-
-
-
-static void
-setAdditionalServerParms(const xmlrpc_server_abyss_parms * const parmsP,
- unsigned int const parm_size,
- TServer * const srvP) {
-
- /* The following ought to be parameters on ServerCreate(), but it
- looks like plugging them straight into the TServer structure is
- the only way to set them.
- */
+ runServerDaemon(&server, runfirst, runfirstArg);
- if (parm_size >= XMLRPC_APSIZE(keepalive_timeout) &&
- parmsP->keepalive_timeout > 0)
- srvP->keepalivetimeout = parmsP->keepalive_timeout;
- if (parm_size >= XMLRPC_APSIZE(keepalive_max_conn) &&
- parmsP->keepalive_max_conn > 0)
- srvP->keepalivemaxconn = parmsP->keepalive_max_conn;
- if (parm_size >= XMLRPC_APSIZE(timeout) &&
- parmsP->timeout > 0)
- srvP->timeout = parmsP->timeout;
- if (parm_size >= XMLRPC_APSIZE(dont_advertise))
- srvP->advertise = !parmsP->dont_advertise;
+ ServerFree(&server);
}
static void
-normalLevelAbyssRun(xmlrpc_env * const envP ATTR_UNUSED,
+normalLevelAbyssRun(xmlrpc_env * const envP,
const xmlrpc_server_abyss_parms * const parmsP,
- unsigned int const parm_size) {
+ unsigned int const parmSize) {
- unsigned int portNumber;
-
- DateInit();
- MIMETypeInit();
-
- if (parm_size >= XMLRPC_APSIZE(port_number))
- portNumber = parmsP->port_number;
- else
- portNumber = 8080;
+ xmlrpc_server_abyss_t * serverP;
- if (portNumber > 0xffff)
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "TCP port number %u exceeds the maximum possible "
- "TCP port number (65535)",
- portNumber);
- else {
- TServer srv;
- const char * logFileName;
+ xmlrpc_server_abyss_create(envP, parmsP, parmSize, &serverP);
- if (parm_size >= XMLRPC_APSIZE(log_file_name))
- logFileName = parmsP->log_file_name;
- else
- logFileName = NULL;
+ if (!envP->fault_occurred) {
+ xmlrpc_server_abyss_sig * oldHandlersP;
- ServerCreate(&srv, "XmlRpcServer", portNumber, DEFAULT_DOCS,
- logFileName);
+ xmlrpc_server_abyss_setup_sig(envP, serverP, &oldHandlersP);
- setAdditionalServerParms(parmsP, parm_size, &srv);
+ if (!envP->fault_occurred) {
+ xmlrpc_server_abyss_run_server(envP, serverP);
- xmlrpc_server_abyss_set_handlers(&srv, parmsP->registryP);
-
- ServerInit(&srv);
-
- setupSignalHandlers();
-
- ServerRun(&srv);
+ xmlrpc_server_abyss_restore_sig(oldHandlersP);
- /* We can't exist here because ServerRun doesn't return */
- XMLRPC_ASSERT(FALSE);
+ free(oldHandlersP);
+ }
+ xmlrpc_server_abyss_destroy(serverP);
}
}
@@ -957,37 +1344,61 @@
void
xmlrpc_server_abyss(xmlrpc_env * const envP,
const xmlrpc_server_abyss_parms * const parmsP,
- unsigned int const parm_size) {
-
+ unsigned int const parmSize) {
+/*----------------------------------------------------------------------------
+ Note that this is not re-entrant and not thread-safe, due to the
+ global library initialization. If you want to run a server inside
+ a thread of a multi-threaded program, use
+ xmlrpc_server_abyss_create() instead. As required by that
+ subroutine, your program will contain a call to
+ xmlrpc_server_abyss_init() early in your program, when it is only
+ one thread.
+-----------------------------------------------------------------------------*/
XMLRPC_ASSERT_ENV_OK(envP);
- if (parm_size < XMLRPC_APSIZE(registryP))
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "You must specify members at least up through "
- "'registryP' in the server parameters argument. "
- "That would mean the parameter size would be >= %u "
- "but you specified a size of %u",
- XMLRPC_APSIZE(registryP), parm_size);
- else {
- if (parmsP->config_file_name)
- oldHighLevelAbyssRun(envP, parmsP, parm_size);
- else
- normalLevelAbyssRun(envP, parmsP, parm_size);
+ xmlrpc_server_abyss_global_init(envP);
+
+ if (!envP->fault_occurred) {
+ if (parmSize < XMLRPC_APSIZE(registryP))
+ xmlrpc_faultf(envP,
+ "You must specify members at least up through "
+ "'registryP' in the server parameters argument. "
+ "That would mean the parameter size would be >= %lu "
+ "but you specified a size of %u",
+ XMLRPC_APSIZE(registryP), parmSize);
+ else {
+ if (parmsP->config_file_name)
+ oldHighLevelAbyssRun(envP, parmsP, parmSize);
+ else
+ normalLevelAbyssRun(envP, parmsP, parmSize);
+
+ }
+ xmlrpc_server_abyss_global_term();
}
}
/*=========================================================================
-** XML-RPC Server Method Registry
-**=========================================================================
-** A simple front-end to our method registry.
+ XML-RPC Server Method Registry
+
+ This is an old deprecated form of the server facilities that uses
+ global variables.
+=========================================================================*/
+
+/* These global variables must be treated as read-only after the
+ server has started.
*/
-/* XXX - This variable is *not* currently threadsafe. Once the server has
-** been started, it must be treated as read-only. */
-static xmlrpc_registry *builtin_registryP;
+static TServer globalSrv;
+ /* When you use the old interface (xmlrpc_server_abyss_init(), etc.),
+ this is the Abyss server to which they refer. Obviously, there can be
+ only one Abyss server per program using this interface.
+ */
+
+static xmlrpc_registry * builtin_registryP;
+
+
void
xmlrpc_server_abyss_init_registry(void) {
@@ -1008,7 +1419,7 @@
die_if_fault_occurred(&env);
xmlrpc_env_clean(&env);
- xmlrpc_server_abyss_set_handlers(&globalSrv, builtin_registryP);
+ setHandlers(&globalSrv, "/RPC2", builtin_registryP, false);
}
@@ -1027,9 +1438,9 @@
/* A quick & easy shorthand for adding a method. */
void
-xmlrpc_server_abyss_add_method (char * const method_name,
- xmlrpc_method const method,
- void * const user_data) {
+xmlrpc_server_abyss_add_method(char * const method_name,
+ xmlrpc_method const method,
+ void * const user_data) {
xmlrpc_env env;
xmlrpc_env_init(&env);
@@ -1042,11 +1453,11 @@
void
-xmlrpc_server_abyss_add_method_w_doc (char * const method_name,
- xmlrpc_method const method,
- void * const user_data,
- char * const signature,
- char * const help) {
+xmlrpc_server_abyss_add_method_w_doc(char * const method_name,
+ xmlrpc_method const method,
+ void * const user_data,
+ char * const signature,
+ char * const help) {
xmlrpc_env env;
xmlrpc_env_init(&env);
@@ -1059,6 +1470,40 @@
+void
+xmlrpc_server_abyss_init(int const flags ATTR_UNUSED,
+ const char * const config_file) {
+
+ ServerCreate(&globalSrv, "XmlRpcServer", 8080, DEFAULT_DOCS, NULL);
+
+ ConfReadServerFile(config_file, &globalSrv);
+
+ xmlrpc_server_abyss_init_registry();
+ /* Installs /RPC2 handler and default handler that use the
+ built-in registry.
+ */
+
+ ServerInit(&globalSrv);
+}
+
+
+
+void
+xmlrpc_server_abyss_run_first(runfirstFn const runfirst,
+ void * const runfirstArg) {
+
+ runServerDaemon(&globalSrv, runfirst, runfirstArg);
+}
+
+
+
+void
+xmlrpc_server_abyss_run(void) {
+ runServerDaemon(&globalSrv, NULL, NULL);
+}
+
+
+
/*
** Copyright (C) 2001 by First Peer, Inc. All rights reserved.
**
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_cgi.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_cgi.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_cgi.c Mon May 26 12:59:57 2008
@@ -237,8 +237,8 @@
input_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, input);
/* Process our call. */
- output = xmlrpc_registry_process_call(&env, registryP, NULL,
- input_data, input_size);
+ xmlrpc_registry_process_call2(&env, registryP,
+ input_data, input_size, NULL, &output);
XMLRPC_FAIL_IF_FAULT(&env);
output_data = XMLRPC_TYPED_MEM_BLOCK_CONTENTS(char, output);
output_size = XMLRPC_TYPED_MEM_BLOCK_SIZE(char, output);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_w32httpsys.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_w32httpsys.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_server_w32httpsys.c Mon May 26 12:59:57 2008
@@ -1,28 +1,4 @@
-/* Copyright (C) 2005 by Steven A. Bone, sbone(a)pobox.com. All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions
-** are met:
-** 1. Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** 2. Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in the
-** documentation and/or other materials provided with the distribution.
-** 3. The name of the author may not be used to endorse or promote products
-** derived from this software without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-** SUCH DAMAGE. */
-
+/* Copyright information is at end of file. */
/* COMPILATION NOTE:
Note that the Platform SDK headers and
link libraries for Windows XP SP2 or newer are required to compile
@@ -43,20 +19,18 @@
#define _UNICODE
#endif
+/* See compilation note above if this header is not found! */
+#include <http.h>
+#include <strsafe.h>
+
+#include "xmlrpc_config.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/server.h"
#include "xmlrpc-c/server_w32httpsys.h"
#include "version.h"
-#if MUST_BUILD_HTTP_SYS_SERVER > 0
-
-/* See compilation note above if this header is not found! */
-#include <http.h>
-#include <windows.h>
-#include <strsafe.h>
-
#pragma comment( lib, "httpapi" )
-
+#pragma message( "Compiling HTTPS server ..." )
/* XXX - This variable is *not* currently threadsafe. Once the server has
** been started, it must be treated as read-only. */
@@ -99,7 +73,7 @@
DWORD
DoReceiveRequests(
HANDLE hReqQueue,
- const xmlrpc_server_httpsys_parms * const parmsP
+ const xmlrpc_server_httpsys_parms * const parmsP
);
DWORD
@@ -134,126 +108,115 @@
void
xmlrpc_server_httpsys(
- xmlrpc_env * const envP,
+ xmlrpc_env * const envP,
const xmlrpc_server_httpsys_parms * const parmsP,
unsigned int const parm_size
- )
+ )
{
- ULONG retCode;
+ ULONG retCode;
HANDLE hReqQueue = NULL;
HTTPAPI_VERSION HttpApiVersion = HTTPAPI_VERSION_1;
- WCHAR wszURL[35];
+ WCHAR wszURL[35];
- XMLRPC_ASSERT_ENV_OK(envP);
+ XMLRPC_ASSERT_ENV_OK(envP);
if (parm_size < XMLRPC_HSSIZE(authfn))
- {
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "You must specify members at least up through "
- "'authfn' in the server parameters argument. "
- "That would mean the parameter size would be >= %u "
- "but you specified a size of %u",
- XMLRPC_HSSIZE(authfn), parm_size);
- return;
- }
-
- //Set logging options
- if (parmsP->logLevel>0)
- g_bDebug=TRUE;
- else
- g_bDebug=FALSE;
-
- if (parmsP->logLevel>1)
- g_bDebugString=TRUE;
- else
- g_bDebugString=FALSE;
-
- if (!parmsP->logFile)
- g_bDebug=FALSE;
- else
- StringCchPrintfA(g_fLogFile,MAX_PATH,parmsP->logFile);
-
- //construct the URL we are listening on
- if (parmsP->useSSL!=0)
- StringCchPrintf(wszURL,35,L"https://+:%u/RPC2",parmsP->portNum);
- else
- StringCchPrintf(wszURL,35,L"http://+:%u/RPC2",parmsP->portNum);
-
- global_registryP = parmsP->registryP;
-
- // Initialize HTTP APIs.
- retCode = HttpInitialize(
- HttpApiVersion,
- HTTP_INITIALIZE_SERVER, // Flags
- NULL // Reserved
- );
- if (retCode != NO_ERROR)
- {
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "HttpInitialize failed with %lu \n ",
- retCode);
- return;
- }
-
- // Create a Request Queue Handle
- retCode = HttpCreateHttpHandle(
- &hReqQueue, // Req Queue
- 0 // Reserved
- );
- if (retCode != NO_ERROR)
- {
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "HttpCreateHttpHandle failed with %lu \n ",
- retCode);
- goto CleanUp;
- }
-
- retCode = HttpAddUrl(
- hReqQueue, // Req Queue
- wszURL, // Fully qualified URL
- NULL // Reserved
- );
-
- if (retCode != NO_ERROR)
- {
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "HttpAddUrl failed with %lu \n ",
- retCode);
- goto CleanUp;
- }
-
- TraceW( L"we are listening for requests on the following url: %ws\n", wszURL);
-
- // Loop while receiving requests
- for(;;)
- {
- TraceW( L"Calling DoReceiveRequests()\n");
- retCode = DoReceiveRequests(hReqQueue, parmsP);
- if(NO_ERROR == retCode)
- {
- TraceW( L"DoReceiveRequests() returned NO_ERROR, breaking");
- break;
- }
- }
+ {
+ xmlrpc_faultf(envP,
+ "You must specify members at least up through "
+ "'authfn' in the server parameters argument. "
+ "That would mean the parameter size would be >= %u "
+ "but you specified a size of %u",
+ XMLRPC_HSSIZE(authfn), parm_size);
+ return;
+ }
+
+ //Set logging options
+ if (parmsP->logLevel>0)
+ g_bDebug=TRUE;
+ else
+ g_bDebug=FALSE;
+
+ if (parmsP->logLevel>1)
+ g_bDebugString=TRUE;
+ else
+ g_bDebugString=FALSE;
+
+ if (!parmsP->logFile)
+ g_bDebug=FALSE;
+ else
+ StringCchPrintfA(g_fLogFile,MAX_PATH,parmsP->logFile);
+
+ //construct the URL we are listening on
+ if (parmsP->useSSL!=0)
+ StringCchPrintf(wszURL,35,L"https://+:%u/RPC2",parmsP->portNum);
+ else
+ StringCchPrintf(wszURL,35,L"http://+:%u/RPC2",parmsP->portNum);
+
+ global_registryP = parmsP->registryP;
+
+ // Initialize HTTP APIs.
+ retCode = HttpInitialize(HttpApiVersion,
+ HTTP_INITIALIZE_SERVER, // Flags
+ NULL // Reserved
+ );
+ if (retCode != NO_ERROR)
+ {
+ xmlrpc_faultf(envP, "HttpInitialize failed with %lu",
+ retCode);
+ return;
+ }
+
+ // Create a Request Queue Handle
+ retCode = HttpCreateHttpHandle(&hReqQueue, // Req Queue
+ 0 // Reserved
+ );
+ if (retCode != NO_ERROR)
+ {
+ xmlrpc_faultf(envP, "HttpCreateHttpHandle failed with %lu", retCode);
+ goto CleanUp;
+ }
+
+ retCode = HttpAddUrl(hReqQueue, // Req Queue
+ wszURL, // Fully qualified URL
+ NULL // Reserved
+ );
+
+ if (retCode != NO_ERROR)
+ {
+ xmlrpc_faultf(envP, "HttpAddUrl failed with %lu", retCode);
+ goto CleanUp;
+ }
+
+ TraceW(L"we are listening for requests on the following url: %ws",
+ wszURL);
+
+ // Loop while receiving requests
+ for(;;)
+ {
+ TraceW(L"Calling DoReceiveRequests()");
+ retCode = DoReceiveRequests(hReqQueue, parmsP);
+ if(NO_ERROR == retCode)
+ {
+ TraceW(L"DoReceiveRequests() returned NO_ERROR, breaking");
+ break;
+ }
+ }
CleanUp:
- TraceW( L"Tearing down the server.\n", wszURL);
+ TraceW(L"Tearing down the server.", wszURL);
+
+ // Call HttpRemoveUrl for the URL that we added.
+ HttpRemoveUrl( hReqQueue, wszURL );
- // Call HttpRemoveUrl for the URL that we added.
- HttpRemoveUrl( hReqQueue, wszURL );
+ // Close the Request Queue handle.
+ if(hReqQueue)
+ CloseHandle(hReqQueue);
- // Close the Request Queue handle.
- if(hReqQueue)
- CloseHandle(hReqQueue);
-
- // Call HttpTerminate.
- HttpTerminate(HTTP_INITIALIZE_SERVER, NULL);
- return;
+ // Call HttpTerminate.
+ HttpTerminate(HTTP_INITIALIZE_SERVER, NULL);
+ return;
}
//
@@ -262,69 +225,71 @@
__inline void TraceA(const char *format, ...)
{
- if(g_bDebug)
- {
- if (format)
- {
- va_list arglist;
- char str[4096];
-
- va_start(arglist, format);
- if (g_fLogFile)
- {
- FILE *fout = fopen(g_fLogFile, "a+t");
- if (fout)
- {
- vfprintf(fout, format, arglist);
- fclose(fout);
- }
- }
-
- StringCchVPrintfA(str,4096, format, arglist);
- printf(str);
-
- if (g_bDebugString)
- {
-
- OutputDebugStringA(str);
- }
-
- va_end(arglist);
- }
- }
+ if(g_bDebug)
+ {
+ if (format)
+ {
+ va_list arglist;
+ char str[4096];
+
+ va_start(arglist, format);
+ StringCchVPrintfA(str, sizeof(str), format, arglist);
+ StringCbCatA(str, sizeof(str), "\n");
+ if (g_fLogFile)
+ {
+ FILE *fout = fopen(g_fLogFile, "a+t");
+ if (fout)
+ {
+ fprintf(fout, str);
+ fclose(fout);
+ }
+ }
+
+ printf(str);
+
+ if (g_bDebugString)
+ {
+
+ OutputDebugStringA(str);
+ }
+
+ va_end(arglist);
+ }
+ }
}
__inline void TraceW(const wchar_t *format, ...)
{
- if(g_bDebug)
- {
- if (format)
- {
- va_list arglist;
- wchar_t str[4096];
-
- va_start(arglist, format);
- if (g_fLogFile)
- {
- FILE *fout = fopen(g_fLogFile, "a+t");
- if (fout)
- {
- vfwprintf(fout, format, arglist);
- fclose(fout);
- }
- }
-
- StringCchVPrintfW(str, 4096, format, arglist);
- wprintf(str);
-
- if (g_bDebugString)
- {
- OutputDebugStringW(str);
- }
-
- va_end(arglist);
- }
- }
+ if(g_bDebug)
+ {
+ if (format)
+ {
+ va_list arglist;
+ wchar_t str[4096];
+
+ va_start(arglist, format);
+ StringCchVPrintfW(str, 4096, format, arglist);
+ StringCbCatW(str, sizeof(str), L"\n");
+ if (g_fLogFile)
+ {
+ FILE *fout = fopen(g_fLogFile, "a+t");
+ if (fout)
+ {
+ fwprintf(fout, str);
+ fclose(fout);
+ }
+ }
+
+ wprintf(str);
+
+ if (g_bDebugString)
+ {
+ OutputDebugStringW(str);
+ }
+
+ va_end(arglist);
+ }
+ }
}
/*
@@ -339,7 +304,7 @@
DWORD
DoReceiveRequests(
IN HANDLE hReqQueue,
- const xmlrpc_server_httpsys_parms * const parmsP
+ const xmlrpc_server_httpsys_parms * const parmsP
)
{
ULONG result;
@@ -348,9 +313,9 @@
PHTTP_REQUEST pRequest;
PCHAR pRequestBuffer;
ULONG RequestBufferLength;
- xmlrpc_env env;
- char szHeaderBuf[255];
- long lContentLength;
+ xmlrpc_env env;
+ char szHeaderBuf[255];
+ long lContentLength;
// Allocate a 2K buffer. Should be good for most requests, we'll grow
// this if required. We also need space for a HTTP_REQUEST structure.
@@ -370,14 +335,14 @@
RtlZeroMemory(pRequest, RequestBufferLength);
result = HttpReceiveHttpRequest(
- hReqQueue, // Req Queue
- requestId, // Req ID
- 0, // Flags
- pRequest, // HTTP request buffer
- RequestBufferLength,// req buffer length
- &bytesRead, // bytes received
- NULL // LPOVERLAPPED
- );
+ hReqQueue, // Req Queue
+ requestId, // Req ID
+ 0, // Flags
+ pRequest, // HTTP request buffer
+ RequestBufferLength,// req buffer length
+ &bytesRead, // bytes received
+ NULL // LPOVERLAPPED
+ );
if(NO_ERROR == result)
{
@@ -386,164 +351,238 @@
{
case HttpVerbPOST:
- TraceW(L"Got a POST request for %ws \n",pRequest->CookedUrl.pFullUrl);
-
- //Check if we need use authorization.
- if(parmsP->authfn)
- {
- xmlrpc_env_init(&env);
- if(pRequest->Headers.KnownHeaders[HttpHeaderAuthorization].RawValueLength<6)
- {
- xmlrpc_env_set_fault( &env, XMLRPC_REQUEST_REFUSED_ERROR,
- "Authorization header too short.");
- }
- else
- {
- //unencode the headers
- if(_strnicmp("basic ",pRequest->Headers.KnownHeaders[HttpHeaderAuthorization].pRawValue,6)!=0)
- {
- xmlrpc_env_set_fault( &env, XMLRPC_REQUEST_REFUSED_ERROR,
- "Authorization header is not of type basic.");
- }
- else
- {
- xmlrpc_mem_block * decoded;
-
- decoded = xmlrpc_base64_decode(&env,pRequest->Headers.KnownHeaders[HttpHeaderAuthorization].pRawValue+6,pRequest->Headers.KnownHeaders[HttpHeaderAuthorization].RawValueLength-6);
- if(!env.fault_occurred)
- {
- char *pDecodedStr;
- char *pUser;
- char *pPass;
- char *pColon;
-
- pDecodedStr = (char*)malloc(decoded->_size+1);
- memcpy(pDecodedStr,decoded->_block,decoded->_size);
- pDecodedStr[decoded->_size]='\0';
- pUser = pPass = pDecodedStr;
- pColon=strchr(pDecodedStr,':');
- if(pColon)
- {
- *pColon='\0';
- pPass=pColon+1;
- //The authfn should set env to fail if auth is denied.
- parmsP->authfn(&env,pUser,pPass);
- }
- else
- {
- xmlrpc_env_set_fault( &env, XMLRPC_REQUEST_REFUSED_ERROR,
- "Decoded auth not of the correct format.");
- }
- free(pDecodedStr);
- }
- if(decoded)
- XMLRPC_MEMBLOCK_FREE(char, decoded);
- }
- }
- if(env.fault_occurred)
- {
- //request basic authorization, as the user did not provide it.
- xmlrpc_env_clean(&env);
- TraceW(L"POST request did not provide valid authorization header.");
- result = SendHttpResponseAuthRequired( hReqQueue, pRequest);
- break;
- }
- xmlrpc_env_clean(&env);
- }
-
- //Check content type to make sure it is text/xml.
- memcpy(szHeaderBuf,pRequest->Headers.KnownHeaders[HttpHeaderContentType].pRawValue,pRequest->Headers.KnownHeaders[HttpHeaderContentType].RawValueLength);
- szHeaderBuf[pRequest->Headers.KnownHeaders[HttpHeaderContentType].RawValueLength]='\0';
- if (_stricmp(szHeaderBuf,"text/xml")!=0)
- {
- //We only handle text/xml data. Anything else is not valid.
- TraceW(L"POST request had an unsupported content-type: %s \n", szHeaderBuf);
- result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 400,
- "Bad Request",
- NULL
- );
- break;
- }
-
- //Check content length to make sure it exists and is not too big.
- memcpy(szHeaderBuf,pRequest->Headers.KnownHeaders[HttpHeaderContentLength].pRawValue,pRequest->Headers.KnownHeaders[HttpHeaderContentLength].RawValueLength);
- szHeaderBuf[pRequest->Headers.KnownHeaders[HttpHeaderContentLength].RawValueLength]='\0';
- lContentLength = atol(szHeaderBuf);
- if (lContentLength<=0)
- {
- //Make sure a content length was supplied.
- TraceW(L"POST request did not include a content-length \n", szHeaderBuf);
- result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 411,
- "Length Required",
- NULL
- );
- break;
- }
- if((size_t) lContentLength > xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
- {
- //Content-length is too big for us to handle
- TraceW(L"POST request content-length is too big for us to handle: %d bytes \n", lContentLength);
- result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 500,
- "content-length too large",
- NULL
- );
- break;
- }
-
- //our initial validations of POST, content-type, and content-length
- //all check out. Collect and pass the complete buffer to the
- //XMLRPC-C library
-
- xmlrpc_env_init(&env);
+ TraceW(L"Got a POST request for %ws",
+ pRequest->CookedUrl.pFullUrl);
+
+ //Check if we need use authorization.
+ if(parmsP->authfn)
+ {
+ xmlrpc_env_init(&env);
+ if(pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization].RawValueLength
+ < 6)
+ {
+ xmlrpc_env_set_fault(
+ &env, XMLRPC_REQUEST_REFUSED_ERROR,
+ "Authorization header too short.");
+ }
+ else
+ {
+ //unencode the headers
+ if(_strnicmp(
+ "basic",
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization].pRawValue,5)
+ !=0)
+ {
+#ifndef NDEBUG
+ PCHAR pTmp = (PCHAR)
+ ALLOC_MEM(pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].RawValueLength + 1 );
+ if( pTmp ) {
+ strncpy(pTmp,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].pRawValue,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].RawValueLength );
+ pTmp[pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].RawValueLength] = 0;
+ TraceA("Got HEADER [%s]",pTmp);
+ FREE_MEM(pTmp);
+ }
+#endif /* #ifndef NDEBUG */
+ xmlrpc_env_set_fault(
+ &env, XMLRPC_REQUEST_REFUSED_ERROR,
+ "Authorization header does not start "
+ "with type 'basic'!");
+ }
+ else
+ {
+ xmlrpc_mem_block * decoded;
+
+ decoded =
+ xmlrpc_base64_decode(
+ &env,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].pRawValue+6,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderAuthorization
+ ].RawValueLength-6);
+ if(!env.fault_occurred)
+ {
+ char *pDecodedStr;
+ char *pUser;
+ char *pPass;
+ char *pColon;
+
+ pDecodedStr = (char*)
+ malloc(decoded->_size+1);
+ memcpy(pDecodedStr,
+ decoded->_block,
+ decoded->_size);
+ pDecodedStr[decoded->_size]='\0';
+ pUser = pPass = pDecodedStr;
+ pColon=strchr(pDecodedStr,':');
+ if(pColon)
+ {
+ *pColon='\0';
+ pPass=pColon+1;
+ //The authfn should set env to
+ //fail if auth is denied.
+ parmsP->authfn(&env,pUser,pPass);
+ }
+ else
+ {
+ xmlrpc_env_set_fault(
+ &env,
+ XMLRPC_REQUEST_REFUSED_ERROR,
+ "Decoded auth not of the correct "
+ "format.");
+ }
+ free(pDecodedStr);
+ }
+ if(decoded)
+ XMLRPC_MEMBLOCK_FREE(char, decoded);
+ }
+ }
+ if(env.fault_occurred)
+ {
+ //request basic authorization, as the user
+ //did not provide it.
+ xmlrpc_env_clean(&env);
+ TraceW(L"POST request did not provide valid "
+ L"authorization header.");
+ result =
+ SendHttpResponseAuthRequired( hReqQueue,
+ pRequest);
+ break;
+ }
+ xmlrpc_env_clean(&env);
+ }
+
+ //Check content type to make sure it is text/xml.
+ memcpy(szHeaderBuf,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderContentType
+ ].pRawValue,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderContentType
+ ].RawValueLength);
+ szHeaderBuf[pRequest->Headers.KnownHeaders[
+ HttpHeaderContentType
+ ].RawValueLength] = '\0';
+ if (_stricmp(szHeaderBuf,"text/xml")!=0)
+ {
+ //We handle only text/xml data. Anything else
+ //is not valid.
+ TraceW(L"POST request had an unrecognized "
+ L"content-type: %s", szHeaderBuf);
+ result = SendHttpResponse(
+ hReqQueue,
+ pRequest,
+ 400,
+ "Bad Request",
+ NULL
+ );
+ break;
+ }
+
+ //Check content length to make sure it exists and
+ //is not too big.
+ memcpy(szHeaderBuf,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderContentLength
+ ].pRawValue,
+ pRequest->Headers.KnownHeaders[
+ HttpHeaderContentLength
+ ].RawValueLength);
+ szHeaderBuf[pRequest->Headers.KnownHeaders[
+ HttpHeaderContentLength
+ ].RawValueLength]='\0';
+ lContentLength = atol(szHeaderBuf);
+ if (lContentLength<=0)
+ {
+ //Make sure a content length was supplied.
+ TraceW(L"POST request did not include a "
+ L"content-length", szHeaderBuf);
+ result = SendHttpResponse(
+ hReqQueue,
+ pRequest,
+ 411,
+ "Length Required",
+ NULL
+ );
+ break;
+ }
+ if((size_t) lContentLength >
+ xmlrpc_limit_get(XMLRPC_XML_SIZE_LIMIT_ID))
+ {
+ //Content-length is too big for us to handle
+ TraceW(L"POST request content-length is too big "
+ L"for us to handle: %d bytes",
+ lContentLength);
+ result = SendHttpResponse(
+ hReqQueue,
+ pRequest,
+ 500,
+ "content-length too large",
+ NULL
+ );
+ break;
+ }
+
+ //our initial validations of POST, content-type,
+ //and content-length all check out. Collect and
+ //pass the complete buffer to the XMLRPC-C library
+
+ xmlrpc_env_init(&env);
processRPCCall(&env,hReqQueue, pRequest);
- if (env.fault_occurred)
- {
- //if we fail and it is anything other than a network error,
- //we should return a failure response to the client.
- if (env.fault_code != XMLRPC_NETWORK_ERROR)
- {
- if (env.fault_string)
- result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 500,
- env.fault_string,
- NULL
- );
- else
- result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 500,
- "Unknown Error",
- NULL
- );
- }
- }
-
- xmlrpc_env_clean(&env);
+ if (env.fault_occurred)
+ {
+ //if we fail and it is anything other than a
+ //network error, we should return a failure
+ //response to the client.
+ if (env.fault_code != XMLRPC_NETWORK_ERROR)
+ {
+ if (env.fault_string)
+ result = SendHttpResponse(
+ hReqQueue,
+ pRequest,
+ 500,
+ env.fault_string,
+ NULL
+ );
+ else
+ result = SendHttpResponse(
+ hReqQueue,
+ pRequest,
+ 500,
+ "Unknown Error",
+ NULL
+ );
+ }
+ }
+
+ xmlrpc_env_clean(&env);
break;
default:
- //We only handle POST data. Anything else is not valid.
- TraceW(L"Got an unsupported Verb request for URI %ws \n", pRequest->CookedUrl.pFullUrl);
-
+ //We handle only POST data. Anything else is not valid.
+ TraceW(L"Got an unrecognized Verb request for URI %ws",
+ pRequest->CookedUrl.pFullUrl);
+
result = SendHttpResponse(
- hReqQueue,
- pRequest,
- 405,
- "Method Not Allowed",
- NULL
- );
+ hReqQueue,
+ pRequest,
+ 405,
+ "Method Not Allowed",
+ NULL
+ );
break;
}
if(result != NO_ERROR)
@@ -592,7 +631,6 @@
}
} // for(;;)
-Cleanup:
if(pRequestBuffer)
{
@@ -620,15 +658,15 @@
HTTP_DATA_CHUNK dataChunk;
DWORD result;
DWORD bytesSent;
- CHAR szServerHeader[20];
+ CHAR szServerHeader[20];
// Initialize the HTTP response structure.
INITIALIZE_HTTP_RESPONSE(&response, StatusCode, pReason);
ADD_KNOWN_HEADER(response, HttpHeaderContentType, "text/html");
-
- StringCchPrintfA(szServerHeader,20, "xmlrpc-c %s",XMLRPC_C_VERSION);
- ADD_KNOWN_HEADER(response, HttpHeaderServer, szServerHeader);
+
+ StringCchPrintfA(szServerHeader,20, "xmlrpc-c %s",XMLRPC_C_VERSION);
+ ADD_KNOWN_HEADER(response, HttpHeaderServer, szServerHeader);
if(pEntityString)
{
@@ -644,29 +682,30 @@
// Since we are sending all the entity body in one call, we don't have
// to specify the Content-Length.
result = HttpSendHttpResponse(
- hReqQueue, // ReqQueueHandle
- pRequest->RequestId, // Request ID
- 0, // Flags
- &response, // HTTP response
- NULL, // pReserved1
- &bytesSent, // bytes sent (OPTIONAL)
- NULL, // pReserved2 (must be NULL)
- 0, // Reserved3 (must be 0)
- NULL, // LPOVERLAPPED (OPTIONAL)
- NULL // pReserved4 (must be NULL)
- );
+ hReqQueue, // ReqQueueHandle
+ pRequest->RequestId, // Request ID
+ 0, // Flags
+ &response, // HTTP response
+ NULL, // pReserved1
+ &bytesSent, // bytes sent (OPTIONAL)
+ NULL, // pReserved2 (must be NULL)
+ 0, // Reserved3 (must be 0)
+ NULL, // LPOVERLAPPED (OPTIONAL)
+ NULL // pReserved4 (must be NULL)
+ );
if(result != NO_ERROR)
{
- TraceW(L"HttpSendHttpResponse failed with %lu \n", result);
+ TraceW(L"HttpSendHttpResponse failed with %lu", result);
}
return result;
}
-/*
- * SendHttpResponseAuthRequired sends a 401 status code requesting authorization
+/* SendHttpResponseAuthRequired sends a 401 status code requesting
+ * authorization
*/
+
DWORD
SendHttpResponseAuthRequired(
IN HANDLE hReqQueue,
@@ -676,35 +715,36 @@
HTTP_RESPONSE response;
DWORD result;
DWORD bytesSent;
- CHAR szServerHeader[20];
+ CHAR szServerHeader[20];
// Initialize the HTTP response structure.
INITIALIZE_HTTP_RESPONSE(&response, 401, "Authentication Required");
// Add the WWW_Authenticate header.
- ADD_KNOWN_HEADER(response, HttpHeaderWwwAuthenticate, "Basic realm=\"xmlrpc\"");
-
- StringCchPrintfA(szServerHeader,20, "xmlrpc-c %s",XMLRPC_C_VERSION);
- ADD_KNOWN_HEADER(response, HttpHeaderServer, szServerHeader);
+ ADD_KNOWN_HEADER(response, HttpHeaderWwwAuthenticate,
+ "Basic realm=\"xmlrpc\"");
+
+ StringCchPrintfA(szServerHeader,20, "xmlrpc-c %s",XMLRPC_C_VERSION);
+ ADD_KNOWN_HEADER(response, HttpHeaderServer, szServerHeader);
// Since we are sending all the entity body in one call, we don't have
// to specify the Content-Length.
result = HttpSendHttpResponse(
- hReqQueue, // ReqQueueHandle
- pRequest->RequestId, // Request ID
- 0, // Flags
- &response, // HTTP response
- NULL, // pReserved1
- &bytesSent, // bytes sent (OPTIONAL)
- NULL, // pReserved2 (must be NULL)
- 0, // Reserved3 (must be 0)
- NULL, // LPOVERLAPPED (OPTIONAL)
- NULL // pReserved4 (must be NULL)
- );
+ hReqQueue, // ReqQueueHandle
+ pRequest->RequestId, // Request ID
+ 0, // Flags
+ &response, // HTTP response
+ NULL, // pReserved1
+ &bytesSent, // bytes sent (OPTIONAL)
+ NULL, // pReserved2 (must be NULL)
+ 0, // Reserved3 (must be 0)
+ NULL, // LPOVERLAPPED (OPTIONAL)
+ NULL // pReserved4 (must be NULL)
+ );
if(result != NO_ERROR)
{
- TraceW(L"SendHttpResponseAuthRequired failed with %lu \n", result);
+ TraceW(L"SendHttpResponseAuthRequired failed with %lu", result);
}
return result;
@@ -733,38 +773,36 @@
ULONG BytesRead;
#define MAX_ULONG_STR ((ULONG) sizeof("4294967295"))
CHAR szContentLength[MAX_ULONG_STR];
- CHAR szServerHeader[20];
+ CHAR szServerHeader[20];
HTTP_DATA_CHUNK dataChunk;
ULONG TotalBytesRead = 0;
- xmlrpc_mem_block * body;
- xmlrpc_mem_block * output;
+ xmlrpc_mem_block * body;
+ xmlrpc_mem_block * output;
BytesRead = 0;
- body = NULL;
- output = NULL;
+ body = NULL;
+ output = NULL;
// Allocate some space for an entity buffer.
- EntityBufferLength = 2048;
+ EntityBufferLength = 2048;
pEntityBuffer = (PUCHAR) ALLOC_MEM( EntityBufferLength );
if (pEntityBuffer == NULL)
{
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INTERNAL_ERROR,
- "Out of Memory");
+ xmlrpc_faultf(envP, "Out of Memory");
goto Done;
}
- // NOTE: If we had passed the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY
+ // NOTE: If we had passed the HTTP_RECEIVE_REQUEST_FLAG_COPY_BODY
// flag with HttpReceiveHttpRequest(), the entity would have
// been a part of HTTP_REQUEST (using the pEntityChunks field).
// Since we have not passed that flag, we can be assured that
// there are no entity bodies in HTTP_REQUEST.
if(pRequest->Flags & HTTP_REQUEST_FLAG_MORE_ENTITY_BODY_EXISTS)
{
- //Allocate some space for an XMLRPC memory block.
- body = xmlrpc_mem_block_new(envP, 0);
- if (envP->fault_occurred)
- goto Done;
+ //Allocate some space for an XMLRPC memory block.
+ body = xmlrpc_mem_block_new(envP, 0);
+ if (envP->fault_occurred)
+ goto Done;
// The entity body can be sent over multiple calls. Let's collect all
// of these in a buffer and send the buffer to the xmlrpc-c library
@@ -773,23 +811,23 @@
// Read the entity chunk from the request.
BytesRead = 0;
result = HttpReceiveRequestEntityBody(
- hReqQueue,
- pRequest->RequestId,
- 0,
- pEntityBuffer,
- EntityBufferLength,
- &BytesRead,
- NULL
- );
+ hReqQueue,
+ pRequest->RequestId,
+ 0,
+ pEntityBuffer,
+ EntityBufferLength,
+ &BytesRead,
+ NULL
+ );
switch(result)
{
case NO_ERROR:
if(BytesRead != 0)
{
- XMLRPC_TYPED_MEM_BLOCK_APPEND(char, envP, body,
- pEntityBuffer, BytesRead);
- if(envP->fault_occurred)
- goto Done;
+ XMLRPC_MEMBLOCK_APPEND(char, envP, body,
+ pEntityBuffer, BytesRead);
+ if(envP->fault_occurred)
+ goto Done;
}
break;
@@ -798,112 +836,125 @@
// process the suppossed XMLRPC data.
if(BytesRead != 0)
{
- XMLRPC_TYPED_MEM_BLOCK_APPEND(char, envP, body,
- pEntityBuffer, BytesRead);
- if(envP->fault_occurred)
- goto Done;
+ XMLRPC_MEMBLOCK_APPEND(char, envP, body,
+ pEntityBuffer, BytesRead);
+ if(envP->fault_occurred)
+ goto Done;
}
// We will send the response over multiple calls.
- // This is achieved by passing the
+ // This is achieved by passing the
// HTTP_SEND_RESPONSE_FLAG_MORE_DATA flag.
// NOTE: Since we are accumulating the TotalBytesRead in
// a ULONG, this will not work for entity bodies that
- // are larger than 4 GB. For supporting large entity
+ // are larger than 4 GB. To work with large entity
// bodies, we would have to use a ULONGLONG.
- TraceA("xmlrpc_server RPC2 handler processing RPC request.\n");
-
- // Process the RPC.
- output = xmlrpc_registry_process_call(
- envP, global_registryP, NULL,
- XMLRPC_MEMBLOCK_CONTENTS(char, body),
- XMLRPC_MEMBLOCK_SIZE(char, body));
- if (envP->fault_occurred)
- goto Done;
-
- // Initialize the HTTP response structure.
- INITIALIZE_HTTP_RESPONSE(&response, 200, "OK");
-
- //Add the content-length
- StringCchPrintfA(szContentLength,MAX_ULONG_STR, "%lu",
- XMLRPC_MEMBLOCK_SIZE(char, output));
- ADD_KNOWN_HEADER(
- response,
- HttpHeaderContentLength,
- szContentLength );
-
- //Add the content-type
- ADD_KNOWN_HEADER(response, HttpHeaderContentType, "text/xml");
-
- StringCchPrintfA(szServerHeader,20, "xmlrpc-c %s",XMLRPC_C_VERSION);
- ADD_KNOWN_HEADER(response, HttpHeaderServer, szServerHeader);
-
- //send the response
- result = HttpSendHttpResponse(
- hReqQueue, // ReqQueueHandle
- pRequest->RequestId, // Request ID
- HTTP_SEND_RESPONSE_FLAG_MORE_DATA,
- &response, // HTTP response
- NULL, // pReserved1
- &bytesSent, // bytes sent (optional)
- NULL, // pReserved2
- 0, // Reserved3
- NULL, // LPOVERLAPPED
- NULL // pReserved4
- );
- if(result != NO_ERROR)
- {
- TraceW(L"HttpSendHttpResponse failed with %lu \n", result);
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR,
- "HttpSendHttpResponse failed with %lu", result);
- goto Done;
- }
-
- // Send entity body from a memory chunk.
- dataChunk.DataChunkType = HttpDataChunkFromMemory;
- dataChunk.FromMemory.BufferLength = (ULONG)XMLRPC_MEMBLOCK_SIZE(char, output);
- dataChunk.FromMemory.pBuffer = XMLRPC_MEMBLOCK_CONTENTS(char, output);
-
- result = HttpSendResponseEntityBody(
- hReqQueue,
- pRequest->RequestId,
- 0, // This is the last send.
- 1, // Entity Chunk Count.
- &dataChunk,
- NULL,
- NULL,
- 0,
- NULL,
- NULL
- );
- if(result != NO_ERROR)
- {
- TraceW(L"HttpSendResponseEntityBody failed with %lu \n", result);
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR,
- "HttpSendResponseEntityBody failed with %lu", result);
- goto Done;
- }
- goto Done;
+ TraceA("xmlrpc_server RPC2 handler processing "
+ "RPC request.");
+
+ // Process the RPC.
+ xmlrpc_registry_process_call2(
+ envP, global_registryP,
+ XMLRPC_MEMBLOCK_CONTENTS(char, body),
+ XMLRPC_MEMBLOCK_SIZE(char, body),
+ NULL,
+ &output);
+ if (envP->fault_occurred)
+ goto Done;
+
+ // Initialize the HTTP response structure.
+ INITIALIZE_HTTP_RESPONSE(&response, 200, "OK");
+
+ //Add the content-length
+ StringCchPrintfA(szContentLength,MAX_ULONG_STR, "%lu",
+ XMLRPC_MEMBLOCK_SIZE(char, output));
+ ADD_KNOWN_HEADER(
+ response,
+ HttpHeaderContentLength,
+ szContentLength );
+
+ //Add the content-type
+ ADD_KNOWN_HEADER(response, HttpHeaderContentType,
+ "text/xml");
+
+ StringCchPrintfA(szServerHeader,20,
+ "xmlrpc-c %s",XMLRPC_C_VERSION);
+ ADD_KNOWN_HEADER(response, HttpHeaderServer,
+ szServerHeader);
+
+ //send the response
+ result = HttpSendHttpResponse(
+ hReqQueue, // ReqQueueHandle
+ pRequest->RequestId, // Request ID
+ HTTP_SEND_RESPONSE_FLAG_MORE_DATA,
+ &response, // HTTP response
+ NULL, // pReserved1
+ &bytesSent, // bytes sent (optional)
+ NULL, // pReserved2
+ 0, // Reserved3
+ NULL, // LPOVERLAPPED
+ NULL // pReserved4
+ );
+ if(result != NO_ERROR)
+ {
+ TraceW(L"HttpSendHttpResponse failed with %lu",
+ result);
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HttpSendHttpResponse failed with %lu", result);
+ goto Done;
+ }
+
+ // Send entity body from a memory chunk.
+ dataChunk.DataChunkType = HttpDataChunkFromMemory;
+ dataChunk.FromMemory.BufferLength =
+ (ULONG)XMLRPC_MEMBLOCK_SIZE(char, output);
+ dataChunk.FromMemory.pBuffer =
+ XMLRPC_MEMBLOCK_CONTENTS(char, output);
+
+ result = HttpSendResponseEntityBody(
+ hReqQueue,
+ pRequest->RequestId,
+ 0, // This is the last send.
+ 1, // Entity Chunk Count.
+ &dataChunk,
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ NULL
+ );
+ if(result != NO_ERROR)
+ {
+ TraceW(L"HttpSendResponseEntityBody failed "
+ L"with %lu", result);
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HttpSendResponseEntityBody failed with %lu",
+ result);
+ goto Done;
+ }
+ goto Done;
break;
default:
- TraceW(L"HttpReceiveRequestEntityBody failed with %lu \n", result);
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_NETWORK_ERROR,
- "HttpReceiveRequestEntityBody failed with %lu", result);
+ TraceW(L"HttpReceiveRequestEntityBody failed with %lu",
+ result);
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_NETWORK_ERROR,
+ "HttpReceiveRequestEntityBody failed "
+ "with %lu", result);
goto Done;
}
} while(TRUE);
}
else
{
- // This request does not have an entity body.
- TraceA("Received a bad request (no body in HTTP post).\n");
- xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_PARSE_ERROR,
- "Bad POST request (no body)");
+ // This request does not have an entity body.
+ TraceA("Received a bad request (no body in HTTP post).");
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_PARSE_ERROR,
+ "Bad POST request (no body)");
goto Done;
}
@@ -912,13 +963,39 @@
if(pEntityBuffer)
FREE_MEM(pEntityBuffer);
- if(output)
- XMLRPC_MEMBLOCK_FREE(char, output);
+ if(output)
+ XMLRPC_MEMBLOCK_FREE(char, output);
- if(body)
- XMLRPC_MEMBLOCK_FREE(char, body);
+ if(body)
+ XMLRPC_MEMBLOCK_FREE(char, body);
return;
}
-#endif /* #if MUST_BUILD_HTTP_SYS_SERVER <> 0 */
\ No newline at end of file
+
+
+/* Copyright (C) 2005 by Steven A. Bone, sbone(a)pobox.com. All rights reserved.
+**
+** Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions
+** are met:
+** 1. Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** 2. Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in the
+** documentation and/or other materials provided with the distribution.
+** 3. The name of the author may not be used to endorse or promote products
+** derived from this software without specific prior written permission.
+**
+** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+** SUCH DAMAGE. */
+
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_struct.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_struct.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/src/xmlrpc_struct.c Mon May 26 12:59:57 2008
@@ -31,6 +31,7 @@
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/base_int.h"
+#include "int.h"
#define KEY_ERROR_BUFFER_SZ (32)
@@ -115,26 +116,23 @@
-/*=========================================================================
-** get_hash
-**=========================================================================
-** A mindlessly simple hash function. Please feel free to write something
-** more clever if this produces bad results.
-*/
-
-static unsigned char
-get_hash(const char * const key,
- size_t const key_len) {
+static uint32_t
+hashStructKey(const char * const key,
+ size_t const keyLen) {
- unsigned char retval;
+ uint32_t hash;
size_t i;
XMLRPC_ASSERT(key != NULL);
- retval = 0;
- for (i = 0; i < key_len; i++)
- retval += key[i];
- return retval;
+ /* This is the Bernstein hash, optimized for lower case ASCII
+ keys. Note that the bytes of such a key differ only in their
+ lower 5 bits.
+ */
+ for (hash = 0, i = 0; i < keyLen; ++i)
+ hash = hash + key[i] + (hash << 5);
+
+ return hash;
}
@@ -149,28 +147,28 @@
static int
find_member(xmlrpc_value * const strctP,
const char * const key,
- size_t const key_len) {
+ size_t const keyLen) {
size_t size, i;
- unsigned char hash;
- _struct_member *contents;
- xmlrpc_value *keyval;
- char *keystr;
- size_t keystr_size;
+ uint32_t searchHash;
+ _struct_member * contents; /* array */
+ xmlrpc_value * keyvalP;
+ const char * keystr;
+ size_t keystrSize;
XMLRPC_ASSERT_VALUE_OK(strctP);
XMLRPC_ASSERT(key != NULL);
/* Look for our key. */
- hash = get_hash(key, key_len);
+ searchHash = hashStructKey(key, keyLen);
size = XMLRPC_MEMBLOCK_SIZE(_struct_member, &strctP->_block);
contents = XMLRPC_MEMBLOCK_CONTENTS(_struct_member, &strctP->_block);
- for (i = 0; i < size; i++) {
- if (contents[i].key_hash == hash) {
- keyval = contents[i].key;
- keystr = XMLRPC_MEMBLOCK_CONTENTS(char, &keyval->_block);
- keystr_size = XMLRPC_MEMBLOCK_SIZE(char, &keyval->_block)-1;
- if (key_len == keystr_size && memcmp(key, keystr, key_len) == 0)
+ for (i = 0; i < size; ++i) {
+ if (contents[i].keyHash == searchHash) {
+ keyvalP = contents[i].key;
+ keystr = XMLRPC_MEMBLOCK_CONTENTS(char, &keyvalP->_block);
+ keystrSize = XMLRPC_MEMBLOCK_SIZE(char, &keyvalP->_block)-1;
+ if (keystrSize == keyLen && memcmp(key, keystr, keyLen) == 0)
return i;
}
}
@@ -336,7 +334,7 @@
if (*valuePP == NULL) {
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR, "No member of struct has key '%.*s'",
- XMLRPC_MEMBLOCK_SIZE(char, &keyP->_block),
+ (int)XMLRPC_MEMBLOCK_SIZE(char, &keyP->_block),
XMLRPC_MEMBLOCK_CONTENTS(char, &keyP->_block));
}
}
@@ -390,7 +388,7 @@
xmlrpc_env_set_fault_formatted(
envP, XMLRPC_INDEX_ERROR,
"No member of struct has key '%.*s'",
- keyLen, key);
+ (int)keyLen, key);
/* We should fix the error message to format the key
for display */
} else
@@ -436,29 +434,28 @@
xmlrpc_struct_set_value_n(xmlrpc_env * const envP,
xmlrpc_value * const strctP,
const char * const key,
- size_t const key_len,
+ size_t const keyLen,
xmlrpc_value * const valueP) {
- xmlrpc_value *keyval;
-
XMLRPC_ASSERT_ENV_OK(envP);
XMLRPC_ASSERT(key != NULL);
- /* Set up error handling preconditions. */
- keyval = NULL;
-
- XMLRPC_TYPE_CHECK(envP, strctP, XMLRPC_TYPE_STRUCT);
-
- /* Build an xmlrpc_value from our string. */
- keyval = xmlrpc_build_value(envP, "s#", key, key_len);
- XMLRPC_FAIL_IF_FAULT(envP);
+ if (xmlrpc_value_type(strctP) != XMLRPC_TYPE_STRUCT)
+ xmlrpc_env_set_fault_formatted(
+ envP, XMLRPC_TYPE_ERROR,
+ "Trying to set value in something not a struct. "
+ "Type is %d; struct is %d",
+ xmlrpc_value_type(strctP), XMLRPC_TYPE_STRUCT);
+ else {
+ xmlrpc_value * keyvalP;
- /* Do the actual work. */
- xmlrpc_struct_set_value_v(envP, strctP, keyval, valueP);
+ /* Get the key as an xmlrpc_value */
+ keyvalP = xmlrpc_build_value(envP, "s#", key, keyLen);
+ if (!envP->fault_occurred)
+ xmlrpc_struct_set_value_v(envP, strctP, keyvalP, valueP);
- cleanup:
- if (keyval)
- xmlrpc_DECREF(keyval);
+ xmlrpc_DECREF(keyvalP);
+ }
}
@@ -501,9 +498,9 @@
xmlrpc_DECREF(old_value);
} else {
/* Add a new member. */
- new_member.key_hash = get_hash(key, key_len);
- new_member.key = keyvalP;
- new_member.value = valueP;
+ new_member.keyHash = hashStructKey(key, key_len);
+ new_member.key = keyvalP;
+ new_member.value = valueP;
XMLRPC_MEMBLOCK_APPEND(_struct_member, envP, &strctP->_block,
&new_member, 1);
XMLRPC_FAIL_IF_FAULT(envP);
@@ -578,7 +575,7 @@
if (index < 0)
xmlrpc_env_set_fault_formatted(
- envP, XMLRPC_INDEX_ERROR, "Index %d is negative.");
+ envP, XMLRPC_INDEX_ERROR, "Index %d is negative.", index);
else {
xmlrpc_struct_read_member(envP, structP, index, keyvalP, valueP);
if (!envP->fault_occurred) {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/Makefile Mon May 26 12:59:57 2008
@@ -1,22 +1,25 @@
-SUBDIR=tools
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/..
-BUILDDIR = $(SRCDIR)
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ SRCDIR := $(call updir,$(CURDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := tools
-include $(SRCDIR)/Makefile.config
+include $(BLDDIR)/config.mk
SUBDIRS = binmode-rpc-kit turbocharger
ifeq ($(MUST_BUILD_CLIENT),yes)
SUBDIRS += xmlrpc xmlrpc_transport
-endif
-ifeq ($(ENABLE_CPLUSPLUS),yes)
- SUBDIRS += xml-rpc-api2cpp
+ ifeq ($(ENABLE_CPLUSPLUS),yes)
+ SUBDIRS += xml-rpc-api2cpp xmlrpc_cpp_proxy
+ # We could add 'xmlrpc_pstream' here, but we don't because we don't
+ # want to deal with finding the Readline/Ncurses libraries.
+ endif
endif
-.PHONY: all clean distclean install dep
+.PHONY: all clean distclean install check dep
all: $(SUBDIRS:%=%/all)
@@ -26,6 +29,8 @@
install: $(SUBDIRS:%=%/install)
+check:
+
dep: $(SUBDIRS:%=%/dep)
-include $(SRCDIR)/Makefile.common
+include $(SRCDIR)/common.mk
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/turbocharger/mod_gzip.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/turbocharger/mod_gzip.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/turbocharger/mod_gzip.c Mon May 26 12:59:57 2008
@@ -355,6 +355,7 @@
* End of inline comments
*/
+#include <stdlib.h>
/*
* Apache headers...
*/
@@ -6722,7 +6723,6 @@
# define STDC_HEADERS
# define SET_BINARY_MODE(fd) setmode(fd, O_BINARY)
# include <io.h>
-# include <malloc.h>
# ifdef NTFAT
# define NO_MULTIPLE_DOTS
# define MAX_EXT_CHARS 3
@@ -6742,7 +6742,6 @@
void * fcalloc (unsigned items, unsigned size);
void fcfree (void *ptr);
# else
-# include <malloc.h>
# define fcalloc(nitems,itemsize) halloc((long)(nitems),(itemsize))
# define fcfree(ptr) hfree(ptr)
# endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.cpp Mon May 26 12:59:57 2008
@@ -1,6 +1,8 @@
#include <iostream>
#include <sstream>
#include <stdexcept>
+#include <map>
+#include <vector>
#include "xmlrpc-c/oldcppwrapper.hpp"
#include "DataType.hpp"
@@ -15,50 +17,66 @@
// Instances of DataType know how generate code fragments for manipulating
// a specific XML-RPC data type.
-string DataType::defaultParameterBaseName (int position) const {
- ostringstream name_stream;
- name_stream << typeName() << position << ends;
- string name(name_stream.str());
- return name;
+string
+DataType::defaultParameterBaseName(unsigned int const position) const {
+
+ ostringstream nameStream;
+
+ nameStream << typeName() << position;
+
+ return nameStream.str();
}
-//=========================================================================
-// class RawDataType
-//=========================================================================
-// We want to manipulate some XML-RPC data types as XmlRpcValue objects.
class RawDataType : public DataType {
public:
- RawDataType (const string& type_name) : DataType(type_name) {}
+ RawDataType(string const& typeName) : DataType(typeName) {}
- virtual string parameterFragment (const string& base_name) const;
- virtual string inputConversionFragment (const string& base_name) const;
- virtual string returnTypeFragment () const;
- virtual string outputConversionFragment (const string& var_name) const;
+ virtual string
+ parameterFragment(string const& baseName) const;
+
+ virtual string
+ inputConversionFragment(string const& baseName) const;
+
+ virtual string
+ returnTypeFragment() const;
+
+ virtual string
+ outputConversionFragment(string const& varName) const;
};
-string RawDataType::parameterFragment (const string& base_name) const {
- return "XmlRpcValue /*" + typeName() + "*/ " + base_name;
+
+
+string
+RawDataType::parameterFragment(string const& baseName) const {
+ return "XmlRpcValue /*" + typeName() + "*/ " + baseName;
}
-string RawDataType::inputConversionFragment (const string& base_name) const {
- return base_name;
+
+
+string
+RawDataType::inputConversionFragment(string const& baseName) const {
+
+ return baseName;
}
-string RawDataType::returnTypeFragment () const {
+
+
+string
+RawDataType::returnTypeFragment() const {
return "XmlRpcValue /*" + typeName() + "*/";
}
-string RawDataType::outputConversionFragment (const string& var_name) const {
- return var_name;
+
+
+string
+RawDataType::outputConversionFragment(string const& varName) const {
+
+ return varName;
}
-//=========================================================================
-// class SimpleDataType
-//=========================================================================
-// Other types can be easily converted to and from a single native type.
class SimpleDataType : public DataType {
string mNativeType;
@@ -66,130 +84,185 @@
string mGetterFunc;
public:
- SimpleDataType (const string& type_name,
- const string& native_type,
- const string& maker_func,
- const string& getter_func);
-
- virtual string parameterFragment (const string& base_name) const;
- virtual string inputConversionFragment (const string& base_name) const;
- virtual string returnTypeFragment () const;
- virtual string outputConversionFragment (const string& var_name) const;
+ SimpleDataType(string const& typeName,
+ string const& nativeType,
+ string const& makerFunc,
+ string const& getterFunc);
+
+ virtual string
+ parameterFragment(string const& baseName) const;
+
+ virtual string
+ inputConversionFragment(string const& baseName) const;
+
+ virtual string
+ returnTypeFragment() const;
+
+ virtual string
+ outputConversionFragment(string const& varName) const;
};
-SimpleDataType::SimpleDataType (const string& type_name,
- const string& native_type,
- const string& maker_func,
- const string& getter_func)
- : DataType(type_name),
- mNativeType(native_type),
- mMakerFunc(maker_func),
- mGetterFunc(getter_func)
-{
+
+
+SimpleDataType::SimpleDataType(string const& typeName,
+ string const& nativeType,
+ string const& makerFunc,
+ string const& getterFunc)
+ : DataType(typeName),
+ mNativeType(nativeType),
+ mMakerFunc(makerFunc),
+ mGetterFunc(getterFunc) {
}
-string SimpleDataType::parameterFragment (const string& base_name) const {
- return mNativeType + " " + base_name;
+
+
+string
+SimpleDataType::parameterFragment(string const& baseName) const {
+
+ return mNativeType + " const " + baseName;
}
-string SimpleDataType::inputConversionFragment (const string& base_name) const
-{
- return mMakerFunc + "(" + base_name + ")";
+
+
+string
+SimpleDataType::inputConversionFragment(string const& baseName) const {
+
+ return mMakerFunc + "(" + baseName + ")";
}
-string SimpleDataType::returnTypeFragment () const {
+
+
+string
+SimpleDataType::returnTypeFragment() const {
+
return mNativeType;
}
-string SimpleDataType::outputConversionFragment (const string& var_name) const
-{
- return var_name + "." + mGetterFunc + "()";
+
+
+string
+SimpleDataType::outputConversionFragment(string const& varName) const {
+ return varName + "." + mGetterFunc + "()";
}
-//=========================================================================
-// class VoidDataType
-//=========================================================================
-// Some XML-RPC servers declare functions as void. Such functions have
-// an arbitrary return value which we should ignore.
class VoidDataType : public DataType {
public:
- VoidDataType () : DataType("void") {}
+ VoidDataType() : DataType("void") {}
- virtual string parameterFragment (const string& base_name) const;
- virtual string inputConversionFragment (const string& base_name) const;
- virtual string returnTypeFragment () const;
- virtual string outputConversionFragment (const string& var_name) const;
+ virtual string
+ parameterFragment(string const& baseName) const;
+
+ virtual string
+ inputConversionFragment(string const& baseName) const;
+
+ virtual string
+ returnTypeFragment() const;
+
+ virtual string
+ outputConversionFragment(string const& varName) const;
};
-string VoidDataType::parameterFragment (const string&) const {
+
+
+string
+VoidDataType::parameterFragment(string const&) const {
+
throw domain_error("Can't handle functions with 'void' arguments'");
-
}
-string VoidDataType::inputConversionFragment (const string&) const {
+
+
+string
+VoidDataType::inputConversionFragment(string const&) const {
+
throw domain_error("Can't handle functions with 'void' arguments'");
}
-string VoidDataType::returnTypeFragment () const {
+
+
+string
+VoidDataType::returnTypeFragment () const {
+
return "void";
}
-string VoidDataType::outputConversionFragment (const string&) const {
+
+
+string
+VoidDataType::outputConversionFragment(string const&) const {
return "/* Return value ignored. */";
}
-//=========================================================================
-// function findDataType
-//=========================================================================
-// Given the name of an XML-RPC data type, try to find a corresponding
-// DataType object.
-SimpleDataType intType ("int", "XmlRpcValue::int32",
- "XmlRpcValue::makeInt",
- "getInt");
-SimpleDataType boolType ("bool", "bool",
- "XmlRpcValue::makeBool",
- "getBool");
-SimpleDataType doubleType ("double", "double",
- "XmlRpcValue::makeDouble",
- "getDouble");
-SimpleDataType stringType ("string", "string",
- "XmlRpcValue::makeString",
- "getString");
-
-RawDataType dateTimeType ("dateTime");
-RawDataType base64Type ("base64");
-RawDataType structType ("struct");
-RawDataType arrayType ("array");
+static SimpleDataType const intType ("int", "XmlRpcValue::int32",
+ "XmlRpcValue::makeInt",
+ "getInt");
+static SimpleDataType const boolType ("bool", "bool",
+ "XmlRpcValue::makeBool",
+ "getBool");
+static SimpleDataType const doubleType ("double", "double",
+ "XmlRpcValue::makeDouble",
+ "getDouble");
+static SimpleDataType const stringType ("string", "std::string",
+ "XmlRpcValue::makeString",
+ "getString");
+
+static RawDataType const dateTimeType ("dateTime");
+static RawDataType const base64Type ("base64");
+static RawDataType const structType ("struct");
+static RawDataType const arrayType ("array");
+
+static VoidDataType const voidType;
+
-VoidDataType voidType;
-const DataType& findDataType (const string& name) {
+const DataType&
+findDataType(string const& name) {
+/*----------------------------------------------------------------------------
+ Given the name of an XML-RPC data type, try to find a corresponding
+ DataType object.
+-----------------------------------------------------------------------------*/
if (name == "int" || name == "i4")
- return intType;
+ return intType;
else if (name == "boolean")
- return boolType;
+ return boolType;
else if (name == "double")
- return doubleType;
+ return doubleType;
else if (name == "string")
- return stringType;
+ return stringType;
else if (name == "dateTime.iso8601")
- return dateTimeType;
+ return dateTimeType;
else if (name == "base64")
- return base64Type;
+ return base64Type;
else if (name == "struct")
- return structType;
+ return structType;
else if (name == "array")
- return arrayType;
+ return arrayType;
else if (name == "void")
- return voidType;
+ return voidType;
+ else if (name == "INT")
+ return intType;
+ else if (name == "BOOLEAN")
+ return boolType;
+ else if (name == "DOUBLE")
+ return doubleType;
+ else if (name == "STRING")
+ return stringType;
+ else if (name == "DATETIME.ISO8601")
+ return dateTimeType;
+ else if (name == "BASE64")
+ return base64Type;
+ else if (name == "STRUCT")
+ return structType;
+ else if (name == "ARRAY")
+ return arrayType;
+ else if (name == "VOID")
+ return voidType;
+ else if (name == "NIL")
+ return voidType;
else
- throw domain_error("Unknown XML-RPC type " + name);
-
- // This code should never be executed.
- XMLRPC_ASSERT(0);
- return intType;
+ throw domain_error("Unknown XML-RPC type name '" + name + "'");
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.hpp Mon May 26 12:59:57 2008
@@ -23,7 +23,7 @@
// Given a parameter position, calculate a unique base name for all
// parameter-related variables.
virtual std::string
- defaultParameterBaseName(int position) const;
+ defaultParameterBaseName(unsigned int const position) const;
// Virtual functions for processing parameters.
virtual std::string
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/Makefile Mon May 26 12:59:57 2008
@@ -1,21 +1,32 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
-BUILDDIR= $(SRCDIR)
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ TOOLSDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(TOOLSDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := tools/xml-rpc-api2cpp
default: all
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
-include ../Makefile.common
+include $(SRCDIR)/tools/common.mk
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include
+INCLUDES = -I$(BLDDIR) -I$(BLDDIR)/include -I$(SRCDIR)/include
CXXFLAGS = $(INCLUDES) $(CXXFLAGS_COMMON) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = $(CLIENT_LDFLAGS) $(LADD)
+LDFLAGS = $(LADD)
-all: xml-rpc-api2cpp
+LDLIBS = -L$(BLDDIR)/src/cpp -lxmlrpc_cpp -lxmlrpc_server $(CLIENT_LDLIBS)
+
+PROGS :=
+
+ifeq ($(MUST_BUILD_CLIENT),yes)
+ PROGS += xml-rpc-api2cpp
+endif
+
+all: $(PROGS)
OBJECTS = \
xml-rpc-api2cpp.o \
@@ -30,17 +41,23 @@
$(LIBXMLRPC_CLIENT) \
$(LIBXMLRPC_SERVER) \
$(LIBXMLRPC) \
- $(LIBXML)
- $(LIBTOOL) --mode=link $(CXXLD) -o $@ $(LDFLAGS) $^
+ $(LIBXMLRPC_XML) \
+ $(LIBXMLRPC_UTIL)
+ $(CXXLD) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
%.o:%.cpp
- $(LIBTOOL) --mode=compile $(CXX) -c $(CXXFLAGS) $<
+ $(CXX) -c $(CXXFLAGS) $<
+
+# This common.mk dependency makes sure the symlinks get built before
+# this make file is used for anything.
+
+$(SRCDIR)/common.mk: srcdir blddir
include Makefile.depend
.PHONY: clean
clean: clean-common
- rm -f xml-rpc-api2cpp
+ rm -f $(PROGS)
.PHONY: distclean
distclean: clean distclean-common
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.cpp Mon May 26 12:59:57 2008
@@ -11,68 +11,74 @@
#include "XmlRpcClass.hpp"
-//=========================================================================
-// XmlRpcClass
-//=========================================================================
-// This class stores information about a proxy class, and knows how to
-// generate code.
-
-XmlRpcClass::XmlRpcClass (string class_name)
- : mClassName(class_name)
-{
-}
+XmlRpcClass::XmlRpcClass(string const& className) :
+ mClassName(className) {}
+
+
+
+XmlRpcClass::XmlRpcClass(XmlRpcClass const& c) :
+ mClassName(c.mClassName),
+ mFunctions(c.mFunctions) {}
-XmlRpcClass::XmlRpcClass (const XmlRpcClass& c)
- : mClassName(c.mClassName),
- mFunctions(c.mFunctions)
-{
-}
-XmlRpcClass& XmlRpcClass::operator= (const XmlRpcClass& c)
-{
- if (this == &c)
- return *this;
- mClassName = c.mClassName;
- mFunctions = c.mFunctions;
+
+XmlRpcClass&
+XmlRpcClass::operator= (XmlRpcClass const& c) {
+
+ if (this != &c) {
+ this->mClassName = c.mClassName;
+ this->mFunctions = c.mFunctions;
+ }
return *this;
}
-void XmlRpcClass::addFunction (const XmlRpcFunction& function)
-{
+
+
+void
+XmlRpcClass::addFunction(XmlRpcFunction const& function) {
+
mFunctions.push_back(function);
}
-void XmlRpcClass::printDeclaration (ostream&)
-{
- cout << "class " << mClassName << " {" << endl;
- cout << " XmlRpcClient mClient;" << endl;
- cout << endl;
- cout << "public:" << endl;
- cout << " " << mClassName << " (const XmlRpcClient& client)" << endl;
- cout << " : mClient(client) {}" << endl;
- cout << " " << mClassName << " (const string& server_url)" << endl;
- cout << " : mClient(XmlRpcClient(server_url)) {}" << endl;
- cout << " " << mClassName << " (const " << mClassName << "& o)" << endl;
- cout << " : mClient(o.mClient) {}" << endl;
- cout << endl;
- cout << " " << mClassName << "& operator= (const "
- << mClassName << "& o) {" << endl;
- cout << " if (this != &o) mClient = o.mClient;" << endl;
- cout << " return *this;" << endl;
- cout << " }" << endl;
- vector<XmlRpcFunction>::iterator f;
+
+void
+XmlRpcClass::printDeclaration(ostream & out) const {
+
+ out << "class " << mClassName << " {" << endl;
+ out << " XmlRpcClient mClient;" << endl;
+ out << endl;
+ out << "public:" << endl;
+ out << " " << mClassName << " (const XmlRpcClient& client)" << endl;
+ out << " : mClient(client) {}" << endl;
+ out << " " << mClassName << " (const std::string& server_url)" << endl;
+ out << " : mClient(XmlRpcClient(server_url)) {}" << endl;
+ out << " " << mClassName << " (const " << mClassName << "& o)" << endl;
+ out << " : mClient(o.mClient) {}" << endl;
+ out << endl;
+ out << " " << mClassName << "& operator= (const "
+ << mClassName << "& o) {" << endl;
+ out << " if (this != &o) mClient = o.mClient;" << endl;
+ out << " return *this;" << endl;
+ out << " }" << endl;
+
+ vector<XmlRpcFunction>::const_iterator f;
for (f = mFunctions.begin(); f < mFunctions.end(); ++f) {
- f->printDeclarations(cout);
+ f->printDeclarations(out);
}
- cout << "};" << endl;
+ out << "};" << endl;
}
-void XmlRpcClass::printDefinition (ostream&)
-{
- vector<XmlRpcFunction>::iterator f;
+
+
+void
+XmlRpcClass::printDefinition(ostream & out) const {
+
+ vector<XmlRpcFunction>::const_iterator f;
+
for (f = mFunctions.begin(); f < mFunctions.end(); ++f) {
- f->printDefinitions(cout, mClassName);
+ f->printDefinitions(out, mClassName);
}
}
+
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.hpp Mon May 26 12:59:57 2008
@@ -1,19 +1,22 @@
#include <vector>
class XmlRpcClass {
+ // An object of this class contains information about a proxy
+ // class, and knows how to generate code.
+
std::string mClassName;
std::vector<XmlRpcFunction> mFunctions;
public:
- XmlRpcClass (std::string class_name);
- XmlRpcClass (const XmlRpcClass&);
- XmlRpcClass& operator= (const XmlRpcClass&);
+ XmlRpcClass (std::string const& className);
+ XmlRpcClass(XmlRpcClass const&);
+ XmlRpcClass& operator= (XmlRpcClass const&);
std::string className () const { return mClassName; }
void addFunction (const XmlRpcFunction& function);
- void printDeclaration (ostream& out);
- void printDefinition (ostream& out);
+ void printDeclaration (ostream& out) const;
+ void printDefinition (ostream& out) const;
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.cpp Mon May 26 12:59:57 2008
@@ -1,137 +1,216 @@
#include <iostream>
+#include <sstream>
#include <stdexcept>
#include "xmlrpc-c/oldcppwrapper.hpp"
#include "DataType.hpp"
#include "XmlRpcFunction.hpp"
-using std::domain_error;
-using std::endl;
+using namespace std;
-//=========================================================================
-// class XmlRpcFunction
-//=========================================================================
-// Contains everything we know about a given server function, and knows
-// how to print local bindings.
-
-XmlRpcFunction::XmlRpcFunction(const string& function_name,
- const string& method_name,
- const string& help,
- XmlRpcValue synopsis)
- : mFunctionName(function_name), mMethodName(method_name),
- mHelp(help), mSynopsis(synopsis)
-{
-}
-
-XmlRpcFunction::XmlRpcFunction (const XmlRpcFunction& f)
- : mFunctionName(f.mFunctionName), mMethodName(f.mMethodName),
- mHelp(f.mHelp), mSynopsis(f.mSynopsis)
-{
-}
-
-XmlRpcFunction& XmlRpcFunction::operator= (const XmlRpcFunction& f) {
- if (this == &f)
- return *this;
- mFunctionName = f.mFunctionName;
- mMethodName = f.mMethodName;
- mHelp = f.mHelp;
- mSynopsis = f.mSynopsis;
+XmlRpcFunction::XmlRpcFunction(string const& functionName,
+ string const& methodName,
+ string const& help,
+ XmlRpcValue const signatureList) :
+ mFunctionName(functionName),
+ mMethodName(methodName),
+ mHelp(help),
+ mSynopsis(signatureList) {}
+
+
+
+XmlRpcFunction::XmlRpcFunction(XmlRpcFunction const& f) :
+ mFunctionName(f.mFunctionName),
+ mMethodName(f.mMethodName),
+ mHelp(f.mHelp),
+ mSynopsis(f.mSynopsis) {}
+
+
+
+XmlRpcFunction&
+XmlRpcFunction::operator= (XmlRpcFunction const& f) {
+
+ if (this != &f) {
+ this->mFunctionName = f.mFunctionName;
+ this->mMethodName = f.mMethodName;
+ this->mHelp = f.mHelp;
+ this->mSynopsis = f.mSynopsis;
+ }
return *this;
}
-void XmlRpcFunction::printDeclarations (ostream& out) {
- // XXX - Do a sloppy job of printing documentation.
- out << endl << " /* " << mHelp << " */" << endl;
- // Print each declaration.
- size_t end = mSynopsis.arraySize();
- for (size_t i = 0; i < end; i++)
- printDeclaration(out, i);
+void
+XmlRpcFunction::printDeclarations(ostream & out) const {
+
+ try {
+ // Print the method help as a comment
+
+ out << endl << " /* " << mHelp << " */" << endl;
+
+ size_t end;
+
+ try {
+ end = mSynopsis.arraySize();
+ } catch (XmlRpcFault const& fault) {
+ throw(logic_error("Failed to get size of signature array for "
+ "method " + this->mFunctionName + ". " +
+ fault.getFaultString()));
+ }
+ // Print the declarations for all the signatures of this
+ // XML-RPC method.
+
+ for (size_t i = 0; i < end; ++i)
+ printDeclaration(out, i);
+
+ } catch (exception const& e) {
+ throw(logic_error("Failed to generate declarations for method " +
+ this->mFunctionName + ". " + e.what()));
+ }
}
-void XmlRpcFunction::printDefinitions (ostream& out, const string& className) {
- size_t end = mSynopsis.arraySize();
- for (size_t i = 0; i < end; i++) {
- out << endl;
- printDefinition(out, className, i);
+
+
+void
+XmlRpcFunction::printDefinitions(ostream & out,
+ string const& className) const {
+
+ try {
+ size_t const end(mSynopsis.arraySize());
+
+ for (size_t i = 0; i < end; ++i) {
+ out << endl;
+ printDefinition(out, className, i);
+ }
+ } catch (XmlRpcFault const& fault) {
+ throw(logic_error("Failed to generate definitions for class " +
+ this->mFunctionName + ". " +
+ fault.getFaultString()));
}
}
-// Print the parameter declarations.
-void XmlRpcFunction::printParameters (ostream& out, size_t synopsis_index) {
- size_t end = parameterCount(synopsis_index);
- bool first = true;
- for (size_t i = 0; i < end; i++) {
- if (first)
- first = false;
- else
- out << ", ";
- const DataType& ptype (parameterType(synopsis_index, i));
- string basename = ptype.defaultParameterBaseName(i + 1);
- out << ptype.parameterFragment(basename);
+
+void
+XmlRpcFunction::printParameters(ostream & out,
+ size_t const synopsisIndex) const {
+/*----------------------------------------------------------------------------
+ Print the parameter declarations.
+-----------------------------------------------------------------------------*/
+ size_t const end(parameterCount(synopsisIndex));
+
+ bool first;
+
+ first = true;
+
+ for (size_t i = 0; i < end; ++i) {
+ if (!first)
+ out << ", ";
+
+ DataType const& ptype(parameterType(synopsisIndex, i));
+ string const basename(ptype.defaultParameterBaseName(i + 1));
+ out << ptype.parameterFragment(basename);
+
+ first = false;
}
}
-void XmlRpcFunction::printDeclaration (ostream& out, size_t synopsis_index) {
- const DataType& rtype (returnType(synopsis_index));
- out << " " << rtype.returnTypeFragment() << " "
- << mFunctionName << " (";
- printParameters(out, synopsis_index);
- out << ");" << endl;
+
+
+void
+XmlRpcFunction::printDeclaration(ostream & out,
+ size_t const synopsisIndex) const {
+
+ try {
+ DataType const& rtype(returnType(synopsisIndex));
+
+ out << " " << rtype.returnTypeFragment() << " "
+ << mFunctionName << " (";
+
+ printParameters(out, synopsisIndex);
+
+ out << ");" << endl;
+ } catch (XmlRpcFault const& fault) {
+ ostringstream msg;
+
+ msg << "Failed to generate header for signature "
+ << synopsisIndex
+ << " . "
+ << fault.getFaultString();
+
+ throw(logic_error(msg.str()));
+ }
}
-void XmlRpcFunction::printDefinition (ostream& out,
- const string& className,
- size_t synopsis_index)
-{
- const DataType& rtype (returnType(synopsis_index));
+
+
+void
+XmlRpcFunction::printDefinition(ostream & out,
+ string const& className,
+ size_t const synopsisIndex) const {
+
+ DataType const& rtype(returnType(synopsisIndex));
+
out << rtype.returnTypeFragment() << " "
- << className << "::" << mFunctionName << " (";
- printParameters(out, synopsis_index);
+ << className << "::" << mFunctionName << " (";
+
+ printParameters(out, synopsisIndex);
+
out << ") {" << endl;
- out << " XmlRpcValue params = XmlRpcValue::makeArray();" << endl;
+ out << " XmlRpcValue params(XmlRpcValue::makeArray());" << endl;
/* Emit code to convert the parameters into an array of XML-RPC objects. */
- size_t end = parameterCount(synopsis_index);
- for (size_t i = 0; i < end; i++) {
- const DataType& ptype (parameterType(synopsis_index, i));
- string basename = ptype.defaultParameterBaseName(i + 1);
- out << " params.arrayAppendItem("
- << ptype.inputConversionFragment(basename) << ");" << endl;
+ size_t const end(parameterCount(synopsisIndex));
+ for (size_t i = 0; i < end; ++i) {
+ DataType const& ptype(parameterType(synopsisIndex, i));
+ string const basename(ptype.defaultParameterBaseName(i + 1));
+ out << " params.arrayAppendItem("
+ << ptype.inputConversionFragment(basename) << ");" << endl;
}
/* Emit the function call.*/
- out << " XmlRpcValue result = this->mClient.call(\""
- << mMethodName << "\", params);" << endl;
+ out << " XmlRpcValue result(this->mClient.call(\""
+ << mMethodName << "\", params));" << endl;
/* Emit the return statement. */
out << " return " << rtype.outputConversionFragment("result")
- << ";" << endl;
+ << ";" << endl;
out << "}" << endl;
}
-const DataType& XmlRpcFunction::returnType (size_t synopsis_index) {
- XmlRpcValue func_synop = mSynopsis.arrayGetItem(synopsis_index);
- return findDataType(func_synop.arrayGetItem(0).getString());
+
+
+const DataType&
+XmlRpcFunction::returnType(size_t const synopsisIndex) const {
+
+ XmlRpcValue const funcSynop(mSynopsis.arrayGetItem(synopsisIndex));
+
+ return findDataType(funcSynop.arrayGetItem(0).getString());
}
-size_t XmlRpcFunction::parameterCount (size_t synopsis_index) {
- XmlRpcValue func_synop = mSynopsis.arrayGetItem(synopsis_index);
- size_t size = func_synop.arraySize();
+
+
+size_t
+XmlRpcFunction::parameterCount(size_t const synopsisIndex) const {
+
+ XmlRpcValue const funcSynop(mSynopsis.arrayGetItem(synopsisIndex));
+ size_t const size(funcSynop.arraySize());
+
if (size < 1)
- throw domain_error("Synopsis contained no items");
+ throw domain_error("Synopsis contained no items");
return size - 1;
}
-const DataType& XmlRpcFunction::parameterType (size_t synopsis_index,
- size_t parameter_index)
-{
- XmlRpcValue func_synop = mSynopsis.arrayGetItem(synopsis_index);
- XmlRpcValue param = func_synop.arrayGetItem(parameter_index + 1);
- return findDataType(param.getString());
-}
+DataType const&
+XmlRpcFunction::parameterType(size_t const synopsisIndex,
+ size_t const parameterIndex) const {
+
+ XmlRpcValue const funcSynop(mSynopsis.arrayGetItem(synopsisIndex));
+ XmlRpcValue const param(funcSynop.arrayGetItem(parameterIndex + 1));
+
+ return findDataType(param.getString());
+}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.hpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.hpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.hpp Mon May 26 12:59:57 2008
@@ -1,4 +1,3 @@
-
#include <string>
#include <iostream>
@@ -6,6 +5,9 @@
using std::ostream;
class XmlRpcFunction {
+ // An object of this class contains everything we know about a
+ // given XML-RPC method, and knows how to print local bindings.
+
string mFunctionName;
string mMethodName;
string mHelp;
@@ -13,25 +15,25 @@
public:
XmlRpcFunction(const string& function_name,
- const string& method_name,
- const string& help,
- XmlRpcValue synopsis);
+ const string& method_name,
+ const string& help,
+ XmlRpcValue synopsis);
XmlRpcFunction (const XmlRpcFunction&);
XmlRpcFunction& operator= (const XmlRpcFunction&);
- void printDeclarations (ostream& out);
- void printDefinitions (ostream& out, const string& className);
+ void printDeclarations (ostream& out) const;
+ void printDefinitions (ostream& out, const string& className) const;
private:
- void printParameters (ostream& out, size_t synopsis_index);
- void printDeclaration (ostream& out, size_t synopsis_index);
+ void printParameters (ostream& out, size_t synopsis_index) const;
+ void printDeclaration (ostream& out, size_t synopsis_index) const;
void printDefinition (ostream& out,
- const string& className,
- size_t synopsis_index);
+ const string& className,
+ size_t synopsis_index) const;
- const DataType& returnType (size_t synopsis_index);
- size_t parameterCount (size_t synopsis_index);
+ const DataType& returnType (size_t synopsis_index) const;
+ size_t parameterCount (size_t synopsis_index) const;
const DataType& parameterType (size_t synopsis_index,
- size_t parameter_index);
+ size_t parameter_index) const;
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cpp Mon May 26 12:59:57 2008
@@ -14,144 +14,199 @@
#define VERSION "0.1"
-//=========================================================================
-// function get_class_info
-//=========================================================================
-// Connect to a remote server and extract the information we'll need to
-// build a proxy class.
-
-XmlRpcClass get_class_info (string server_url,
- string class_prefix,
- string class_name)
-{
- // Create a place to store our data.
- XmlRpcClass info(class_name);
-
- // Create a proxy class.
- SystemProxy system(server_url);
-
- // Fetch the full list of methods, and process the ones we want.
- XmlRpcValue methods = system.listMethods();
- size_t end = methods.arraySize();
- for (size_t i = 0; i < end; i++) {
-
- // Break the method name into two pieces.
- string method_prefix;
- string function_name;
- string method_name = methods.arrayGetItem(i).getString();
- size_t last_dot = method_name.rfind('.');
- if (last_dot == string::npos) {
- function_name = method_name;
- } else {
- method_prefix = string(method_name, 0, last_dot);
- function_name = string(method_name, last_dot + 1);
- }
-
- // Decide whether we care about this function.
- if (method_prefix == class_prefix) {
-
- // Fetch some information about the function.
- string help = system.methodHelp(method_name);
- XmlRpcValue signature = system.methodSignature(method_name);
-
- // Add this function to our class information.
- XmlRpcFunction func(function_name, method_name, help, signature);
- info.addFunction(func);
- }
+/*----------------------------------------------------------------------------
+ Command line
+-----------------------------------------------------------------------------*/
+
+class cmdlineInfo {
+public:
+ string serverUrl;
+ string methodPrefix;
+ string localClass;
+
+ cmdlineInfo(int const argc,
+ const char ** const argv);
+
+private:
+ cmdlineInfo();
+};
+
+
+
+cmdlineInfo::cmdlineInfo(int const argc,
+ const char ** const argv) {
+
+ if (argc-1 != 3) {
+ cerr << argv[0] << ": Usage:" << endl
+ << " xml-rpc-api2cpp <server_url> <method_prefix> <local_class>"
+ << endl << endl
+ << "Sample arguments:" << endl
+ << " server_url = http://localhost/RPC2" << endl
+ << " method_prefix = system" << endl
+ << " local_class = SystemProxy" << endl;
+ exit(1);
}
+ this->serverUrl = string(argv[1]);
+ this->methodPrefix = string(argv[2]);
+ this->localClass = string(argv[3]);
+}
+
+
+static XmlRpcClass
+getClassInfo(string const& serverUrl,
+ string const& classPrefix,
+ string const& className) {
+/*----------------------------------------------------------------------------
+ Connect to a remote server and extract the information we'll need to
+ build a proxy class.
+-----------------------------------------------------------------------------*/
+ XmlRpcClass info(className);
+
+ SystemProxy system(serverUrl);
+
+ XmlRpcValue const methods(system.listMethods());
+
+ size_t const end = methods.arraySize();
+
+ for (size_t i = 0; i < end; ++i) {
+
+ // Break the method name into two pieces.
+ string const methodName(methods.arrayGetItem(i).getString());
+ size_t const lastDot(methodName.rfind('.'));
+
+ string methodPrefix;
+ string functionName;
+
+ if (lastDot == string::npos) {
+ methodPrefix = "";
+ functionName = methodName;
+ } else {
+ methodPrefix = string(methodName, 0, lastDot);
+ functionName = string(methodName, lastDot + 1);
+ }
+
+ if (methodPrefix == classPrefix) {
+ // It's a method User cares about
+
+ string const help(system.methodHelp(methodName));
+ XmlRpcValue const signatureList(
+ system.methodSignature(methodName));
+
+ if (signatureList.getType() != XMLRPC_TYPE_ARRAY) {
+ // It must be the string "undef", meaning the server
+ // won't tell us any signatures.
+ cerr << "Skipping method " << methodName << " "
+ << "because server does not report any signatures "
+ << "for it (via system.methodSignature method)"
+ << endl;
+ } else {
+ // Add this function to our class information.
+ XmlRpcFunction const method(functionName,
+ methodName,
+ help,
+ signatureList);
+ info.addFunction(method);
+ }
+ }
+ }
return info;
}
-//=========================================================================
-// function print_header
-//=========================================================================
-// Print a complete header for the specified class.
-
-void print_header (ostream& out, XmlRpcClass& class_info) {
- string class_name = class_info.className();
- out << "// " << class_name << ".h - xmlrpc-c C++ proxy class" << endl;
- out << "// Auto-generated by xml-rpc-api2cpp." << endl;
- out << endl;
-
- string header_symbol = "_" + class_name + "_H_";
- out << "#ifndef " << header_symbol << endl;
- out << "#define " << header_symbol << " 1" << endl;
- out << endl;
- out << "#include <XmlRpcCpp.h>" << endl;
- out << endl;
- class_info.printDeclaration(cout);
+static void
+printHeader(ostream & out,
+ XmlRpcClass const& classInfo) {
+/*----------------------------------------------------------------------------
+ Print a complete header for the specified class.
+-----------------------------------------------------------------------------*/
+ string const className(classInfo.className());
- out << endl;
- out << "#endif /* " << header_symbol << " */" << endl;
+ try {
+ out << "// " << className << ".h - xmlrpc-c C++ proxy class" << endl;
+ out << "// Auto-generated by xml-rpc-api2cpp." << endl;
+ out << endl;
+
+ string const headerSymbol("_" + className + "_H_");
+
+ out << "#ifndef " << headerSymbol << endl;
+ out << "#define " << headerSymbol << " 1" << endl;
+ out << endl;
+ out << "#include <xmlrpc-c/oldcppwrapper.hpp>" << endl;
+ out << endl;
+
+ classInfo.printDeclaration(cout);
+
+ out << endl;
+ out << "#endif /* " << headerSymbol << " */" << endl;
+ } catch (exception const& e) {
+ throw(logic_error("Failed to generate header for class " +
+ className + ". " + e.what()));
+ }
}
-//=========================================================================
-// function print_cc_file
-//=========================================================================
-// Print a complete header for the specified class.
-
-void print_cc_file (ostream& out, XmlRpcClass& class_info) {
- string class_name = class_info.className();
- out << "// " << class_name << ".cc - xmlrpc-c C++ proxy class" << endl;
- out << "// Auto-generated by xml-rpc-api2cpp." << endl;
- out << endl;
- out << "#include <XmlRpcCpp.h>" << endl;
- out << "#include \"" << class_name << ".h\"" << endl;
+static void
+printCppFile(ostream & out,
+ XmlRpcClass const& classInfo) {
+/*----------------------------------------------------------------------------
+ Print a complete definition for the specified class.
+-----------------------------------------------------------------------------*/
+ string const className(classInfo.className());
- class_info.printDefinition(cout);
+ try {
+ out << "// " << className << ".cc - xmlrpc-c C++ proxy class" << endl;
+ out << "// Auto-generated by xml-rpc-api2cpp." << endl;
+ out << endl;
+
+ out << "#include <xmlrpc-c/oldcppwrapper.hpp>" << endl;
+ out << "#include \"" << className << ".h\"" << endl;
+
+ classInfo.printDefinition(cout);
+ } catch (XmlRpcFault const& fault) {
+ throw(logic_error("Failed to generate definition for class " +
+ className + ". " + fault.getFaultString()));
+ }
}
-//=========================================================================
-// function main
-//=========================================================================
-// For now, just a test harness.
-
-int main (int argc, char **argv) {
-
- /* Parse our command-line arguments. */
- if (argc != 4) {
- cerr << argv[0] << ": Usage:" << endl
- << " xml-rpc-api2cpp <server_url> <method_prefix> <local_class>"
- << endl << endl
- << "Sample arguments:" << endl
- << " server_url = http://localhost/RPC2" << endl
- << " method_prefix = system" << endl
- << " local_class = SystemProxy" << endl;
- exit(1);
- }
- string server_url = argv[1];
- string method_prefix = argv[2];
- string local_class = argv[3];
- int status = 0;
+int
+main(int const argc,
+ const char ** const argv) {
+
+ string const progName(argv[0]);
+
+ cmdlineInfo const cmdline(argc, argv);
+
+ int retval;
+
XmlRpcClient::Initialize(NAME, VERSION);
try {
- XmlRpcClass system = get_class_info(server_url,
- method_prefix,
- local_class);
- print_header(cout, system);
- cout << endl;
- print_cc_file(cout, system);
+ XmlRpcClass system = getClassInfo(cmdline.serverUrl,
+ cmdline.methodPrefix,
+ cmdline.localClass);
+ printHeader(cout, system);
+ cout << endl;
+ printCppFile(cout, system);
+ retval = 0;
} catch (XmlRpcFault& fault) {
- cerr << argv[0] << ": XML-RPC fault #" << fault.getFaultCode()
- << ": " << fault.getFaultString() << endl;
- status = 1;
+ cerr << progName << ": XML-RPC fault #" << fault.getFaultCode()
+ << ": " << fault.getFaultString() << endl;
+ retval = 1;
} catch (logic_error& err) {
- cerr << argv[0] << ": " << err.what() << endl;
- status = 1;
+ cerr << progName << ": " << err.what() << endl;
+ retval = 1;
} catch (...) {
- cerr << argv[0] << ": Unknown exception" << endl;
- status = 1;
+ cerr << progName << ": Unknown exception" << endl;
+ retval = 1;
}
XmlRpcClient::Terminate();
- return status;
+ return retval;
}
+
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/Makefile Mon May 26 12:59:57 2008
@@ -1,35 +1,59 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
-BUILDDIR = $(SRCDIR)
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ TOOLSDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(TOOLSDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := tools/xmlrpc
-all: xmlrpc
+default: all
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
PROGRAMS_TO_INSTALL = xmlrpc
-include ../Makefile.common
+include $(SRCDIR)/tools/common.mk
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include
+INCLUDES = \
+ -I../lib/include \
+ -Iblddir \
+ -Iblddir/include \
+ -Isrcdir/include \
+ -Isrcdir/lib/util/include
CFLAGS = $(CFLAGS_COMMON) $(INCLUDES) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = $(CLIENT_LDFLAGS) $(LADD)
+LDFLAGS = $(LADD)
+
+all: xmlrpc
+
+UTIL_OBJS = \
+ casprintf.o \
+ cmdline_parser.o \
+ getoptx.o \
+ stripcaseeq.o \
+ string_parser.o \
-UTIL_OBJS = cmdline_parser.o getoptx.o
UTILS = $(UTIL_OBJS:%=$(UTIL_DIR)/%)
-xmlrpc:%:%.o $(LIBXMLRPC_CLIENT) $(LIBXMLRPC) $(LIBXML) $(UTILS)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LDFLAGS) $^
+DUMPVALUE = srcdir/tools/lib/dumpvalue.o
+
+# Can we just use $(LIBS) in the link?
+
+LIBS = $(LIBXMLRPC_CLIENT) $(LIBXMLRPC) $(LIBXMLRPC_XML) $(LIBXMLRPC_UTIL)
+
+XMLRPC_OBJS = xmlrpc.o $(DUMPVALUE)
+
+xmlrpc: $(XMLRPC_OBJS) $(LIBS) $(UTILS)
+ $(CCLD) -o $@ $(LDFLAGS) $(XMLRPC_OBJS) $(UTILS) $(CLIENT_LDLIBS)
-%.o:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $<
+%.o:%.c $(BLDDIR)/include/xmlrpc-c/config.h
+ $(CC) -c $(CFLAGS) $<
-*.c: config.h
+# This common.mk dependency makes sure the symlinks get built before
+# this make file is used for anything.
-config.h:
- $(LN_S) $(BUILDDIR)/xmlrpc_config.h $@
+$(SRCDIR)/tools/common.mk: srcdir blddir
include Makefile.depend
@@ -38,7 +62,7 @@
.PHONY: clean
clean: clean-common
- rm -f xmlrpc config.h
+ rm -f xmlrpc
.PHONY: distclean
distclean: clean distclean-common
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.c Mon May 26 12:59:57 2008
@@ -35,16 +35,23 @@
*/
-#define _GNU_SOURCE
+//#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+#include <assert.h>
-#include "config.h" /* information about this build environment */
-#include "casprintf.h"
+#include "xmlrpc_config.h" /* information about this build environment */
+#include "bool.h"
+#include "int.h"
#include "mallocvar.h"
+#include "girstring.h"
+#include "casprintf.h"
+#include "string_parser.h"
#include "cmdline_parser.h"
+#include "dumpvalue.h"
#include "xmlrpc-c/base.h"
#include "xmlrpc-c/client.h"
@@ -78,8 +85,7 @@
static void
die_if_fault_occurred (xmlrpc_env * const envP) {
if (envP->fault_occurred) {
- fprintf(stderr, "Error: %s (%d)\n",
- envP->fault_string, envP->fault_code);
+ fprintf(stderr, "Failed. %s\n", envP->fault_string);
exit(1);
}
}
@@ -191,7 +197,7 @@
cmd_getOptionValueString(cp, "curluseragent");
if ((!cmdlineP->transport ||
- strcmp(cmdlineP->transport, "curl") != 0)
+ !streq(cmdlineP->transport, "curl"))
&&
(cmdlineP->curlinterface ||
cmdlineP->curlnoverifypeer ||
@@ -235,11 +241,10 @@
computeUrl(const char * const urlArg,
const char ** const urlP) {
- if (strstr(urlArg, "://") != 0) {
- *urlP = strdup(urlArg);
- } else {
+ if (strstr(urlArg, "://") != 0)
+ casprintf(urlP, "%s", urlArg);
+ else
casprintf(urlP, "http://%s/RPC2", urlArg);
- }
}
@@ -249,7 +254,49 @@
const char * const valueString,
xmlrpc_value ** const paramPP) {
- *paramPP = xmlrpc_build_value(envP, "s", valueString);
+ *paramPP = xmlrpc_string_new(envP, valueString);
+}
+
+
+
+static void
+buildBytestring(xmlrpc_env * const envP,
+ const char * const valueString,
+ xmlrpc_value ** const paramPP) {
+
+ size_t const valueStringSize = strlen(valueString);
+
+ if (valueStringSize / 2 * 2 != valueStringSize)
+ xmlrpc_faultf(envP, "Hexadecimal text is not an even "
+ "number of characters (it is %u characters)",
+ strlen(valueString));
+ else {
+ size_t const byteStringSize = strlen(valueString)/2;
+
+ unsigned char byteString[byteStringSize];
+ size_t bsCursor;
+ size_t strCursor;
+
+ strCursor = 0;
+ bsCursor = 0;
+
+ while (strCursor < valueStringSize && !envP->fault_occurred) {
+ int rc;
+
+ assert(bsCursor < byteStringSize);
+
+ rc = sscanf(&valueString[strCursor], "%2hhx",
+ &byteString[bsCursor++]);
+
+ if (rc != 1)
+ xmlrpc_faultf(envP, "Invalid hex data '%s'",
+ &valueString[strCursor]);
+ else
+ strCursor += 2;
+ }
+ if (!envP->fault_occurred)
+ *paramPP = xmlrpc_base64_new(envP, byteStringSize, byteString);
+ }
}
@@ -262,19 +309,19 @@
if (strlen(valueString) < 1)
setError(envP, "Integer argument has nothing after the 'i/'");
else {
- long value;
- char * tailptr;
-
- value = strtol(valueString, &tailptr, 10);
+ int value;
+ const char * error;
- if (*tailptr != '\0')
- setError(envP,
- "Integer argument has non-digit crap in it: '%s'",
- tailptr);
- else
- *paramPP = xmlrpc_build_value(envP, "i", value);
+ interpretInt(valueString, &value, &error);
+
+ if (error) {
+ setError(envP, "'%s' is not a valid 32-bit integer. %s",
+ valueString, error);
+ strfree(error);
+ } else
+ *paramPP = xmlrpc_int_new(envP, value);
}
-}
+}
@@ -283,12 +330,10 @@
const char * const valueString,
xmlrpc_value ** const paramPP) {
- if (strcmp(valueString, "t") == 0 ||
- strcmp(valueString, "true") == 0)
- *paramPP = xmlrpc_build_value(envP, "b", 1);
- else if (strcmp(valueString, "f") == 0 ||
- strcmp(valueString, "false") == 0)
- *paramPP = xmlrpc_build_value(envP, "b", 0);
+ if (streq(valueString, "t") || streq(valueString, "true"))
+ *paramPP = xmlrpc_bool_new(envP, true);
+ else if (streq(valueString, "f") == 0 || streq(valueString, "false"))
+ *paramPP = xmlrpc_bool_new(envP, false);
else
setError(envP, "Boolean argument has unrecognized value '%s'. "
"recognized values are 't', 'f', 'true', and 'false'.",
@@ -298,6 +343,30 @@
static void
+buildDouble(xmlrpc_env * const envP,
+ const char * const valueString,
+ xmlrpc_value ** const paramPP) {
+
+ if (strlen(valueString) < 1)
+ setError(envP, "\"Double\" argument has nothing after the 'd/'");
+ else {
+ double value;
+ char * tailptr;
+
+ value = strtod(valueString, &tailptr);
+
+ if (*tailptr != '\0')
+ setError(envP,
+ "\"Double\" argument has non-decimal crap in it: '%s'",
+ tailptr);
+ else
+ *paramPP = xmlrpc_double_new(envP, value);
+ }
+}
+
+
+
+static void
buildNil(xmlrpc_env * const envP,
const char * const valueString,
xmlrpc_value ** const paramPP) {
@@ -305,7 +374,31 @@
if (strlen(valueString) > 0)
setError(envP, "Nil argument has something after the 'n/'");
else {
- *paramPP = xmlrpc_build_value(envP, "n");
+ *paramPP = xmlrpc_nil_new(envP);
+ }
+}
+
+
+
+static void
+buildI8(xmlrpc_env * const envP,
+ const char * const valueString,
+ xmlrpc_value ** const paramPP) {
+
+ if (strlen(valueString) < 1)
+ setError(envP, "Integer argument has nothing after the 'I/'");
+ else {
+ int64_t value;
+ const char * error;
+
+ interpretLl(valueString, &value, &error);
+
+ if (error) {
+ setError(envP, "'%s' is not a valid 64-bit integer. %s",
+ valueString, error);
+ strfree(error);
+ } else
+ *paramPP = xmlrpc_i8_new(envP, value);
}
}
@@ -318,8 +411,14 @@
if (strncmp(paramArg, "s/", 2) == 0)
buildString(envP, ¶mArg[2], paramPP);
+ else if (strncmp(paramArg, "h/", 2) == 0)
+ buildBytestring(envP, ¶mArg[2], paramPP);
else if (strncmp(paramArg, "i/", 2) == 0)
buildInt(envP, ¶mArg[2], paramPP);
+ else if (strncmp(paramArg, "I/", 2) == 0)
+ buildI8(envP, ¶mArg[2], paramPP);
+ else if (strncmp(paramArg, "d/", 2) == 0)
+ buildDouble(envP, ¶mArg[2], paramPP);
else if (strncmp(paramArg, "b/", 2) == 0)
buildBool(envP, ¶mArg[2], paramPP);
else if (strncmp(paramArg, "n/", 2) == 0)
@@ -344,7 +443,7 @@
xmlrpc_value * paramArrayP;
- paramArrayP = xmlrpc_build_value(envP, "()");
+ paramArrayP = xmlrpc_array_new(envP);
for (i = 0; i < paramCount && !envP->fault_occurred; ++i) {
xmlrpc_value * paramP;
@@ -362,371 +461,37 @@
-/* Forward declaration for recursion */
-static void
-dumpValue(const char * const prefix,
- xmlrpc_value * const valueP);
-
-
-
-static void
-dumpInt(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- xmlrpc_int value;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "i", &value);
-
- if (env.fault_occurred)
- printf("Unable to parse integer in result. %s\n",
- env.fault_string);
- else
- printf("%sInteger: %d\n", prefix, value);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpBool(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- xmlrpc_bool value;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "b", &value);
-
- if (env.fault_occurred)
- printf("Unable to parse boolean in result. %s\n",
- env.fault_string);
- else
- printf("%sBoolean: %s\n", prefix, value ? "TRUE" : "FALSE");
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-
-static void
-dumpDouble(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- xmlrpc_double value;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "d", &value);
-
- if (env.fault_occurred)
- printf("Unable to parse floating point number in result. %s\n",
- env.fault_string);
- else
- printf("%sFloating Point: %f\n", prefix, value);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpDatetime(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- printf("%sDon't know how to print datetime value result %p.\n",
- prefix, valueP);
-}
-
-
-
-static void
-dumpString(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- const char * value;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "s", &value);
-
- if (env.fault_occurred)
- printf("Unable to parse string in result. %s\n",
- env.fault_string);
- else
- printf("%sString: '%s'\n", prefix, value);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
static void
-dumpBase64(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- const unsigned char * value;
- size_t length;
-
- xmlrpc_env_init(&env);
+dumpResult(xmlrpc_value * const resultP) {
- xmlrpc_parse_value(&env, valueP, "6", &value, &length);
-
- if (env.fault_occurred)
- printf("Unable to parse base64 bit strnig in result. %s\n",
- env.fault_string);
- else {
- unsigned int i;
+ printf("Result:\n\n");
- printf("%sBit string: ", prefix);
- for (i = 0; i < length; ++i)
- printf("%02x", value[i]);
- }
- xmlrpc_env_clean(&env);
+ dumpValue("", resultP);
}
static void
-dumpArray(const char * const prefix,
- xmlrpc_value * const arrayP) {
-
+callWithClient(xmlrpc_env * const envP,
+ const xmlrpc_server_info * const serverInfoP,
+ const char * const methodName,
+ xmlrpc_value * const paramArrayP,
+ xmlrpc_value ** const resultPP) {
+
xmlrpc_env env;
- unsigned int arraySize;
-
xmlrpc_env_init(&env);
-
- XMLRPC_ASSERT_ARRAY_OK(arrayP);
-
- arraySize = xmlrpc_array_size(&env, arrayP);
- if (env.fault_occurred)
- printf("Unable to get array size. %s\n", env.fault_string);
- else {
- int const spaceCount = strlen(prefix);
-
- unsigned int i;
- const char * blankPrefix;
-
- printf("%sArray of %u items:\n", prefix, arraySize);
-
- casprintf(&blankPrefix, "%*s", spaceCount, "");
-
- for (i = 0; i < arraySize; ++i) {
- xmlrpc_value * valueP;
-
- xmlrpc_array_read_item(&env, arrayP, i, &valueP);
-
- if (env.fault_occurred)
- printf("Unable to get array item %u\n", i);
- else {
- const char * prefix2;
-
- casprintf(&prefix2, "%s Index %2u ", blankPrefix, i);
- dumpValue(prefix2, valueP);
- strfree(prefix2);
-
- xmlrpc_DECREF(valueP);
- }
- }
- strfree(blankPrefix);
- }
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpStructMember(const char * const prefix,
- xmlrpc_value * const structP,
- unsigned int const index) {
-
- xmlrpc_env env;
-
- xmlrpc_value * keyP;
- xmlrpc_value * valueP;
+ *resultPP = xmlrpc_client_call_server_params(
+ &env, serverInfoP, methodName, paramArrayP);
- xmlrpc_env_init(&env);
-
- xmlrpc_struct_read_member(&env, structP, index, &keyP, &valueP);
-
if (env.fault_occurred)
- printf("Unable to get struct member %u\n", index);
- else {
- int const blankCount = strlen(prefix);
- const char * prefix2;
- const char * blankPrefix;
-
- casprintf(&prefix2, "%s Key: ", prefix);
- dumpValue(prefix2, keyP);
- strfree(prefix2);
-
- casprintf(&blankPrefix, "%*s", blankCount, "");
-
- casprintf(&prefix2, "%s Value: ", blankPrefix);
- dumpValue(prefix2, valueP);
- strfree(prefix2);
-
- strfree(blankPrefix);
-
- xmlrpc_DECREF(keyP);
- xmlrpc_DECREF(valueP);
- }
+ xmlrpc_faultf(envP, "Call failed. %s. (XML-RPC fault code %d)",
+ env.fault_string, env.fault_code);
xmlrpc_env_clean(&env);
}
static void
-dumpStruct(const char * const prefix,
- xmlrpc_value * const structP) {
-
- xmlrpc_env env;
- unsigned int structSize;
-
- xmlrpc_env_init(&env);
-
- structSize = xmlrpc_struct_size(&env, structP);
- if (env.fault_occurred)
- printf("Unable to get struct size. %s\n", env.fault_string);
- else {
- unsigned int i;
-
- printf("%sStruct of %u members:\n", prefix, structSize);
-
- for (i = 0; i < structSize; ++i) {
- const char * prefix1;
-
- if (i == 0)
- prefix1 = strdup(prefix);
- else {
- int const blankCount = strlen(prefix);
- casprintf(&prefix1, "%*s", blankCount, "");
- }
- dumpStructMember(prefix1, structP, i);
-
- strfree(prefix1);
- }
- }
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpCPtr(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
- const char * value;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "p", &value);
-
- if (env.fault_occurred)
- printf("Unable to parse C pointer in result. %s\n",
- env.fault_string);
- else
- printf("%sC pointer: '%p'\n", prefix, value);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpNil(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- xmlrpc_env env;
-
- xmlrpc_env_init(&env);
-
- xmlrpc_parse_value(&env, valueP, "n");
-
- if (env.fault_occurred)
- printf("Unable to parse nil value in result. %s\n",
- env.fault_string);
- else
- printf("%sNil\n", prefix);
-
- xmlrpc_env_clean(&env);
-}
-
-
-
-static void
-dumpUnknown(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- printf("%sDon't recognize the type of the result: %u.\n",
- prefix, xmlrpc_value_type(valueP));
- printf("%sCan't print it.\n", prefix);
-}
-
-
-
-static void
-dumpValue(const char * const prefix,
- xmlrpc_value * const valueP) {
-
- switch (xmlrpc_value_type(valueP)) {
- case XMLRPC_TYPE_INT:
- dumpInt(prefix, valueP);
- break;
- case XMLRPC_TYPE_BOOL:
- dumpBool(prefix, valueP);
- break;
- case XMLRPC_TYPE_DOUBLE:
- dumpDouble(prefix, valueP);
- break;
- case XMLRPC_TYPE_DATETIME:
- dumpDatetime(prefix, valueP);
- break;
- case XMLRPC_TYPE_STRING:
- dumpString(prefix, valueP);
- break;
- case XMLRPC_TYPE_BASE64:
- dumpBase64(prefix, valueP);
- break;
- case XMLRPC_TYPE_ARRAY:
- dumpArray(prefix, valueP);
- break;
- case XMLRPC_TYPE_STRUCT:
- dumpStruct(prefix, valueP);
- break;
- case XMLRPC_TYPE_C_PTR:
- dumpCPtr(prefix, valueP);
- break;
- case XMLRPC_TYPE_NIL:
- dumpNil(prefix, valueP);
- break;
- default:
- dumpUnknown(prefix, valueP);
- }
-}
-
-
-
-static void
-dumpResult(xmlrpc_value * const resultP) {
-
- printf("Result:\n\n");
-
- dumpValue("", resultP);
-}
-
-
-
-static void
doCall(xmlrpc_env * const envP,
const char * const transport,
const char * const curlinterface,
@@ -744,7 +509,7 @@
clientparms.transport = transport;
- if (transport && strcmp(transport, "curl") == 0) {
+ if (transport && streq(transport, "curl")) {
struct xmlrpc_curl_xportparms * curlXportParmsP;
MALLOCVAR(curlXportParmsP);
@@ -753,8 +518,7 @@
curlXportParmsP->no_ssl_verifyhost = curlnoverifyhost;
curlXportParmsP->user_agent = curluseragent;
- clientparms.transportparmsP = (struct xmlrpc_xportparms *)
- curlXportParmsP;
+ clientparms.transportparmsP = curlXportParmsP;
clientparms.transportparm_size = XMLRPC_CXPSIZE(user_agent);
} else {
clientparms.transportparmsP = NULL;
@@ -763,13 +527,12 @@
xmlrpc_client_init2(envP, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION,
&clientparms, XMLRPC_CPSIZE(transportparm_size));
if (!envP->fault_occurred) {
- *resultPP = xmlrpc_client_call_server_params(
- envP, serverInfoP, methodName, paramArrayP);
-
+ callWithClient(envP, serverInfoP, methodName, paramArrayP, resultPP);
+
xmlrpc_client_cleanup();
}
if (clientparms.transportparmsP)
- free(clientparms.transportparmsP);
+ free((void*)clientparms.transportparmsP);
}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.html
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.html (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.html Mon May 26 12:59:57 2008
@@ -9,6 +9,9 @@
XML-RPC servers. XML-RPC is such that the RPCs normally need to be made
by a program rather than a person to be of use.
+<p>A similar tool done as a web form is at <a
+href="http://gggeek.damacom.it/debugger/">
+http://gggeek.damacom.it/debugger/</a>
<h2>Examples</h2>
@@ -75,7 +78,9 @@
<p>
<b>i/</b><i>integer</i> |
<b>s/</b><i>string</i> |
+<b>h/</b><i>hexstring</i> |
<b>b/</b>{<b>true</b>|<b>false</b>|<b>t</b>|<b>f</b>} |
+<b>d/</b><i>realnum</i> |
<b>n/</b> |
<b><i>string</i></b>
@@ -115,17 +120,27 @@
<dl>
<dt>i/
-<dd>integer (<int4>)
+<dd>integer (<i4>) (32 bit)
<dt>s/
<dd>string (<string>)
+<dt>h/
+<dd>byte string (<base64>). Specify the value in hexadecimal.
+
<dt>b/
-<dd>boolean (<boolean>)
+<dd>boolean (<boolean>). Specify the value as "true" or
+"t" for true; "false" or "f" for false.
+
+<dt>d/
+<dd>double (<double>) (i.e. real number)
<dt>n/
<dd>nil (<nil>)
+<dt>I/
+<dd>64 bit integer (<i8>)
+
</dl>
<p>As a shortcut, if you don't specify a prefix (i.e. your argument does
@@ -239,4 +254,13 @@
</dl>
+<h2>Limitations</h2>
+
+<p>If you run <b>xmlrpc</b> in an environment in which programs get
+their arguments encoded some way other than UTF-8, <b>xmlrpc</b>
+will generate garbage for the XML-RPC call and display garbage for
+the XML-RPC response. Typically, you control this aspect of the
+environment with a <b>LANG</b> environment variable. One safe value
+for <b>LANG</b> is "C".
+
</body>
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/Makefile Mon May 26 12:59:57 2008
@@ -1,35 +1,59 @@
-ifeq ($(SRCDIR)x,x)
-SRCDIR = $(CURDIR)/../..
-BUILDDIR = $(SRCDIR)
+ifeq ($(SRCDIR),)
+ updir = $(shell echo $(dir $(1)) | sed 's/.$$//')
+ TOOLSDIR := $(call updir,$(CURDIR))
+ SRCDIR := $(call updir,$(TOOLSDIR))
+ BLDDIR := $(SRCDIR)
endif
+SUBDIR := tools/xmlrpc_transport
-all: xmlrpc_transport
+default: all
-include $(BUILDDIR)/Makefile.config
+include $(BLDDIR)/config.mk
PROGRAMS_TO_INSTALL = xmlrpc_transport
-include ../Makefile.common
+include $(SRCDIR)/tools/common.mk
-INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/include -I$(SRCDIR)/lib/util/include
+INCLUDES = \
+ -I$(BLDDIR) \
+ -I$(BLDDIR)/include \
+ -I$(SRCDIR)/include \
+ -I$(SRCDIR)/lib/util/include
CFLAGS = $(CFLAGS_COMMON) $(INCLUDES) $(CFLAGS_PERSONAL) $(CADD)
-LDFLAGS = $(CLIENT_LDFLAGS) $(LADD)
+LDFLAGS = $(LADD)
+
+all: xmlrpc_transport
+
+UTIL_OBJS = \
+ casprintf.o \
+ cmdline_parser.o \
+ getoptx.o \
+ stripcaseeq.o \
+ string_parser.o \
-UTIL_OBJS = cmdline_parser.o getoptx.o
UTILS = $(UTIL_OBJS:%=$(UTIL_DIR)/%)
-xmlrpc_transport:%:%.o $(LIBXMLRPC_CLIENT) $(LIBXMLRPC) $(LIBXML) $(UTILS)
- $(LIBTOOL) --mode=link $(CCLD) -o $@ $(LDFLAGS) $^
+# These are the Libtool .la files. We use them only for make dependencies.
+# We'd like to use these in the link rule, by using libtool --link, but
+# Libtool adds -l options to the link to cover the dependencies that are
+# recorded inside the shared libraries. And it doesn't add the necessary
+# -L options (it can't), so we end up with a messy mixture of the two
+# forms of specifying libraries.
+
+LIBS = $(LIBXMLRPC_CLIENT) $(LIBXMLRPC) $(LIBXMLRPC_XML) $(LIBXMLRPC_UTIL)
+
+xmlrpc_transport:%:%.o $(LIBS) $(UTILS)
+ $(CCLD) -o $@ $(LDFLAGS) $< $(CLIENT_LDLIBS) $(UTILS)
%.o:%.c
- $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $<
+ $(CC) -c $(CFLAGS) $<
-*.c: config.h
+# This common.mk dependency makes sure the symlinks get built before
+# this make file is used for anything.
-config.h:
- $(LN_S) $(BUILDDIR)/xmlrpc_config.h $@
+$(SRCDIR)/tools/common.mk: srcdir blddir
include Makefile.depend
@@ -38,7 +62,7 @@
.PHONY: clean
clean: clean-common
- rm -f xmlrpc config.h
+ rm -f xmlrpc_transport config.h
.PHONY: distclean
distclean: clean distclean-common
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/xmlrpc_transport.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/xmlrpc_transport.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/tools/xmlrpc_transport/xmlrpc_transport.c Mon May 26 12:59:57 2008
@@ -2,13 +2,13 @@
an XML-RPC call.
*/
-#define _GNU_SOURCE
+//#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include "config.h" /* information about this build environment */
+#include "xmlrpc_config.h" /* information about this build environment */
#include "casprintf.h"
#include "mallocvar.h"
#include "cmdline_parser.h"
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/version.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/version.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/version.h Mon May 26 12:59:57 2008
@@ -1,4 +1,8 @@
-/* Change this for each release. */
-
-#define XMLRPC_C_VERSION "1.03.14"
-
+#ifndef XMLRPC_C_VERSION_INCLUDED
+#define XMLRPC_C_VERSION_INCLUDED
+/* generated by Windows/mkvers.bat on Fri 05/23/2008 ... */
+#define XMLRPC_C_VERSION "Xmlrpc-c 1.14.99"
+#define XMLRPC_VERSION_MAJOR 1
+#define XMLRPC_VERSION_MINOR 14
+#define XMLRPC_VERSION_POINT 99
+#endif
Modified: freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc_config.h.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc_config.h.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/xmlrpc-c/xmlrpc_config.h.in Mon May 26 12:59:57 2008
@@ -1,5 +1,19 @@
/* xmlrpc_config.h is generated from xmlrpc_config.h.in by 'configure'.
+ The purpose of this file is to define stuff particular to the build
+ environment being used to build Xmlrpc-c. Xmlrpc-c source files can
+ #include this file and have build-environment-independent source code.
+
+ A major goal of this file is to reduce conditional compilation in
+ the other source files as much as possible. Even more, we want to avoid
+ having to generate source code particular to a build environment
+ except in this file.
+
+ This file is NOT meant to be used by any code outside of the
+ Xmlrpc-c source tree. There is a similar file that gets installed
+ as <xmlrpc-c/config.h> that performs the same function for Xmlrpc-c
+ interface header files that get compiled as part of a user's program.
+
This file just uses plain AC_SUBST substitution, the same as
Makefile.config. Wherever you see @XXX@, that gets replaced by the
value of 'configure' variable XXX.
@@ -9,28 +23,69 @@
"false" and some problem with the code.
*/
+#ifndef XMLRPC_CONFIG_H_INCLUDED
+#define XMLRPC_CONFIG_H_INCLUDED
/* We hope to replace xmlrpc_amconfig.h some day with something that
doesn't require a whole special set of software to build, to make
- xmlrpc-c approachable by dumber developers.
+ Xmlrpc-c approachable by dumber developers.
*/
#include "xmlrpc_amconfig.h"
+#ifndef HAVE_SETGROUPS
+#define HAVE_SETGROUPS 0
+#endif
+#ifndef HAVE_ASPRINTF
+#define HAVE_ASPRINTF 0
+#endif
+#ifndef HAVE_SETENV
+#define HAVE_SETENV 0
+#endif
+#ifndef HAVE_PSELECT
+#define HAVE_PSELECT 0
+#endif
+#ifndef HAVE_WCSNCMP
+#define HAVE_WCSNCMP 1
+#endif
+#ifndef HAVE_GETTIMEOFDAY
+#define HAVE_GETTIMEOFDAY 0
+#endif
+#ifndef HAVE_LOCALTIME_R
+#define HAVE_LOCALTIME_R 0
+#endif
+#ifndef HAVE_GMTIME_R
+#define HAVE_GMTIME_R 0
+#endif
+#ifndef HAVE_STRCASECMP
+#define HAVE_STRCASECMP 0
+#endif
+#ifndef HAVE_STRICMP
+#define HAVE_STRICMP 0
+#endif
+#ifndef HAVE__STRICMP
+#define HAVE__STRICMP 0
+#endif
+#ifndef HAVE_WCHAR_H
+#define HAVE_WCHAR_H 0
+#endif
+#ifndef HAVE_SYS_FILIO_H
+#define HAVE_SYS_FILIO_H 0
+#endif
+#ifndef HAVE_SYS_IOCTL_H
+#define HAVE_SYS_IOCTL_H 0
+#endif
#define VA_LIST_IS_ARRAY @VA_LIST_IS_ARRAY_DEFINE@
#define HAVE_LIBWWW_SSL @HAVE_LIBWWW_SSL_DEFINE@
+/* Used to mark an unused function parameter */
#define ATTR_UNUSED @ATTR_UNUSED@
-#define HAVE_UNICODE_WCHAR @HAVE_UNICODE_WCHAR_DEFINE@
-/* This is a hack in the name of stability -- saves modifying a lot of code */
-#if !HAVE_UNICODE_WCHAR
-#undef HAVE_UNICODE_WCHAR
-#endif
-
#define DIRECTORY_SEPARATOR "@DIRECTORY_SEPARATOR@"
+#define HAVE_UNICODE_WCHAR HAVE_WCHAR_H
+
/* Xmlrpc-c code uses __inline__ to declare functions that should
be compiled as inline code. GNU C recognizes the __inline__ keyword.
Others recognize 'inline' or '__inline' or nothing at all to say
@@ -41,10 +96,60 @@
*/
#if (!defined(__GNUC__))
#if (!defined(__inline__))
- #if (defined(__sgi) || defined(_AIX))
+ #if (defined(__sgi) || defined(_AIX) || defined(_MSC_VER))
#define __inline__ __inline
#else
#define __inline__
#endif
#endif
#endif
+
+/* MSVCRT means we're using the Microsoft Visual C++ runtime library */
+
+#ifdef _MSC_VER
+/* The compiler is Microsoft Visual C++. */
+ #define MSVCRT _MSC_VER
+#else
+ #define MSVCRT 0
+#endif
+
+#if MSVCRT
+ /* The MSVC runtime library _does_ have a 'struct timeval', but it is
+ part of the Winsock interface (along with select(), which is probably
+ its intended use), so isn't intended for use for general timekeeping.
+ */
+ #define HAVE_TIMEVAL 0
+ #define HAVE_TIMESPEC 0
+#else
+ #define HAVE_TIMEVAL 1
+ /* timespec is Posix.1b. If we need to work on a non-Posix.1b non-Windows
+ system, we'll have to figure out how to make Configure determine this.
+ */
+ #define HAVE_TIMESPEC 1
+#endif
+
+#if MSVCRT
+ #define XMLRPC_VSNPRINTF _vsnprintf
+#else
+ #define XMLRPC_VSNPRINTF vsnprintf
+#endif
+
+#if defined(_MSC_VER)
+/* Starting with MSVC 8, the runtime library defines various POSIX functions
+ such as strdup() whose names violate the ISO C standard (the standard
+ says the strXXX names are reserved for the standard), but warns you of
+ the standards violation. That warning is 4996, along with other warnings
+ that tell you you're using a function that Microsoft thinks you
+ shouldn't.
+
+ Well, POSIX is more important than that element of ISO C, so we disable
+ that warning.
+
+ FYI, msvcrt also defines _strdup(), etc, which doesn't violate the
+ naming standard. But since other environments don't define _strdup(),
+ we can't use it in portable code.
+*/
+#pragma warning(disable:4996)
+#endif
+
+#endif
1
0
[commit] r8532 - freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc
by Freeswitch SVN 22 May '08
by Freeswitch SVN 22 May '08
22 May '08
Author: lukedashjr
Date: Thu May 22 15:06:30 2008
New Revision: 8532
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/Makefile
Log:
LIBADD != LDFLAGS
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/Makefile Thu May 22 15:06:30 2008
@@ -1,3 +1,3 @@
LOCAL_CFLAGS=-I/usr/include/ilbc
-LOCAL_LIBADD=-lilbc
+LOCAL_LDFLAGS=-lilbc
include $(BASE)/build/modmake.rules
1
0
Author: lukedashjr
Date: Thu May 22 15:05:28 2008
New Revision: 8531
Added:
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_nua.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_register.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/check_session.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_types.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/nua_types.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/libsofia-sip-ua/nua/test_s2.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_100rel.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_100rel.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_basic_call.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_basic_call.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_hold.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_call_hold.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_call_reject.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_call_reject.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_cancel_bye.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_cancel_bye.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_extension.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_extension.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_init.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_init.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nat_tags.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nat_tags.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_api.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua_api.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_nua_params.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_nua_params.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_offer_answer.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_offer_answer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_ops.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_ops.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_proxy.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_proxy.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_proxy.h
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_proxy.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_refer.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_refer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_register.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_register.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_session_timer.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_session_timer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_simple.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_simple.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/test_sip_events.c
- copied unchanged from r8528, /freeswitch/tags/1.0.rc6/libs/sofia-sip/tests/test_sip_events.c
Removed:
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_100rel.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_basic_call.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_call_hold.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_call_reject.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_cancel_bye.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_extension.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_init.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nat_tags.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_api.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_nua_params.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_offer_answer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_ops.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_proxy.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_refer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_register.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_session_timer.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_simple.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/test_sip_events.c
Modified:
freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c
Log:
MERGE to: http://svn.freeswitch.org/svn/freeswitch/tags/1.0.rc6
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/Makefile.am Thu May 22 15:05:28 2008
@@ -18,7 +18,7 @@
sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
- soundfile=`echo freeswitch-sounds-$$full_sound_dir-$(PACKAGE_VERSION).tar.gz`; \
+ soundfile=`echo freeswitch-sounds-$$full_sound_dir-$(SOUNDS_VERSION).tar.gz`; \
if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
if test "$$target_prefix" = "sounds"; then \
if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
@@ -158,6 +158,13 @@
$(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > quiet_libtool
+vm-sync:
+ test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
+ test -d $(DESTDIR)$(prefix)/conf/lang || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang
+ test -d $(DESTDIR)$(prefix)/conf/lang/en || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en
+ test -d $(DESTDIR)$(prefix)/conf/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/lang/en/vm
+ $(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)$(prefix)/conf/lang/en/vm
+
samples-conf:
test -d $(DESTDIR)$(prefix)/conf || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf
test -d $(DESTDIR)$(prefix)/conf/dialplan/extensions || $(mkinstalldirs) $(DESTDIR)$(prefix)/conf/dialplan/extensions
@@ -268,6 +275,11 @@
$(MAKE) -j core
$(MAKE) -j modules
+sofia-reconf:
+ cd libs/sofia-sip && $(MAKE) clean
+ cd libs/sofia-sip && autoreconf -fi
+ cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
+
current: update-clean
svn update
$(MAKE) all
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/conference.conf.xml Thu May 22 15:05:28 2008
@@ -83,6 +83,7 @@
<param name="pin-sound" value="conference/conf-pin.wav"/>
<!-- File to play to when the pin is invalid -->
<param name="bad-pin-sound" value="conference/conf-bad-pin.wav"/>
+ <param name="comfort-noise-level" value="1400"/>
<!-- Conference pin -->
<!--<param name="pin" value="12345"/>-->
<!-- Default Caller ID Name for outbound calls -->
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/modules.conf.xml Thu May 22 15:05:28 2008
@@ -27,7 +27,7 @@
<!-- Endpoints -->
<!-- <load module="mod_dingaling"/> -->
- <load module="mod_iax"/>
+ <!-- <load module="mod_iax"/> -->
<!-- <load module="mod_portaudio"/> -->
<!-- <load module="mod_alsa"/> -->
<load module="mod_sofia"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/switch.conf.xml Thu May 22 15:05:28 2008
@@ -37,6 +37,7 @@
<variables>
<variable name="uk-ring" value="%(400,200,400,450);%(400,2200,400,450)"/>
<variable name="us-ring" value="%(2000, 4000, 440.0, 480.0)"/>
+ <variable name="fr-ring" value="%(1500, 3500, 440.0, 0.0)"/>
<variable name="bong-ring" value="v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
</variables>
</configuration>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/voicemail.conf.xml Thu May 22 15:05:28 2008
@@ -40,6 +40,8 @@
-->
<param name="operator-extension" value="operator XML default"/>
<param name="operator-key" value="9"/>
+ <param name="vmain-extension" value="vmain XML default"/>
+ <param name="vmain-key" value="*"/>
<email>
<param name="template-file" value="voicemail.tpl"/>
<!-- this is the format voicemail_time will have -->
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/autoload_configs/xml_curl.conf.xml Thu May 22 15:05:28 2008
@@ -14,6 +14,8 @@
<!-- optional: if enabled this will disable CA root certificate checks by libcurl -->
<!-- note: default value is disabled. only enable if you want this! -->
<!-- <param name="ignore-cacert-check" value="true" /> -->
+ <!-- one or more of these imply you want to pick the exact variables that are transmitted -->
+ <!--<param name="enable-post-var" value="Unique-ID"/>-->
</binding>
</bindings>
</configuration>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/client.xml Thu May 22 15:05:28 2008
@@ -1,5 +1,6 @@
<include>
<!-- Client Profile (Original mode) -->
+ <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> -->
<x-profile type="client">
<param name="name" value="$${xmpp_client_profile}"/>
<param name="login" value="myjid(a)myserver.com/talk"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/jingle_profiles/server.xml Thu May 22 15:05:28 2008
@@ -1,5 +1,6 @@
<include>
<!-- Component (Server to Server Login) -->
+ <!-- to use this profile take the x- away from the open and close tags so its <profile> and </profile> -->
<x-profile type="component">
<param name="name" value="$${xmpp_server_profile}"/>
<param name="password" value="secret"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/sounds.xml Thu May 22 15:05:28 2008
@@ -50,7 +50,7 @@
</macro>
<macro name="voicemail_message_count">
- <input pattern="^(1):(.*)$">
+ <input pattern="^(1):(.*)$" break_on_match="true">
<match>
<action function="play-file" data="voicemail/vm-you_have.wav"/>
<action function="say" data="$1" method="pronounced" type="items"/>
@@ -59,7 +59,7 @@
<action function="play-file" data="voicemail/vm-in_folder.wav"/>
</match>
</input>
- <input pattern="^([0,2-9]+):(.*)$">
+ <input pattern="^(\d+):(.*)$">
<match>
<action function="play-file" data="voicemail/vm-you_have.wav"/>
<action function="say" data="$1" method="pronounced" type="items"/>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/lang/en/vm/tts.xml Thu May 22 15:05:28 2008
@@ -48,12 +48,12 @@
</macro>
<macro name="voicemail_message_count">
- <input pattern="^1:(.*)$">
+ <input pattern="^1:(.*)$" break_on_match="true">
<match>
<action function="speak-text" data="you have 1 $1 message in folder ${voicemail_current_folder}."/>
</match>
</input>
- <input pattern="^([0,2-9]+):(.*)$">
+ <input pattern="^(\d+):(.*)$">
<match>
<action function="speak-text" data="you have $1 $2 messages in folder ${voicemail_current_folder}."/>
</match>
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/conf/sip_profiles/internal.xml Thu May 22 15:05:28 2008
@@ -35,10 +35,11 @@
<!-- ip address to bind to -->
<param name="sip-ip" value="$${local_ip_v4}"/>
<param name="hold-music" value="$${hold_music}"/>
+ <param name="apply-nat-acl" value="rfc1918"/>
<!--<param name="enable-timer" value="false"/>-->
<!--<param name="enable-100rel" value="false"/>-->
- <!--<param name="apply-inbound-acl" value="lan"/>-->
- <!--<param name="apply-register-acl" value="lan"/>-->
+ <!--<param name="apply-inbound-acl" value="rfc1918"/>-->
+ <!--<param name="apply-register-acl" value="rfc1918"/>-->
<!--<param name="dtmf-type" value="info"/>-->
<param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
<!--enable to use presense and mwi -->
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/configure.in Thu May 22 15:05:28 2008
@@ -3,11 +3,12 @@
# Must change all of the below together
# For a release, set revision for that tagged release as well and uncomment
-AC_INIT([freeswitch], [1.0.rc5], BUG-REPORT-ADDRESS)
+AC_INIT([freeswitch], [1.0.rc6], BUG-REPORT-ADDRESS)
AC_SUBST(SWITCH_VERSION_MAJOR, [1])
AC_SUBST(SWITCH_VERSION_MINOR, [0])
-AC_SUBST(SWITCH_VERSION_MICRO, [rc5])
-AC_SUBST(SWITCH_VERSION_REVISION, [8381])
+AC_SUBST(SWITCH_VERSION_MICRO, [rc6])
+AC_SUBST(SWITCH_VERSION_REVISION, [8500])
+AC_SUBST(SOUNDS_VERSION, [1.0.1])
AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
@@ -575,16 +576,11 @@
[with_python="try"]
)
-AC_ARG_WITH(
- [python-config],
- [AS_HELP_STRING([--with-python-config=PATH], [Location of python-config])],
- [with_python_config="$withval"],
- [with_python_config="no"]
-)
-
-
if test "$with_python" != "no"
then
+ save_CFLAGS="$CFLAGS"
+ save_LIBS="$LIBS"
+
if test "$with_python" != "yes" -a "$with_python" != "try" ; then
AC_MSG_CHECKING([for python])
if test ! -x "$with_python" ; then
@@ -605,68 +601,78 @@
fi
AC_MSG_RESULT([$PYTHON_VER])
- AC_MSG_CHECKING([location of site-packages])
-
- # NOTE: this assumes our desired location is always the last one in the list
- # (= system package location is searched last)
- #
- # needs double brackets because m4 removes one pair
- PYTHON_SITE_DIR="`$PYTHON -c 'import sys; print sys.path[[-1]];'`"
-
- if test -z "$PYTHON_SITE_DIR" ; then
- AC_MSG_ERROR([Unable to detect python site-packages path])
- elif test ! -d "$PYTHON_SITE_DIR" ; then
- AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
+ AC_MSG_CHECKING([for python distutils])
+ python_result="`$PYTHON -c 'import distutils;' 2>&1`"
+ if test -z "$python_result" ; then
+ python_has_distutils="yes"
+ else
+ python_has_distutils="no"
fi
- AC_MSG_RESULT([$PYTHON_SITE_DIR])
- AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
+ AC_MSG_RESULT([$python_has_distutils])
+
+ if test "$python_has_distutils" != "no" ; then
+ AC_MSG_CHECKING([location of site-packages])
- if test "$with_python_config" != "no" ; then
- AC_MSG_CHECKING([for python-config])
- if test ! -x "$with_python_config" ; then
- AC_MSG_ERROR([Specified python-config does not exist or is not executable: $with_python_config])
+ PYTHON_SITE_DIR="`$PYTHON -c 'from distutils import sysconfig; print sysconfig.get_python_lib(0);'`"
+
+ if test -z "$PYTHON_SITE_DIR" ; then
+ AC_MSG_ERROR([Unable to detect python site-packages path])
+ elif test ! -d "$PYTHON_SITE_DIR" ; then
+ AC_MSG_ERROR([Path $PYTHON_SITE_DIR returned by python does not exist!])
fi
- AC_MSG_RESULT([$with_python_config])
- AC_SUBST([PYTHON_CONFIG], ["$with_python_config"])
- else
- AC_PATH_PROG([PYTHON_CONFIG], ["python-config"], ["no"], ["$PATH:/usr/bin:/usr/local/bin"])
- fi
+ AC_MSG_RESULT([$PYTHON_SITE_DIR])
+ AC_SUBST([PYTHON_SITE_DIR], [$PYTHON_SITE_DIR])
- # this one is fatal if with_python != try
- if test "$PYTHON_CONFIG" != "no" ; then
- PYTHON_CFLAGS="`$PYTHON_CONFIG --cflags`"
- PYTHON_LDFLAGS="`$PYTHON_CONFIG --ldflags`"
+ #
+ # python distutils found, get settings from python directly
+ #
+ PYTHON_CFLAGS="`$PYTHON -c 'from distutils import sysconfig; flags = [[\"-I\" + sysconfig.get_python_inc(0), \"-I\" + sysconfig.get_python_inc(1), \" \".join(sysconfig.get_config_var(\"CFLAGS\").split())]]; print \" \".join(flags);'`"
+ PYTHON_LDFLAGS="`$PYTHON -c 'from distutils import sysconfig; libs = sysconfig.get_config_var(\"LIBS\").split() + sysconfig.get_config_var(\"SYSLIBS\").split(); libs.append(\"-lpython\"+sysconfig.get_config_var(\"VERSION\")); print \" \".join(libs);'`"
+ PYTHON_LIB="`$PYTHON -c 'from distutils import sysconfig; print \"python\" + sysconfig.get_config_var(\"VERSION\");'`"
+
+ # check libpython
+ AC_CHECK_LIB([$PYTHON_LIB], [main], [has_libpython="yes"], [has_libpython="no"])
+
+ if test "$has_libpython" = "no" ; then
+ AS_IF([test "$with_python" = "try"],
+ [AC_MSG_WARN([$PYTHON_LIB is unusable])],
+ [AC_MSG_ERROR([$PYTHON_LIB is unusable])]
+ )
+ fi
# check whether system libpython is usable and has threads support
- save_LIBS="$LIBS"
+ CFLAGS="$PYTHON_CFLAGS"
LIBS="$PYTHON_LDFLAGS"
AC_CHECK_FUNC([PyThread_init_thread], [python_has_threads="yes"], [python_has_threads="no"])
- LIBS="$save_LIBS"
-
- if test "$python_has_threads" = "no" ; then
- if test "$with_python" = "try" ; then
- AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])
- fi
- AC_MSG_WARN([Your python lacks threads support, can not build mod_python])
+ if test "$python_has_threads" = "no"; then
+ AS_IF([test "$with_python" = "try"],
+ [AC_MSG_WARN([Your python lacks threads support, can not build mod_python])],
+ [AC_MSG_ERROR([Your python lacks threads support, can not build mod_python])]
+ )
else
AC_MSG_NOTICE([Your python seems OK, do not forget to enable mod_python in modules.conf])
- AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
+ AC_SUBST([PYTHON_CFLAGS], [$PYTHON_CFLAGS])
AC_SUBST([PYTHON_LDFLAGS], [$PYTHON_LDFLAGS])
fi
else
- if test "$with_python" != "try" ; then
- AC_MSG_ERROR([python-config could not be found, use --with-python-config to specify the location])
- fi
-
- AC_MSG_WARN([python-config could not be found, mod_python will not build, use --with-python-config to specify the location])
- fi
- else
- if test "$with_python" != "try" ; then
- AC_MSG_ERROR([Could not find python, use --with-python to specify the location])
+ AS_IF([test "$with_python" = "try"],
+ [AC_MSG_WARN([Could not find or use python distutils module: $python_result])],
+ [AC_MSG_ERROR([Could not find or use python distutils module: $python_result])]
+ )
fi
- AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])
+ LIBS="$save_LIBS"
+ CFLAGS="$save_CFLAGS"
+
+ unset python_has_threads
+ unset python_has_distutils
+ unset python_result
+ else
+ AS_IF([test "$with_python" = "try"],
+ [AC_MSG_WARN([Could not find python, mod_python will not build, use --with-python to specify the location])],
+ [AC_MSG_ERROR([Could not find python, use --with-python to specify the location])]
+ )
fi
else
AC_MSG_WARN([python support disabled, building mod_python will fail!])
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/debian/changelog Thu May 22 15:05:28 2008
@@ -1,3 +1,22 @@
+freeswitch (1.0~rc6-1) unstable; urgency=low
+
+ * Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
+ * Enhanced sofia sip nat handling
+ * Fix libedit build on solaris
+ * Fix session timers in mod_sofia
+ * Fix conference fire-call
+ * Change: add var_event down into the endpoints so chans with no parents can still pass options
+ * Added enable-post-var param to xml_rpc
+ * Fix mod_lua build on solaris
+ * Many fixes found by Klockwork (www.klocwork.com)
+ * Add unregister event in mod_sofia
+ * Enhance python configure detection
+ * Add vm_boxcount api func
+ * Fixed att_xfer issue
+ * Fix sip now includes the Allow-Events header in more places
+
+-- Michael Jerris <mike(a)jerris.com> Tue, 13 May 2008 02:01:00 -0400
+
freeswitch (1.0~rc5-1) unstable; urgency=low
* Changed internal state names to avoid confusion
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/docs/ChangeLog Thu May 22 15:05:28 2008
@@ -1,3 +1,19 @@
+freeswitch (1.0.rc6)
+ Changed to not allow pass_2833 on transcoded calls (it never worked, now it will tell you)
+ Enhanced sofia sip nat handling
+ Fix libedit build on solaris
+ Fix session timers in mod_sofia
+ Fix conference fire-call
+ Change: add var_event down into the endpoints so chans with no parents can still pass options
+ Added enable-post-var param to xml_rpc
+ Fix mod_lua build on solaris
+ Many fixes found by Klockwork (www.klocwork.com)
+ Add unregister event in mod_sofia
+ Enhance python configure detection
+ Add vm_boxcount api func
+ Fixed att_xfer issue
+ Fix sip now includes the Allow-Events header in more places
+
freeswitch (1.0.rc5)
Changed internal state names to avoid confusion
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/private/switch_core_pvt.h Thu May 22 15:05:28 2008
@@ -85,7 +85,8 @@
typedef enum {
SSF_NONE = 0,
- SSF_DESTROYED = (1 << 0)
+ SSF_DESTROYED = (1 << 0),
+ SSF_WARN_TRANSCODE = (1 << 1)
} switch_session_flag_t;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_channel.h Thu May 22 15:05:28 2008
@@ -254,7 +254,7 @@
\param flags or'd list of channel flags to test
\return TRUE if flags were present
*/
-SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags);
/*!
\brief Set given flag(s) on a given channel
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_config.h Thu May 22 15:05:28 2008
@@ -65,7 +65,7 @@
/*! FILE stream buffer to the opened file */
FILE *file;
/*! path to the file */
- char *path;
+ char path[512];
/*! current category */
char category[256];
/*! current section */
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core.h Thu May 22 15:05:28 2008
@@ -732,6 +732,7 @@
\return the cause code of the attempted call
*/
SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(_In_opt_ switch_core_session_t *session,
+ _In_opt_ switch_event_t *var_event,
_In_z_ const char *endpoint_name,
_In_ switch_caller_profile_t *caller_profile,
_Inout_ switch_core_session_t **new_session,
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_core_event_hook.h Thu May 22 15:05:28 2008
@@ -48,7 +48,7 @@
typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t;
typedef switch_status_t (*switch_outgoing_channel_hook_t)
-(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
+(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
@@ -56,8 +56,8 @@
typedef switch_status_t (*switch_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
typedef switch_status_t (*switch_video_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, int);
-typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
-typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *);
+typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
+typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction);
typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *);
typedef switch_call_cause_t (*switch_resurrect_session_hook_t)(switch_core_session_t **, switch_memory_pool_t **, void *);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_cpp.h Thu May 22 15:05:28 2008
@@ -11,10 +11,12 @@
#include <switch.h>
+#define this_check(x) do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n"); return x;}} while(0)
+#define this_check_void() do { if (!this) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "object is not initalized\n");}} while(0)
#define sanity_check(x) do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return x;}} while(0)
#define sanity_check_noreturn do { if (!(session && allocated)) { switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "session is not initalized\n"); return;}} while(0)
-#define init_vars() do { session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
+#define init_vars() do { allocated = 0; session = NULL; channel = NULL; uuid = NULL; tts_name = NULL; voice_name = NULL; xml_cdr_text = NULL; memset(&args, 0, sizeof(args)); ap = NULL; caller_profile.source = "mod_unknown"; caller_profile.dialplan = ""; caller_profile.context = ""; caller_profile.caller_id_name = ""; caller_profile.caller_id_number = ""; caller_profile.network_addr = ""; caller_profile.ani = ""; caller_profile.aniii = ""; caller_profile.rdnis = ""; caller_profile.username = ""; on_hangup = NULL; memset(&cb_state, 0, sizeof(cb_state)); hook_state = CS_NEW; } while(0)
//
@@ -191,6 +193,8 @@
SWITCH_DECLARE(void *)getPrivate(char *var);
SWITCH_DECLARE(const char *)getVariable(char *var);
SWITCH_DECLARE(switch_status_t) process_callback_result(char *ret);
+ SWITCH_DECLARE(void) say(const char *tosay, const char *module_name, const char *say_type, const char *say_method);
+ SWITCH_DECLARE(void) sayPhrase(const char *phrase_name, const char *phrase_data = "", const char *phrase_lang = NULL);
/** \brief Record to a file
* \param filename
@@ -306,7 +310,7 @@
SWITCH_DECLARE(bool) ready();
- SWITCH_DECLARE(void) execute(char *app, char *data);
+ SWITCH_DECLARE(void) execute(char *app, char *data=NULL);
SWITCH_DECLARE(void) sendEvent(Event *sendME);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_event.h Thu May 22 15:05:28 2008
@@ -339,7 +339,7 @@
*/
#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data)
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix);
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix,switch_hash_t* vars_map);
///\}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_ivr.h Thu May 22 15:05:28 2008
@@ -753,7 +753,7 @@
const char *valid_terminators);
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
- switch_bool_t dial_b, switch_bool_t exec_b, const char *app);
+ switch_bind_flag_t bind_flags, const char *app);
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *session, const char *unhold_key, const char *moh_a, const char *moh_b);
SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *tosay, const char *module_name, const char *say_type, const char *say_method, switch_input_args_t *args);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_module_interfaces.h Thu May 22 15:05:28 2008
@@ -100,7 +100,7 @@
typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
-(switch_core_session_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
+(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t);
typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_rtp.h Thu May 22 15:05:28 2008
@@ -233,7 +233,7 @@
\param flags the flags to test
\return TRUE or FALSE
*/
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
+SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags);
/*!
\brief Clear an RTP Flag
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_types.h Thu May 22 15:05:28 2008
@@ -151,6 +151,20 @@
} switch_dtmf_t;
typedef enum {
+ SBF_DIAL_ALEG = (1 << 0),
+ SBF_EXEC_ALEG = (1 << 1),
+ SBF_DIAL_BLEG = (1 << 2),
+ SBF_EXEC_BLEG = (1 << 3),
+ SBF_EXEC_OPPOSITE = (1 << 4),
+ SBF_EXEC_SAME = (1 << 5)
+} switch_bind_flag_t;
+
+typedef enum {
+ SWITCH_DTMF_RECV = 0,
+ SWITCH_DTMF_SEND = 1
+} switch_dtmf_direction_t;
+
+typedef enum {
SOF_NONE = 0,
SOF_NOBLOCK = (1 << 0),
SOF_FORKED_DIAL = (1 << 1)
@@ -513,7 +527,8 @@
SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
SWITCH_MESSAGE_INDICATE_DEFLECT,
SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ,
- SWITCH_MESSAGE_INDICATE_DISPLAY
+ SWITCH_MESSAGE_INDICATE_DISPLAY,
+ SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY
} switch_core_session_message_types_t;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/include/switch_utils.h Thu May 22 15:05:28 2008
@@ -55,6 +55,25 @@
#define switch_is_file_path(file) (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)))
#endif
+/*!
+ \brief Test for NULL or zero length string
+ \param s the string to test
+ \return true value if the string is NULL or zero length
+*/
+#define switch_strlen_zero(s) (!s || *s == '\0')
+
+
+static inline switch_bool_t switch_is_moh(const char *s)
+{
+ if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
+ return SWITCH_FALSE;
+ }
+ return SWITCH_TRUE;
+}
+
+
+
+
SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen);
SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
@@ -73,6 +92,7 @@
SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len);
+
/*!
\brief Evaluate the truthfullness of a string expression
\param expr a string expression
@@ -265,13 +285,6 @@
/*!
- \brief Test for NULL or zero length string
- \param s the string to test
- \return true value if the string is NULL or zero length
-*/
-#define switch_strlen_zero(s) (!s || *s == '\0')
-
-/*!
\brief Make a null string a blank string instead
\param s the string to test
\return the original string or blank string.
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_commands/mod_commands.c Thu May 22 15:05:28 2008
@@ -1513,7 +1513,7 @@
timeout = atoi(argv[6]);
}
- if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
+ if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, cid_name, cid_num, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !caller_session) {
if (machine) {
stream->write_function(stream, "-ERR %s\n", switch_channel_cause2str(cause));
} else {
@@ -1555,9 +1555,7 @@
stream->write_function(stream, "+OK Created Session: %s\n", switch_core_session_get_uuid(caller_session));
}
- if (caller_session) {
- switch_core_session_rwunlock(caller_session);
- }
+ switch_core_session_rwunlock(caller_session);
done:
switch_safe_free(mycmd);
@@ -1715,6 +1713,11 @@
char *reply, *freply = NULL;
switch_event_t *event;
char *arg;
+ switch_memory_pool_t *pool;
+
+ if (!job) return NULL;
+
+ pool = job->pool;
SWITCH_STANDARD_STREAM(stream);
@@ -1747,12 +1750,9 @@
switch_safe_free(stream.data);
switch_safe_free(freply);
- if (job) {
- switch_memory_pool_t *pool = job->pool;
- job = NULL;
- switch_core_destroy_memory_pool(&pool);
- pool = NULL;
- }
+ job = NULL;
+ switch_core_destroy_memory_pool(&pool);
+ pool = NULL;
return NULL;
}
@@ -1921,7 +1921,7 @@
{
char sql[1024];
char *errmsg;
- switch_core_db_t *db = switch_core_db_handle();
+ switch_core_db_t *db;
struct holder holder = { 0 };
int help = 0;
char *mydata = NULL, *argv[6] = {0};
@@ -1933,6 +1933,8 @@
return SWITCH_STATUS_FALSE;
}
+ db = switch_core_db_handle();
+
if (cmd && (mydata = strdup(cmd))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
command = argv[0];
@@ -2023,6 +2025,12 @@
} else if (!strcasecmp(as, "xml")) {
switch_core_db_exec(db, sql, show_as_xml_callback, &holder, &errmsg);
+ if (errmsg) {
+ stream->write_function(stream, "-ERR SQL Error [%s]\n", errmsg);
+ switch_core_db_free(errmsg);
+ errmsg = NULL;
+ }
+
if (holder.xml) {
char count[50];
char *xmlstr;
@@ -2207,6 +2215,7 @@
switch_xml_free(xml);
} else {
stream->write_function(stream, "-ERR Unable to create xml!\n");
+ switch_event_destroy(&event);
switch_core_session_rwunlock(psession);
goto done;
}
@@ -2219,7 +2228,7 @@
switch_event_destroy(&event);
free(buf);
} else {
- abort();
+ stream->write_function(stream, "-ERR Allocation error\n");
}
switch_core_session_rwunlock(psession);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_conference/mod_conference.c Thu May 22 15:05:28 2008
@@ -349,7 +349,7 @@
static switch_status_t conference_say(conference_obj_t * conference, const char *text, uint32_t leadin);
static void conference_list(conference_obj_t * conference, switch_stream_handle_t *stream, char *delim);
SWITCH_STANDARD_API(conf_api_main);
-static switch_status_t audio_bridge_on_routing(switch_core_session_t *session);
+
static switch_status_t conference_outcall(conference_obj_t * conference,
char *conference_name,
switch_core_session_t *session,
@@ -1755,7 +1755,7 @@
}
for (cp = call_list; cp; cp = cp->next) {
- conference_outcall_bg(member->conference, NULL, member->session, cp->string, to, switch_str_nil(flags), cid_name, cid_num);
+ conference_outcall_bg(member->conference, NULL, NULL, cp->string, to, switch_str_nil(flags), cid_name, cid_num);
}
}
/* Fair WARNING, If you expect the caller to hear anything or for digit handling to be proccessed, */
@@ -3726,31 +3726,6 @@
}
-/* outbound call bridge progress call state callback handler */
-static switch_status_t audio_bridge_on_routing(switch_core_session_t *session)
-{
- switch_channel_t *channel = NULL;
-
- channel = switch_core_session_get_channel(session);
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM ROUTING\n");
-
- /* put the channel in a passive state so we can loop audio to it */
- switch_channel_set_state(channel, CS_SOFT_EXECUTE);
- return SWITCH_STATUS_FALSE;
-}
-
-static switch_state_handler_table_t audio_bridge_peer_state_handlers = {
- /*.on_init */ NULL,
- /*.on_routing */ audio_bridge_on_routing,
- /*.on_execute */ NULL,
- /*.on_hangup */ NULL,
- /*.on_exchange_media */ NULL,
- /*.on_soft_execute */ NULL,
- /*.on_consume_media */ NULL,
-};
-
-
/* generate an outbound call from the conference */
static switch_status_t conference_outcall(conference_obj_t * conference,
char *conference_name,
@@ -3769,7 +3744,6 @@
if (conference == NULL) {
char *dialstr = switch_mprintf("{ignore_early_media=true}%s", bridgeto);
-
status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, SOF_NONE);
switch_safe_free(dialstr);
@@ -3802,8 +3776,9 @@
}
/* establish an outbound call leg */
+
if (switch_ivr_originate(session,
- &peer_session, cause, bridgeto, timeout, &audio_bridge_peer_state_handlers, cid_name, cid_num,
+ &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num,
NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause));
if (caller_channel) {
@@ -3811,10 +3786,11 @@
}
goto done;
}
-
+
rdlock = 1;
peer_channel = switch_core_session_get_channel(peer_session);
-
+ switch_channel_set_state(peer_channel, CS_SOFT_EXECUTE);
+
/* make sure the conference still exists */
if (!switch_test_flag(conference, CFLAG_RUNNING)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Conference is gone now, nevermind..\n");
@@ -4982,7 +4958,7 @@
conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
}
- if (!switch_strlen_zero(moh_sound)) {
+ if (!switch_strlen_zero(moh_sound) && switch_is_moh(moh_sound)) {
conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_dptools/mod_dptools.c Thu May 22 15:05:28 2008
@@ -160,7 +160,7 @@
}
}
-#define BIND_SYNTAX "<key> [a|b] [a|b] <app>"
+#define BIND_SYNTAX "<key> [a|b|ab] [a|b|o|s] <app>"
SWITCH_STANDARD_APP(dtmf_bind_function)
{
char *argv[4] = { 0 };
@@ -170,10 +170,46 @@
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
int kval = atoi(argv[0]);
- char a1 = (char)tolower(*argv[1]);
- char a2 = (char)tolower(*argv[2]);
-
- if (switch_ivr_bind_dtmf_meta_session(session, kval, a1 == 'b', a2 == 'b', argv[3]) != SWITCH_STATUS_SUCCESS) {
+ switch_bind_flag_t bind_flags = 0;
+
+ if (strchr(argv[1], 'a')) {
+ bind_flags |= SBF_DIAL_ALEG;
+ }
+ if (strchr(argv[1], 'b')) {
+ bind_flags |= SBF_DIAL_BLEG;
+ }
+ if (strchr(argv[2], 'a')) {
+ if ((bind_flags & SBF_EXEC_BLEG)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
+ } else {
+ bind_flags |= SBF_EXEC_ALEG;
+ }
+ }
+ if (strchr(argv[2], 'b')) {
+ if ((bind_flags & SBF_EXEC_ALEG)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
+ } else {
+ bind_flags |= SBF_EXEC_BLEG;
+ }
+ }
+
+ if (strchr(argv[2], 'o')) {
+ if ((bind_flags & SBF_EXEC_BLEG) || (bind_flags & SBF_EXEC_ALEG) || (bind_flags & SBF_EXEC_SAME)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
+ } else {
+ bind_flags |= SBF_EXEC_OPPOSITE;
+ }
+ }
+
+ if (strchr(argv[2], 's')) {
+ if ((bind_flags & SBF_EXEC_BLEG) || (bind_flags & SBF_EXEC_ALEG) || (bind_flags & SBF_EXEC_SAME)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot bind execute to multiple legs\n");
+ } else {
+ bind_flags |= SBF_EXEC_SAME;
+ }
+ }
+
+ if (switch_ivr_bind_dtmf_meta_session(session, kval, bind_flags, argv[3]) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error!\n");
}
} else {
@@ -714,16 +750,16 @@
if (!strcasecmp(name, "caller_id_number")) {
caller_profile->caller_id_number = val;
}
- if (!strcasecmp(name, "caller_ton")) {
+ if (val && !strcasecmp(name, "caller_ton")) {
caller_profile->caller_ton = (uint8_t)atoi(val);
}
- if (!strcasecmp(name, "caller_numplan")) {
+ if (val && !strcasecmp(name, "caller_numplan")) {
caller_profile->caller_numplan = (uint8_t)atoi(val);
}
- if (!strcasecmp(name, "destination_number_ton")) {
+ if (val && !strcasecmp(name, "destination_number_ton")) {
caller_profile->destination_number_ton = (uint8_t)atoi(val);
}
- if (!strcasecmp(name, "destination_number_numplan")) {
+ if (val && !strcasecmp(name, "destination_number_numplan")) {
caller_profile->destination_number_numplan = (uint8_t)atoi(val);
}
if (!strcasecmp(name, "ani")) {
@@ -768,7 +804,15 @@
} else {
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
var = switch_core_session_strdup(session, data);
- val = strchr(var, '=');
+ if (var) {
+ val = strchr(var, '=');
+ if (!strncasecmp(var, "nolocal:", 8)) {
+ var_name = var + 8;
+ local = 0;
+ } else {
+ var_name = var;
+ }
+ }
if (val) {
*val++ = '\0';
@@ -777,14 +821,7 @@
}
}
- if (!strncasecmp(var, "nolocal:", 8)) {
- var_name = var + 8;
- local = 0;
- } else {
- var_name = var;
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name, val ? val : "UNDEF");
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "", val ? val : "UNDEF");
switch_channel_set_variable(channel, var, val);
if (var && val) {
@@ -864,12 +901,14 @@
for (x = 0; x < argc; x++) {
char *p, *this = argv[x];
- p = this;
- while(*p == ' ') *p++ = '\0';
- this = p;
-
if (this) {
- char *var = this, *val = NULL;
+ char *var, *val;
+ p = this;
+ while(*p == ' ') *p++ = '\0';
+ this = p;
+
+ var = this;
+ val = NULL;
if ((val = strchr(var, '='))) {
p = val - 1;
*val++ = '\0';
@@ -1337,6 +1376,7 @@
switch_channel_set_caller_extension(peer_channel, extension);
switch_channel_set_flag(peer_channel, CF_TRANSFER);
switch_channel_set_state(peer_channel, CS_EXECUTE);
+ switch_channel_set_variable(channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, NULL);
return SWITCH_STATUS_FALSE;
}
@@ -1380,6 +1420,8 @@
switch_channel_t *channel, *peer_channel = NULL;
const char *bond = NULL;
int timelimit = 60;
+ switch_core_session_t *b_session = NULL;
+
channel = switch_core_session_get_channel(session);
@@ -1394,8 +1436,8 @@
timelimit = atoi(var);
}
- if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS) {
- return;
+ if (switch_ivr_originate(session, &peer_session, &cause, data, timelimit, NULL, NULL, NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS || !peer_session) {
+ goto end;
}
peer_channel = switch_core_session_get_channel(peer_session);
@@ -1404,18 +1446,27 @@
switch_ivr_multi_threaded_bridge(session, peer_session, xfer_on_dtmf, peer_session, NULL);
+ switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
+ switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
+
+ if (!switch_channel_get_state(peer_channel) >= CS_HANGUP) {
+ switch_core_session_rwunlock(peer_session);
+ goto end;
+ }
+
if (bond) {
- switch_core_session_t *b_session;
char buf[128] = "";
- if ((b_session = switch_core_session_locate(bond))) {
+ if (!switch_channel_ready(channel)) {
+ switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond);
+ } else if ((b_session = switch_core_session_locate(bond))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), switch_core_session_get_uuid(session));
switch_channel_set_variable(b_channel, "xfer_uuids", buf);
switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), bond);
switch_channel_set_variable(channel, "xfer_uuids", buf);
-
+
switch_core_event_hook_add_state_change(session, hanguphook);
switch_core_event_hook_add_state_change(b_session, hanguphook);
@@ -1424,13 +1475,11 @@
switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
}
-
- if (peer_session) {
- switch_core_session_rwunlock(peer_session);
- }
+ switch_core_session_rwunlock(peer_session);
+
+ end:
switch_channel_set_variable(channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
-
}
@@ -1638,7 +1687,10 @@
}
path = switch_core_session_strdup(session, data);
- if (path && (p = strchr(path, '+'))) {
+
+ if (!path) return;
+
+ if ((p = strchr(path, '+'))) {
char *q = p - 1;
while(q && *q == ' ') {
*q = '\0';
@@ -1771,6 +1823,7 @@
/* fake chan_user */
switch_endpoint_interface_t *user_endpoint_interface;
static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
+ switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
@@ -1780,6 +1833,7 @@
};
static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
+ switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
@@ -1798,6 +1852,8 @@
user = strdup(outbound_profile->destination_number);
+ if (!user) goto done;
+
if (!(domain = strchr(user, '@'))) {
goto done;
}
@@ -1856,7 +1912,18 @@
d_dest = switch_channel_expand_variables(channel, dest);
} else {
- d_dest = strdup(dest);
+ switch_event_t *event = var_event;
+ if (!event) {
+ switch_event_create(&event, SWITCH_EVENT_MESSAGE);
+ switch_assert(event);
+ }
+
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_user", user);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "dialed_domain", domain);
+ d_dest = switch_event_expand_headers(event, dest);
+ if (event && event != var_event) {
+ switch_event_destroy(&event);
+ }
}
if ((flags & SOF_FORKED_DIAL)) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_esf/mod_esf.c Thu May 22 15:05:28 2008
@@ -76,6 +76,8 @@
switch_port_t mcast_port = 34567;
switch_port_t mcast_control_port = 6061;
char *mcast_port_str = "34567";
+ const char *esf_broadcast_ip = NULL, *var;
+
if (!switch_strlen_zero((char *) data)) {
mydata = switch_core_session_strdup(session, data);
@@ -83,6 +85,10 @@
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if ((var = switch_channel_get_variable(channel, "esf_multicast_ip"))) {
+ mcast_ip = switch_core_session_strdup(session, var);
+ }
+
if (!switch_strlen_zero(argv[0])) {
mcast_ip = argv[0];
}
@@ -165,13 +171,20 @@
}
}
- switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
- if (!(rtp_port = switch_rtp_request_port(guess_ip))) {
+ if ((var = switch_channel_get_variable(channel, "esf_broadcast_ip"))) {
+ esf_broadcast_ip = switch_core_session_strdup(session, var);
+ } else {
+ switch_find_local_ip(guess_ip, sizeof(guess_ip), AF_INET);
+ esf_broadcast_ip = guess_ip;
+ }
+
+
+ if (!(rtp_port = switch_rtp_request_port(esf_broadcast_ip))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RTP Port Error\n");
goto fail;
}
- rtp_session = switch_rtp_new(guess_ip,
+ rtp_session = switch_rtp_new(esf_broadcast_ip,
rtp_port,
mcast_ip,
mcast_port,
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_fifo/mod_fifo.c Thu May 22 15:05:28 2008
@@ -569,7 +569,11 @@
switch_core_session_flush_private_events(session);
if (moh) {
- switch_ivr_play_file(session, NULL, moh, &args);
+ switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args);
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ aborted = 1;
+ goto abort;
+ }
} else {
switch_ivr_collect_digits_callback(session, &args, 0);
}
@@ -736,10 +740,15 @@
pop = NULL;
if (moh && do_wait) {
+ switch_status_t status = switch_ivr_play_file(session, NULL, moh, &args);
memset(&args, 0, sizeof(args));
args.read_frame_callback = consumer_read_frame_callback;
args.user_data = node_list;
switch_ivr_play_file(session, NULL, moh, &args);
+
+ if (!SWITCH_READ_ACCEPTABLE(status)) {
+ break;
+ }
}
for(i = 0; i < node_count; i++) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp Thu May 22 15:05:28 2008
@@ -55,7 +55,7 @@
int literal;
};
-static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_media_bug_t *bug;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/applications/mod_voicemail/mod_voicemail.c Thu May 22 15:05:28 2008
@@ -81,11 +81,13 @@
char rew_key[2];
char urgent_key[2];
char operator_key[2];
+ char vmain_key[2];
char file_ext[10];
char *record_title;
char *record_comment;
char *record_copyright;
char *operator_ext;
+ char *vmain_ext;
char *tone_spec;
char *storage_dir;
char *callback_dialplan;
@@ -272,6 +274,8 @@
char *urgent_key = "*";
char *operator_key = "";
char *operator_ext = "";
+ char *vmain_key = "";
+ char *vmain_ext = "";
char *tone_spec = "%(1000, 0, 640)";
char *file_ext = "wav";
char *storage_dir = "";
@@ -433,6 +437,10 @@
operator_key = val;
} else if (!strcasecmp(var, "operator-extension") && !switch_strlen_zero(val)) {
operator_ext = val;
+ } else if (!strcasecmp(var, "vmain-key") && !switch_strlen_zero(val)) {
+ vmain_key = val;
+ } else if (!strcasecmp(var, "vmain-extension") && !switch_strlen_zero(val)) {
+ vmain_ext = val;
} else if (!strcasecmp(var, "storage-dir") && !switch_strlen_zero(val)) {
storage_dir = val;
} else if (!strcasecmp(var, "callback-dialplan") && !switch_strlen_zero(val)) {
@@ -652,11 +660,13 @@
*profile->rew_key = *rew_key;
*profile->urgent_key = *urgent_key;
*profile->operator_key = *operator_key;
+ *profile->vmain_key = *vmain_key;
profile->record_threshold = record_threshold;
profile->record_silence_hits = record_silence_hits;
profile->record_sample_rate = record_sample_rate;
profile->operator_ext = switch_core_strdup(globals.pool, operator_ext);
+ profile->vmain_ext = switch_core_strdup(globals.pool, vmain_ext);
profile->storage_dir = switch_core_strdup(globals.pool, storage_dir);
profile->tone_spec = switch_core_strdup(globals.pool, tone_spec);
profile->callback_dialplan = switch_core_strdup(globals.pool, callback_dialplan);
@@ -1876,6 +1886,20 @@
goto end;
}
}
+ } else if (!strcasecmp(buf, profile->vmain_key) && !switch_strlen_zero(profile->vmain_key)) {
+ int argc;
+ char *argv[4];
+ char *mycmd;
+
+ if (!switch_strlen_zero(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
+ argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ if (argc >= 1 && argc <= 4) {
+ switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+ /* the application still runs after we leave it so we need to make sure that we dont do anything evil */
+ send_mail=0;
+ goto end;
+ }
+ }
} else {
goto greet;
}
@@ -2153,11 +2177,75 @@
}
}
-static void message_query_handler(switch_event_t *event)
+#define BOXCOUNT_SYNTAX "<user>@<domain>[|[new|saved|new-urgent|saved-urgent|all]]"
+SWITCH_STANDARD_API(boxcount_api_function)
+{
+ char *dup;
+ char *how = "new";
+ int total_new_messages = 0;
+ int total_saved_messages = 0;
+ int total_new_urgent_messages = 0;
+ int total_saved_urgent_messages = 0;
+
+ if (cmd) {
+ switch_hash_index_t *hi;
+ void *val;
+ vm_profile_t *profile;
+ char *id, *domain, *p;
+
+ dup = strdup(cmd);
+ id = dup;
+
+ if (!strncasecmp(cmd, "sip:", 4)) {
+ id += 4;
+ }
+
+ if (!id) {
+ stream->write_function(stream, "%d", 0);
+ free(dup);
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if ((domain = strchr(id, '@'))) {
+ *domain++ = '\0';
+ if ((p = strchr(domain, '|'))) {
+ *p++ = '\0';
+ how = p;
+ }
+
+ for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+ switch_hash_this(hi, NULL, NULL, &val);
+ profile = (vm_profile_t *) val;
+ total_new_messages = total_saved_messages = 0;
+ message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
+ &total_new_urgent_messages, &total_saved_urgent_messages);
+ }
+ }
+
+ switch_safe_free(id);
+ }
+
+ if (!strcasecmp(how, "saved")) {
+ stream->write_function(stream, "%d", total_saved_messages);
+ } else if (!strcasecmp(how, "new-urgent")) {
+ stream->write_function(stream, "%d", total_new_urgent_messages);
+ } else if (!strcasecmp(how, "new-saved")) {
+ stream->write_function(stream, "%d", total_saved_urgent_messages);
+ } else if (!strcasecmp(how, "all")) {
+ stream->write_function(stream, "%d:%d:%d:%d", total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+ } else {
+ stream->write_function(stream, "%d", total_new_messages);
+ }
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
+static void message_query_handler(switch_event_t *event)
{
char *account = switch_event_get_header(event, "message-account");
int created = 0;
switch_event_t *new_event = NULL;
+ char *dup = NULL;
if (account) {
switch_hash_index_t *hi;
@@ -2169,12 +2257,17 @@
vm_profile_t *profile;
char *id, *domain;
+ dup = strdup(account);
+ id = dup;
+
if (!strncasecmp(account, "sip:", 4)) {
- id = strdup(account + 4);
- } else {
- id = strdup(account);
+ id += 4;
+ }
+
+ if (!id) {
+ free(dup);
+ return;
}
- switch_assert(id);
if ((domain = strchr(id, '@'))) {
*domain++ = '\0';
@@ -2200,7 +2293,7 @@
}
}
- switch_safe_free(id);
+ switch_safe_free(dup);
}
@@ -2784,7 +2877,8 @@
}
SWITCH_ADD_API(commands_api_interface, "voicemail", "voicemail", voicemail_api_function, VOICEMAIL_SYNTAX);
-
+ SWITCH_ADD_API(commands_api_interface, "vm_boxcount", "vm_boxcount", boxcount_api_function, BOXCOUNT_SYNTAX);
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_NOUNLOAD;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/codecs/mod_ilbc/mod_ilbc.c Thu May 22 15:05:28 2008
@@ -115,7 +115,7 @@
float buf[240];
for (x = 0; x < loops && new_len < *encoded_data_len; x++) {
- for (y = 0; y < context->dbytes / sizeof(short); y++) {
+ for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
buf[y] = ddp[y];
}
iLBC_encode(edp, buf, &context->encoder);
@@ -157,7 +157,7 @@
for (x = 0; x < loops && new_len < *decoded_data_len; x++) {
iLBC_decode(buf, edp, &context->decoder, 1);
- for (y = 0; y < context->dbytes / sizeof(short); y++) {
+ for (y = 0; y < context->dbytes / sizeof(short) && y < 240; y++) {
ddp[y] = (short) buf[y];
}
ddp += context->dbytes / sizeof(short);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c Thu May 22 15:05:28 2008
@@ -289,7 +289,7 @@
/* fake chan_sip */
switch_endpoint_interface_t *sip_endpoint_interface;
-static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
@@ -298,7 +298,7 @@
/*.outgoing_channel */ sip_outgoing_channel
};
-static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
@@ -316,7 +316,7 @@
}
outbound_profile->destination_number = switch_core_sprintf(outbound_profile->pool, "%s/%s", profile, outbound_profile->destination_number);
- return switch_core_session_outgoing_channel(session, "sofia", outbound_profile, new_session, pool, SOF_NONE);
+ return switch_core_session_outgoing_channel(session, var_event, "sofia", outbound_profile, new_session, pool, SOF_NONE);
}
@@ -324,7 +324,7 @@
/* fake chan_iax2 */
switch_endpoint_interface_t *iax2_endpoint_interface;
-static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
@@ -333,13 +333,13 @@
/*.outgoing_channel */ iax2_outgoing_channel
};
-static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session,
switch_memory_pool_t **pool,
switch_originate_flag_t flags)
{
- return switch_core_session_outgoing_channel(session, "iax", outbound_profile, new_session, pool, SOF_NONE);
+ return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_alsa/mod_alsa.c Thu May 22 15:05:28 2008
@@ -146,7 +146,7 @@
static switch_status_t channel_on_routing(switch_core_session_t *session);
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -753,7 +753,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.c Thu May 22 15:05:28 2008
@@ -208,7 +208,7 @@
static switch_status_t channel_on_routing(switch_core_session_t *session);
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -1566,7 +1566,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/iax.c Thu May 22 15:05:28 2008
@@ -2984,7 +2984,12 @@
static struct iax_event *iax_net_read(void)
{
unsigned char buf[65536];
- int res, sinlen;
+ int res;
+#ifndef __Linux__
+ socklen_t sinlen;
+#else
+ unsigned int sinlen;
+#endif
struct sockaddr_in sin;
sinlen = sizeof(sin);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_iax/mod_iax.c Thu May 22 15:05:28 2008
@@ -419,7 +419,7 @@
static switch_status_t channel_on_routing(switch_core_session_t *session);
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -693,7 +693,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_portaudio/mod_portaudio.c Thu May 22 15:05:28 2008
@@ -143,7 +143,7 @@
static switch_status_t channel_on_routing(switch_core_session_t *session);
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -631,7 +631,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_reference/mod_reference.c Thu May 22 15:05:28 2008
@@ -103,7 +103,7 @@
static switch_status_t channel_on_routing(switch_core_session_t *session);
static switch_status_t channel_on_exchange_media(switch_core_session_t *session);
static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -395,7 +395,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.c Thu May 22 15:05:28 2008
@@ -52,7 +52,7 @@
static switch_status_t sofia_on_exchange_media(switch_core_session_t *session);
static switch_status_t sofia_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -339,6 +339,7 @@
const char *val;
const char *b_sdp = NULL;
int is_proxy = 0;
+ char *sticky = NULL;
if (switch_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
return SWITCH_STATUS_SUCCESS;
@@ -405,9 +406,20 @@
session_timeout = v_session_timeout;
}
}
+
+ if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
+ ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+ sticky = tech_pvt->record_route;
+ session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
+ switch_channel_set_variable(channel, "sip_nat_detected", "true");
+ }
+
+
nua_respond(tech_pvt->nh, SIP_200_OK,
NUTAG_AUTOANSWER(0),
+ TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
NUTAG_SESSION_TIMER(session_timeout),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
@@ -752,6 +764,12 @@
}
break;
+ case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY:
+ if (tech_pvt->rtp_session && switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot pass 2833 on a transcoded call.\n");
+ switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+ }
+ break;
case SWITCH_MESSAGE_INDICATE_BROADCAST: {
const char *ip = NULL, *port = NULL;
ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
@@ -957,7 +975,7 @@
code = 488;
}
- if (!reason && code != 407) {
+ if (switch_strlen_zero(reason) && code != 407) {
reason = sip_status_phrase(code);
if (switch_strlen_zero(reason)) {
reason = "Because";
@@ -967,7 +985,7 @@
if (code == 407 && !msg->numeric_arg) {
const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
const char *to_host = reason;
-
+
if (switch_strlen_zero(to_host)) {
to_host = switch_channel_get_variable(channel, "sip_to_host");
}
@@ -996,7 +1014,7 @@
switch_set_flag_locked(tech_pvt, TFLAG_BYE);
}
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d %s\n", code, reason);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
if (!switch_strlen_zero(((char *)msg->pointer_arg))) {
tech_pvt->local_sdp_str = switch_core_session_strdup(tech_pvt->session, (char *)msg->pointer_arg);
@@ -1033,6 +1051,9 @@
break;
case SWITCH_MESSAGE_INDICATE_PROGRESS:
{
+ char *sticky = NULL;
+ const char *val = NULL;
+
if (!switch_test_flag(tech_pvt, TFLAG_ANS) && !switch_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
switch_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
@@ -1081,9 +1102,19 @@
}
}
switch_channel_mark_pre_answered(channel);
+
+
+ if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
+ ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+ sticky = tech_pvt->record_route;
+ switch_channel_set_variable(channel, "sip_nat_detected", "true");
+ }
+
nua_respond(tech_pvt->nh,
SIP_183_SESSION_PROGRESS,
NUTAG_AUTOANSWER(0),
+ TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1),
@@ -1651,7 +1682,7 @@
return SWITCH_STATUS_SUCCESS;
}
-static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
@@ -1663,7 +1694,7 @@
private_object_t *tech_pvt = NULL;
switch_channel_t *nchannel;
char *host = NULL, *dest_to = NULL;
-
+
*new_session = NULL;
if (!(nsession = switch_core_session_request(sofia_endpoint_interface, pool))) {
@@ -1859,6 +1890,8 @@
switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp");
+ switch_ivr_transfer_variable(session, nsession, "sip-force-contact");
+ switch_ivr_transfer_variable(session, nsession, "sip_sticky_contact");
if (switch_core_session_compare(session, nsession)) {
/* It's another sofia channel! so lets cache what they use as a pt for telephone event so
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/mod_sofia.h Thu May 22 15:05:28 2008
@@ -45,7 +45,7 @@
#ifdef SWITCH_HAVE_ODBC
#include <switch_odbc.h>
#endif
-
+#define SOFIA_NAT_SESSION_TIMEOUT 20
#define SOFIA_MAX_ACL 100
#define MODNAME "mod_sofia"
@@ -65,7 +65,9 @@
#define SOFIA_SESSION_TIMEOUT "sofia_session_timeout"
#define MY_EVENT_REGISTER "sofia::register"
+#define MY_EVENT_UNREGISTER "sofia::unregister"
#define MY_EVENT_EXPIRE "sofia::expire"
+
#define MULTICAST_EVENT "multicast::event"
#define SOFIA_REPLACES_HEADER "_sofia_replaces_"
#define SOFIA_USER_AGENT "FreeSWITCH-mod_sofia/" SWITCH_VERSION_MAJOR "." SWITCH_VERSION_MINOR "." SWITCH_VERSION_MICRO "-" SWITCH_VERSION_REVISION
@@ -172,7 +174,7 @@
TFLAG_REFER = (1 << 17),
TFLAG_NOHUP = (1 << 18),
TFLAG_XFER = (1 << 19),
- TFLAG_RESERVED = (1 << 20),
+ TFLAG_NAT = (1 << 20),
TFLAG_BUGGY_2833 = (1 << 21),
TFLAG_SIP_HOLD = (1 << 22),
TFLAG_INB_NOMEDIA = (1 << 23),
@@ -330,6 +332,8 @@
uint32_t acl_count;
char *reg_acl[SOFIA_MAX_ACL];
uint32_t reg_acl_count;
+ char *nat_acl[SOFIA_MAX_ACL];
+ uint32_t nat_acl_count;
};
@@ -394,6 +398,7 @@
char *gateway_name;
char *local_crypto_key;
char *remote_crypto_key;
+ char *record_route;
int crypto_tag;
unsigned char local_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
unsigned char remote_raw_key[SWITCH_RTP_MAX_CRYPTO_LEN];
@@ -434,6 +439,8 @@
uint32_t video_count;
sofia_dtmf_t dtmf_type;
int q850_cause;
+ char *remote_ip;
+ int remote_port;
};
struct callback_t {
@@ -444,7 +451,8 @@
typedef enum {
REG_REGISTER,
- REG_INVITE
+ REG_AUTO_REGISTER,
+ REG_INVITE,
} sofia_regtype_t;
typedef enum {
@@ -626,3 +634,4 @@
switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
void sofia_presence_event_thread_start(void);
void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id);
+
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia.c Thu May 22 15:05:28 2008
@@ -1304,6 +1304,12 @@
profile->username = switch_core_strdup(profile->pool, val);
} else if (!strcasecmp(var, "context")) {
profile->context = switch_core_strdup(profile->pool, val);
+ } else if (!strcasecmp(var, "apply-nat-acl")) {
+ if (profile->acl_count < SOFIA_MAX_ACL) {
+ profile->nat_acl[profile->nat_acl_count++] = switch_core_strdup(profile->pool, val);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", SOFIA_MAX_ACL);
+ }
} else if (!strcasecmp(var, "apply-inbound-acl")) {
if (profile->acl_count < SOFIA_MAX_ACL) {
profile->acl[profile->acl_count++] = switch_core_strdup(profile->pool, val);
@@ -1534,6 +1540,9 @@
if (gateway) {
if (status == 200 || status == 404) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "ping success %s\n", gateway->name);
+ if (gateway->state == REG_STATE_FAILED) {
+ gateway->state = REG_STATE_UNREGED;
+ }
gateway->status = SOFIA_GATEWAY_UP;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "ping failed %s\n", gateway->name);
@@ -2642,7 +2651,8 @@
uint32_t sess_max = switch_core_session_limit(0);
int is_auth = 0, calling_myself = 0;
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
-
+ int network_port = 0;
+ char *sticky = NULL, *is_nat = NULL;
if (sess_count >= sess_max || !(profile->pflags & PFLAG_RUNNING)) {
nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
@@ -2657,30 +2667,77 @@
get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
+ network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+
+ if (profile->nat_acl_count) {
+ uint32_t x = 0;
+ int ok = 1;
+ char *last_acl = NULL;
+ const char *contact_host = NULL;
+
+ if (sip && sip->sip_contact && sip->sip_contact->m_url) {
+ contact_host = sip->sip_contact->m_url->url_host;
+ }
+
+ if (!switch_strlen_zero(contact_host)) {
+ for (x = 0 ; x < profile->nat_acl_count; x++) {
+ last_acl = profile->nat_acl[x];
+ if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
+ break;
+ }
+ }
+
+ if (ok) {
+ is_nat = last_acl;
+ }
+ }
+ }
+
if (profile->acl_count) {
uint32_t x = 0;
+ int ok = 1;
+ char *last_acl = NULL;
+
for (x = 0 ; x < profile->acl_count; x++) {
- if (!switch_check_network_list_ip(network_ip, profile->acl[x])) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->acl[x]);
+ last_acl = profile->acl[x];
+ if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
+ break;
+ }
+ }
+
+ if (ok) {
+ if ((profile->pflags & PFLAG_AUTH_CALLS)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Approved by acl %s. Access Granted.\n",
+ network_ip, switch_str_nil(last_acl));
+ is_auth = 1;
+ }
+ } else {
+ if (!(profile->pflags & PFLAG_AUTH_CALLS)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, switch_str_nil(last_acl));
nua_respond(nh, SIP_403_FORBIDDEN, TAG_END());
return;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by acl %s. Falling back to Digest auth.\n",
+ network_ip, switch_str_nil(last_acl));
}
}
}
-
- if ((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization))) {
- int rport = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
- if (!strcmp(network_ip, profile->sipip) && rport == profile->sip_port) {
+
+ if (!is_auth &&
+ ((profile->pflags & PFLAG_AUTH_CALLS) || (!(profile->pflags & PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+ if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
calling_myself++;
} else {
if (sofia_reg_handle_register(nua, profile, nh, sip, REG_INVITE, key, sizeof(key), &v_event)) {
if (v_event) {
switch_event_destroy(&v_event);
}
+ switch_safe_free(sticky);
return;
}
+ switch_safe_free(sticky);
}
is_auth++;
}
@@ -2706,11 +2763,26 @@
}
switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+ tech_pvt->remote_ip = switch_core_session_strdup(session, network_ip);
+ tech_pvt->remote_port = network_port;
+
+ channel = tech_pvt->channel = switch_core_session_get_channel(session);
+
+ if (sip->sip_contact && sip->sip_contact->m_url) {
+ char tmp[35] = "";
+ tech_pvt->record_route = switch_core_session_sprintf(session, "sip:%s@%s:%d",
+ sip->sip_contact->m_url->url_user,
+ tech_pvt->remote_ip,
+ tech_pvt->remote_port);
+ switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
+ snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
+ switch_channel_set_variable(channel, "sip_received_port", tmp);
+ }
+
if (*key != '\0') {
tech_pvt->key = switch_core_session_strdup(session, key);
}
- channel = tech_pvt->channel = switch_core_session_get_channel(session);
if (is_auth) {
switch_channel_set_variable(channel, "sip_authorized", "true");
@@ -3119,6 +3191,12 @@
switch_assert(sql);
sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
}
+
+ if (is_nat) {
+ switch_set_flag(tech_pvt, TFLAG_NAT);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting NAT mode based on acl %s\n", is_nat);
+ switch_channel_set_variable(channel, "sip_nat_detected", "true");
+ }
return;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_glue.c Thu May 22 15:05:28 2008
@@ -868,6 +868,7 @@
uint32_t session_timeout = 0;
const char *val;
const char *rep;
+ char *sticky;
rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
@@ -1001,6 +1002,18 @@
TAG_END());
+ if (switch_test_flag(tech_pvt, TFLAG_NAT) ||
+ (val = switch_channel_get_variable(channel, "sip-force-contact")) ||
+ ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) {
+ tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
+ sticky = tech_pvt->record_route;
+ session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
+ switch_channel_set_variable(channel, "sip_nat_detected", "true");
+ }
+
+
+
+
/* TODO: We should use the new tags for making an rpid and add profile options to turn this on/off */
if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NAME)) {
priv = "name";
@@ -1091,6 +1104,7 @@
sofia_glue_tech_patch_sdp(tech_pvt);
}
+
nua_invite(tech_pvt->nh,
NUTAG_AUTOANSWER(0),
NUTAG_SESSION_TIMER(session_timeout),
@@ -1519,6 +1533,16 @@
if (tech_pvt->cng_pt) {
flags |= SWITCH_RTP_FLAG_AUTO_CNG;
}
+
+ if (tech_pvt->rtp_session && switch_test_flag(tech_pvt, TFLAG_REINVITE)) {
+ const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
+ const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
+
+ if (ip && port && !strcmp(ip, tech_pvt->adv_sdp_audio_ip) && atoi(port) == tech_pvt->remote_sdp_audio_port) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Audio params are unchanged.\n");
+ goto video;
+ }
+ }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
switch_channel_get_name(tech_pvt->channel),
@@ -1796,7 +1820,7 @@
}
if (((m = sdp->sdp_media)) && m->m_mode == sdp_sendonly) {
- sendonly = 1;
+ sendonly = 2; /* global sendonly always wins */
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
@@ -1806,7 +1830,7 @@
if ((!strcasecmp(attr->a_name, "sendonly")) || (!strcasecmp(attr->a_name, "inactive"))) {
sendonly = 1;
- } else if (!strcasecmp(attr->a_name, "sendrecv")) {
+ } else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) {
sendonly = 0;
} else if (!strcasecmp(attr->a_name, "ptime")) {
dptime = atoi(attr->a_value);
@@ -1827,8 +1851,8 @@
if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
stream = tech_pvt->profile->hold_music;
}
-
- if (stream && strcasecmp(stream, "silence")) {
+
+ if (stream && switch_is_moh(stream)) {
if (!strcasecmp(stream, "indicate_hold")) {
switch_channel_set_flag(tech_pvt->channel, CF_SUSPEND);
switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_presence.c Thu May 22 15:05:28 2008
@@ -806,7 +806,7 @@
}
if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find handle for %s\n", call_id);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id);
return 0;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_sofia/sofia_reg.c Thu May 22 15:05:28 2008
@@ -269,10 +269,10 @@
}
} else {
#endif
- if (!profile->master_db) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
- return;
- }
+ if (!profile->master_db) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname);
+ return;
+ }
#ifdef SWITCH_HAVE_ODBC
}
#endif
@@ -401,9 +401,13 @@
switch_mprintf("Digest realm=\"%q\", nonce=\"%q\",%s algorithm=MD5, qop=\"auth\"", realm, uuid_str, stale ? " stale=\"true\"," : "");
if (regtype == REG_REGISTER) {
- nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
+ nua_respond(nh,
+ SIP_401_UNAUTHORIZED,
+ TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_WWW_AUTHENTICATE_STR(auth_str), TAG_END());
} else if (regtype == REG_INVITE) {
- nua_respond(nh, SIP_407_PROXY_AUTH_REQUIRED, TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
+ nua_respond(nh,
+ SIP_407_PROXY_AUTH_REQUIRED,
+ TAG_IF(nua, NUTAG_WITH_THIS(nua)), SIPTAG_PROXY_AUTHENTICATE_STR(auth_str), TAG_END());
}
switch_safe_free(auth_str);
@@ -421,6 +425,7 @@
const char *to_user = NULL;
const char *to_host = NULL;
char contact_str[1024] = "";
+ int nat_hack = 0;
//char buf[512];
uint8_t stale = 0, forbidden = 0;
auth_res_t auth_res;
@@ -495,7 +500,8 @@
authorization = sip->sip_proxy_authorization;
}
- if (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG)) {
+ if (regtype == REG_AUTO_REGISTER || (regtype == REG_REGISTER && (profile->pflags & PFLAG_BLIND_REG))) {
+ regtype = REG_REGISTER;
goto reg;
}
@@ -506,7 +512,7 @@
stale = 1;
}
- if (v_event && *v_event) {
+ if (exptime && v_event && *v_event) {
char *exp_var;
register_gateway = switch_event_get_header(*v_event, "sip-register-gateway");
@@ -524,7 +530,7 @@
!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
if (contact->m_url->url_params) {
switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d;%s>",
- display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
+ display, contact->m_url->url_user, network_ip, network_port, contact->m_url->url_params);
} else {
switch_snprintf(contact_str, sizeof(contact_str), "%s <sip:%s@%s:%d>", display, contact->m_url->url_user, network_ip, network_port);
}
@@ -534,6 +540,7 @@
reg_desc = "Registered(NATHACK)";
exptime = 20;
}
+ nat_hack = 1;
} else {
char *p;
switch_copy_string(contact_str, v_contact_str, sizeof(contact_str));
@@ -556,9 +563,13 @@
if (auth_res != AUTH_OK && !stale) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "send %s for [%s@%s]\n", forbidden ? "forbidden" : "challange", to_user, to_host);
if (auth_res == AUTH_FORBIDDEN) {
- nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh,
+ SIP_403_FORBIDDEN,
+ NUTAG_WITH_THIS(nua), TAG_END());
} else {
- nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh,
+ SIP_401_UNAUTHORIZED,
+ NUTAG_WITH_THIS(nua), TAG_END());
}
return 1;
}
@@ -571,7 +582,7 @@
}
return 1;
}
- reg:
+ reg:
if (regtype != REG_REGISTER) {
return 0;
@@ -580,7 +591,6 @@
call_id = sip->sip_call_id->i_id; //sip_header_as_string(profile->home, (void *) sip->sip_call_id);
switch_assert(call_id);
-
if (exptime) {
const char *agent = "dunno";
@@ -681,17 +691,23 @@
/*
- if (call_id) {
- su_free(profile->home, call_id);
- }
+ if (call_id) {
+ su_free(profile->home, call_id);
+ }
*/
if (regtype == REG_REGISTER) {
char *new_contact = NULL;
if (exptime) {
- new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
- nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
+ if (nat_hack) {
+ new_contact = switch_mprintf("%s;expires=%ld;received=\"%s:%d\"", contact_str, (long)exptime, network_ip, network_port);
+ } else {
+ new_contact = switch_mprintf("%s;expires=%ld", contact_str, (long)exptime);
+ }
+ nua_respond(nh,
+ SIP_200_OK,
+ SIPTAG_CONTACT_STR(new_contact), NUTAG_WITH_THIS(nua), TAG_END());
switch_safe_free(new_contact);
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", to_user, to_host);
@@ -699,7 +715,20 @@
switch_event_fire(&event);
}
} else {
- nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
+ nua_respond(nh,
+ SIP_200_OK,
+ SIPTAG_CONTACT(contact), NUTAG_WITH_THIS(nua), TAG_END());
+
+ if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) {
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "profile-name", "%s", profile->name);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-user", "%s", to_user);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from-host", "%s", to_host);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s", contact_str);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "call-id", "%s", call_id);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "rpid", "%s", rpid);
+ switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
+ switch_event_fire(&s_event);
+ }
}
return 1;
@@ -716,40 +745,58 @@
switch_event_t *v_event = NULL;
char network_ip[80];
su_addrinfo_t *my_addrinfo = msg_addrinfo(nua_current_request(nua));
+ sofia_regtype_t type = REG_REGISTER;
+ int network_port = 0;
+
+ get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
+ network_port = ntohs(((struct sockaddr_in *) msg_addrinfo(nua_current_request(nua))->ai_addr)->sin_port);
+
+ if (!(sip->sip_contact && sip->sip_contact->m_url)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
+ nua_respond(nh, 400, "Missing Contact Header", TAG_END());
+ goto end;
+ }
+
+ if (!(profile->mflags & MFLAG_REGISTER)) {
+ nua_respond(nh,
+ SIP_403_FORBIDDEN,
+ NUTAG_WITH_THIS(nua), TAG_END());
+ goto end;
+ }
+
if (profile->reg_acl_count) {
uint32_t x = 0;
+ int ok = 1;
+ char *last_acl = NULL;
- get_addr(network_ip, sizeof(network_ip), &((struct sockaddr_in *) my_addrinfo->ai_addr)->sin_addr);
-
for (x = 0 ; x < profile->reg_acl_count; x++) {
- if (!switch_check_network_list_ip(network_ip, profile->reg_acl[x])) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
- nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
- goto end;
+ last_acl = profile->reg_acl[x];
+ if (!(ok = switch_check_network_list_ip(network_ip, last_acl))) {
+ break;
}
}
- }
-
-
- if (!(profile->mflags & MFLAG_REGISTER)) {
- nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
- goto end;
+
+ if (ok && !(profile->pflags & PFLAG_BLIND_REG)) {
+ type = REG_AUTO_REGISTER;
+ } else if (!ok) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl %s\n", network_ip, profile->reg_acl[x]);
+ nua_respond(nh,
+ SIP_403_FORBIDDEN,
+ NUTAG_WITH_THIS(nua), TAG_END());
+ goto end;
+ }
}
if (!sip || !sip->sip_request || !sip->sip_request->rq_method_name) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received an invalid packet!\n");
- nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
- goto end;
- }
-
- if (!(sip->sip_contact && sip->sip_contact->m_url)) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
- nua_respond(nh, 400, "Missing Contact Header", TAG_END());
+ nua_respond(nh,
+ SIP_500_INTERNAL_SERVER_ERROR,
+ TAG_END());
goto end;
}
- sofia_reg_handle_register(nua, profile, nh, sip, REG_REGISTER, key, sizeof(key), &v_event);
+ sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event);
if (v_event) {
switch_event_fire(&v_event);
@@ -763,8 +810,8 @@
void sofia_reg_handle_sip_r_register(int status,
- char const *phrase,
- nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
+ char const *phrase,
+ nua_t * nua, sofia_profile_t *profile, nua_handle_t * nh, sofia_private_t * sofia_private, sip_t const *sip, tagi_t tags[])
{
if (sofia_private && sofia_private->gateway) {
switch (status) {
@@ -866,7 +913,7 @@
}
auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, sip_t const *sip, const char *regstr,
- char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
+ char *np, size_t nplen, char *ip, switch_event_t **v_event, long exptime, sofia_regtype_t regtype, const char *to_user)
{
int indexnum;
const char *cur;
@@ -1177,7 +1224,7 @@
}
}
}
- end:
+ end:
switch_event_destroy(¶ms);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_wanpipe/mod_wanpipe.c Thu May 22 15:05:28 2008
@@ -466,7 +466,7 @@
static switch_status_t wanpipe_on_hangup(switch_core_session_t *session);
static switch_status_t wanpipe_on_exchange_media(switch_core_session_t *session);
static switch_status_t wanpipe_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame,
switch_io_flag_t flags, int stream_id);
@@ -1006,7 +1006,7 @@
/*.on_soft_execute */ wanpipe_on_soft_execute
};
-static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+static switch_call_cause_t wanpipe_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event, switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
char *bchan = NULL;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/endpoints/mod_woomera/mod_woomera.c Thu May 22 15:05:28 2008
@@ -173,7 +173,7 @@
static switch_status_t woomera_on_routing(switch_core_session_t *session);
static switch_status_t woomera_on_exchange_media(switch_core_session_t *session);
static switch_status_t woomera_on_soft_execute(switch_core_session_t *session);
-static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags);
static switch_status_t woomera_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
@@ -401,7 +401,7 @@
/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
*/
-static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session,
+static switch_call_cause_t woomera_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_local_stream/mod_local_stream.c Thu May 22 15:05:28 2008
@@ -184,7 +184,7 @@
return NULL;
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing [%s] rate: %dhz\n", fname, source->rate);
while (RUNNING) {
switch_core_timer_next(&timer);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/formats/mod_sndfile/mod_sndfile.c Thu May 22 15:05:28 2008
@@ -167,7 +167,7 @@
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
+ //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opening File [%s] rate %dhz\n", path, context->sfinfo.samplerate);
handle->samples = (unsigned int) context->sfinfo.frames;
handle->samplerate = context->sfinfo.samplerate;
handle->channels = (uint8_t) context->sfinfo.channels;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java Thu May 22 15:05:28 2008
@@ -121,6 +121,22 @@
return new SWIGTYPE_p_switch_status_t(freeswitchJNI.CoreSession_process_callback_result(swigCPtr, this, ret), true);
}
+ public void say(String tosay, String module_name, String say_type, String say_method) {
+ freeswitchJNI.CoreSession_say(swigCPtr, this, tosay, module_name, say_type, say_method);
+ }
+
+ public void sayPhrase(String phrase_name, String phrase_data, String phrase_lang) {
+ freeswitchJNI.CoreSession_sayPhrase__SWIG_0(swigCPtr, this, phrase_name, phrase_data, phrase_lang);
+ }
+
+ public void sayPhrase(String phrase_name, String phrase_data) {
+ freeswitchJNI.CoreSession_sayPhrase__SWIG_1(swigCPtr, this, phrase_name, phrase_data);
+ }
+
+ public void sayPhrase(String phrase_name) {
+ freeswitchJNI.CoreSession_sayPhrase__SWIG_2(swigCPtr, this, phrase_name);
+ }
+
public int recordFile(String file_name, int max_len, int silence_threshold, int silence_secs) {
return freeswitchJNI.CoreSession_recordFile__SWIG_0(swigCPtr, this, file_name, max_len, silence_threshold, silence_secs);
}
@@ -210,7 +226,11 @@
}
public void execute(String app, String data) {
- freeswitchJNI.CoreSession_execute(swigCPtr, this, app, data);
+ freeswitchJNI.CoreSession_execute__SWIG_0(swigCPtr, this, app, data);
+ }
+
+ public void execute(String app) {
+ freeswitchJNI.CoreSession_execute__SWIG_1(swigCPtr, this, app);
}
public void sendEvent(Event sendME) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java Thu May 22 15:05:28 2008
@@ -81,6 +81,10 @@
public final static native long CoreSession_getPrivate(long jarg1, CoreSession jarg1_, String jarg2);
public final static native String CoreSession_getVariable(long jarg1, CoreSession jarg1_, String jarg2);
public final static native long CoreSession_process_callback_result(long jarg1, CoreSession jarg1_, String jarg2);
+ public final static native void CoreSession_say(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4, String jarg5);
+ public final static native void CoreSession_sayPhrase__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4);
+ public final static native void CoreSession_sayPhrase__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native void CoreSession_sayPhrase__SWIG_2(long jarg1, CoreSession jarg1_, String jarg2);
public final static native int CoreSession_recordFile__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4, int jarg5);
public final static native int CoreSession_recordFile__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2, int jarg3, int jarg4);
public final static native int CoreSession_recordFile__SWIG_2(long jarg1, CoreSession jarg1_, String jarg2, int jarg3);
@@ -103,7 +107,8 @@
public final static native int CoreSession_setAutoHangup(long jarg1, CoreSession jarg1_, boolean jarg2);
public final static native void CoreSession_setHangupHook(long jarg1, CoreSession jarg1_, long jarg2);
public final static native boolean CoreSession_ready(long jarg1, CoreSession jarg1_);
- public final static native void CoreSession_execute(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native void CoreSession_execute__SWIG_0(long jarg1, CoreSession jarg1_, String jarg2, String jarg3);
+ public final static native void CoreSession_execute__SWIG_1(long jarg1, CoreSession jarg1_, String jarg2);
public final static native void CoreSession_sendEvent(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);
public final static native void CoreSession_setEventData(long jarg1, CoreSession jarg1_, long jarg2, Event jarg2_);
public final static native String CoreSession_getXMLCDR(long jarg1, CoreSession jarg1_);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_java/switch_swig_wrap.cpp Thu May 22 15:05:28 2008
@@ -1475,6 +1475,120 @@
}
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1say(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4, jstring jarg5) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ arg4 = 0;
+ if (jarg4) {
+ arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+ if (!arg4) return ;
+ }
+ arg5 = 0;
+ if (jarg5) {
+ arg5 = (char *)jenv->GetStringUTFChars(jarg5, 0);
+ if (!arg5) return ;
+ }
+ (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+ if (arg5) jenv->ReleaseStringUTFChars(jarg5, (const char *)arg5);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ arg4 = 0;
+ if (jarg4) {
+ arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+ if (!arg4) return ;
+ }
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+ if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ arg3 = 0;
+ if (jarg3) {
+ arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+ if (!arg3) return ;
+ }
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+ if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+}
+
+
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sayPhrase_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ (arg1)->sayPhrase((char const *)arg2);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1recordFile_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jint jarg3, jint jarg4, jint jarg5) {
jint jresult = 0 ;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -2005,7 +2119,7 @@
}
-SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3) {
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
char *arg3 = (char *) 0 ;
@@ -2030,6 +2144,24 @@
}
+SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1execute_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ (void)jenv;
+ (void)jcls;
+ (void)jarg1_;
+ arg1 = *(CoreSession **)&jarg1;
+ arg2 = 0;
+ if (jarg2) {
+ arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+ if (!arg2) return ;
+ }
+ (arg1)->execute(arg2);
+ if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+}
+
+
SWIGEXPORT void JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1sendEvent(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jobject jarg2_) {
CoreSession *arg1 = (CoreSession *) 0 ;
Event *arg2 = (Event *) 0 ;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/Makefile Thu May 22 15:05:28 2008
@@ -11,7 +11,7 @@
local_depend: $(LOCAL_OBJS)
$(LIBLUA_A):
- cd lua && $(MAKE) CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
+ cd lua && $(MAKE) CC="$(CC)" CFLAGS="$(ALL_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
luaclean:
cd lua && $(MAKE) clean
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_lua/mod_lua_wrap.cpp Thu May 22 15:05:28 2008
@@ -3750,6 +3750,217 @@
}
+static int _wrap_CoreSession_say(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+
+ SWIG_check_num_args("say",5,5)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *");
+ if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *");
+ if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ arg4 = (char *)lua_tostring(L, 4);
+ arg5 = (char *)lua_tostring(L, 5);
+ (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_sayPhrase__SWIG_0(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+
+ SWIG_check_num_args("sayPhrase",4,4)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
+ if(!lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ arg4 = (char *)lua_tostring(L, 4);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_sayPhrase__SWIG_1(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+
+ SWIG_check_num_args("sayPhrase",3,3)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+ if(!lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ arg3 = (char *)lua_tostring(L, 3);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_sayPhrase__SWIG_2(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ SWIG_check_num_args("sayPhrase",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ (arg1)->sayPhrase((char const *)arg2);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_sayPhrase(lua_State* L) {
+ int argc;
+ int argv[5]={
+ 1,2,3,4,5
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_2(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_1(L);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[2]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[3]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_0(L);
+ }
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L,"No matching function for overloaded 'CoreSession_sayPhrase'");
+ lua_error(L);return 0;
+}
+
+
static int _wrap_CoreSession_recordFile__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -4696,7 +4907,7 @@
}
-static int _wrap_CoreSession_execute(lua_State* L) {
+static int _wrap_CoreSession_execute__SWIG_0(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
@@ -4726,6 +4937,89 @@
}
+static int _wrap_CoreSession_execute__SWIG_1(lua_State* L) {
+ int SWIG_arg = -1;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+
+ SWIG_check_num_args("execute",2,2)
+ if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *");
+ if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char *");
+
+ if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){
+ SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession);
+ }
+
+ arg2 = (char *)lua_tostring(L, 2);
+ (arg1)->execute(arg2);
+ SWIG_arg=0;
+
+ return SWIG_arg;
+
+ if(0) SWIG_fail;
+
+fail:
+ lua_error(L);
+ return SWIG_arg;
+}
+
+
+static int _wrap_CoreSession_execute(lua_State* L) {
+ int argc;
+ int argv[4]={
+ 1,2,3,4
+ };
+
+ argc = lua_gettop(L);
+ if (argc == 2) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_1(L);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ {
+ void *ptr;
+ if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) {
+ _v = 0;
+ } else {
+ _v = 1;
+ }
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[1]);
+ }
+ if (_v) {
+ {
+ _v = lua_isstring(L,argv[2]);
+ }
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_0(L);
+ }
+ }
+ }
+ }
+
+ lua_pushstring(L,"No matching function for overloaded 'CoreSession_execute'");
+ lua_error(L);return 0;
+}
+
+
static int _wrap_CoreSession_sendEvent(lua_State* L) {
int SWIG_arg = -1;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -4993,6 +5287,8 @@
{"getPrivate", _wrap_CoreSession_getPrivate},
{"getVariable", _wrap_CoreSession_getVariable},
{"process_callback_result", _wrap_CoreSession_process_callback_result},
+ {"say", _wrap_CoreSession_say},
+ {"sayPhrase", _wrap_CoreSession_sayPhrase},
{"recordFile", _wrap_CoreSession_recordFile},
{"setCallerData", _wrap_CoreSession_setCallerData},
{"originate", _wrap_CoreSession_originate},
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/freeswitch.pm Thu May 22 15:05:28 2008
@@ -308,6 +308,8 @@
*getPrivate = *freeswitchc::CoreSession_getPrivate;
*getVariable = *freeswitchc::CoreSession_getVariable;
*process_callback_result = *freeswitchc::CoreSession_process_callback_result;
+*say = *freeswitchc::CoreSession_say;
+*sayPhrase = *freeswitchc::CoreSession_sayPhrase;
*recordFile = *freeswitchc::CoreSession_recordFile;
*setCallerData = *freeswitchc::CoreSession_setCallerData;
*originate = *freeswitchc::CoreSession_originate;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_perl/mod_perl_wrap.cpp Thu May 22 15:05:28 2008
@@ -4700,6 +4700,357 @@
}
+XS(_wrap_CoreSession_say) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int res5 ;
+ char *buf5 = 0 ;
+ int alloc5 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 5) || (items > 5)) {
+ SWIG_croak("Usage: CoreSession_say(self,tosay,module_name,say_type,say_method);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ res5 = SWIG_AsCharPtrAndSize(ST(4), &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+ }
+ arg5 = reinterpret_cast< char * >(buf5);
+ (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_0) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 4) || (items > 4)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data,phrase_lang);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 3) || (items > 3)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name,phrase_data);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase__SWIG_2) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_sayPhrase(self,phrase_name);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ (arg1)->sayPhrase((char const *)arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_sayPhrase) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 1;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 2;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_2:
+
+ if (items == 4) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_3;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_3;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_3;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_3;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 3;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_3:
+
+ dispatch:
+ switch(_index) {
+ case 1:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_2); return;
+ case 2:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_1); return;
+ case 3:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_sayPhrase__SWIG_0); return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_sayPhrase'");
+ XSRETURN(0);
+}
+
+
XS(_wrap_CoreSession_recordFile__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -6196,7 +6547,7 @@
}
-XS(_wrap_CoreSession_execute) {
+XS(_wrap_CoreSession_execute__SWIG_0) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
@@ -6245,6 +6596,130 @@
}
+XS(_wrap_CoreSession_execute__SWIG_1) {
+ {
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int argvi = 0;
+ dXSARGS;
+
+ if ((items < 2) || (items > 2)) {
+ SWIG_croak("Usage: CoreSession_execute(self,app);");
+ }
+ res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ (arg1)->execute(arg2);
+
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ XSRETURN(argvi);
+ fail:
+
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ SWIG_croak_null();
+ }
+}
+
+
+XS(_wrap_CoreSession_execute) {
+ dXSARGS;
+
+ {
+ unsigned long _index = 0;
+ SWIG_TypeRank _rank = 0;
+ if (items == 2) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_1;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 1;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_1:
+
+ if (items == 3) {
+ SWIG_TypeRank _ranki = 0;
+ SWIG_TypeRank _rankm = 0;
+ SWIG_TypeRank _pi = 1;
+ int _v = 0;
+ {
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(ST(0), &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ {
+ int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ }
+ if (!_v) goto check_2;
+ _ranki += _v*_pi;
+ _rankm += _pi;
+ _pi *= SWIG_MAXCASTRANK;
+ if (!_index || (_ranki < _rank)) {
+ _rank = _ranki; _index = 2;
+ if (_rank == _rankm) goto dispatch;
+ }
+ }
+ check_2:
+
+ dispatch:
+ switch(_index) {
+ case 1:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_1); return;
+ case 2:
+ ++PL_markstack_ptr; SWIG_CALLXS(_wrap_CoreSession_execute__SWIG_0); return;
+ }
+ }
+
+ croak("No matching function for overloaded 'CoreSession_execute'");
+ XSRETURN(0);
+}
+
+
XS(_wrap_CoreSession_sendEvent) {
{
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7796,6 +8271,8 @@
{"freeswitchc::CoreSession_getPrivate", _wrap_CoreSession_getPrivate},
{"freeswitchc::CoreSession_getVariable", _wrap_CoreSession_getVariable},
{"freeswitchc::CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result},
+{"freeswitchc::CoreSession_say", _wrap_CoreSession_say},
+{"freeswitchc::CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase},
{"freeswitchc::CoreSession_recordFile", _wrap_CoreSession_recordFile},
{"freeswitchc::CoreSession_setCallerData", _wrap_CoreSession_setCallerData},
{"freeswitchc::CoreSession_originate", _wrap_CoreSession_originate},
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/Makefile.in Thu May 22 15:05:28 2008
@@ -4,10 +4,12 @@
# and define these variables to impact your build
LOCAL_CFLAGS = @PYTHON_CFLAGS@
-LOCAL_LDFLAGS= @PYTHON_LDFLAGS@ -lstdc++
+LOCAL_LDFLAGS= @PYTHON_LDFLAGS@
LOCAL_OBJS=freeswitch_python.o mod_python_wrap.o
include ../../../../build/modmake.rules
+LINK=$(CXXLINK)
+
PYMOD=freeswitch
PYTHON_SITE_DIR=@PYTHON_SITE_DIR@
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/freeswitch.py Thu May 22 15:05:28 2008
@@ -199,6 +199,8 @@
def getPrivate(*args): return _freeswitch.CoreSession_getPrivate(*args)
def getVariable(*args): return _freeswitch.CoreSession_getVariable(*args)
def process_callback_result(*args): return _freeswitch.CoreSession_process_callback_result(*args)
+ def say(*args): return _freeswitch.CoreSession_say(*args)
+ def sayPhrase(*args): return _freeswitch.CoreSession_sayPhrase(*args)
def recordFile(*args): return _freeswitch.CoreSession_recordFile(*args)
def setCallerData(*args): return _freeswitch.CoreSession_setCallerData(*args)
def originate(*args): return _freeswitch.CoreSession_originate(*args)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/languages/mod_python/mod_python_wrap.cpp Thu May 22 15:05:28 2008
@@ -5289,6 +5289,282 @@
}
+SWIGINTERN PyObject *_wrap_CoreSession_say(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ char *arg5 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ int res5 ;
+ char *buf5 = 0 ;
+ int alloc5 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+ PyObject * obj4 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOOOO:CoreSession_say",&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_say" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_say" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_say" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_say" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ res5 = SWIG_AsCharPtrAndSize(obj4, &buf5, NULL, &alloc5);
+ if (!SWIG_IsOK(res5)) {
+ SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "CoreSession_say" "', argument " "5"" of type '" "char const *""'");
+ }
+ arg5 = reinterpret_cast< char * >(buf5);
+ (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ if (alloc5 == SWIG_NEWOBJ) delete[] buf5;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ char *arg4 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ int res4 ;
+ char *buf4 = 0 ;
+ int alloc4 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+ PyObject * obj3 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+ if (!SWIG_IsOK(res4)) {
+ SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "CoreSession_sayPhrase" "', argument " "4"" of type '" "char const *""'");
+ }
+ arg4 = reinterpret_cast< char * >(buf4);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ char *arg3 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ int res3 ;
+ char *buf3 = 0 ;
+ int alloc3 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+ PyObject * obj2 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OOO:CoreSession_sayPhrase",&obj0,&obj1,&obj2)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+ if (!SWIG_IsOK(res3)) {
+ SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_sayPhrase" "', argument " "3"" of type '" "char const *""'");
+ }
+ arg3 = reinterpret_cast< char * >(buf3);
+ (arg1)->sayPhrase((char const *)arg2,(char const *)arg3);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_sayPhrase",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_sayPhrase" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_sayPhrase" "', argument " "2"" of type '" "char const *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ (arg1)->sayPhrase((char const *)arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_sayPhrase(PyObject *self, PyObject *args) {
+ int argc;
+ PyObject *argv[5];
+ int ii;
+
+ if (!PyTuple_Check(args)) SWIG_fail;
+ argc = (int)PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 4); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args,ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_2(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_1(self, args);
+ }
+ }
+ }
+ }
+ if (argc == 4) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_sayPhrase__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+ }
+
+fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_sayPhrase'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " sayPhrase(CoreSession *,char const *,char const *,char const *)\n"
+ " sayPhrase(CoreSession *,char const *,char const *)\n"
+ " sayPhrase(CoreSession *,char const *)\n");
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_CoreSession_recordFile__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -6484,7 +6760,7 @@
}
-SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
char *arg2 = (char *) 0 ;
@@ -6529,6 +6805,89 @@
}
+SWIGINTERN PyObject *_wrap_CoreSession_execute__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+ PyObject *resultobj = 0;
+ CoreSession *arg1 = (CoreSession *) 0 ;
+ char *arg2 = (char *) 0 ;
+ void *argp1 = 0 ;
+ int res1 = 0 ;
+ int res2 ;
+ char *buf2 = 0 ;
+ int alloc2 = 0 ;
+ PyObject * obj0 = 0 ;
+ PyObject * obj1 = 0 ;
+
+ if (!PyArg_ParseTuple(args,(char *)"OO:CoreSession_execute",&obj0,&obj1)) SWIG_fail;
+ res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 );
+ if (!SWIG_IsOK(res1)) {
+ SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_execute" "', argument " "1"" of type '" "CoreSession *""'");
+ }
+ arg1 = reinterpret_cast< CoreSession * >(argp1);
+ res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+ if (!SWIG_IsOK(res2)) {
+ SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_execute" "', argument " "2"" of type '" "char *""'");
+ }
+ arg2 = reinterpret_cast< char * >(buf2);
+ (arg1)->execute(arg2);
+ resultobj = SWIG_Py_Void();
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return resultobj;
+fail:
+ if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+ return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_CoreSession_execute(PyObject *self, PyObject *args) {
+ int argc;
+ PyObject *argv[4];
+ int ii;
+
+ if (!PyTuple_Check(args)) SWIG_fail;
+ argc = (int)PyObject_Length(args);
+ for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+ argv[ii] = PyTuple_GET_ITEM(args,ii);
+ }
+ if (argc == 2) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_1(self, args);
+ }
+ }
+ }
+ if (argc == 3) {
+ int _v;
+ void *vptr = 0;
+ int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_CoreSession, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+ _v = SWIG_CheckState(res);
+ if (_v) {
+ return _wrap_CoreSession_execute__SWIG_0(self, args);
+ }
+ }
+ }
+ }
+
+fail:
+ SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'CoreSession_execute'.\n"
+ " Possible C/C++ prototypes are:\n"
+ " execute(CoreSession *,char *,char *)\n"
+ " execute(CoreSession *,char *)\n");
+ return NULL;
+}
+
+
SWIGINTERN PyObject *_wrap_CoreSession_sendEvent(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
CoreSession *arg1 = (CoreSession *) 0 ;
@@ -7358,6 +7717,8 @@
{ (char *)"CoreSession_getPrivate", _wrap_CoreSession_getPrivate, METH_VARARGS, NULL},
{ (char *)"CoreSession_getVariable", _wrap_CoreSession_getVariable, METH_VARARGS, NULL},
{ (char *)"CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result, METH_VARARGS, NULL},
+ { (char *)"CoreSession_say", _wrap_CoreSession_say, METH_VARARGS, NULL},
+ { (char *)"CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase, METH_VARARGS, NULL},
{ (char *)"CoreSession_recordFile", _wrap_CoreSession_recordFile, METH_VARARGS, NULL},
{ (char *)"CoreSession_setCallerData", _wrap_CoreSession_setCallerData, METH_VARARGS, NULL},
{ (char *)"CoreSession_originate", _wrap_CoreSession_originate, METH_VARARGS, NULL},
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c Thu May 22 15:05:28 2008
@@ -43,6 +43,8 @@
char *cred;
int disable100continue;
uint32_t ignore_cacert_check;
+ switch_hash_t* vars_map;
+ switch_memory_pool_t* vars_map_pool;
};
static int keep_files_around = 0;
@@ -110,7 +112,7 @@
struct curl_slist *headers = NULL;
char hostname[256] = "";
char basic_data[512];
-
+
gethostname(hostname, sizeof(hostname));
if (!binding) {
@@ -134,7 +136,7 @@
switch_str_nil(key_name),
switch_str_nil(key_value));
- data = switch_event_build_param_string(params, basic_data);
+ data = switch_event_build_param_string(params, basic_data,binding->vars_map);
switch_assert(data);
switch_uuid_get(&uuid);
@@ -204,14 +206,17 @@
return xml;
}
-
+#define ENABLE_PARAM_VALUE "enabled"
static switch_status_t do_config(void)
{
char *cf = "xml_curl.conf";
switch_xml_t cfg, xml, bindings_tag, binding_tag, param;
xml_binding_t *binding = NULL;
int x = 0;
-
+ int need_vars_map = 0;
+ switch_hash_t* vars_map = NULL;
+ switch_memory_pool_t* vars_map_pool = NULL;
+
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
return SWITCH_STATUS_TERM;
@@ -244,7 +249,29 @@
disable100continue = 1;
} else if (!strcasecmp(var, "ignore-cacert-check") && switch_true(val)) {
ignore_cacert_check = 1;
- }
+ } else if(!strcasecmp(var, "enable-post-var")) {
+ if (!vars_map && need_vars_map == 0) {
+ if (switch_core_new_memory_pool(&vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+ need_vars_map = -1;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant create memory pool!\n");
+ continue;
+ }
+
+ if (switch_core_hash_init(&vars_map,vars_map_pool) != SWITCH_STATUS_SUCCESS) {
+ need_vars_map = -1;
+ switch_core_destroy_memory_pool(&vars_map_pool);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant init params hash!\n");
+ continue;
+ }
+ need_vars_map = 1;
+ }
+
+ if (vars_map && val)
+ if (switch_core_hash_insert(vars_map, val, ENABLE_PARAM_VALUE) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cant add %s to params hash!\n",val);
+ }
+
+ }
}
if (!url) {
@@ -269,6 +296,9 @@
binding->disable100continue = disable100continue;
binding->ignore_cacert_check = ignore_cacert_check;
+
+ binding->vars_map = vars_map;
+ binding->vars_map_pool = vars_map_pool;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch.c Thu May 22 15:05:28 2008
@@ -404,6 +404,10 @@
x++;
if (argv[x] && strlen(argv[x])) {
SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(argv[x]) + 1);
+ if (!SWITCH_GLOBAL_dirs.conf_dir) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
strcpy(SWITCH_GLOBAL_dirs.conf_dir, argv[x]);
alt_dirs++;
} else {
@@ -417,6 +421,10 @@
x++;
if (argv[x] && strlen(argv[x])) {
SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(argv[x]) + 1);
+ if (!SWITCH_GLOBAL_dirs.log_dir) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
strcpy(SWITCH_GLOBAL_dirs.log_dir, argv[x]);
alt_dirs++;
} else {
@@ -430,6 +438,10 @@
x++;
if (argv[x] && strlen(argv[x])) {
SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(argv[x]) + 1);
+ if (!SWITCH_GLOBAL_dirs.db_dir) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
strcpy(SWITCH_GLOBAL_dirs.db_dir, argv[x]);
alt_dirs++;
} else {
@@ -443,6 +455,10 @@
x++;
if (argv[x] && strlen(argv[x])) {
SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(argv[x]) + 1);
+ if (!SWITCH_GLOBAL_dirs.script_dir) {
+ fprintf(stderr, "Allocation error\n");
+ return 255;
+ }
strcpy(SWITCH_GLOBAL_dirs.script_dir, argv[x]);
} else {
fprintf(stderr, "When using -scripts you must specify a scripts directory\n");
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_channel.c Thu May 22 15:05:28 2008
@@ -130,7 +130,7 @@
uint8_t x;
const char *str = "UNKNOWN";
- for (x = 0; CAUSE_CHART[x].name; x++) {
+ for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) ; x++) {
if (CAUSE_CHART[x].cause == cause) {
str = CAUSE_CHART[x].name;
}
@@ -147,7 +147,7 @@
if (*str > 47 && *str < 58) {
cause = atoi(str);
} else {
- for (x = 0; CAUSE_CHART[x].name; x++) {
+ for (x = 0; x < (sizeof(CAUSE_CHART) / sizeof(struct switch_cause_table)) && CAUSE_CHART[x].name; x++) {
if (!strcasecmp(CAUSE_CHART[x].name, str)) {
cause = CAUSE_CHART[x].cause;
}
@@ -585,7 +585,7 @@
return SWITCH_STATUS_FALSE;
}
-SWITCH_DECLARE(int) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flags)
{
switch_assert(channel != NULL);
return switch_test_flag(channel, flags) ? 1 : 0;
@@ -776,6 +776,8 @@
channel->state_flags = 0;
}
+ switch_clear_flag(channel, CF_TAGGED);
+
if (channel->state >= CS_ROUTING) {
switch_clear_flag(channel, CF_TRANSFER);
switch_channel_presence(channel, "unknown", (char *) state_names[state]);
@@ -1270,10 +1272,9 @@
int index, i = channel->state_handler_index;
const switch_state_handler_table_t *new_handlers[SWITCH_MAX_STATE_HANDLERS] = { 0 };
+ switch_assert(channel != NULL);
switch_mutex_lock(channel->flag_mutex);
-
- switch_assert(channel != NULL);
channel->state_handler_index = 0;
if (state_handler) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_config.c Thu May 22 15:05:28 2008
@@ -66,7 +66,7 @@
}
cfg->file = f;
- cfg->path = path;
+ switch_set_string(cfg->path, path);
while (switch_config_next_pair(cfg, &var, &val)) {
if (file_path && (cfg->sectno != last) && !strcmp(cfg->section, file_path)) {
@@ -83,7 +83,7 @@
return 0;
} else {
cfg->file = f;
- cfg->path = path;
+ switch_set_string(cfg->path, path);
return 1;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_console.c Thu May 22 15:05:28 2008
@@ -824,7 +824,7 @@
for (x = 0; x < (sizeof(cmd) - 1); x++) {
int c = getchar();
if (c < 0) {
- int y = read(fileno(stdin), cmd, sizeof(cmd));
+ int y = read(fileno(stdin), cmd, sizeof(cmd) - 1);
cmd[y - 1] = '\0';
break;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core.c Thu May 22 15:05:28 2008
@@ -369,6 +369,16 @@
runtime.memory_pool);
switch_safe_free(dir_path);
+ switch_assert(SWITCH_GLOBAL_dirs.base_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.mod_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.conf_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.log_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.db_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.script_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.htdocs_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.grammar_dir);
+ switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
+
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
@@ -571,12 +581,14 @@
SWITCH_DECLARE(switch_status_t) switch_core_mime_add_type(const char *type, const char *ext)
{
- const char *check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
+ const char *check;
switch_status_t status = SWITCH_STATUS_FALSE;
switch_assert(type);
switch_assert(ext);
+ check = (const char *) switch_core_hash_find(runtime.mime_types, ext);
+
if (!check) {
char *ptype = switch_core_permanent_strdup(type);
char *ext_list = strdup(ext);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_db.c Thu May 22 15:05:28 2008
@@ -96,6 +96,10 @@
if (errmsg) {
*errmsg = err;
+ } else if (err) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", err);
+ switch_core_db_free(err);
+ err = NULL;
}
return ret;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_io.c Thu May 22 15:05:28 2008
@@ -61,6 +61,8 @@
switch_status_t status = SWITCH_STATUS_FALSE;
switch_io_event_hook_video_read_frame_t *ptr;
+ switch_assert(session != NULL);
+
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
@@ -84,7 +86,6 @@
goto done;
}
- switch_assert(session != NULL);
switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_CNG)) {
@@ -104,7 +105,9 @@
int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0;
unsigned int flag = 0;
- top:
+ switch_assert(session != NULL);
+
+top:
if (switch_channel_get_state(session->channel) >= CS_HANGUP) {
*frame = NULL;
@@ -115,7 +118,6 @@
status = SWITCH_STATUS_FALSE;
need_codec = perfect = 0;
- switch_assert(session != NULL);
*frame = NULL;
if (switch_channel_test_flag(session->channel, CF_HOLD)) {
@@ -142,7 +144,6 @@
goto done;
}
- switch_assert(session != NULL);
switch_assert(*frame != NULL);
if (switch_test_flag(*frame, SFF_PROXY_PACKET)) {
@@ -192,6 +193,14 @@
if (status == SWITCH_STATUS_SUCCESS && need_codec) {
switch_frame_t *enc_frame, *read_frame = *frame;
+ if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
+ switch_core_session_message_t msg = { 0 };
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+ switch_core_session_receive_message(session, &msg);
+ switch_set_flag(session, SSF_WARN_TRANSCODE);
+ }
+
if (read_frame->codec || is_cng) {
session->raw_read_frame.datalen = session->raw_read_frame.buflen;
@@ -558,6 +567,14 @@
}
if (need_codec) {
+ if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
+ switch_core_session_message_t msg = { 0 };
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+ switch_core_session_receive_message(session, &msg);
+ switch_set_flag(session, SSF_WARN_TRANSCODE);
+ }
+
if (frame->codec) {
session->raw_write_frame.datalen = session->raw_write_frame.buflen;
status = switch_core_codec_decode(frame->codec,
@@ -945,7 +962,7 @@
}
for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) {
- if ((status = ptr->recv_dtmf(session, &new_dtmf)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) {
return status;
}
}
@@ -976,7 +993,7 @@
for (ptr = session->event_hooks.send_dtmf; ptr; ptr = ptr->next) {
- if ((status = ptr->send_dtmf(session, dtmf)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = ptr->send_dtmf(session, dtmf, SWITCH_DTMF_SEND)) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_SUCCESS;
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_session.c Thu May 22 15:05:28 2008
@@ -188,12 +188,12 @@
return endpoint_interface->io_routines->resurrect_session(new_session, pool, data);
}
-SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session,
- const char *endpoint_name,
- switch_caller_profile_t *caller_profile,
- switch_core_session_t **new_session,
- switch_memory_pool_t **pool,
- switch_originate_flag_t flags)
+ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
+ const char *endpoint_name,
+ switch_caller_profile_t *caller_profile,
+ switch_core_session_t **new_session,
+ switch_memory_pool_t **pool,
+ switch_originate_flag_t flags)
{
switch_io_event_hook_outgoing_channel_t *ptr;
switch_status_t status = SWITCH_STATUS_FALSE;
@@ -217,6 +217,8 @@
if (session) {
channel = switch_core_session_get_channel(session);
+ switch_assert(channel != NULL);
+
forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
if (!switch_strlen_zero(forwardvar)) {
forwardval = atoi(forwardvar) - 1;
@@ -247,13 +249,13 @@
}
}
- if ((cause = endpoint_interface->io_routines->outgoing_channel(session, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
+ if ((cause = endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags)) != SWITCH_CAUSE_SUCCESS) {
return cause;
}
if (session) {
for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) {
- if ((status = ptr->outgoing_channel(session, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) {
break;
}
}
@@ -267,20 +269,20 @@
switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
switch_event_t *event;
switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session);
+
+ switch_assert(peer_channel);
+
+ peer_profile = switch_channel_get_caller_profile(peer_channel);
- if (session && channel) {
- profile = switch_channel_get_caller_profile(channel);
- }
- if (peer_channel) {
- peer_profile = switch_channel_get_caller_profile(peer_channel);
- }
-
- if (channel && peer_channel) {
+ if (channel) {
const char *export_vars, *val;
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
const char *max_forwards = switch_core_session_sprintf(session, "%d", forwardval);
+
switch_channel_set_variable(peer_channel, SWITCH_MAX_FORWARDS_VARIABLE, max_forwards);
+ profile = switch_channel_get_caller_profile(channel);
+
if (read_codec) {
char tmp[80];
switch_codec2str(read_codec, tmp, sizeof(tmp));
@@ -336,7 +338,7 @@
}
if (peer_profile) {
- if (session && (cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
+ if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
}
}
@@ -571,7 +573,9 @@
SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(switch_core_session_t *session)
{
- if (session->private_event_queue) {
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+
+ if (!switch_channel_test_flag(channel, CF_EVENT_LOCK) && session->private_event_queue) {
return switch_queue_size(session->private_event_queue);
}
@@ -634,6 +638,7 @@
}
}
+ switch_clear_flag(session, SSF_WARN_TRANSCODE);
switch_ivr_deactivate_unicast(session);
switch_channel_clear_flag(channel, CF_BREAK);
}
@@ -1095,7 +1100,10 @@
if ((dparg = strchr(dpname, ':'))) {
*dparg++ = '\0';
}
+ } else {
+ continue;
}
+
if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
continue;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_sqldb.c Thu May 22 15:05:28 2008
@@ -71,9 +71,10 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL Retry [%s]\n", errmsg);
}
switch_core_db_free(errmsg);
+ errmsg = NULL;
if (again) {
- switch_core_db_exec(db, "end transaction", NULL, NULL, &errmsg);
+ switch_core_db_exec(db, "end transaction", NULL, NULL, NULL);
goto again;
}
@@ -93,6 +94,7 @@
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n", errmsg);
switch_core_db_free(errmsg);
+ errmsg = NULL;
switch_yield(100000);
retries--;
if (retries == 0 && forever) {
@@ -107,7 +109,7 @@
done:
- switch_core_db_exec(db, "end transaction", NULL, NULL, &errmsg);
+ switch_core_db_exec(db, "end transaction", NULL, NULL, NULL);
return status;
}
@@ -234,6 +236,8 @@
{
char *sql = NULL;
+ switch_assert(event);
+
switch (event->event_id) {
case SWITCH_EVENT_ADD_SCHEDULE:
sql = switch_mprintf("insert into tasks values('%q','%q','%q','%q')",
@@ -282,10 +286,14 @@
);
break;
case SWITCH_EVENT_CHANNEL_STATE:
- if (event) {
+ {
char *state = switch_event_get_header_nil(event, "channel-state-number");
- switch_channel_state_t state_i = atoi(state);
+ switch_channel_state_t state_i = CS_DONE;
+ if (!switch_strlen_zero(state)) {
+ state_i = atoi(state);
+ }
+
switch (state_i) {
case CS_HANGUP:
case CS_DONE:
@@ -300,18 +308,15 @@
switch_event_get_header_nil(event, "caller-destination-number"),
switch_event_get_header_nil(event, "caller-dialplan"),
switch_event_get_header_nil(event, "caller-context"),
- switch_event_get_header_nil(event, "unique-id")
- );
+ switch_event_get_header_nil(event, "unique-id"));
break;
default:
sql = switch_mprintf("update channels set state='%s' where uuid='%s'",
- switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "unique-id")
- );
+ switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "unique-id"));
break;
}
-
+ break;
}
- break;
case SWITCH_EVENT_CHANNEL_BRIDGE:
sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s')",
switch_event_get_header_nil(event, "event-date-local"),
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_core_state_machine.c Thu May 22 15:05:28 2008
@@ -84,6 +84,8 @@
if ((dparg = strchr(dpname, ':'))) {
*dparg++ = '\0';
}
+ } else {
+ continue;
}
if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
continue;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_cpp.cpp Thu May 22 15:05:28 2008
@@ -77,6 +77,8 @@
{
switch_ivr_action_t ivr_action = SWITCH_IVR_ACTION_NOOP;
+ this_check_void();
+
if (switch_ivr_menu_str2action(action, &ivr_action) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "bind %s to %s(%s)\n", bind, action, arg);
switch_ivr_menu_bind_action(menu, ivr_action, arg, bind);
@@ -87,6 +89,7 @@
SWITCH_DECLARE(void) IVRMenu::execute(CoreSession *session, const char *name)
{
+ this_check_void();
switch_ivr_menu_execute(session->session, menu, (char *)name, NULL);
}
@@ -104,6 +107,7 @@
SWITCH_DECLARE(char *) API::execute(const char *cmd, const char *arg)
{
switch_stream_handle_t stream = { 0 };
+ this_check("");
SWITCH_STANDARD_STREAM(stream);
switch_api_execute(cmd, arg, NULL, &stream);
last_data = (char *) stream.data;
@@ -118,6 +122,8 @@
switch_assert(mycmd);
+ this_check("");
+
if ((arg = strchr(mycmd, ' '))) {
*arg++ = '\0';
}
@@ -168,6 +174,8 @@
{
int isxml = 0;
+ this_check("");
+
if (serialized_string) {
free(serialized_string);
}
@@ -201,6 +209,9 @@
SWITCH_DECLARE(bool) Event::fire(void)
{
+
+ this_check(false);
+
if (!mine) {
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "Not My event!\n");
return false;
@@ -218,6 +229,8 @@
SWITCH_DECLARE(bool) Event::setPriority(switch_priority_t priority)
{
+ this_check(false);
+
if (event) {
switch_event_set_priority(event, priority);
return true;
@@ -227,6 +240,8 @@
SWITCH_DECLARE(char *)Event::getHeader(char *header_name)
{
+ this_check("");
+
if (event) {
return switch_event_get_header(event, header_name);
}
@@ -235,6 +250,8 @@
SWITCH_DECLARE(bool) Event::addHeader(const char *header_name, const char *value)
{
+ this_check(false);
+
if (event) {
return switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, value) == SWITCH_STATUS_SUCCESS ? true : false;
}
@@ -244,6 +261,8 @@
SWITCH_DECLARE(bool) Event::delHeader(const char *header_name)
{
+ this_check(false);
+
if (event) {
return switch_event_del_header(event, header_name) == SWITCH_STATUS_SUCCESS ? true : false;
}
@@ -254,6 +273,8 @@
SWITCH_DECLARE(bool) Event::addBody(const char *value)
{
+ this_check(false);
+
if (event) {
return switch_event_add_body(event, "%s", value) == SWITCH_STATUS_SUCCESS ? true : false;
}
@@ -263,6 +284,9 @@
SWITCH_DECLARE(char *)Event::getBody(void)
{
+
+ this_check((char *)"");
+
if (event) {
return switch_event_get_body(event);
}
@@ -272,6 +296,8 @@
SWITCH_DECLARE(const char *)Event::getType(void)
{
+ this_check("");
+
if (event) {
return switch_event_name(event->event_id);
}
@@ -302,11 +328,14 @@
SWITCH_DECLARE(void) Stream::write(const char *data)
{
+ this_check_void();
stream_p->write_function(stream_p, "%s", data);
}
SWITCH_DECLARE(const char *)Stream::get_data()
{
+ this_check("");
+
return stream_p ? (const char *)stream_p->data : NULL;
}
@@ -392,7 +421,8 @@
{
switch_xml_t cdr;
-
+
+ this_check((char *)"");
sanity_check((char *)"");
switch_safe_free(xml_cdr_text);
@@ -407,6 +437,7 @@
SWITCH_DECLARE(void) CoreSession::setEventData(Event *e)
{
+ this_check_void();
sanity_check_noreturn;
if (channel && e->event) {
@@ -417,7 +448,7 @@
SWITCH_DECLARE(int) CoreSession::answer()
{
switch_status_t status;
-
+ this_check(-1);
sanity_check(-1);
status = switch_channel_answer(channel);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
@@ -426,6 +457,7 @@
SWITCH_DECLARE(int) CoreSession::preAnswer()
{
switch_status_t status;
+ this_check(-1);
sanity_check(-1);
status = switch_channel_pre_answer(channel);
return status == SWITCH_STATUS_SUCCESS ? 1 : 0;
@@ -433,8 +465,9 @@
SWITCH_DECLARE(void) CoreSession::hangup(char *cause)
{
+ this_check_void();
+ sanity_check_noreturn;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::hangup\n");
- sanity_check_noreturn;
this->begin_allow_threads();
switch_channel_hangup(channel, switch_channel_str2cause(cause));
this->end_allow_threads();
@@ -442,31 +475,36 @@
SWITCH_DECLARE(void) CoreSession::setPrivate(char *var, void *val)
{
+ this_check_void();
sanity_check_noreturn;
switch_channel_set_private(channel, var, val);
}
SWITCH_DECLARE(void *)CoreSession::getPrivate(char *var)
{
+ this_check(NULL);
sanity_check(NULL);
return switch_channel_get_private(channel, var);
}
SWITCH_DECLARE(void) CoreSession::setVariable(char *var, char *val)
{
+ this_check_void();
sanity_check_noreturn;
switch_channel_set_variable(channel, var, val);
}
SWITCH_DECLARE(const char *)CoreSession::getVariable(char *var)
{
- sanity_check(NULL);
+ this_check("");
+ sanity_check("");
return switch_channel_get_variable(channel, var);
}
SWITCH_DECLARE(void) CoreSession::execute(char *app, char *data)
{
const switch_application_interface_t *application_interface;
+ this_check_void();
sanity_check_noreturn;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::execute. app: %s data:%s\n", app, data);
@@ -479,6 +517,7 @@
SWITCH_DECLARE(void) CoreSession::setDTMFCallback(void *cbfunc, char *funcargs) {
+ this_check_void();
sanity_check_noreturn;
cb_state.funcargs = funcargs;
@@ -501,6 +540,9 @@
SWITCH_DECLARE(void) CoreSession::sendEvent(Event *sendME)
{
+ this_check_void();
+ sanity_check_noreturn;
+
if (sendME->event) {
switch_event_t *new_event;
if (switch_event_dup(&new_event, sendME->event) == SWITCH_STATUS_SUCCESS) {
@@ -513,6 +555,7 @@
{
switch_status_t status;
+ this_check(-1);
sanity_check(-1);
// create and store an empty filehandle in callback args
@@ -539,6 +582,7 @@
SWITCH_DECLARE(void) CoreSession::set_tts_parms(char *tts_name_p, char *voice_name_p)
{
+ this_check_void();
sanity_check_noreturn;
switch_safe_free(tts_name);
switch_safe_free(voice_name);
@@ -549,6 +593,7 @@
SWITCH_DECLARE(int) CoreSession::collectDigits(int timeout) {
+ this_check(-1);
sanity_check(-1);
begin_allow_threads();
switch_ivr_collect_digits_callback(session, ap, timeout);
@@ -561,6 +606,7 @@
int timeout)
{
switch_status_t status;
+ this_check((char *)"");
sanity_check((char *)"");
begin_allow_threads();
char terminator;
@@ -582,6 +628,7 @@
SWITCH_DECLARE(int) CoreSession::transfer(char *extension, char *dialplan, char *context)
{
switch_status_t status;
+ this_check(-1);
sanity_check(-1);
begin_allow_threads();
status = switch_ivr_session_transfer(session, extension, dialplan, context);
@@ -597,6 +644,8 @@
int timeout,
const char *valid_terminators)
{
+ this_check((char *)"");
+ sanity_check((char *)"");
if (min_digits < 1) {
min_digits = 1;
}
@@ -624,6 +673,7 @@
{
switch_status_t status;
sanity_check((char *)"");
+ this_check((char *)"");
begin_allow_threads();
memset(dtmf_buf, 0, sizeof(dtmf_buf));
status = switch_play_and_get_digits( session,
@@ -644,12 +694,41 @@
return dtmf_buf;
}
+SWITCH_DECLARE(void) CoreSession::say(const char *tosay, const char *module_name, const char *say_type, const char *say_method)
+{
+ this_check_void();
+ sanity_check_noreturn;
+ if (!(tosay && module_name && say_type && say_method)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! invalid args.\n");
+ return;
+ }
+ begin_allow_threads();
+ switch_ivr_say(session, tosay, module_name, say_type, say_method, ap);
+ end_allow_threads();
+}
+
+SWITCH_DECLARE(void) CoreSession::sayPhrase(const char *phrase_name, const char *phrase_data, const char *phrase_lang)
+{
+ this_check_void();
+ sanity_check_noreturn;
+
+ if (!(phrase_name)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! invalid args.\n");
+ return;
+ }
+
+ begin_allow_threads();
+ switch_ivr_phrase_macro(session, phrase_name, phrase_data, phrase_lang, ap);
+ end_allow_threads();
+}
+
SWITCH_DECLARE(int) CoreSession::streamFile(char *file, int starting_sample_count) {
switch_status_t status;
//switch_file_handle_t fh = { 0 };
const char *prebuf;
+ this_check(-1);
sanity_check(-1);
memset(&local_fh, 0, sizeof(local_fh));
@@ -677,6 +756,7 @@
SWITCH_DECLARE(bool) CoreSession::ready() {
+ this_check(false);
sanity_check(false);
return switch_channel_ready(channel) != 0;
}
@@ -688,6 +768,9 @@
switch_core_session_t *aleg_core_session = NULL;
switch_call_cause_t cause;
+ this_check(0);
+ sanity_check(0);
+
cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
if (a_leg_session != NULL) {
@@ -737,6 +820,9 @@
switch_file_handle_t fh = { 0 };
switch_status_t status;
+ this_check(-1);
+ sanity_check(-1);
+
fh.thresh = silence_threshold;
fh.silence_hits = silence_secs;
store_file_handle(&fh);
@@ -752,6 +838,9 @@
switch_event_t *event;
switch_channel_t *channel;
+ this_check(-1);
+ sanity_check(-1);
+
if (!session) {
return SWITCH_STATUS_FALSE;
}
@@ -765,12 +854,17 @@
SWITCH_DECLARE(int) CoreSession::flushDigits()
{
+ this_check(-1);
+ sanity_check(-1);
switch_channel_flush_dtmf(switch_core_session_get_channel(session));
return SWITCH_STATUS_SUCCESS;
}
SWITCH_DECLARE(int) CoreSession::setAutoHangup(bool val)
{
+ this_check(-1);
+ sanity_check(-1);
+
if (!session) {
return SWITCH_STATUS_FALSE;
}
@@ -784,6 +878,9 @@
SWITCH_DECLARE(void) CoreSession::setCallerData(char *var, char *val) {
+ this_check_void();
+ sanity_check_noreturn;
+
if (strcmp(var, "dialplan") == 0) {
caller_profile.dialplan = val;
}
@@ -816,8 +913,9 @@
SWITCH_DECLARE(void) CoreSession::setHangupHook(void *hangup_func) {
+ this_check_void();
sanity_check_noreturn;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::seHangupHook, hangup_func: %p\n", hangup_func);
on_hangup = hangup_func;
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -943,6 +1041,9 @@
switch_file_handle_t *fh = NULL;
+ this_check(SWITCH_STATUS_FALSE);
+ sanity_check(SWITCH_STATUS_FALSE);
+
if (switch_strlen_zero(ret)) {
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_event.c Thu May 22 15:05:28 2008
@@ -429,13 +429,15 @@
{
switch_thread_t *thread;
switch_threadattr_t *thd_attr;;
+
+ switch_assert(pool != NULL);
+
switch_threadattr_create(&thd_attr, pool);
switch_threadattr_detach_set(thd_attr, 1);
gethostname(hostname, sizeof(hostname));
switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), AF_INET);
switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), AF_INET6);
- switch_assert(pool != NULL);
THRUNTIME_POOL = RUNTIME_POOL = pool;
switch_queue_create(&EVENT_QUEUE[0], POOL_COUNT_MAX + 10, THRUNTIME_POOL);
@@ -732,6 +734,7 @@
/* go ahead and give ourselves some space to work with, should save a few reallocs */
if (!(encode_buf = malloc(encode_len))) {
+ switch_safe_free(buf);
return SWITCH_STATUS_MEMERR;
}
@@ -787,7 +790,7 @@
}
}
- switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, switch_strlen_zero(encode_buf) ? "_undef_" : encode_buf);
+ switch_snprintf(buf + len, dlen - len, "%s: %s\n", hp->name, *encode_buf == '\0' ? "_undef_" : encode_buf);
len = strlen(buf);
}
@@ -860,11 +863,14 @@
ret = vasprintf(&data, fmt, ap);
#else
data = (char *) malloc(2048);
- switch_assert(data);
+ if (!data) return NULL;
ret = vsnprintf(data, 2048, fmt, ap);
#endif
va_end(ap);
if (ret == -1) {
+#ifndef HAVE_VASPRINTF
+ free(data);
+#endif
return NULL;
}
}
@@ -1275,7 +1281,7 @@
return data;
}
-SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix)
+SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t* vars_map)
{
switch_stream_handle_t stream = { 0 };
switch_size_t encode_len = 1024, new_len = 0;
@@ -1284,6 +1290,7 @@
char *e = NULL;
switch_event_header_t *hi;
uint32_t x = 0;
+ void* data = NULL;
SWITCH_STANDARD_STREAM(stream);
@@ -1318,10 +1325,18 @@
if (event) {
if ((hi = event->headers)) {
+
for (; hi; hi = hi->next) {
char *var = hi->name;
char *val = hi->value;
-
+
+ if (vars_map != NULL)
+ {
+ if ((data = switch_core_hash_find(vars_map,var)) == NULL || strcasecmp(((char*)data),"enabled"))
+ continue;
+
+ }
+
new_len = (strlen((char *) var) * 3) + 1;
if (encode_len < new_len) {
char *tmp;
@@ -1339,6 +1354,7 @@
}
}
}
+
e = (char *) stream.data + (strlen((char *) stream.data) - 1);
if (e && *e == '&') {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr.c Thu May 22 15:05:28 2008
@@ -279,8 +279,9 @@
if (lead_frames) {
switch_frame_t *read_frame;
int frame_count = atoi(lead_frames);
-
- while(frame_count > 0) {
+ int max_frames = frame_count * 2;
+
+ while(frame_count > 0 && --max_frames > 0) {
status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
if (!SWITCH_READ_ACCEPTABLE(status)) {
goto done;
@@ -321,7 +322,7 @@
stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
}
- if (stream) {
+ if (stream && switch_is_moh(stream)) {
if ((b_session = switch_core_session_locate(b_uuid))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
@@ -334,10 +335,14 @@
}
}
for (x = 0; x < loops || loops < 0; x++) {
+ switch_time_t b4, aftr;
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
switch_channel_get_name(channel), app_name, app_arg);
+ b4 = switch_timestamp_now();
switch_core_session_exec(session, application_interface, app_arg);
- if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST)) {
+ aftr = switch_timestamp_now();
+ if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
break;
}
}
@@ -573,7 +578,7 @@
switch_time_t started = 0;
uint32_t elapsed;
- if (!args->input_callback) {
+ if (!args || !args->input_callback) {
return SWITCH_STATUS_GENERR;
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_async.c Thu May 22 15:05:28 2008
@@ -928,7 +928,7 @@
return 0;
}
-static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t generate_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_media_bug_t *bug = switch_channel_get_private(channel, "dtmf_generate");
@@ -1298,17 +1298,23 @@
typedef struct {
const char *app;
uint32_t flags;
+ switch_bind_flag_t bind_flags;
} dtmf_meta_app_t;
typedef struct {
dtmf_meta_app_t map[10];
time_t last_digit;
- switch_bool_t meta_on;
+ switch_bool_t meta_on;
+ int up;
+} dtmf_meta_settings_t;
+
+typedef struct {
+ dtmf_meta_settings_t sr[3];
} dtmf_meta_data_t;
#define SWITCH_META_VAR_KEY "__dtmf_meta"
-static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
+static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
@@ -1320,39 +1326,77 @@
return SWITCH_STATUS_SUCCESS;
}
- if (md->meta_on && now - md->last_digit > 5) {
- md->meta_on = SWITCH_FALSE;
+ if (direction == SWITCH_DTMF_RECV && !md->sr[SWITCH_DTMF_RECV].up) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (direction == SWITCH_DTMF_SEND && !md->sr[SWITCH_DTMF_SEND].up) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+ if (md->sr[direction].meta_on && now - md->sr[direction].last_digit > 5) {
+ md->sr[direction].meta_on = SWITCH_FALSE;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Meta digit timeout parsing %c\n", switch_channel_get_name(channel), dtmf->digit);
return SWITCH_STATUS_SUCCESS;
}
- md->last_digit = now;
+ md->sr[direction].last_digit = now;
if (dtmf->digit == '*') {
- if (md->meta_on) {
- md->meta_on = SWITCH_FALSE;
+ if (md->sr[direction].meta_on) {
+ md->sr[direction].meta_on = SWITCH_FALSE;
return SWITCH_STATUS_SUCCESS;
} else {
- md->meta_on = SWITCH_TRUE;
+ md->sr[direction].meta_on = SWITCH_TRUE;
return SWITCH_STATUS_FALSE;
}
}
- if (md->meta_on) {
+ if (md->sr[direction].meta_on) {
if (dtmf->digit >= '0' && dtmf->digit <= '9') {
+ int ok = 0;
*digit = dtmf->digit;
dval = atoi(digit);
- if (md->map[dval].app) {
+
+ if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) {
+ ok = 1;
+ } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) {
+ ok = 1;
+ }
+
+ if (ok && md->sr[direction].map[dval].app) {
+ uint32_t flags = md->sr[direction].map[dval].flags;
+
+ if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_OPPOSITE)) {
+ if (direction == SWITCH_DTMF_SEND) {
+ flags |= SMF_ECHO_ALEG;
+ } else {
+ flags |= SMF_ECHO_BLEG;
+ }
+ } else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_SAME)) {
+ if (direction == SWITCH_DTMF_SEND) {
+ flags |= SMF_ECHO_BLEG;
+ } else {
+ flags |= SMF_ECHO_ALEG;
+ }
+ } else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_ALEG)) {
+ flags |= SMF_ECHO_ALEG;
+ } else if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_BLEG)) {
+ flags |= SMF_ECHO_BLEG;
+ } else {
+ flags |= SMF_ECHO_ALEG;
+ }
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
- switch_channel_get_name(channel), dtmf->digit, md->map[dval].app);
- switch_ivr_broadcast(switch_core_session_get_uuid(session), md->map[dval].app, md->map[dval].flags);
+ switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app);
+ switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Ignoring meta digit '%c' not mapped\n",
switch_channel_get_name(channel), dtmf->digit);
}
}
- md->meta_on = SWITCH_FALSE;
+ md->sr[direction].meta_on = SWITCH_FALSE;
return SWITCH_STATUS_FALSE;
}
@@ -1368,7 +1412,7 @@
}
SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
- switch_bool_t dial_b, switch_bool_t exec_b, const char *app)
+ switch_bind_flag_t bind_flags, const char *app)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
@@ -1377,25 +1421,39 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid key %u\n", key);
return SWITCH_STATUS_FALSE;
}
-
+
if (!md) {
md = switch_core_session_alloc(session, sizeof(*md));
switch_channel_set_private(channel, SWITCH_META_VAR_KEY, md);
- if (dial_b) {
- switch_core_event_hook_add_send_dtmf(session, meta_on_dtmf);
- } else {
- switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
- }
+ switch_core_event_hook_add_send_dtmf(session, meta_on_dtmf);
+ switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
}
if (!switch_strlen_zero(app)) {
- md->map[key].app = switch_core_session_strdup(session, app);
- md->map[key].flags = exec_b ? SMF_ECHO_BLEG : SMF_ECHO_ALEG;
- md->map[key].flags |= SMF_HOLD_BLEG;
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound: %d %s\n", key, app);
+ if ((bind_flags & SBF_DIAL_ALEG)) {
+ md->sr[SWITCH_DTMF_RECV].up = 1;
+ md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
+ md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
+ md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound A-Leg: %d %s\n", key, app);
+ }
+ if ((bind_flags & SBF_DIAL_BLEG)) {
+ md->sr[SWITCH_DTMF_SEND].up = 1;
+ md->sr[SWITCH_DTMF_SEND].map[key].app = switch_core_session_strdup(session, app);
+ md->sr[SWITCH_DTMF_SEND].map[key].flags |= SMF_HOLD_BLEG;
+ md->sr[SWITCH_DTMF_SEND].map[key].bind_flags = bind_flags;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound B-Leg: %d %s\n", key, app);
+ }
+
} else {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound: %d\n", key);
- md->map[key].app = NULL;
+ if ((bind_flags & SBF_DIAL_ALEG)) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound A-Leg: %d\n", key);
+ md->sr[SWITCH_DTMF_SEND].map[key].app = NULL;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound: B-Leg %d\n", key);
+ md->sr[SWITCH_DTMF_SEND].map[key].app = NULL;
+ }
}
return SWITCH_STATUS_SUCCESS;
@@ -1848,6 +1906,11 @@
mypath = strdup(path);
+ if (!mypath) {
+ switch_core_session_rwunlock(session);
+ return SWITCH_STATUS_MEMERR;
+ }
+
if ((nomedia = switch_channel_test_flag(channel, CF_PROXY_MODE))) {
switch_ivr_media(uuid, SMF_REBRIDGE);
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_bridge.c Thu May 22 15:05:28 2008
@@ -99,7 +99,7 @@
uint32_t loop_count = 0;
const char *app_name = NULL, *app_arg = NULL;
const char *hook_var = NULL;
- int nosuspend = 0;
+ int inner_bridge = 0;
#ifdef SWITCH_VIDEO_IN_THREADS
struct vid_helper vh = { 0 };
uint32_t vid_launch = 0;
@@ -123,16 +123,24 @@
ans_b = switch_channel_test_flag(chan_b, CF_ANSWERED);
}
- switch_channel_set_flag(chan_a, CF_BRIDGED);
-
- nosuspend = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
+ inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
+
+ switch_channel_set_flag(chan_a, CF_BRIDGED);
+
+
+ switch_channel_wait_for_flag(chan_b, CF_BRIDGED, SWITCH_TRUE, 1000000);
+
for (;;) {
switch_channel_state_t b_state;
switch_status_t status;
switch_event_t *event;
loop_count++;
+ if (!switch_channel_test_flag(chan_b, CF_BRIDGED)) {
+ goto end_of_bridge_loop;
+ }
+
if (!switch_channel_ready(chan_a)) {
goto end_of_bridge_loop;
}
@@ -160,7 +168,7 @@
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
}
- if (!nosuspend && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
+ if (!inner_bridge && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -290,7 +298,7 @@
}
#endif
- if (!nosuspend) {
+ if (!inner_bridge) {
hook_var = switch_channel_get_variable(chan_a, SWITCH_API_BRIDGE_END_VARIABLE);
}
@@ -319,7 +327,7 @@
msg.from = __FILE__;
switch_core_session_receive_message(session_a, &msg);
- if (!nosuspend && switch_channel_get_state(chan_a) < CS_HANGUP) {
+ if (!inner_bridge && switch_channel_get_state(chan_a) < CS_HANGUP) {
if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
switch_caller_extension_t *extension = NULL;
if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
@@ -345,7 +353,9 @@
switch_core_session_reset(session_a, SWITCH_TRUE);
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
- switch_channel_clear_flag(chan_a, CF_BRIDGED);
+ if (!inner_bridge) {
+ switch_channel_clear_flag(chan_a, CF_BRIDGED);
+ }
switch_core_session_rwunlock(session_b);
return NULL;
}
@@ -369,8 +379,8 @@
switch_channel_clear_state_handler(channel, &audio_bridge_peer_state_handlers);
state = switch_channel_get_state(channel);
-
- if (!switch_channel_test_flag(channel, CF_TRANSFER) && state != CS_PARK && state != CS_ROUTING) {
+
+ if (!switch_channel_test_flag(channel, CF_TRANSFER) && state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
@@ -648,7 +658,8 @@
switch_channel_state_t state;
switch_event_t *event;
int br = 0;
-
+ int inner_bridge = switch_channel_test_flag(caller_channel, CF_INNER_BRIDGE);
+
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
switch_channel_clear_flag(caller_channel, CF_TRANSFER);
switch_channel_clear_flag(peer_channel, CF_TRANSFER);
@@ -757,8 +768,7 @@
audio_bridge_thread(NULL, (void *) a_leg);
switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
- //make sure this doesnt break anything
-
+
if (!switch_channel_test_flag(peer_channel, CF_TRANSFER) && switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
switch_channel_set_state(peer_channel, CS_RESET);
}
@@ -785,9 +795,6 @@
done:
- switch_channel_clear_flag(caller_channel, CF_INNER_BRIDGE);
- switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
-
if (br && switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(caller_channel, event);
switch_event_fire(&event);
@@ -795,7 +802,7 @@
state = switch_channel_get_state(caller_channel);
- if (!switch_channel_test_flag(caller_channel, CF_TRANSFER)) {
+ if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !inner_bridge) {
if ((state != CS_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP &&
switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE)))) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_menu.c Thu May 22 15:05:28 2008
@@ -268,80 +268,77 @@
switch_status_t status = SWITCH_STATUS_FALSE;
switch_input_args_t args = { 0 };
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sound=[%s]\n", sound);
+ if (!session || !menu || switch_strlen_zero(sound)) {
+ return status;
+ }
- if (session != NULL && menu != NULL && !switch_strlen_zero(sound)) {
- memset(menu->buf, 0, menu->inlen + 1);
- menu->ptr = menu->buf;
+ memset(menu->buf, 0, menu->inlen + 1);
+ menu->ptr = menu->buf;
- if (!need) {
- len = 1;
- ptr = NULL;
- } else {
- len = (uint32_t) menu->inlen + 1;
- ptr = menu->ptr;
- }
- args.buf = ptr;
- args.buflen = len;
+ if (!need) {
+ len = 1;
+ ptr = NULL;
+ } else {
+ len = (uint32_t) menu->inlen + 1;
+ ptr = menu->ptr;
+ }
+ args.buf = ptr;
+ args.buflen = len;
- status = switch_ivr_play_file(session, NULL, sound, &args);
+ status = switch_ivr_play_file(session, NULL, sound, &args);
-
- if (need) {
+ if (!need) {
+ return status;
+ }
- menu->ptr += strlen(menu->buf);
- if (strlen(menu->buf) < need) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n",
- (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
- status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf),
- need, "#", &terminator, menu->inter_timeout, 0, 0);
- }
+ menu->ptr += strlen(menu->buf);
+ if (strlen(menu->buf) < need) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n",
+ (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
+ status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf),
+ need, "#", &terminator, menu->inter_timeout, 0, 0);
+ }
-
- if (menu->confirm_macro && status == SWITCH_STATUS_SUCCESS && !switch_strlen_zero(menu->buf)) {
- switch_input_args_t confirm_args = { 0 }, *ap = NULL;
- char buf[10] = "";
- char terminator_key;
- int att = menu->confirm_attempts;
+ if (menu->confirm_macro && status == SWITCH_STATUS_SUCCESS && *menu->buf != '\0') {
+ switch_input_args_t confirm_args = { 0 }, *ap = NULL;
+ char buf[10] = "";
+ char terminator_key;
+ int att = menu->confirm_attempts;
-
- while (att) {
- confirm_args.buf = buf;
- confirm_args.buflen = sizeof(buf);
- memset(buf, 0, confirm_args.buflen);
+ while (att) {
+ confirm_args.buf = buf;
+ confirm_args.buflen = sizeof(buf);
+ memset(buf, 0, confirm_args.buflen);
- if (menu->confirm_key) {
- ap = &confirm_args;
- }
-
- switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
+ if (menu->confirm_key) {
+ ap = &confirm_args;
+ }
+
+ switch_ivr_phrase_macro(session, menu->confirm_macro, menu->buf, NULL, ap);
- if (menu->confirm_key && *buf == '\0') {
- switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, "#", &terminator_key, menu->timeout, 0, 0);
- }
+ if (menu->confirm_key && *buf == '\0') {
+ switch_ivr_collect_digits_count(session, buf, sizeof(buf), 1, "#", &terminator_key, menu->timeout, 0, 0);
+ }
- if (menu->confirm_key && *buf != '\0') {
- if (*menu->confirm_key == *buf) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
- "approving digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
- break;
- } else {
- att = 0;
- break;
- }
- }
- att--;
- }
- if (!att) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
- *menu->buf = '\0';
+ if (menu->confirm_key && *buf != '\0') {
+ if (*menu->confirm_key == *buf) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+ "approving digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
+ break;
+ } else {
+ att = 0;
+ break;
}
}
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digits '%s'\n", menu->buf);
+ att--;
+ }
+ if (!att) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
+ *menu->buf = '\0';
}
}
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "returning [%d]\n", status);
+
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "digits '%s'\n", menu->buf);
return status;
}
@@ -357,7 +354,7 @@
switch_channel_t *channel;
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (session == NULL || stack == NULL || switch_strlen_zero(name)) {
+ if (!session || !stack || switch_strlen_zero(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid menu context\n");
return SWITCH_STATUS_FALSE;
}
@@ -395,8 +392,7 @@
memset(menu->buf, 0, menu->inlen + 1);
status = play_and_collect(session, menu, greeting_sound, menu->inlen);
- if (!switch_strlen_zero(menu->buf)) {
-
+ if (*menu->buf != '\0') {
for (ap = menu->actions; ap; ap = ap->next) {
int ok = 0;
@@ -485,7 +481,6 @@
}
}
-
if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) { // top level
if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) { // catch the fallback and recover
switch_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_originate.c Thu May 22 15:05:28 2008
@@ -39,7 +39,7 @@
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
- while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA) {
+ while(switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
switch_ivr_sleep(session, 10);
}
}
@@ -268,6 +268,10 @@
const char *var = switch_channel_get_variable(caller_channel, "call_timeout");
switch_time_t start = 0;
+ if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
+ return SWITCH_STATUS_SUCCESS;
+ }
+
switch_zmalloc(write_frame.data, SWITCH_RECOMMENDED_BUFFER_SIZE);
write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
@@ -281,10 +285,6 @@
timelimit *= 1000000;
start = switch_timestamp_now();
- if ((switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
- return SWITCH_STATUS_SUCCESS;
- }
-
if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
}
@@ -821,7 +821,7 @@
myflags |= SOF_FORKED_DIAL;
}
}
- if ((reason = switch_core_session_outgoing_channel(session, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
+ if ((reason = switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool, myflags)) != SWITCH_CAUSE_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
chan_type, switch_channel_cause2str(reason));
if (pool) {
@@ -1154,16 +1154,17 @@
}
}
}
-
- if (caller_channel && i == 0) {
- holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
- holding = switch_core_session_strdup(session, holding);
- switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
- }
- if (holding) {
- switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_sessions[i]));
- } else {
- switch_channel_hangup(peer_channels[i], reason);
+ if (switch_channel_ready(peer_channels[i])) {
+ if (caller_channel && i == 0) {
+ holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
+ holding = switch_core_session_strdup(session, holding);
+ switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
+ }
+ if (holding) {
+ switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_sessions[i]));
+ } else {
+ switch_channel_hangup(peer_channels[i], reason);
+ }
}
}
}
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_ivr_play_say.c Thu May 22 15:05:28 2008
@@ -209,7 +209,8 @@
while (input && !done) {
char *pattern = (char *) switch_xml_attr(input, "pattern");
-
+ const char *do_break = switch_xml_attr_soft(input, "break_on_match");
+
if (pattern) {
switch_regex_t *re = NULL;
int proceed = 0, ovector[30];
@@ -220,7 +221,7 @@
switch_xml_t match = NULL;
status = SWITCH_STATUS_SUCCESS;
-
+
if ((proceed = switch_regex_perform(data, pattern, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
match = switch_xml_child(input, "match");
} else {
@@ -232,7 +233,7 @@
for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) {
char *adata = (char *) switch_xml_attr_soft(action, "data");
char *func = (char *) switch_xml_attr_soft(action, "function");
-
+
if (strchr(pattern, '(') && strchr(adata, '$')) {
len = (uint32_t) (strlen(data) + strlen(adata) + 10);
if (!(substituted = malloc(len))) {
@@ -269,6 +270,12 @@
status = SWITCH_STATUS_FALSE;
cmd = switch_core_session_strdup(session, odata);
+
+ if (!cmd) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Allocation error calling execute\n");
+ break;
+ }
+
cmd_args = switch_separate_paren_args(cmd);
if (!cmd_args ) {
@@ -313,6 +320,12 @@
switch_regex_safe_free(re);
switch_safe_free(expanded);
switch_safe_free(substituted);
+
+
+ if (match && do_break && switch_true(do_break)) {
+ break;
+ }
+
}
if (status != SWITCH_STATUS_SUCCESS) {
@@ -637,12 +650,12 @@
}
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data,
- read_frame->codec->implementation->bytes_per_frame)) <= 0) {
+ read_codec->implementation->bytes_per_frame)) <= 0) {
break;
}
write_frame.samples = write_frame.datalen / 2;
-
+
if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
break;
}
@@ -663,7 +676,7 @@
SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file, switch_input_args_t *args)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
- int16_t *abuf;
+ int16_t *abuf = NULL;
switch_dtmf_t dtmf = {0};
uint32_t interval = 0, samples = 0, framelen, sample_start = 0;
uint32_t ilen = 0;
@@ -686,8 +699,6 @@
const char *prebuf;
const char *alt = NULL;
- switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
-
switch_channel_pre_answer(channel);
prefix = switch_channel_get_variable(channel, "sound_prefix");
@@ -708,12 +719,11 @@
const char *lang = switch_channel_get_variable(channel, "language");
alt = file + 7;
dup = switch_core_session_strdup(session, alt);
-
- if ((arg = strchr(dup, ':'))) {
- *arg++ = '\0';
- }
if (dup) {
+ if ((arg = strchr(dup, ':'))) {
+ *arg++ = '\0';
+ }
return switch_ivr_phrase_macro(session, dup, arg, lang, args);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Args\n");
@@ -748,12 +758,10 @@
}
-
if (!prefix) {
prefix = SWITCH_GLOBAL_dirs.base_dir;
}
-
if (!strstr(file, SWITCH_URL_SEPARATOR)) {
if (!switch_is_file_path(file)) {
file = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file);
@@ -797,6 +805,7 @@
asis = 1;
}
+ switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf));
write_frame.data = abuf;
write_frame.buflen = FILE_STARTSAMPLES;
@@ -988,7 +997,6 @@
if (done || olen <= 0) {
break;
}
-
if (!asis) {
if (fh->speed > 2) {
@@ -1144,7 +1152,7 @@
end:
- free(abuf);
+ switch_safe_free(abuf);
switch_core_session_reset(session, SWITCH_TRUE);
return status;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_loadable_module.c Thu May 22 15:05:28 2008
@@ -1349,7 +1349,7 @@
}
}
- if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
+ if (cmd && (api = switch_loadable_module_get_api_interface(cmd)) != 0) {
status = api->function(arg, session, stream);
} else {
status = SWITCH_STATUS_FALSE;
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_log.c Thu May 22 15:05:28 2008
@@ -311,7 +311,9 @@
switch_safe_free(data);
switch_safe_free(new_fmt);
- fflush(handle);
+ if (handle) {
+ fflush(handle);
+ }
}
SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_regex.c Thu May 22 15:05:28 2008
@@ -144,6 +144,10 @@
z = 0;
num = atoi(index);
+ if (num < 0 || num > 256) {
+ num = -1;
+ }
+
if (pcre_copy_substring(field_data, ovector, match_count, num, replace, sizeof(replace)) > 0) {
switch_size_t r;
for (r = 0; r < strlen(replace); r++) {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_rtp.c Thu May 22 15:05:28 2008
@@ -201,12 +201,12 @@
unsigned int elapsed;
switch_size_t bytes;
switch_status_t status = SWITCH_STATUS_SUCCESS;
-
- WRITE_INC(rtp_session);
switch_assert(rtp_session != NULL);
switch_assert(rtp_session->ice_user != NULL);
+ WRITE_INC(rtp_session);
+
if (rtp_session->stuncount != 0) {
rtp_session->stuncount--;
goto end;
@@ -985,9 +985,9 @@
}
}
-SWITCH_DECLARE(uint8_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
+SWITCH_DECLARE(uint32_t) switch_rtp_test_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
{
- return (uint8_t) switch_test_flag(rtp_session, flags);
+ return (uint32_t) switch_test_flag(rtp_session, flags);
}
SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp_flag_t flags)
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/src/switch_utils.c Thu May 22 15:05:28 2008
@@ -568,12 +568,16 @@
const char *sp = str;
char *p, *s = NULL;
- while(sp && *sp && *sp == ' ') {
+ if (!sp) return NULL;
+
+ while(*sp == ' ') {
sp++;
}
s = strdup(sp);
+ if (!s) return NULL;
+
p = s + (strlen(s) - 1);
while(*p == ' ') {
Modified: freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj (original)
+++ freeswitch/branches/lukedashjr/syslibs/freeswitch/w32/Library/FreeSwitchCore.2008.vcproj Thu May 22 15:05:28 2008
@@ -363,6 +363,14 @@
<File
RelativePath="..\..\src\switch_core_session.c"
>
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ DisableSpecificWarnings="6385"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\..\src\switch_core_speech.c"
Modified: freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/libedit/src/makelist Thu May 22 15:05:28 2008
@@ -36,6 +36,7 @@
# makelist.sh: Automatically generate header files...
AWK=awk
+
USAGE="Usage: $0 -h|-e|-fc|-fh|-bc|-bh|-m <filenames>"
if [ "x$1" = "x" ]
@@ -140,7 +141,7 @@
#
-fh)
cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
- sort | tr '[:lower:]' '[:upper:]' | $AWK '
+ sort | LANG=C tr '[:lower:]' '[:upper:]' | $AWK '
BEGIN {
printf("/* Automatically generated file, do not edit */\n");
printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/.update Thu May 22 15:05:28 2008
@@ -1 +1 @@
-Mon May 12 14:41:23 EDT 2008
+Wed May 21 00:25:55 CEST 2008
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h Thu May 22 15:05:28 2008
@@ -282,7 +282,7 @@
#define MSG_STRUCT_ALIGN(p) ((p) = (void*)MSG_ALIGN(p, sizeof(void *)))
enum {
- msg_n_params = 8, /* allocation size of parameter string list */
+ msg_n_params = 8 /* allocation size of parameter string list */
#define MSG_N_PARAMS msg_n_params
};
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nta/nta.c Thu May 22 15:05:28 2008
@@ -2579,6 +2579,10 @@
rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port));
msg_header_replace_param(msg_home(msg), v->v_common, rport);
}
+ else {
+ 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;
}
@@ -8008,7 +8012,7 @@
outgoing_queue_init(sa->sa_out.free = rq, 0);
while ((orq = sa->sa_out.re_list)) {
- if ((int32_t)(orq->orq_retry) - now > 0)
+ if ((int32_t)(orq->orq_retry - now) > 0)
break;
if (retransmitted >= timer_max_retransmit)
break;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/Makefile.am Thu May 22 15:05:28 2008
@@ -13,13 +13,13 @@
noinst_LTLIBRARIES = libnua.la
-check_LTLIBRARIES = libtestnua.la libtestproxy.la libtestnat.la
+check_PROGRAMS =
+TESTS =
-check_PROGRAMS = test_nua
-
-TESTS = test_nua
-
-CLEANFILES = tmp_sippasswd.??????
+if HAVE_CHECK
+check_PROGRAMS += check_nua
+TESTS += check_nua
+endif
# ----------------------------------------------------------------------
# Rules for building the targets
@@ -30,7 +30,7 @@
sofia-sip/nua.h sofia-sip/nua_tag.h
libnua_la_SOURCES = nua.c nua_stack.h nua_common.c nua_stack.c \
- nua_extension.c \
+ nua_extension.c nua_types.h \
nua_dialog.c nua_dialog.h \
outbound.c outbound.h \
nua_params.c nua_params.h \
@@ -43,27 +43,13 @@
COVERAGE_INPUT = $(libnua_la_SOURCES) $(include_sofia_HEADERS)
-test_nua_LDFLAGS = -static
-
-libtestnua_la_SOURCES = test_nua.h test_ops.c \
- test_init.c \
- test_nua_api.c test_nua_params.c \
- test_register.c test_basic_call.c \
- test_offer_answer.c \
- test_call_reject.c test_cancel_bye.c \
- test_call_hold.c test_session_timer.c \
- test_refer.c test_100rel.c \
- test_sip_events.c test_simple.c \
- test_extension.c
-
-
-libtestproxy_la_SOURCES = test_proxy.h test_proxy.c
-
-libtestnat_la_SOURCES = test_nat.h test_nat.c test_nat_tags.c
+check_nua_SOURCES = check_nua.c check_nua.h \
+ check_session.c check_register.c \
+ test_s2.h test_s2.c
-test_nua_SOURCES = test_nua.c
+check_nua_LDADD = $(nua_libs) @CHECK_LIBS@
-test_nua_LDADD = libnua.la libtestnua.la libtestproxy.la libtestnat.la \
+nua_libs = libnua.la \
../iptsec/libiptsec.la \
../ipt/libipt.la \
../nea/libnea.la \
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c Thu May 22 15:05:28 2008
@@ -468,6 +468,26 @@
ds->ds_terminating = 0;
}
+void nua_dialog_update_params(nua_dialog_state_t *ds,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *params,
+ nua_handle_preferences_t const *defaults)
+{
+ nua_dialog_usage_t *usage;
+
+ for (usage = ds->ds_usage; usage; usage = usage->du_next) {
+ usage->du_class->usage_update_params(usage, changed, params, defaults);
+ }
+}
+
+void nua_base_usage_update_params(nua_dialog_usage_t const *du,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *params,
+ nua_handle_preferences_t const *defaults)
+{
+ (void)du, (void)changed, (void)params, (void)defaults;
+}
+
/**@internal
* Set refresh value suitably.
*
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.h Thu May 22 15:05:28 2008
@@ -35,27 +35,12 @@
* @date Created: Wed Mar 8 11:38:18 EET 2006 ppessi
*/
-#ifndef NUA_OWNER_T
-#define NUA_OWNER_T struct nua_owner_s
-#endif
-typedef NUA_OWNER_T nua_owner_t;
+#include <nua_types.h>
#ifndef NTA_H
#include <sofia-sip/nta.h>
#endif
-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_dialog_peer_info nua_dialog_peer_info_t;
-
-#ifndef NUA_SAVED_SIGNAL_T
-#define NUA_SAVED_SIGNAL_T struct nua_saved_signal *
-#endif
-
-typedef NUA_SAVED_SIGNAL_T nua_saved_signal_t;
-
typedef struct {
sip_method_t sm_method;
char const *sm_method_name;
@@ -386,6 +371,10 @@
nua_client_request_t *cr,
nua_server_request_t *sr);
char const *(*usage_name)(nua_dialog_usage_t const *du);
+ void (*usage_update_params)(nua_dialog_usage_t const *du,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *params,
+ nua_handle_preferences_t const *defaults);
void (*usage_peer_info)(nua_dialog_usage_t *du,
nua_dialog_state_t const *ds,
sip_t const *sip);
@@ -452,6 +441,16 @@
nua_client_request_t *cr,
nua_server_request_t *sr);
+void nua_dialog_update_params(nua_dialog_state_t *ds,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *params,
+ nua_handle_preferences_t const *defaults);
+
+void nua_base_usage_update_params(nua_dialog_usage_t const *du,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *params,
+ nua_handle_preferences_t const *defaults);
+
void nua_dialog_deinit(nua_owner_t *own,
nua_dialog_state_t *ds);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c Thu May 22 15:05:28 2008
@@ -92,6 +92,7 @@
nua_notify_usage_add,
nua_notify_usage_remove,
nua_notify_usage_name,
+ nua_base_usage_update_params,
NULL,
nua_notify_usage_refresh,
nua_notify_usage_shutdown,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c Thu May 22 15:05:28 2008
@@ -82,17 +82,6 @@
/* Bitwise or of bitfields, casted to unsigned */
a->nhp_set_.set_unsigned[0] |= b->nhp_set_.set_unsigned[0];
a->nhp_set_.set_unsigned[1] |= b->nhp_set_.set_unsigned[1];
-
- /*
- unsigned *ap, const *bp;
- size_t i;
-
- ap = a->nhp_set_.set_unsigned;
- bp = b->nhp_set_.set_unsigned;
- for (i = 0; i < (sizeof a->nhp_set); i += (sizeof *ap))
- *ap++ |= *bp++;
-
- */
}
static int nhp_set_tags(su_home_t *home,
@@ -110,10 +99,9 @@
tag_value_t value);
static int nhp_save_params(nua_handle_t *nh,
- su_home_t *tmphome,
- nua_global_preferences_t *gsrc,
- nua_handle_preferences_t *src);
-
+ su_home_t *tmphome,
+ nua_global_preferences_t *gsrc,
+ nua_handle_preferences_t *src);
/* ====================================================================== */
/* Magical NUTAG_USER_AGENT() - add NHP_USER_AGENT there if it is not there */
@@ -310,6 +298,7 @@
* NUTAG_ONLY183_100REL() \n
* NUTAG_OUTBOUND() \n
* NUTAG_PATH_ENABLE() \n
+ * NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
* NUTAG_REFER_EXPIRES() \n
* NUTAG_REFER_WITH_ID() \n
* NUTAG_REGISTRAR() \n
@@ -430,6 +419,7 @@
* NUTAG_ONLY183_100REL() \n
* NUTAG_OUTBOUND() \n
* NUTAG_PATH_ENABLE() \n
+ * NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) \n
* NUTAG_REFER_EXPIRES() \n
* NUTAG_REFER_WITH_ID() \n
* NUTAG_REGISTRAR() \n
@@ -482,13 +472,15 @@
int status;
char const *phrase;
+ nua_handle_preferences_t tmp[1];
+ int any_changes = 0;
+
enter;
{
su_home_t tmphome[1] = { SU_HOME_INIT(tmphome) };
nua_handle_preferences_t *nhp = nh->nh_prefs;
nua_handle_preferences_t const *dnhp = dnh->nh_prefs;
- nua_handle_preferences_t tmp[1];
nua_global_preferences_t gtmp[1], *ngp = NULL;
*tmp = *nhp; NHP_UNSET_ALL(tmp);
@@ -521,7 +513,7 @@
status = 900, phrase = "Error storing default handle parameters";
else if (nhp_set_tags(tmphome, tmp, ngp, tags) < 0)
status = 900, phrase = "Error storing parameters";
- else if (nhp_save_params(nh, tmphome, ngp, tmp) < 0)
+ else if ((any_changes = nhp_save_params(nh, tmphome, ngp, tmp)) < 0)
status = 900, phrase = su_strerror(ENOMEM);
else
status = 200, phrase = "OK", nh->nh_used_ptags = 1;
@@ -562,7 +554,8 @@
if (nua_stack_set_smime_params(nua, tags) < 0) {
status = 900, phrase = "Error setting S/MIME parameters";
}
- else if (nua->nua_nta && nta_agent_set_params(nua->nua_nta, TAG_NEXT(tags)) < 0) {
+ else if (nua->nua_nta &&
+ nta_agent_set_params(nua->nua_nta, TAG_NEXT(tags)) < 0) {
status = 900, phrase = "Error setting NTA parameters";
}
else {
@@ -581,6 +574,18 @@
else {
if (e == nua_r_set_params)
UA_EVENT2(e, status, phrase);
+
+ if (any_changes) {
+ nua_handle_preferences_t changed[1];
+
+ *changed = *nh->nh_prefs;
+ memcpy(&changed->nhp_set_, &tmp->nhp_set_, sizeof changed->nhp_set_);
+
+ nua_dialog_update_params(nh->nh_ds,
+ changed,
+ nh->nh_prefs,
+ dnh->nh_prefs);
+ }
return 0;
}
}
@@ -612,11 +617,10 @@
}
/* Set copy of string from url to handle pref structure */
-#define NHP_SET_STR_BY_URL(nhp, name, v) \
+#define NHP_SET_STR_BY_URL(nhp, type, name, v) \
if ((v) != (tag_value_t)-1) { \
url_t const *_value = (url_t const *)(v); \
- char *_new; \
- _new = url_as_string(home, (void *)_value); \
+ type *_new = (type *)url_as_string(home, (void *)_value); \
if (NHP_ISSET(nhp, name)) \
su_free(home, (void *)nhp->nhp_##name); \
NHP_SET(nhp, name, _new); \
@@ -953,7 +957,7 @@
}
/* NUTAG_REGISTRAR(registrar) */
else if (tag == nutag_registrar) {
- NHP_SET_STR_BY_URL(nhp, registrar, value);
+ NHP_SET_STR_BY_URL(nhp, char, registrar, value);
if (NHP_ISSET(nhp, registrar) && !str0cmp(nhp->nhp_registrar, "*"))
NHP_SET_STR(nhp, registrar, 0);
}
@@ -981,6 +985,10 @@
else if (tag == nutag_outbound) {
NHP_SET_STR(nhp, outbound, value);
}
+ /* NUTAG_PROXY() (aka NTATAG_DEFAULT_PROXY()) */
+ else if (tag == ntatag_default_proxy) {
+ NHP_SET_STR_BY_URL(nhp, url_string_t, proxy, value);
+ }
/* NUTAG_DETECT_NETWORK_UPDATES(detect_network_updates) */
else if (ngp && tag == nutag_detect_network_updates) {
int detector = (int)value;
@@ -1070,6 +1078,10 @@
}
/** Save parameters in @a gtmp and @a tmp.
+ *
+ * @retval 1 - parameters were changed
+ * @retval 0 - no changes in parameters
+ * @retval -1 - an error
*/
static
int nhp_save_params(nua_handle_t *nh,
@@ -1132,7 +1144,7 @@
nh->nh_prefs = dst;
- return 0;
+ return memcmp(dst, old, sizeof *dst) != 0;
}
static int nua_handle_tags_filter(tagi_t const *f, tagi_t const *t);
@@ -1141,21 +1153,6 @@
/** Save taglist to a handle */
int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags)
{
-#if HAVE_OPEN_C
- /* Nice. An old symbian compiler */
- tagi_t tagfilter[2];
- tagi_t paramfilter[2];
-#else
- tagi_t const tagfilter[] = {
- { TAG_FILTER(nua_handle_tags_filter) },
- { TAG_NULL() }
- };
- tagi_t const paramfilter[] = {
- { TAG_FILTER(nua_handle_param_filter) },
- { TAG_NULL() }
- };
-#endif
-
/* Initialization parameters */
url_string_t const *url = NULL;
sip_to_t const *p_to = NULL;
@@ -1171,6 +1168,10 @@
int error;
#if HAVE_OPEN_C
+ /* Nice. An old symbian compiler */
+ tagi_t tagfilter[2];
+ tagi_t paramfilter[2];
+
tagfilter[0].t_tag = tag_filter;
tagfilter[0].t_value = tag_filter_v(nua_handle_tags_filter);
tagfilter[1].t_tag = (tag_type_t)0;
@@ -1180,6 +1181,16 @@
paramfilter[0].t_value = tag_filter_v(nua_handle_param_filter);
paramfilter[1].t_tag = (tag_type_t)0;
paramfilter[1].t_value = (tag_value_t)0;
+
+#else
+ tagi_t const tagfilter[] = {
+ { TAG_FILTER(nua_handle_tags_filter) },
+ { TAG_NULL() }
+ };
+ tagi_t const paramfilter[] = {
+ { TAG_FILTER(nua_handle_param_filter) },
+ { TAG_NULL() }
+ };
#endif
for (t = tags; t; t = tl_next(t)) {
@@ -1525,7 +1536,7 @@
nua_handle_t *dnh = nua->nua_dhandle;
nua_global_preferences_t const *ngp = nua->nua_prefs;
nua_handle_preferences_t const *nhp = nh->nh_prefs;
-
+ nua_handle_preferences_t const nhp_zero[1] = {{ 0 }};
tagi_t *lst;
int has_from;
@@ -1549,18 +1560,19 @@
enter;
- nta_agent_get_params(nua->nua_nta,
- NTATAG_UDP_MTU_REF(udp_mtu),
- NTATAG_MAX_PROCEEDING_REF(max_proceeding),
- NTATAG_SIP_T1_REF(sip_t1),
- NTATAG_SIP_T2_REF(sip_t2),
- NTATAG_SIP_T4_REF(sip_t4),
- NTATAG_SIP_T1X64_REF(sip_t1x64),
- NTATAG_DEBUG_DROP_PROB_REF(debug_drop_prob),
- NTATAG_DEFAULT_PROXY_REF(proxy),
- NTATAG_ALIASES_REF(aliases),
- NTATAG_SIPFLAGS_REF(flags),
- TAG_END());
+ if (nh == dnh)
+ nta_agent_get_params(nua->nua_nta,
+ NTATAG_UDP_MTU_REF(udp_mtu),
+ NTATAG_MAX_PROCEEDING_REF(max_proceeding),
+ NTATAG_SIP_T1_REF(sip_t1),
+ NTATAG_SIP_T2_REF(sip_t2),
+ NTATAG_SIP_T4_REF(sip_t4),
+ NTATAG_SIP_T1X64_REF(sip_t1x64),
+ NTATAG_DEBUG_DROP_PROB_REF(debug_drop_prob),
+ NTATAG_DEFAULT_PROXY_REF(proxy),
+ NTATAG_ALIASES_REF(aliases),
+ NTATAG_SIPFLAGS_REF(flags),
+ TAG_END());
if (nh->nh_ds->ds_local)
has_from = 1, *from = *nh->nh_ds->ds_local, from->a_params = NULL;
@@ -1597,6 +1609,9 @@
? sip_##pref##_make(tmphome, (char *)nhp->nhp_##pref) \
: NULL))
+ if (nh != dnh && nhp == dnh->nh_prefs)
+ nhp = nhp_zero;
+
su_home_auto(tmphome, sizeof(tmphome));
lst = tl_filtered_tlist
@@ -1669,6 +1684,10 @@
TIF(NUTAG_M_FEATURES, m_features),
TIF(NUTAG_OUTBOUND, outbound),
+ /* Handle-specific proxy */
+ TAG_IF(nh != dnh && nhp->nhp_set.nhb_proxy,
+ NUTAG_PROXY(nhp->nhp_proxy)),
+
/* Skip user-agent-level parameters if parameters are for handle only */
TAG_IF(nh != dnh, TAG_NEXT(media_params)),
@@ -1693,12 +1712,13 @@
#endif
NTATAG_UDP_MTU(udp_mtu),
- NTATAG_MAX_PROCEEDING(max_proceeding),
+ NTATAG_MAX_PROCEEDING(max_proceeding),
NTATAG_SIP_T1(sip_t1),
NTATAG_SIP_T2(sip_t2),
NTATAG_SIP_T4(sip_t4),
NTATAG_SIP_T1X64(sip_t1x64),
NTATAG_DEBUG_DROP_PROB(debug_drop_prob),
+ /* Stack-wide proxy */
NTATAG_DEFAULT_PROXY(proxy),
NTATAG_ALIASES(aliases),
NTATAG_SIPFLAGS(flags),
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.h Thu May 22 15:05:28 2008
@@ -35,6 +35,8 @@
* @date Created: Wed Mar 8 11:38:18 EET 2006 ppessi
*/
+#include <nua_types.h>
+
/**@internal @brief NUA preferences.
*
* This structure contains values for various preferences and a separate
@@ -50,7 +52,7 @@
*
* @see NHP_GET(), NH_PGET(), NHP_ISSET(), NH_PISSET()
*/
-typedef struct nua_handle_preferences
+struct nua_handle_preferences
{
unsigned nhp_retry_count; /**< times to retry a request */
unsigned nhp_max_subscriptions;
@@ -133,6 +135,9 @@
/** Initial route set */
sip_route_t *nhp_initial_route;
+ /** Next hop URI (used instead of route). */
+ url_string_t *nhp_proxy;
+
union { struct {
/* A bit for each feature set by application */
/* NOTE:
@@ -191,16 +196,17 @@
unsigned nhb_outbound:1;
unsigned nhb_appl_method:1;
unsigned nhb_initial_route:1;
+ unsigned nhb_proxy:1;
unsigned :0;
} set_bits;
unsigned set_unsigned[2];
} nhp_set_;
-} nua_handle_preferences_t;
+};
#define nhp_set nhp_set_.set_bits
/** Global preferences for nua. */
-typedef struct {
+struct nua_global_preferences {
/** Network detection: NONE, INFORMAL, TRY_FULL */
signed int ngp_detect_network_updates:3;
/** Pass events during shutdown, too */
@@ -215,7 +221,7 @@
} set_bits;
unsigned set_unsigned[2];
} ngp_set_;
-} nua_global_preferences_t;
+};
#define ngp_set ngp_set_.set_bits
@@ -238,7 +244,7 @@
/* Get preference from handle, if set, otherwise from default handle */
#define NH_PGET(nh, pref) \
- NHP_GET((nh)->nh_prefs, (nh)->nh_nua->nua_dhandle->nh_prefs, pref)
+ NHP_GET((nh)->nh_prefs, (nh)->nh_dprefs, pref)
/* Get preference from handle, if exists and set,
otherwise from default handle */
@@ -255,7 +261,7 @@
(NHP_ISSET((nh)->nh_prefs, pref) && \
(nh)->nh_nua->nua_dhandle->nh_prefs != (nh)->nh_prefs)
-/* Check if preference has been set by applicationx */
+/* Check if preference has been set by application */
#define NUA_PISSET(nua, nh, pref) \
(NHP_ISSET((nua)->nua_dhandle->nh_prefs, pref) || \
((nh) && NHP_ISSET((nh)->nh_prefs, pref)))
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_publish.c Thu May 22 15:05:28 2008
@@ -79,6 +79,7 @@
nua_publish_usage_add,
nua_publish_usage_remove,
nua_publish_usage_name,
+ nua_base_usage_update_params,
NULL,
nua_publish_usage_refresh,
nua_publish_usage_shutdown,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c Thu May 22 15:05:28 2008
@@ -107,6 +107,10 @@
nua_dialog_usage_t *du,
nua_client_request_t *cr,
nua_server_request_t *sr);
+static void nua_register_usage_update_params(nua_dialog_usage_t const *du,
+ nua_handle_preferences_t const *,
+ nua_handle_preferences_t const *,
+ nua_handle_preferences_t const *);
static void nua_register_usage_peer_info(nua_dialog_usage_t *du,
nua_dialog_state_t const *ds,
sip_t const *sip);
@@ -169,6 +173,7 @@
nua_register_usage_add,
nua_register_usage_remove,
nua_register_usage_name,
+ nua_register_usage_update_params,
nua_register_usage_peer_info,
nua_register_usage_refresh,
nua_register_usage_shutdown
@@ -672,6 +677,11 @@
NH_PGET(nh, instance));
if (!nr->nr_ob)
return nua_client_return(cr, 900, "Cannot create outbound", msg);
+
+ nua_register_usage_update_params(du,
+ NULL,
+ nh->nh_prefs,
+ nh->nh_dprefs);
}
if (nr->nr_ob) {
@@ -687,13 +697,6 @@
unreg = 1; /* All contacts have expires=0 */
}
- outbound_set_options(ob,
- NH_PGET(nh, outbound),
- NH_PGET(nh, keepalive),
- NH_PISSET(nh, keepalive_stream)
- ? NH_PGET(nh, keepalive_stream)
- : NH_PGET(nh, keepalive));
-
if (outbound_set_contact(ob, sip->sip_contact, nr->nr_via, unreg) < 0)
return nua_client_return(cr, 900, "Cannot set outbound contact", msg);
}
@@ -712,6 +715,7 @@
sip_contact_t *m, *contacts = sip->sip_contact;
char const *min_expires = NULL;
int unreg;
+ tport_t *tport = NULL;
(void)nh;
@@ -755,6 +759,8 @@
if (previous)
sip_add_dup(msg, sip, (sip_header_t *)previous);
}
+
+ tport = nr->nr_tport;
}
for (m = sip->sip_contact; m; m = m->m_next) {
@@ -789,7 +795,7 @@
TAG_IF(unreg, NTATAG_SIGCOMP_CLOSE(1)),
TAG_IF(!unreg, NTATAG_COMP("sigcomp")),
#endif
- NTATAG_TPORT(nr->nr_tport),
+ NTATAG_TPORT(tport),
TAG_NEXT(tags));
}
@@ -1038,6 +1044,42 @@
nua_dialog_usage_set_refresh_range(du, 0, 0);
}
+static void
+nua_register_usage_update_params(nua_dialog_usage_t const *du,
+ nua_handle_preferences_t const *changed,
+ nua_handle_preferences_t const *nhp,
+ nua_handle_preferences_t const *dnhp)
+{
+ nua_registration_t *nr = nua_dialog_usage_private(du);
+ outbound_t *ob = nr->nr_ob;
+
+ if (!ob)
+ return;
+
+ if (!changed ||
+ NHP_ISSET(changed, outbound) ||
+ NHP_ISSET(changed, keepalive) ||
+ NHP_ISSET(changed, keepalive_stream)) {
+ char const *outbound =
+ NHP_ISSET(nhp, outbound) ? nhp->nhp_outbound
+ : dnhp->nhp_outbound;
+ unsigned keepalive =
+ NHP_ISSET(nhp, keepalive) ? nhp->nhp_keepalive
+ : dnhp->nhp_keepalive;
+ unsigned keepalive_stream =
+ NHP_ISSET(nhp, keepalive_stream) ? nhp->nhp_keepalive_stream
+ : NHP_ISSET(dnhp, keepalive_stream) ? nhp->nhp_keepalive_stream
+ : keepalive;
+
+ outbound_set_options(ob, outbound, keepalive, keepalive_stream);
+ }
+
+ if (!changed || NHP_ISSET(changed, proxy)) {
+ if (NHP_ISSET(nhp, proxy))
+ outbound_set_proxy(ob, nhp->nhp_proxy);
+ }
+}
+
static void nua_register_usage_refresh(nua_handle_t *nh,
nua_dialog_state_t *ds,
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c Thu May 22 15:05:28 2008
@@ -207,6 +207,7 @@
nua_session_usage_add,
nua_session_usage_remove,
nua_session_usage_name,
+ nua_base_usage_update_params,
NULL,
nua_session_usage_refresh,
nua_session_usage_shutdown
@@ -335,9 +336,6 @@
/* ======================================================================== */
/* INVITE and call (session) processing */
-int nua_stack_prack(nua_t *nua, nua_handle_t *nh, nua_event_t e,
- tagi_t const *tags);
-
static int session_timer_is_supported(struct session_timer const *t);
static void session_timer_preferences(struct session_timer *t,
@@ -1206,6 +1204,8 @@
sip_authorization_t *wa;
sip_proxy_authorization_t *pa;
sip_cseq_t *cseq;
+ int proxy_is_set;
+ url_string_t *proxy;
nta_outgoing_t *ack;
int status = 200;
char const *phrase = "OK", *reason = NULL;
@@ -1314,9 +1314,14 @@
}
}
+ proxy_is_set = NH_PISSET(nh, proxy);
+ proxy = NH_PGET(nh, proxy);
+
if ((ack = nta_outgoing_mcreate(nh->nh_nua->nua_nta, NULL, NULL, NULL,
msg,
NTATAG_ACK_BRANCH(invite_branch),
+ TAG_IF(proxy_is_set,
+ NTATAG_DEFAULT_PROXY(proxy)),
SIPTAG_END(),
TAG_NEXT(tags)))) {
/* TR engine keeps this around for T2 so it catches all 2XX retransmissions */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c Thu May 22 15:05:28 2008
@@ -2541,8 +2541,9 @@
/**
* Next, values previously set with nua_set_params() or nua_set_hparams()
- * are used: @Allow, @Supported, @Organization, and @UserAgent headers are
- * added to the request if they are not already set.
+ * are used: @Allow, @Supported, @Organization, @UserAgent and
+ * @AllowEvents headers are added to the request if they are not already
+ * set.
*/
if (!sip->sip_allow)
sip_add_dup(msg, sip, (sip_header_t*)NH_PGET(nh, allow));
@@ -2561,6 +2562,20 @@
if (!sip->sip_user_agent && NH_PGET(nh, user_agent))
sip_add_make(msg, sip, sip_user_agent_class, NH_PGET(nh, user_agent));
+ /** Any node implementing one or more event packages SHOULD include an
+ * appropriate @AllowEvents header indicating all supported events in
+ * all methods which initiate dialogs and their responses (such as
+ * INVITE) and OPTIONS responses.
+ */
+ if (!sip->sip_allow_events &&
+ NH_PGET(nh, allow_events) &&
+ (method == sip_method_notify || /* Always in NOTIFY */
+ (!ds->ds_remote_tag && /* And in initial requests */
+ (method == sip_method_subscribe || method == sip_method_refer ||
+ method == sip_method_options ||
+ method == sip_method_invite))))
+ sip_add_dup(msg, sip, (void *)NH_PGET(nh, allow_events));
+
/**
* Next, the stack generates a @Contact header for the request (unless
* the application already gave a @Contact header or it does not want to
@@ -2633,6 +2648,8 @@
tagi_t const *tags)
{
nua_handle_t *nh = cr->cr_owner;
+ int proxy_is_set = NH_PISSET(nh, proxy);
+ url_string_t * proxy = NH_PGET(nh, proxy);
if (nh->nh_auth) {
if (cr->cr_challenged ||
@@ -2648,6 +2665,8 @@
nua_client_orq_response, cr,
NULL,
msg,
+ TAG_IF(proxy_is_set,
+ NTATAG_DEFAULT_PROXY(proxy)),
TAG_NEXT(tags));
return cr->cr_orq ? 0 : -1;
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h Thu May 22 15:05:28 2008
@@ -154,6 +154,7 @@
nua_handle_t *nh_identity; /**< Identity */
nua_handle_preferences_t *nh_prefs; /**< Preferences */
+#define nh_dprefs nh_nua->nua_dhandle->nh_prefs
/* Handle type is determined by special event and flags. */
nua_event_t nh_special; /**< Special event */
@@ -431,8 +432,6 @@
/* ---------------------------------------------------------------------- */
-typedef unsigned longlong ull;
-
#define SET_STATUS(_status, _phrase) status = _status, phrase = _phrase
#define SET_STATUS2(_status, _phrase) status = _status, phrase = _phrase
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_subnotref.c Thu May 22 15:05:28 2008
@@ -91,6 +91,7 @@
nua_subscribe_usage_add,
nua_subscribe_usage_remove,
nua_subscribe_usage_name,
+ nua_base_usage_update_params,
NULL,
nua_subscribe_usage_refresh,
nua_subscribe_usage_shutdown
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c Thu May 22 15:05:28 2008
@@ -598,6 +598,8 @@
* Retry count determines how many times stack will automatically retry
* after an recoverable error response, like 302, 401 or 407.
*
+ * Note that the first request does not count as retry.
+ *
* @par Used with
* nua_create(), nua_set_params(), nua_handle(), nua_set_hparams(),
* nua_get_params(), nua_get_hparams(),
@@ -613,7 +615,9 @@
* unsigned
*
* @par Values
- * @c 0 Never retry automatically \n
+ * - 0 - Never retry automatically \n
+ * - Otherwise, number of extra transactions initiated after initial
+ * transaction failed with recoverable error response
*
* @NEW_1_12_4.
*
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.c Thu May 22 15:05:28 2008
@@ -104,8 +104,8 @@
unsigned ob_registering:1;
/** 2XX response to REGISTER containg ob_rcontact has been received */
unsigned ob_registered:1;
- /**The registration has been validated:
- * We have successfully sent OPTIONS to ourselves.
+ /** The registration has been validated:
+ * We have successfully sent OPTIONS to ourselves.
*/
unsigned ob_validated:1;
/** The registration has been validated once.
@@ -113,8 +113,11 @@
* up if OPTIONS probe fails.
*/
unsigned ob_once_validated:1;
+
+ unsigned ob_proxy_override:1; /**< Override stack default proxy */
unsigned :0;
+ url_string_t *ob_proxy; /**< Outbound-specific proxy */
char const *ob_instance; /**< Our instance ID */
int32_t ob_reg_id; /**< Flow-id */
sip_contact_t *ob_rcontact; /**< Our contact */
@@ -209,10 +212,11 @@
ob->ob_nta = agent;
if (instance)
- ob->ob_instance = su_strcat_all(ob->ob_home, "+sip.instance=\"<", instance, ">\"", NULL);
+ ob->ob_instance =
+ su_sprintf(ob->ob_home, "+sip.instance=\"<%s>\"", instance);
ob->ob_reg_id = 0;
- /* Generate a cookie (used as Call-ID) for us */
+ /* Generate a random cookie (used as Call-ID) for us */
su_md5_init(md5);
su_guid_generate(guid);
if (instance)
@@ -246,16 +250,23 @@
/** Set various outbound and nat-traversal related options. */
int outbound_set_options(outbound_t *ob,
- char const *options,
+ char const *_options,
unsigned interval,
unsigned stream_interval)
{
struct outbound_prefs prefs[1] = {{ 0 }};
- char const *s;
+ char *s, *options = su_strdup(NULL, _options);
+ int invalid;
prefs->interval = interval;
prefs->stream_interval = stream_interval;
+#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
+
+ if (options) {
+ for (s = options; s[0]; s++) if (s[0] == '-') s[0] = '_';
+ }
+
prefs->gruuize = 1;
prefs->outbound = 0;
prefs->natify = 1;
@@ -263,17 +274,11 @@
prefs->validate = 1;
prefs->use_rport = 1;
-#define MATCH(v) (len == sizeof(#v) - 1 && strncasecmp(#v, s, len) == 0)
-
for (s = options; s && s[0]; ) {
size_t len = span_token(s);
int value = 1;
- if (len > 3 && strncasecmp(s, "no-", 3) == 0)
- value = 0, s += 3, len -= 3;
- else if (len > 4 && strncasecmp(s, "not-", 4) == 0)
- value = 0, s += 4, len -= 4;
- else if (len > 3 && strncasecmp(s, "no_", 3) == 0)
+ if (len > 3 && strncasecmp(s, "no_", 3) == 0)
value = 0, s += 3, len -= 3;
else if (len > 4 && strncasecmp(s, "not_", 4) == 0)
value = 0, s += 4, len -= 4;
@@ -284,14 +289,12 @@
else if (MATCH(outbound)) prefs->outbound = value;
else if (MATCH(natify)) prefs->natify = value;
else if (MATCH(validate)) prefs->validate = value;
- else if (MATCH(options-keepalive)) prefs->okeepalive = value;
else if (MATCH(options_keepalive)) prefs->okeepalive = value;
- else if (MATCH(use-connect)) prefs->use_connect = value;
else if (MATCH(use_connect)) prefs->use_connect = value;
- else if (MATCH(use-rport) || MATCH(use_rport)) prefs->use_rport = value;
- else if (MATCH(use-socks) || MATCH(use_socks)) prefs->use_socks = value;
- else if (MATCH(use-upnp) || MATCH(use_upnp)) prefs->use_upnp = value;
- else if (MATCH(use-stun) || MATCH(use_stun)) prefs->use_stun = value;
+ else if (MATCH(use_rport)) prefs->use_rport = value;
+ else if (MATCH(use_socks)) prefs->use_socks = value;
+ else if (MATCH(use_upnp)) prefs->use_upnp = value;
+ else if (MATCH(use_stun)) prefs->use_stun = value;
else
SU_DEBUG_1(("outbound(%p): unknown option \"%.*s\"\n",
(void *)ob->ob_owner, (int)len, s));
@@ -303,7 +306,10 @@
s += len;
}
- if (s && s[0]) {
+ invalid = s && s[0];
+ su_free(NULL, options);
+
+ if (invalid) {
SU_DEBUG_1(("outbound(%p): invalid options \"%s\"\n",
(void *)ob->ob_owner, options));
return -1;
@@ -326,6 +332,25 @@
return 0;
}
+/** Override stack default proxy for outbound */
+int outbound_set_proxy(outbound_t *ob,
+ url_string_t *proxy)
+{
+ url_string_t *new_proxy = NULL, *old_proxy = ob->ob_proxy;
+
+ if (proxy)
+ new_proxy = (url_string_t *)url_as_string(ob->ob_home, proxy->us_url);
+
+ if (proxy == NULL || new_proxy != NULL) {
+ ob->ob_proxy_override = 1;
+ ob->ob_proxy = new_proxy;
+ su_free(ob->ob_home, old_proxy);
+ return 0;
+ }
+
+ return -1;
+}
+
/* ---------------------------------------------------------------------- */
/** Obtain contacts for REGISTER */
@@ -784,6 +809,8 @@
ob,
NULL,
req,
+ TAG_IF(ob->ob_proxy_override,
+ NTATAG_DEFAULT_PROXY(ob->ob_proxy)),
TAG_END());
if (!ob->ob_keepalive.orq)
@@ -949,6 +976,8 @@
ob,
NULL,
req,
+ TAG_IF(ob->ob_proxy_override,
+ NTATAG_DEFAULT_PROXY(ob->ob_proxy)),
SIPTAG_SUBJECT_STR("REGISTRATION PROBE"),
/* NONE is used to remove
Max-Forwards: 0 found in ordinary keepalives */
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/nua/outbound.h Thu May 22 15:05:28 2008
@@ -70,6 +70,9 @@
unsigned dgram_interval,
unsigned stream_interval);
+int outbound_set_proxy(outbound_t *ob,
+ url_string_t *proxy);
+
int outbound_get_contacts(outbound_t *ob,
sip_contact_t **return_current_contact,
sip_contact_t **return_previous_contact);
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c Thu May 22 15:05:28 2008
@@ -2190,6 +2190,8 @@
return c;
}
+uint16_t _sres_default_port = 53;
+
/** Parse config file.
*
* @return Number of search domains, if successful.
@@ -2212,7 +2214,7 @@
c->c_opt.check_names = 1;
c->c_opt.timeout = SRES_RETRY_INTERVAL;
c->c_opt.attempts = SRES_MAX_RETRY_COUNT;
- c->c_port = 53;
+ c->c_port = _sres_default_port;
if (f != NULL) {
for (line = 1; fgets(buf, sizeof(buf), f); line++) {
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/Makefile.am Thu May 22 15:05:28 2008
@@ -1,35 +1,63 @@
#
-# Tests using check
+# Makefile.am for Sofia SIP tests
#
+# Copyright (C) 2007,2008 Nokia Corporation
+# Contact: Pekka Pessi <pekka.pessi(a)nokia.com>
+# Licensed under LGPL. See file COPYING.
+
+TESTS = test_nua
+check_PROGRAMS = test_nua
EXTRA_DIST = check_sofia.h check_sofia.c suite_for_nua.c
-TESTS =
-tests_PROGRAMS =
-testsdir := ${libdir}/tests/libsofia-sip-ua-tests
+test_nua_SOURCES = test_nua.c
-include $(top_srcdir)/rules/sofia.am
+test_nua_LDADD = $(check_LIBRARIES) \
+ ${sofiabuilddir}/libsofia-sip-ua.la
-INCLUDES = ${INTERNAL_INCLUDES}
+check_LIBRARIES = libtestnua.a libtestproxy.a libtestnat.a
-AM_CFLAGS += @CHECK_CFLAGS@
+libtestnua_a_SOURCES = test_nua.h test_ops.c \
+ test_init.c \
+ test_nua_api.c test_nua_params.c \
+ test_register.c test_basic_call.c \
+ test_offer_answer.c \
+ test_call_reject.c test_cancel_bye.c \
+ test_call_hold.c test_session_timer.c \
+ test_refer.c test_100rel.c \
+ test_simple.c test_sip_events.c \
+ test_extension.c
-if HAVE_CHECK
+libtestproxy_a_SOURCES = test_proxy.h test_proxy.c
+
+libtestnat_a_SOURCES = test_nat.h test_nat.c test_nat_tags.c
+#
+# Install in special test package
+#
+testsdir = ${libdir}/tests/libsofia-sip-ua-tests
+tests_PROGRAMS =
+
+if HAVE_CHECK
TESTS += check_sofia
tests_PROGRAMS += check_sofia
+endif
+
+check_sofia_CFLAGS = @CHECK_CFLAGS@
+
check_sofia_SOURCES = check_sofia.c check_sofia.h \
suite_for_nua.c
-CHECKLIBS = ${sofiabuilddir}/nua/libtestnua.la \
- ${sofiabuilddir}/nua/libtestproxy.la \
- ${sofiabuilddir}/nua/libtestnat.la
-
-$(CHECKLIBS):
- cd ${sofiabuilddir}/nua && make checklib
-
-check_sofia_LDADD = \
- $(CHECKLIBS) ${sofiabuilddir}/libsofia-sip-ua.la \
- @CHECK_LIBS@
-endif
+check_sofia_LDADD = $(check_LIBRARIES) \
+ ${sofiabuilddir}/libsofia-sip-ua.la \
+ @CHECK_LIBS@
+
+CLEANFILES = tmp_sippasswd.??????
+
+# ----------------------------------------------------------------------
+# Sofia specific rules
+
+include $(top_srcdir)/rules/sofia.am
+
+INCLUDES = ${INTERNAL_INCLUDES}
Modified: freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c
==============================================================================
--- freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c (original)
+++ freeswitch/branches/lukedashjr/syslibs/libs/sofia-sip/tests/suite_for_nua.c Thu May 22 15:05:28 2008
@@ -22,7 +22,7 @@
*
*/
-/**@CFILE check_sofia.c
+/**@CFILE suite_for_nua.c
*
* @brief Check-driven tester for Sofia SIP User Agent library
*
1
0