[Freeswitch-branches] [commit] r8663 - in freeswitch/branches/lukedashjr/syslibs: freeswitch freeswitch/build freeswitch/build/config freeswitch/conf/autoload_configs freeswitch/conf/dialplan freeswitch/conf/lang/en freeswitch/conf/lang/en/demo freeswitch/conf/sip_profiles freeswitch/debian freeswitch/scripts/contrib/jpalley/telegraph freeswitch/scripts/contrib/jpalley/telegraph/trunk freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_events_controller/templates freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model freeswitch/scripts/contrib/jpalley/telegraph/trunk/generators/voice_model/templates freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_events freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/core/voice_view freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch freeswitch/scripts/contrib/jpalley/telegraph/trunk/lib/freeswitch/voice_model freeswitch/scripts/contrib/jpalley/telegraph/trunk/test freeswitch/scripts/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Commands freeswitch/src freeswitch/src/include freeswitch/src/mod/applications/mod_commands freeswitch/src/mod/applications/mod_conference freeswitch/src/mod/applications/mod_dptools freeswitch/src/mod/applications/mod_fifo freeswitch/src/mod/applications/mod_voicemail freeswitch/src/mod/endpoints/mod_alsa freeswitch/src/mod/endpoints/mod_portaudio freeswitch/src/mod/endpoints/mod_sofia freeswitch/src/mod/endpoints/mod_woomera freeswitch/src/mod/formats/mod_local_stream freeswitch/src/mod/formats/mod_shout freeswitch/src/mod/formats/mod_sndfile freeswitch/src/mod/languages/mod_java freeswitch/src/mod/languages/mod_java/src/org/freeswitch/swig freeswitch/src/mod/languages/mod_lua freeswitch/src/mod/languages/mod_mono freeswitch/src/mod/languages/mod_mono_managed freeswitch/src/mod/languages/mod_mono_managed/Properties freeswitch/src/mod/languages/mod_mono_managed/swig freeswitch/src/mod/languages/mod_perl freeswitch/src/mod/languages/mod_spidermonkey freeswitch/src/mod/xml_int/mod_xml_cdr freeswitch/src/mod/xml_int/mod_xml_rpc libs/sofia-sip libs/sofia-sip/libsofia-sip-ua/docs libs/sofia-sip/libsofia-sip-ua/http libs/sofia-sip/libsofia-sip-ua/iptsec libs/sofia-sip/libsofia-sip-ua/msg libs/sofia-sip/libsofia-sip-ua/nea libs/sofia-sip/libsofia-sip-ua/nta libs/sofia-sip/libsofia-sip-ua/nua libs/sofia-sip/libsofia-sip-ua/sdp libs/sofia-sip/libsofia-sip-ua/sip libs/sofia-sip/libsofia-sip-ua/soa libs/sofia-sip/libsofia-sip-ua/sresolv libs/sofia-sip/libsofia-sip-ua/stun libs/sofia-sip/libsofia-sip-ua/su libs/sofia-sip/libsofia-sip-ua/su/sofia-sip libs/sofia-sip/libsofia-sip-ua/tport libs/sofia-sip/open_c/group libs/sofia-sip/tests libs/sofia-sip/win32/libsofia-sip-ua libs/sofia-sip/win32/tests/test_nua libs/xmlrpc-c libs/xmlrpc-c/Windows libs/xmlrpc-c/Windows/xmlrpc-c libs/xmlrpc-c/doc libs/xmlrpc-c/examples libs/xmlrpc-c/examples/cpp libs/xmlrpc-c/include libs/xmlrpc-c/include/xmlrpc-c libs/xmlrpc-c/lib libs/xmlrpc-c/lib/abyss libs/xmlrpc-c/lib/abyss/example libs/xmlrpc-c/lib/abyss/example/conf libs/xmlrpc-c/lib/abyss/example/htdocs libs/xmlrpc-c/lib/abyss/src libs/xmlrpc-c/lib/curl_transport libs/xmlrpc-c/lib/expat libs/xmlrpc-c/lib/expat/gennmtab libs/xmlrpc-c/lib/expat/xmlparse libs/xmlrpc-c/lib/expat/xmltok libs/xmlrpc-c/lib/expat/xmlwf libs/xmlrpc-c/lib/libutil libs/xmlrpc-c/lib/libwww_transport libs/xmlrpc-c/lib/util libs/xmlrpc-c/lib/util/include libs/xmlrpc-c/lib/wininet_transport libs/xmlrpc-c/src libs/xmlrpc-c/src/cpp libs/xmlrpc-c/src/cpp/test libs/xmlrpc-c/src/test libs/xmlrpc-c/src/test/data libs/xmlrpc-c/tools libs/xmlrpc-c/tools/lib libs/xmlrpc-c/tools/lib/include libs/xmlrpc-c/tools/perl_packetsocket libs/xmlrpc-c/tools/turbocharger libs/xmlrpc-c/tools/xml-rpc-api2cpp libs/xmlrpc-c/tools/xmlrpc libs/xmlrpc-c/tools/xmlrpc_cpp_proxy libs/xmlrpc-c/tools/xmlrpc_pstream libs/xmlrpc-c/tools/xmlrpc_transport

Freeswitch SVN lukedashjr at freeswitch.org
Mon May 26 12:59:59 EDT 2008


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 at jerris.com>  Tue, 13 May 2008 02:01:00 -0400
+ -- Michael Jerris <mike at 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 at 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 at 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 at 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="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
 				PreprocessorDefinitions="ABYSS_WIN32"
 				UsePrecompiledHeader="0"
 			/>
@@ -103,7 +103,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
 				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="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
 				PreprocessorDefinitions="ABYSS_WIN32"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
 				Name="VCLinkerTool"
 				AdditionalLibraryDirectories="..\..\..\..\libs\xmlrpc\lib;&quot;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\apr-util\xml\expat\lib\LibD&quot;"
 			/>
+			<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="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\abyss\src&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\lib\util\include&quot;;&quot;$(InputDir)..\..\..\..\libs\xmlrpc-c\Windows&quot;"
 				PreprocessorDefinitions="ABYSS_WIN32"
 				UsePrecompiledHeader="0"
 			/>
 			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
 				Name="VCLinkerTool"
 				AdditionalLibraryDirectories="..\..\..\..\libs\xmlrpc\lib;&quot;..\..\..\..\libs\xmlrpc\lib\abyss\src\$(OutDir)&quot;;&quot;..\..\..\..\libs\apr-util\xml\expat\lib\LibR&quot;"
 			/>
+			<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 @@
- at 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
+ at REM Windows build
+ at REM This must be RUN once to establish some header files,
+ at REM that are generated by the automake process
+ at echo creating Win32 header files...once only
+ at set TEMPV=
+ at if EXIST ..\include\xmlrpc-c\config.h goto DN1
+copy .\win32_config.h ..\include\xmlrpc-c\config.h > nul
+ at set TEMPV=%TEMPV% ..\include\xmlrpc-c\config.h
+:DN1
+ at if EXIST ..\xmlrpc_config.h goto DN2
+copy .\xmlrpc_win32_config.h ..\xmlrpc_config.h > nul
+ at set TEMPV=%TEMPV% ..\xmlrpc_config.h
+:DN2
+ at if EXIST ..\transport_config.h goto DN3
+copy .\transport_config_win32.h ..\transport_config.h > nul
+ at set TEMPV=%TEMPV% ..\transport_config.h
+:DN3
+ at if EXIST ..\version.h goto DN4
+call mkvers
+ at set TEMPV=%TEMPV% ..\version.h
+:DN4
+ at if EXIST ..\examples\config.h goto DN5
+copy .\xmlrpc_win32_config.h ..\examples\config.h > nul
+ at set TEMPV=%TEMPV% ..\examples\config.h
+:DN5
+ at if "%TEMPV%." == "." goto ALLDN
+ at echo Generated the following win32 header files ...
+ at echo %TEMPV%
+ at goto END
+
+:ALLDN
+ at echo Using previous copies ... Use CleanWin32.bat to remove, and do again ...
+ at 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 at 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 at giraffe-data.com>)
-(SAB means Steven A. Bone <sbone at 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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at pobox.com> - 20 January 2001
-
-  * Bug fix: Make sure CGI-based servers send correct content-length.
-
-0.9.4 - Eric Kidd <eric.kidd at pobox.com> - 18 January 2001
-
-  * Services for CGI-based servers.
-
-0.9.3 - Eric Kidd <eric.kidd at 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 at 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 at 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>" \
-  "&copy; <a href=\"mailto:mmoez at 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 at 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 at 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 at 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 at 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( &ltime );
-    DateFromGMT(&date,ltime);
-    
+    time(&ltime);
+    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 at 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 at 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 at 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 at 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 at 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, &paramArrayP, 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, &paramP);
-            if (env.fault_occurred)
-                throw(error(env.fault_string));
+            xmlrpc_array_read_item(&env.env_c, paramArrayP, i, &paramP);
+            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 = &registry;
-    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(&registry);
+    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, &paramArrayP);
+    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, &paramArrayP);
+    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, &params);
-    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, &params);
-        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>&lt;&amp;&gt;</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, &params);
+                      &methodName, &paramsP);
     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, &params);
+
+    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, &params);
+
         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, &paramArrayP, &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, &paramArrayP, &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, &paramArrayP, &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, &paramArrayP, &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; /* &lt; */
-        else if (str[i] == '>')
-            needed += 4; /* &gt; */
-        else if (str[i] == '&')
-            needed += 5; /* &amp; */
+    size = 0;
+    for (i = 0; i < len; ++i) {
+        if (chars[i] == '<')
+            size += 4; /* &lt; */
+        else if (chars[i] == '>')
+            size += 4; /* &gt; */
+        else if (chars[i] == '&')
+            size += 5; /* &amp; */
+        else if (chars[i] == '\r')
+            size += 6; /* &#x0d; */
         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
+   &amp; and &lt;.
+
+   Also change > to &gt;, even though not required for XML, for
+   symmetry.
+
+   &lt; etc. are known in XML as "entity references."
+   
+   Also Escape CR as &#x0d; .  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.
+
+   &#x0d; 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, "&lt;", 4);
+                p += 4;
+            } else if (chars[i] == '>') {
+                memcpy(p, "&gt;", 4);
+                p += 4;
+            } else if (chars[i] == '&') {
+                memcpy(p, "&amp;", 5);
+                p += 5;
+            } else if (chars[i] == '\r') {
+                memcpy(p, "&#x0d;", 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 at 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 at 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 at 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, &paramArg[2], paramPP);
+    else if (strncmp(paramArg, "h/", 2) == 0)
+        buildBytestring(envP, &paramArg[2], paramPP);
     else if (strncmp(paramArg, "i/", 2) == 0) 
         buildInt(envP, &paramArg[2], paramPP);
+    else if (strncmp(paramArg, "I/", 2) == 0) 
+        buildI8(envP, &paramArg[2], paramPP);
+    else if (strncmp(paramArg, "d/", 2) == 0) 
+        buildDouble(envP, &paramArg[2], paramPP);
     else if (strncmp(paramArg, "b/", 2) == 0)
         buildBool(envP, &paramArg[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 (&lt;int4&gt;)
+<dd>integer (&lt;i4&gt;) (32 bit)
 
 <dt>s/
 <dd>string (&lt;string&gt;)
 
+<dt>h/
+<dd>byte string (&lt;base64&gt;).  Specify the value in hexadecimal.
+
 <dt>b/
-<dd>boolean (&lt;boolean&gt;)
+<dd>boolean (&lt;boolean&gt;).  Specify the value as &quot;true&quot; or
+&quot;t&quot; for true; &quot;false&quot; or &quot;f&quot; for false.
+
+<dt>d/
+<dd>double (&lt;double&gt;)  (i.e. real number)
 
 <dt>n/
 <dd>nil (&lt;nil&gt;)
 
+<dt>I/
+<dd>64 bit integer (&lt;i8&gt;)
+
 </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 &quot;C&quot;.
+
 </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



More information about the Freeswitch-branches mailing list