[Freeswitch-svn] [commit] r8545 - in freeswitch/trunk/libs/xmlrpc-c: . Windows doc examples examples/cpp include include/xmlrpc-c lib lib/abyss lib/abyss/example lib/abyss/example/conf lib/abyss/example/htdocs lib/abyss/src lib/curl_transport lib/expat lib/expat/gennmtab lib/expat/xmlparse lib/expat/xmltok lib/expat/xmlwf lib/libutil lib/libwww_transport lib/util lib/util/include lib/wininet_transport src src/cpp src/cpp/test src/test src/test/data tools tools/lib tools/lib/include tools/perl_packetsocket tools/turbocharger tools/xml-rpc-api2cpp tools/xmlrpc tools/xmlrpc_cpp_proxy tools/xmlrpc_pstream tools/xmlrpc_transport

Freeswitch SVN mikej at freeswitch.org
Fri May 23 16:56:25 EDT 2008


Author: mikej
Date: Fri May 23 16:56:24 2008
New Revision: 8545

Added:
   freeswitch/trunk/libs/xmlrpc-c/Makefile.srcdir.in
   freeswitch/trunk/libs/xmlrpc-c/Makefile.version
   freeswitch/trunk/libs/xmlrpc-c/Windows/CleanAll.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/CleanWin32.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeOld.txt
   freeswitch/trunk/libs/xmlrpc-c/Windows/UsingProxyDSP.txt
   freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/configwin32.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/curllink.h
   freeswitch/trunk/libs/xmlrpc-c/Windows/delsln.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/diffcfg.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers1.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/updcfg.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/win32_config.h
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlhttpsys.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_cpp_proxy.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_misc.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpccpp.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.dsp
   freeswitch/trunk/libs/xmlrpc-c/common.mk
   freeswitch/trunk/libs/xmlrpc-c/config.mk.in
   freeswitch/trunk/libs/xmlrpc-c/dll-common.make
   freeswitch/trunk/libs/xmlrpc-c/doc/INSTALL
   freeswitch/trunk/libs/xmlrpc-c/dylib-common.make
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/asynch_client.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_client.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_inetd_server.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_inetd_server.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_loop_server.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_client.c
   freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_server.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_inetd_server.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_socket_server.c
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_opensslsock.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_unixsock.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_winsock.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base64.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/c_util.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_global.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_transport.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/inttypes.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/packetsocket.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/select_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_pstream.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/sleep_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/string_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/time_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
   freeswitch/trunk/libs/xmlrpc-c/irix-common.make
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/HISTORY
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/abyss.conf
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/mime.types
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/index.htm
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/pwrabyss.gif   (contents, props changed)
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/abyss_info.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/init.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/response.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_openssl.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_fork.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_pthread.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_windows.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/trace.h
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/asprintf.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/error.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/make_printable.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/memblock.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/select.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/sleep.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/time.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libutil/utf8.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/cmdline_parser_cpp.cpp
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/assertx.hpp
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/c_util.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/cmdline_parser.hpp
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/girmath.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/girstring.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/int.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/stdargx.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/string_parser.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/unistdx.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/string_parser.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/stripcaseeq.c
   freeswitch/trunk/libs/xmlrpc-c/missing
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/base64.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/curl.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/env_wrap.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/env_wrap.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/girerr.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/libwww.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/packetsocket.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/pstream.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/server_pstream.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/Makefile
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/registry.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/registry.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_abyss.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_abyss.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_pstream.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/server_pstream.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/test.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/testclient_dummy.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/tools.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/test/tools.hpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/wininet.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/double.c
   freeswitch/trunk/libs/xmlrpc-c/src/double.h
   freeswitch/trunk/libs/xmlrpc-c/src/method.c
   freeswitch/trunk/libs/xmlrpc-c/src/method.h
   freeswitch/trunk/libs/xmlrpc-c/src/parse_value.c
   freeswitch/trunk/libs/xmlrpc-c/src/parse_value.h
   freeswitch/trunk/libs/xmlrpc-c/src/registry.c
   freeswitch/trunk/libs/xmlrpc-c/src/registry.h
   freeswitch/trunk/libs/xmlrpc-c/src/resource.c
   freeswitch/trunk/libs/xmlrpc-c/src/system_method.c
   freeswitch/trunk/libs/xmlrpc-c/src/system_method.h
   freeswitch/trunk/libs/xmlrpc-c/src/test/Makefile
   freeswitch/trunk/libs/xmlrpc-c/src/test/abyss.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/abyss.h
   freeswitch/trunk/libs/xmlrpc-c/src/test/client_dummy.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/data/
   freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_no_params.xml
   freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_out_of_order.xml
   freeswitch/trunk/libs/xmlrpc-c/src/test/data/req_value_name.xml
   freeswitch/trunk/libs/xmlrpc-c/src/test/data/sample_add_call.xml
   freeswitch/trunk/libs/xmlrpc-c/src/test/method_registry.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/method_registry.h
   freeswitch/trunk/libs/xmlrpc-c/src/test/serialize_value.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/serialize_value.h
   freeswitch/trunk/libs/xmlrpc-c/src/trace.c
   freeswitch/trunk/libs/xmlrpc-c/src/version.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_build.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_client_global.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_decompose.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_server_info.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_string.c
   freeswitch/trunk/libs/xmlrpc-c/tools/common.mk
   freeswitch/trunk/libs/xmlrpc-c/tools/lib/
   freeswitch/trunk/libs/xmlrpc-c/tools/lib/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/lib/dumpvalue.c
   freeswitch/trunk/libs/xmlrpc-c/tools/lib/include/
   freeswitch/trunk/libs/xmlrpc-c/tools/lib/include/dumpvalue.h
   freeswitch/trunk/libs/xmlrpc-c/tools/perl_packetsocket/
   freeswitch/trunk/libs/xmlrpc-c/tools/perl_packetsocket/PacketSocket.pm
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/proxyClass.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/systemProxy.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcMethod.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpcType.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_cpp_proxy/xmlrpc_cpp_proxy.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/test
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_pstream/xmlrpc_pstream.html
   freeswitch/trunk/libs/xmlrpc-c/transport_config.make
   freeswitch/trunk/libs/xmlrpc-c/unix-common.make
   freeswitch/trunk/libs/xmlrpc-c/xmlrpc-c-config.main
   freeswitch/trunk/libs/xmlrpc-c/xmlrpc-c-config.test.main
   freeswitch/trunk/libs/xmlrpc-c/xmlrpc_amconfig.h.in
Modified:
   freeswitch/trunk/libs/xmlrpc-c/GNUmakefile
   freeswitch/trunk/libs/xmlrpc-c/Makefile
   freeswitch/trunk/libs/xmlrpc-c/README
   freeswitch/trunk/libs/xmlrpc-c/Windows/ConfigureWin32.bat
   freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeWin32.txt
   freeswitch/trunk/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt
   freeswitch/trunk/libs/xmlrpc-c/Windows/cpptest.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/rpctest.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/transport_config_win32.h
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsw
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp
   freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h
   freeswitch/trunk/libs/xmlrpc-c/configure.in
   freeswitch/trunk/libs/xmlrpc-c/doc/COPYING
   freeswitch/trunk/libs/xmlrpc-c/doc/HISTORY
   freeswitch/trunk/libs/xmlrpc-c/doc/TODO
   freeswitch/trunk/libs/xmlrpc-c/examples/Makefile
   freeswitch/trunk/libs/xmlrpc-c/examples/auth_client.c
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/Makefile
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp
   freeswitch/trunk/libs/xmlrpc-c/examples/gen_sample_add_xml.c
   freeswitch/trunk/libs/xmlrpc-c/examples/synch_client.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_loop_server.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c
   freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c
   freeswitch/trunk/libs/xmlrpc-c/include/Makefile
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_int.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/transport.h
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp
   freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h
   freeswitch/trunk/libs/xmlrpc-c/lib/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conf.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/main.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/token.c
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/token.h
   freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/trace.c
   freeswitch/trunk/libs/xmlrpc-c/lib/curl_transport/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/curl_transport/xmlrpc_curl_transport.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/expat.html
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/gennmtab/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmlparse/xmlparse.h
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmldef.h
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmlrole.h
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmltok.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmltok.h
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmltok_impl.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmltok/xmltok_ns.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmlwf/xmlfile.c
   freeswitch/trunk/libs/xmlrpc-c/lib/expat/xmlwf/xmlwf.c
   freeswitch/trunk/libs/xmlrpc-c/lib/libwww_transport/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/libwww_transport/xmlrpc_libwww_transport.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/util/casprintf.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/cmdline_parser.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/getoptx.c
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/bool.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/casprintf.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/cmdline_parser.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/mallocvar.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/include/pthreadx.h
   freeswitch/trunk/libs/xmlrpc-c/lib/util/pthreadx_win32.c
   freeswitch/trunk/libs/xmlrpc-c/lib/wininet_transport/Makefile
   freeswitch/trunk/libs/xmlrpc-c/lib/wininet_transport/xmlrpc_wininet_transport.c
   freeswitch/trunk/libs/xmlrpc-c/mkinstalldirs
   freeswitch/trunk/libs/xmlrpc-c/src/Makefile
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/Makefile
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/XmlRpcCpp.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/client.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/client_simple.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/girmem.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/outcome.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/param_list.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/registry.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/server_abyss.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/value.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/cpp/xml.cpp
   freeswitch/trunk/libs/xmlrpc-c/src/test/cgi.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/client.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/parse_xml.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/serialize.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/server_abyss.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/test.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/test.h
   freeswitch/trunk/libs/xmlrpc-c/src/test/value.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/xml_data.c
   freeswitch/trunk/libs/xmlrpc-c/src/test/xml_data.h
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_array.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_authcookie.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_client.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_data.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_datetime.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_expat.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_libxml2.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_parse.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_serialize.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_server_abyss.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_server_cgi.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_server_w32httpsys.c
   freeswitch/trunk/libs/xmlrpc-c/src/xmlrpc_struct.c
   freeswitch/trunk/libs/xmlrpc-c/tools/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/turbocharger/mod_gzip.c
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/DataType.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcClass.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/XmlRpcFunction.hpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xml-rpc-api2cpp/xml-rpc-api2cpp.cpp
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.c
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc/xmlrpc.html
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_transport/Makefile
   freeswitch/trunk/libs/xmlrpc-c/tools/xmlrpc_transport/xmlrpc_transport.c
   freeswitch/trunk/libs/xmlrpc-c/xmlrpc_config.h.in

Log:
merged new xmlrpc-c revision 1472 from https://xmlrpc-c.svn.sourceforge.net/svnroot/xmlrpc-c/trunk

Modified: freeswitch/trunk/libs/xmlrpc-c/GNUmakefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/GNUmakefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/GNUmakefile	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Makefile	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/Makefile.srcdir.in
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Makefile.srcdir.in	Fri May 23 16:56:24 2008
@@ -0,0 +1 @@
+SRCDIR=@abs_srcdir@

Added: freeswitch/trunk/libs/xmlrpc-c/Makefile.version
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Makefile.version	Fri May 23 16:56:24 2008
@@ -0,0 +1,11 @@
+###############################################################################
+# This is not only a make file inclusion, but a source file for the program
+# 'mkvers' in the Windows build system.  The latter is very particular about
+# the format of this file.  Do not change white space, add comment lines, or
+# anything!
+#
+#
+###############################################################################
+XMLRPC_MAJOR_RELEASE = 1
+XMLRPC_MINOR_RELEASE = 14
+XMLRPC_POINT_RELEASE = 99

Modified: freeswitch/trunk/libs/xmlrpc-c/README
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/README	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/README	Fri May 23 16:56:24 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
 ----------------------

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/CleanAll.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/CleanAll.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,48 @@
+ at echo This batch file requires a powerful XDELETE program. One
+ at echo that will REMOVE whole directories recursively ...
+ at echo If you do NOT have such a program, then abort now, and
+ at echo adjust the line below ...
+ at set TEMPX=xdelete -dfrm
+ at echo set TEMPX=%TEMPX%
+ at pause
+ at echo #####################################################
+ at echo ARE YOU SURE YOU WANT TO DO THIS? Ctrl+C to abort ...
+ at echo #####################################################
+ at pause
+ at echo CleanAll: Last chance ... ctrl+c to abort ...
+ at pause
+ at echo CleanAll: Cleaning the headers ...
+call CleanWin32
+ at echo CleanAll: and removing the SOLUTION files ...
+call delsln
+ at echo CleanAll: Cleaning the gennmtab generated header ...
+ at if EXIST ..\lib\expat\xmltok\nametab.h del ..\lib\expat\xmltok\nametab.h > nul
+ at echo CleanAll: Cleaning all built binaries ...
+ at if EXIST ..\bin\*.exe del ..\bin\*.exe > nul
+ at if EXIST ..\bin\*.exp del ..\bin\*.exp > nul
+ at if EXIST ..\bin\*.ilk del ..\bin\*.ilk > nul
+ at if EXIST ..\bin\*.lib del ..\bin\*.lib > nul
+ at if EXIST ..\lib\*.lib del ..\lib\*.lib > nul
+ at if EXIST ..\lib\*.dll del ..\lib\*.dll > nul
+ at echo CleanAll: Cleaning test data files ...
+ at if EXIST ..\bin\data\*.xml del ..\bin\data\*.xml > nul
+ at if EXIST ..\bin\data\. rd ..\bin\data > nul
+ at if EXIST ..\bin\. rd ..\bin > nul
+ at echo CleanAll: Cleaning old residual built binaries ... but none should exist ...
+ at if EXIST ..\lib\expat\gennmtab\Debug\. %TEMPX% ..\lib\expat\gennmtab\Debug
+ at if EXIST ..\lib\expat\gennmtab\Release\. %TEMPX% ..\lib\expat\gennmtab\Release
+ at if EXIST ..\lib\expat\xmlparse\Debug\. %TEMPX% ..\lib\expat\xmlparse\Debug
+ at if EXIST ..\lib\expat\xmlparse\DebugDLL\. %TEMPX% ..\lib\expat\xmlparse\DebugDLL
+ at if EXIST ..\lib\expat\xmlparse\Release\. %TEMPX% ..\lib\expat\xmlparse\Release
+ at if EXIST ..\lib\expat\xmlparse\ReleaseDLL\. %TEMPX% ..\lib\expat\xmlparse\ReleaseDLL
+ at if EXIST ..\lib\expat\xmlparse\ReleaseMinSizeDLL\. %TEMPX% ..\lib\expat\xmlparse\ReleaseMinSizeDLL
+ at if EXIST ..\lib\expat\xmltok\Debug\. %TEMPX% ..\lib\expat\xmltok\Debug
+ at if EXIST ..\lib\expat\xmltok\DebugDLL\. %TEMPX% ..\lib\expat\xmltok\DebugDLL
+ at if EXIST ..\lib\expat\xmltok\Release\. %TEMPX% ..\lib\expat\xmltok\Release
+ at if EXIST ..\lib\expat\xmltok\ReleaseDLL\. %TEMPX% ..\lib\expat\xmltok\ReleaseDLL
+ at echo CleanAll: Finally, cleaning the main intermediate directories ...
+ at if EXIST Debug\. %TEMPX% Debug
+ at if EXIST Release\. %TEMPX% Release
+ at echo .
+ at echo CleanAll: Phew ... all done ...
+ at echo .

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/CleanWin32.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/CleanWin32.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,43 @@
+ at echo Windows build
+ at echo This batch file deletes the copied header files,
+ at echo Deleting Win32 header files...
+ at echo #####################################################
+ at echo IF YOU HAVE MADE CHANGES IN ..\xmlrpc_config.h, ..\include\xmlrpc-c\config.h etc ...
+ at echo THESE CHANGES WILL BE LOST!
+ at echo You should run diffcfg.bat first to check for changes,
+ at echo and updcfg.bat if you have made changes ...
+ at echo #####################################################
+ at echo ARE YOU SURE YOU WANT TO DO THIS? Ctrl+C to abort ...
+ at echo #####################################################
+ at pause
+ at set TEMP1=
+ at if NOT EXIST ..\include\xmlrpc-c\config.h goto DN1
+del ..\include\xmlrpc-c\config.h > nul
+ at set TEMP1=%TEMP1% ..\include\xmlrpc-c\config.h
+:DN1
+ at if NOT EXIST ..\xmlrpc_config.h goto DN2
+del ..\xmlrpc_config.h > nul
+ at set TEMP1=%TEMP1% ..\xmlrpc_config.h
+:DN2
+ at if NOT EXIST ..\transport_config.h goto DN3
+del ..\transport_config.h > nul
+ at set TEMP1=%TEMP1% ..\transport_config.h
+:DN3
+ at if NOT EXIST ..\version.h goto DN4
+del ..\version.h > nul
+ at set TEMP1=%TEMP1% ..\version.h
+:DN4
+ at if NOT EXIST ..\examples\config.h goto DN5
+del ..\examples\config.h > nul
+ at set TEMP1=%TEMP1% ..\examples\config.h
+:DN5
+ at if "%TEMP1%." == "." goto ALLDN
+ at echo DELETED win32 header files.
+ at echo %TEMP1%
+ at goto END
+
+:ALLDN
+ at echo NOne to DELETE ...
+ at goto END
+
+:END

Modified: freeswitch/trunk/libs/xmlrpc-c/Windows/ConfigureWin32.bat
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/ConfigureWin32.bat	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/ConfigureWin32.bat	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeOld.txt
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeOld.txt	Fri May 23 16:56:24 2008
@@ -0,0 +1,125 @@
+Current information is in ReadMeWin32.txt.
+
+What follows is previous contents of that file.
+
+
+
+Markus Hoffrogge:
+
+Compilation for WIN32 is possible now again for version 1.6.10 - non
+CPP parts only.  Project files have been tested under VicualStudio
+6.0.  Build project all - this will build all other projects.  CPP
+code is not compiled and adopted right now.
+
+This release excludes the option to compile an "http.sys" version of
+an XML-RPC server. If you do wish to build in the http.sys server, set
+the MUST_BUILD_HTTP_SYS_SERVER to 1 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.
+

Modified: freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeWin32.txt
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeWin32.txt	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/ReadMeWin32.txt	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/UsingCURLinWin32.txt	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/UsingProxyDSP.txt
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/UsingProxyDSP.txt	Fri May 23 16:56:24 2008
@@ -0,0 +1,51 @@
+
+Using xmlrpc_cpp_proxy.dsp
+
+While not included in the main xmlrpc.dsw file, this
+xmlrpc_cpp_proxy.dsp, if added as a project to the xmlrpc solution,
+will build bin\xmlrpc_cpp_proxy.exe and xmlrpc_cpp_proxyD.exe, for
+testing using the default WinINET transport.
+
+After you have loaded the xmlrpc_cpp_proxy.dsp, which adds an 
+xmlrpc_cpp_proxy project, it is necessary to ADD a dependance on
+the xmlrpc library, to complete the link.
+
+To do this in say MSVC8, select the xmlrpc_cpp_proxy project, and right
+mouse click, and in the context menu, select 'Project Dependancies...'.
+And in the Project Dependancies dialog, check the xmlrpc proejct,
+then [Ok] ...
+
+To test your xmlrpc_cpp_proxy[D].exe -
+
+
+1. In a console start the server, like -
+
+bin/xmlrpc_sample_add_serverD 8080
+
+Note, since this server opens a socket, you may have to enable it on some
+anti-virus software that detects the socket being established, and
+'Unblock' it in the Windows Security Alert system dialog that appears.
+
+You can later remove this program from the Firewall exceptions, through
+Control Panel -> Windows Firewall, selecting the 'Exceptions' tab, where
+you can also disable this 'blocking' notification, but not recommended.
+
+The server should start, and report -
+Running XML-RPC server...
+
+
+2. In another console run the cpp proxy client, with say -
+
+bin>xmlrpc_cpp_proxyD http://localhost:8080/RPC2 null null
+
+The client should connect to the server, and output a 'null' header,
+and implementation file. If this functions, for a bigger example, try -
+
+bin>xmlrpc_cpp_proxyD http://localhost:8080/RPC2 system systemProxy
+
+and you should see a better example of a class header, and the 
+implementation code ...
+
+20 December, 2007
+
+EOF

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/abyss.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,252 @@
+# Microsoft Developer Studio Project File - Name="abyss" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=abyss - 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 "abyss.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 "abyss.mak" CFG="abyss - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "abyss - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "abyss - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "abyss - 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\Abyss"
+# PROP Intermediate_Dir "Release\Abyss"
+# 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 "..\\" /I "..\include" /I "..\lib\util\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /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
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\lib\abyss.lib"
+
+!ELSEIF  "$(CFG)" == "abyss - 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\abyss"
+# PROP Intermediate_Dir "Debug\abyss"
+# 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 /MTd /W3 /Gm /GX /ZI /Od /I "..\\" /I "..\include" /I "..\lib\util\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /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
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\lib\abyssD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "abyss - Win32 Release"
+# Name "abyss - 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\channel.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\chanswitch.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\date.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\file.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\handler.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\http.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\init.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\response.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\server.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\session.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket_openssl.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket_unix.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\socket_win.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\thread_fork.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\thread_pthread.c
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\thread_windows.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\token.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\trace.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\abyss_info.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=..\lib\abyss\src\conn.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\data.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\abyss\src\handler.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\http.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\server.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\session.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\abyss\src\thread.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\token.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\abyss\src\trace.h
+# End Source File
+# End Group
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/configwin32.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/configwin32.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,97 @@
+# Microsoft Developer Studio Project File - Name="configwin32" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=configwin32 - 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 "configwin32.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 "configwin32.mak" CFG="configwin32 - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "configwin32 - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "configwin32 - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF  "$(CFG)" == "configwin32 - 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 Cmd_Line "ConfigureWin32.bat"
+# PROP BASE Rebuild_Opt ""
+# PROP BASE Target_File "../config.h"
+# PROP BASE Bsc_Name ""
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "ConfigureWin32.bat"
+# PROP Rebuild_Opt ""
+# PROP Target_File "../config.h"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF  "$(CFG)" == "configwin32 - 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 Cmd_Line "ConfigureWin32.bat"
+# PROP BASE Rebuild_Opt ""
+# PROP BASE Target_File "../config.h"
+# PROP BASE Bsc_Name ""
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir ""
+# PROP Cmd_Line "ConfigureWin32.bat"
+# PROP Rebuild_Opt ""
+# PROP Target_File "../config.h"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "configwin32 - Win32 Release"
+# Name "configwin32 - Win32 Debug"
+
+!IF  "$(CFG)" == "configwin32 - Win32 Release"
+
+!ELSEIF  "$(CFG)" == "configwin32 - Win32 Debug"
+
+!ENDIF
+
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# 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/trunk/libs/xmlrpc-c/Windows/cpptest.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/cpptest.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/cpptest.dsp	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/curllink.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/curllink.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,18 @@
+/* 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, we include this file into the Curl transport source code
+   to tell the linker to add these libs.
+   
+   Alternatively, the USER can add the libraries to LINK with as
+   NEEDED!
+*/
+
+#ifdef _DEBUG
+#pragma comment( lib, "C:\\FG\\FGCOMXML\\curl\\build\\Debug\\Lib_curl.lib" )
+#else
+#pragma comment( lib, "C:\\FG\\FGCOMXML\\curl\\build\\Release\\Lib_curl.lib" )
+#endif
+
+#pragma comment( lib, "Winmm.lib" )
+#pragma comment( lib, "Ws2_32.lib" )
+#pragma comment( lib, "Wldap32.lib" )

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/delsln.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/delsln.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,56 @@
+ at echo Delete the MSVC7 or MSVC8 soultion files ...
+ at echo *****************************************************
+ at echo ARE YOU SURE YOU WANT TO DO THIS? Ctrl+C to ABORT ...
+ at echo *****************************************************
+ at pause
+ at echo Deleting SOLUTION files ...
+ at if EXIST *.sln del *.sln > nul
+ at if EXIST *.vcproj del *.vcproj > nul
+ at if EXIST *.old echo Deleting *.old ...
+ at if EXIST *.old Del *.old > nul
+ at if EXIST *.bak echo Deleting *.bak ...
+ at if EXIST *.bak Del *.bak > nul
+ at if NOT EXIST temp*.* goto dntmp
+ at echo	Delete temp*.* ...
+ at del temp*.* > nul
+:dntmp
+ at if NOT EXIST *.obj goto dnobj
+ at echo	Delete *.obj ...
+ at del *.obj > nul
+:dnobj
+ at if NOT EXIST *.err goto dnerr
+ at echo	Delete *.err ...
+ at del *.err > nul
+:dnerr
+ at if NOT EXIST *.pdb goto dnpdb
+ at echo	Delete *.pdb ...
+ at del *.pdb > nul
+:dnpdb
+ at if NOT EXIST *.lst goto dnlst
+ at echo	Delete *.lst ...
+ at del *.lst > nul
+:dnlst
+ at if EXIST *.pch echo Deleting *.pch ...
+ at if EXIST *.pch Del *.pch > nul
+ at if EXIST *.ilk echo Deleting *.ilk ...
+ at if EXIST *.ilk Del *.ilk > nul
+ at if EXIST *.NCB echo Deleting *.NCB ...
+ at if EXIST *.NCB Del *.NCB > nul
+ at if EXIST *.plg echo Deleting *.plg ...
+ at if EXIST *.plg Del *.plg > nul
+ at if EXIST *.OPT echo Deleting *.OPT ...
+ at if EXIST *.OPT Del *.OPT > nul
+ at if EXIST *.idb echo Deleting *.idb ...
+ at if EXIST *.idb Del *.idb > nul
+ at if EXIST *.aps echo Deleting *.aps ...
+ at if EXIST *.aps Del *.aps > nul
+ at if EXIST *.sbr echo Deleting *.sbr ...
+ at if EXIST *.sbr Del *.sbr > nul
+ at if NOT EXIST *.suo goto DNSUO
+ at attrib -S -R -H *.suo > nul
+ at if EXIST *.suo echo Deleting *.suo ...
+ at if EXIST *.suo Del *.suo > nul
+:DNSUO
+ at if EXIST *.user echo Deleting *.user ...
+ at if EXIST *.user Del *.user > nul
+ at echo All done ...

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/diffcfg.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/diffcfg.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,6 @@
+diff -us win32_config.h ..\include\xmlrpc-c\config.h > tempcfg.diff
+diff -us xmlrpc_win32_config.h ..\xmlrpc_config.h >> tempcfg.diff
+diff -us transport_config_win32.h ..\transport_config.h >> tempcfg.diff
+diff -us xmlrpc_win32_config.h ..\examples\config.h >> tempcfg.diff
+np tempcfg.diff
+

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/gennmtab.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,112 @@
+# Microsoft Developer Studio Project File - Name="gennmtab" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=gennmtab - Win32 Release
+!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 "gennmtab.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 "gennmtab.mak" CFG="gennmtab - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "gennmtab - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "gennmtab - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "gennmtab - 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\gennmtab"
+# PROP Intermediate_Dir "Release\gennmtab"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "NDEBUG"
+# ADD RSC /l 0x809 /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 /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 /nologo /subsystem:console /machine:I386 /out:"..\bin\gennmtab.exe"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=(R) Generating nametab.h ...
+PostBuild_Cmds=..\bin\gennmtab.exe >..\lib\expat\xmltok\nametab.h
+# End Special Build Tool
+
+!ELSEIF  "$(CFG)" == "gennmtab - 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\gennmtab"
+# PROP Intermediate_Dir "Debug\gennmtab"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir "."
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x809 /d "_DEBUG"
+# ADD RSC /l 0x809 /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 /nologo /subsystem:console /debug /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 /nologo /subsystem:console /debug /machine:I386 /out:"..\bin\gennmtabD.exe"
+# Begin Special Build Tool
+SOURCE="$(InputPath)"
+PostBuild_Desc=(D) Generating nametab.h ...
+PostBuild_Cmds=..\bin\gennmtabD.exe >..\lib\expat\xmltok\nametab.h
+# End Special Build Tool
+
+!ENDIF 
+
+# Begin Target
+
+# Name "gennmtab - Win32 Release"
+# Name "gennmtab - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=..\lib\expat\gennmtab\gennmtab.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,53 @@
+ at if EXIST ..\version.h goto SHOW
+ at if NOT EXIST ..\Makefile.version goto ERR1
+ at if NOT EXIST mkvers1.bat goto ERR2
+ at echo updating/creating ..\version.h ...
+ at set TEMP1=1
+ at for /F "skip=8 tokens=3" %%i in (..\Makefile.version) do @call mkvers1 %%i
+ at if "%TEMPX1%." == "." goto NOX1
+ at if "%TEMPX2%." == "." goto NOX1
+ at if "%TEMPX3%." == "." goto NOX1
+ at set TEMP1=..\version.h
+ at echo #ifndef XMLRPC_C_VERSION_INCLUDED > %TEMP1%
+ at echo #define XMLRPC_C_VERSION_INCLUDED >> %TEMP1%
+ at echo /* generated by Windows/mkvers.bat on %DATE% ... */ >> %TEMP1%
+ at echo #define XMLRPC_C_VERSION "Xmlrpc-c %TEMPX1%.%TEMPX2%.%TEMPX3%" >> %TEMP1%
+ at echo #define XMLRPC_VERSION_MAJOR %TEMPX1% >> %TEMP1%
+ at echo #define XMLRPC_VERSION_MINOR %TEMPX2% >> %TEMP1%
+ at echo #define XMLRPC_VERSION_POINT %TEMPX3% >> %TEMP1%
+ at echo #endif >> %TEMP1%
+type %TEMP1%
+ at echo ..\version.h set to the above ...
+ at set TEMP1=
+ at set TEMPX1=
+ at set TEMPX2=
+ at set TEMPX3=
+ at goto END 
+
+:NOX1
+ at echo Some error occurred in the batch process ...
+ at goto NOVER
+
+:NOVER
+ at echo Failed to create ..\version.h .
+ at pause
+ at goto END
+
+
+:ERR1
+ at echo Can not locate ..\Makefile.version ... check name, location ...
+ at pause
+ at goto END
+:ERR2
+ at echo Can not locate mkvers1.bat ... check name, location ...
+ at pause
+ at goto END
+
+:SHOW
+ at echo ..\version.h already exist, with version ...
+ at type ..\version.h
+ at echo Delete this file if you wish to redo it ...
+ at pause
+ at goto END
+
+:END

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers1.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/mkvers1.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,32 @@
+ at if "%1." == "." goto ERR2
+ at if "%TEMP1%." == "." goto ERR1
+ at if "%TEMP1%" == "1" goto SET1
+ at if "%TEMP1%" == "2" goto SET2
+ at if "%TEMP1%" == "3" goto SET3
+ at echo environment variable has an invalid value %TEMP1% ...
+ at goto ERR2
+
+:SET1
+ at set TEMPX1=%1
+ at set TEMP1=2
+ at goto END
+
+:SET2
+ at set TEMPX2=%1
+ at set TEMP1=3
+ at goto END
+
+:SET3
+ at set TEMPX3=%1
+ at set TEMP1=4
+ at goto END
+
+
+:ERR1
+ at echo Environment variable TEMP1 not set ...
+:ERR2
+ at echo This batch is only intended to be run from within UPDVERS.BAT ...
+ at pause
+ at goto END
+
+:END

Modified: freeswitch/trunk/libs/xmlrpc-c/Windows/rpctest.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/rpctest.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/rpctest.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/transport_config_win32.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/transport_config_win32.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/transport_config_win32.h	Fri May 23 16:56:24 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";

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/updcfg.bat
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/updcfg.bat	Fri May 23 16:56:24 2008
@@ -0,0 +1,9 @@
+ at echo This will COPY the current config.h, xmlrpc_config.h, transprt_config.h,
+ at echo version.h, overwriting files in this 'Windows' folder!
+ at echo ARE YOU SURE YOU WANT TO DO THIS??? Ctrl+C to abort ...
+ at pause
+copy ..\include\xmlrpc-c\config.h win32_config.h
+copy ..\xmlrpc_config.h xmlrpc_win32_config.h
+copy ..\transport_config.h transport_config_win32.h
+ at echo all done ...
+

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/win32_config.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/win32_config.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,38 @@
+#ifndef XMLRPC_C_CONFIG_H_INCLUDED
+#define XMLRPC_C_CONFIG_H_INCLUDED
+
+/* This file, part of XML-RPC For C/C++, is meant to 
+   define characteristics of this particular installation 
+   that the other <xmlrpc-c/...> header files need in 
+   order to compile correctly when #included in Xmlrpc-c
+   user code.
+
+   Those header files #include this one.
+
+   This file was created by a make rule.
+*/
+#define XMLRPC_HAVE_WCHAR 1
+#ifdef WIN32
+  /* SOCKET is a type defined by <winsock.h>.  Anyone who
+     uses XMLRPC_SOCKET on a WIN32 system must #include
+     <winsock.h>
+  */
+  #define XMLRPC_SOCKET SOCKET
+  #define XMLRPC_HAVE_TIMEVAL 0
+  #define XMLRPC_HAVE_TIMESPEC 0
+#else
+  #define XMLRPC_SOCKET int
+  #define XMLRPC_HAVE_TIMEVAL 1
+  #define XMLRPC_HAVE_TIMESPEC 1
+#endif
+
+#if defined(_MSC_VER)
+  /* Newer MSVC has long long, but MSVC 6 does not */
+  #define XMLRPC_INT64 __int64
+  #define XMLRPC_INT32 __int32
+#else
+  #define XMLRPC_INT64 long long
+  #define XMLRPC_INT32 int
+#endif
+#endif
+

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlhttpsys.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlhttpsys.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="xmlhttpsys" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmlhttpsys - Win32 Release
+!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 "xmlhttpsys.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 "xmlhttpsys.mak" CFG="xmlhttpsys - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmlhttpsys - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmlhttpsys - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmlhttpsys - 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\xmlhttpsys"
+# PROP Intermediate_Dir "Release\xmlhttpsys"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /I "..\include" /D "NDEBUG" /D "XML_NS" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "_MBCS" /D "_LIB" /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\xmlhttpsys.lib"
+
+!ELSEIF  "$(CFG)" == "xmlhttpsys - 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\xmlhttpsys"
+# PROP Intermediate_Dir "Debug\xmlhttpsys"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "..\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "XML_NS" /D "_MBCS" /D "_LIB" /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\xmlhttpsysD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmlhttpsys - Win32 Release"
+# Name "xmlhttpsys - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=..\src\xmlrpc_server_w32httpsys.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=..\xmlrpc_config.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlparse.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,106 @@
+# Microsoft Developer Studio Project File - Name="xmlparse" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmlparse - Win32 Release
+!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 "xmlparse.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 "xmlparse.mak" CFG="xmlparse - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmlparse - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmlparse - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmlparse - 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\xmlparse"
+# PROP Intermediate_Dir "Release\xmlparse"
+# 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\expat\xmltok" /I "..\lib\expat\xmlwf" /I ".." /I "..\lib\util\include" /I "..\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "_MBCS" /D "_LIB" /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\xmlparse.lib"
+
+!ELSEIF  "$(CFG)" == "xmlparse - 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\xmlparse"
+# PROP Intermediate_Dir "Debug\xmlparse"
+# 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\expat\xmltok" /I "..\lib\expat\xmlwf" /I ".." /I "..\lib\util\include" /I "..\include" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "_MBCS" /D "_LIB" /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\xmlparseD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmlparse - Win32 Release"
+# Name "xmlparse - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=..\lib\expat\xmlparse\xmlparse.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=..\lib\expat\xmlparse\xmlparse.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Modified: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsw
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsw	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc.dsw	Fri May 23 16:56:24 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>
+{{{
+}}}
+
+###############################################################################
+

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_cpp_proxy.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_cpp_proxy.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,132 @@
+# Microsoft Developer Studio Project File - Name="xmlrpc_cpp_proxy" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=xmlrpc_cpp_proxy - 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_cpp_proxy.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_cpp_proxy.mak" CFG="xmlrpc_cpp_proxy - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmlrpc_cpp_proxy - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "xmlrpc_cpp_proxy - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmlrpc_cpp_proxy - 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_cpp_proxy"
+# PROP Intermediate_Dir "Release\xmlrpc_cpp_proxy"
+# 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\xmlrpc_cpp_proxy.exe"
+
+!ELSEIF  "$(CFG)" == "xmlrpc_cpp_proxy - 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_cpp_proxy"
+# PROP Intermediate_Dir "Debug\xmlrpc_cpp_proxy"
+# 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\xmlrpc_cpp_proxyD.exe" /pdbtype:sept
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmlrpc_cpp_proxy - Win32 Release"
+# Name "xmlrpc_cpp_proxy - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\proxyClass.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\systemProxy.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\xmlrpcMethod.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\xmlrpcType.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\xmlrpc_cpp_proxy.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\proxyClass.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\systemProxy.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\xmlrpcMethod.hpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\tools\xmlrpc_cpp_proxy\xmlrpcType.hpp
+# 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
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_misc.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_misc.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,122 @@
+# Microsoft Developer Studio Project File - Name="xmlrpc_misc" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmlrpc_misc - Win32 Release
+!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_misc.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_misc.mak" CFG="xmlrpc_misc - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmlrpc_misc - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmlrpc_misc - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmlrpc_misc - 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_misc"
+# PROP Intermediate_Dir "Release\xmlrpc_misc"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".."  /I "..\lib\util\include" /D "NDEBUG" /D "XML_NS" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "_MBCS" /D "_LIB" /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_misc.lib"
+
+!ELSEIF  "$(CFG)" == "xmlrpc_misc - 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_misc"
+# PROP Intermediate_Dir "Debug\xmlrpc_misc"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /I "..\lib\util\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "XML_NS" /D "_MBCS" /D "_LIB" /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\xmlrpc_miscD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmlrpc_misc - Win32 Release"
+# Name "xmlrpc_misc - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=..\lib\util\casprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\cmdline_parser.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\cmdline_parser_cpp.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\getoptx.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\string_parser.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\util\stripcaseeq.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Modified: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_asynch_client.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_server_w32httpsys.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_add_sync_client.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_sample_auth_client.dsp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpc_win32_config.h	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpccpp.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmlrpccpp.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,179 @@
+# Microsoft Developer Studio Project File - Name="xmlrpccpp" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmlrpccpp - 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 "xmlrpccpp.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 "xmlrpccpp.mak" CFG="xmlrpccpp - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmlrpccpp - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmlrpccpp - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmlrpccpp - 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\xmlrpccpp"
+# PROP Intermediate_Dir "Release\xmlrpccpp"
+# 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 /GR /GX /O2 /I "../lib" /I "../lib/curl_transport" /I "../lib/util/include" /I "../include" /I ".." /I "../lib/expat/xmlparse" /I "../lib/abyss/src" /I "../lib/wininet_transport" /I "../.." /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\xmlrpccpp.lib"
+
+!ELSEIF  "$(CFG)" == "xmlrpccpp - 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\xmlrpccpp"
+# PROP Intermediate_Dir "Debug\xmlrpccpp"
+# 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 /GR /Gm /GX /ZI /Od /I "../lib" /I "../lib/curl_transport" /I "../lib/util/include" /I "../include" /I ".." /I "../lib/expat/xmlparse" /I "../lib/abyss/src" /I "../lib/wininet_transport" /I "../.." /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\xmlrpccppD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmlrpccpp - Win32 Release"
+# Name "xmlrpccpp - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;cc"
+# Begin Source File
+
+SOURCE=..\src\cpp\base64.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\client_simple.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\curl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\env_wrap.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\fault.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\girerr.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\girmem.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\libwww.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\outcome.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\packetsocket.cpp
+# PROP Exclude_From_Build 1
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\param_list.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\pstream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\registry.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\server_abyss.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\server_pstream.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\value.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\wininet.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\xml.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\src\cpp\XmlRpcCpp.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=..\src\cpp\env_wrap.hpp
+# End Source File
+# End Group
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.dsp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/Windows/xmltok.dsp	Fri May 23 16:56:24 2008
@@ -0,0 +1,138 @@
+# Microsoft Developer Studio Project File - Name="xmltok" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=xmltok - Win32 Release
+!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 "xmltok.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 "xmltok.mak" CFG="xmltok - Win32 Release"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "xmltok - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "xmltok - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "xmltok - 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\xmltok"
+# PROP Intermediate_Dir "Release\xmltok"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I ".." /D "NDEBUG" /D "XML_NS" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "_MBCS" /D "_LIB" /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\xmltok.lib"
+
+!ELSEIF  "$(CFG)" == "xmltok - 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\xmltok"
+# PROP Intermediate_Dir "Debug\xmltok"
+# PROP Target_Dir "."
+MTL=midl.exe
+LINK32=link.exe -lib
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "XML_DTD" /D "XML_NS" /D "_MBCS" /D "_LIB" /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\xmltokD.lib"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "xmltok - Win32 Release"
+# Name "xmltok - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\xmlrole.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\xmltok.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\asciitab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\iasciitab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\latin1tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\nametab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\utf8tab.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\xmldef.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\xmlrole.h
+# End Source File
+# Begin Source File
+
+SOURCE=..\lib\expat\xmltok\xmltok.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project

Added: freeswitch/trunk/libs/xmlrpc-c/common.mk
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/common.mk	Fri May 23 16:56:24 2008
@@ -0,0 +1,611 @@
+# This file contains rules and variable settings for the convenience
+# of every other make file in the package.
+
+# No make file is required to use this file, but it usually saves a lot
+# of duplication.
+
+# The following make variables are meaningful as input to this file:
+#
+# SRCDIR:  Name of directory which is the top of the Xmlrpc-c source tree.
+# BLDDIR: Name of directory which is the top of the Xmlrpc-c build tree.
+
+include $(SRCDIR)/Makefile.version
+
+# .DELETE_ON_ERROR is a special predefined Make target that says to delete
+# the target if a command in the rule for it fails.  That's important,
+# because we don't want a half-made target sitting around looking like it's
+# fully made.
+.DELETE_ON_ERROR:
+
+GCC_WARNINGS = -Wall -Wundef -Wimplicit -W -Winline -Wundef
+  # We need -Wwrite-strings after we fix all the missing consts
+
+GCC_C_WARNINGS = $(GCC_WARNINGS) \
+  -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes
+
+GCC_CXX_WARNINGS = $(GCC_WARNINGS) -Woverloaded-virtual -Wsynth
+
+# The NDEBUG macro says not to build code that assumes there are no bugs.
+# This makes the code go faster.  The main thing it does is tell the C library
+# to make assert() a no-op as opposed to generating code to check the
+# assertion and crash the program if it isn't really true.  You can add
+# -UNDEBUG (in any of various ways) to override this.
+#
+CFLAGS_COMMON = -DNDEBUG
+CXXFLAGS_COMMON = -DNDEBUG
+
+ifeq ($(C_COMPILER_GNU),yes)
+  CFLAGS_COMMON += $(GCC_C_WARNINGS) -fno-common -g -O3
+endif
+
+ifeq ($(CXX_COMPILER_GNU),yes)
+  CXXFLAGS_COMMON += $(GCC_CXX_WARNINGS) -g
+endif
+
+DISTDIR = $(BLDDIR)/$(PACKAGE)-$(VERSION)/$(SUBDIR)
+
+# MIN is the minor version number for shared libraries.
+# MAJ is the major version number, but is set separately by
+# individual make files so that the major number of one library can change
+# from one release to another while the major number of another does not.
+MIN = $(XMLRPC_MINOR_RELEASE)
+
+# CURDIR was introduced in GNU Make 3.77.
+ifeq ($(CURDIR)x,x)
+  CURDIR := $(shell /bin/pwd)
+endif
+
+##############################################################################
+#                        STATIC LINK LIBRARY RULES                           #
+##############################################################################
+
+
+# To use this rule, the including make file must set a target_specific
+# variable LIBOBJECTS (and declare dependencies that include LIBOBJECTS).
+# Example:
+#   FOO_OBJECTS = foo1.o foo2.o
+#   libfoo.a: LIBOBJECTS = $(FOO_OBJECTS)
+#   libfoo.a: $(FOO_OBJECTS)
+#   TARGET_LIBRARY_NAMES = libfoo
+
+TARGET_STATIC_LIBRARIES = \
+  $(TARGET_LIBRARY_NAMES:%=%.a) $(TARGET_LIB_NAMES_PP:%=%.a)
+$(TARGET_STATIC_LIBRARIES):
+	-rm -f $@
+	$(AR) cru $@ $(LIBOBJECTS)
+	$(RANLIB) $@
+
+
+##############################################################################
+#                     SHARED LIBRARY RULES, VARIABLES                        #
+##############################################################################
+
+ifeq ($(SHARED_LIB_TYPE),unix)
+  include $(SRCDIR)/unix-common.make
+  endif
+
+ifeq ($(SHARED_LIB_TYPE),irix)
+  include $(SRCDIR)/irix-common.make
+  endif
+
+ifeq ($(SHARED_LIB_TYPE),dll)
+  include $(SRCDIR)/dll-common.make
+  endif
+
+ifeq ($(SHARED_LIB_TYPE),dylib)
+  include $(SRCDIR)/dylib-common.make
+  endif
+
+ifeq ($(SHARED_LIB_TYPE),NONE)
+  install-shared-libraries:
+  endif
+
+# To use this rule, the including make file must set a target-specific
+# variable LIBOBJECTS (and declare dependencies that include LIBOBJECTS).
+# Analogous to static library rule above.
+
+# Optionally, including make file can set LIBDEP (probably
+# target-specific) to the -L and -l options necessary to declare the
+# libraries the target uses at run time.  (This information gets built
+# into the shared library so that the runtime library loader will load
+# the specified libraries when asked to load the target library).
+
+ifeq ($(MUST_BUILD_SHLIB),Y)
+  TARGET_SHARED_LIBRARIES = $(call shlibfn, $(TARGET_LIBRARY_NAMES))
+  TARGET_SHARED_LIBS_PP = $(call shlibfn, $(TARGET_LIB_NAMES_PP))
+  ifeq ($(MUST_BUILD_SHLIBLE),Y)
+    TARGET_SHARED_LE_LIBS = \
+      $(call shliblefn, $(TARGET_LIBRARY_NAMES) $(TARGET_LIB_NAMES_PP))
+  else
+    TARGET_SHARED_LE_LIBS =
+  endif
+else
+  TARGET_SHARED_LIBRARIES =
+  TARGET_SHARED_LIBS_PP =
+  TARGET_SHARED_LE_LIBS =
+endif
+
+#------ the actual rules ----------------------------------------------------
+$(TARGET_SHARED_LIBRARIES) dummyshlib:
+	$(CCLD) $(LDFLAGS_SHLIB) $(LIBDEP) -o $@ $(LIBOBJECTS) $(LADD)
+
+$(TARGET_SHARED_LIBS_PP) dummyshlibpp:
+	$(CXXLD) $(LDFLAGS_SHLIB) $(LIBDEP) -o $@ $(LIBOBJECTS) $(LADD)
+#----------------------------------------------------------------------------
+
+LIBXMLRPC_UTIL_DIR = $(BLDDIR)/lib/libutil
+
+ifneq ($(OMIT_LIBXMLRPC_UTIL_RULE),Y)
+LIBXMLRPC_UTIL           = \
+  $(call shliblefn, $(LIBXMLRPC_UTIL_DIR)/libxmlrpc_util)
+LIBXMLRPC_UTIL_A         = $(LIBXMLRPC_UTIL_DIR)/libxmlrpc_util.a
+endif
+
+ifneq ($(OMIT_XMLRPC_LIB_RULE),Y)
+
+LIBXMLRPC              = \
+  $(call shliblefn, $(BLDDIR)/src/libxmlrpc)
+LIBXMLRPC_CLIENT       = \
+  $(call shliblefn, $(BLDDIR)/src/libxmlrpc_client)
+LIBXMLRPC_SERVER       = \
+  $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server)
+LIBXMLRPC_SERVER_ABYSS = \
+  $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server_abyss)
+LIBXMLRPC_SERVER_CGI   = \
+  $(call shliblefn, $(BLDDIR)/src/libxmlrpc_server_cgi)
+
+LIBXMLRPC_A              = $(BLDDIR)/src/libxmlrpc.a
+LIBXMLRPC_CLIENT_A       = $(BLDDIR)/src/libxmlrpc_client.a
+LIBXMLRPC_SERVER_A       = $(BLDDIR)/src/libxmlrpc_server.a
+LIBXMLRPC_SERVER_ABYSS_A = $(BLDDIR)/src/libxmlrpc_server_abyss.a
+LIBXMLRPC_SERVER_CGI_A   = $(BLDDIR)/src/libxmlrpc_server_cgi.a
+
+endif
+
+LIBXMLRPC_XMLTOK_DIR = $(BLDDIR)/lib/expat/xmltok
+
+ifneq ($(OMIT_XMLTOK_LIB_RULE),Y)
+LIBXMLRPC_XMLTOK         = \
+  $(call shliblefn, $(LIBXMLRPC_XMLTOK_DIR)/libxmlrpc_xmltok)
+LIBXMLRPC_XMLTOK_A       = $(LIBXMLRPC_XMLTOK_DIR)/libxmlrpc_xmltok.a
+endif
+
+LIBXMLRPC_XMLPARSE_DIR = $(BLDDIR)/lib/expat/xmlparse
+
+ifneq ($(OMIT_XMLPARSE_LIB_RULE),Y)
+LIBXMLRPC_XMLPARSE       = \
+  $(call shliblefn, $(LIBXMLRPC_XMLPARSE_DIR)/libxmlrpc_xmlparse)
+LIBXMLRPC_XMLPARSE_A     = $(LIBXMLRPC_XMLPARSE_DIR)/libxmlrpc_xmlparse.a
+endif
+
+LIBXMLRPC_ABYSS_DIR = $(BLDDIR)/lib/abyss/src
+
+ifneq ($(OMIT_ABYSS_LIB_RULE),Y)
+LIBXMLRPC_ABYSS          = \
+  $(call shliblefn, $(LIBXMLRPC_ABYSS_DIR)/libxmlrpc_abyss)
+LIBXMLRPC_ABYSS_A        = $(LIBXMLRPC_ABYSS_DIR)/libxmlrpc_abyss.a
+endif
+
+ifneq ($(OMIT_CPP_LIB_RULES),Y)
+LIBXMLRPC_CPP              = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_cpp)
+LIBXMLRPC_CPP_A            = $(BLDDIR)/src/cpp/libxmlrpc_cpp.a
+LIBXMLRPCPP                = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc++)
+LIBXMLRPCPP_A              = $(BLDDIR)/src/cpp/libxmlrpc++.a
+LIBXMLRPC_PACKETSOCKET     = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_packetsocket)
+LIBXMLRPC_PACKETSOCKET_A   = $(BLDDIR)/src/cpp/libxmlrpc_packetsocket.a
+LIBXMLRPC_CLIENTPP         =  \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_client++)
+LIBXMLRPC_CLIENTPP_A       = $(BLDDIR)/src/cpp/libxmlrpc_client++.a
+LIBXMLRPC_SERVERPP         = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server++)
+LIBXMLRPC_SERVERPP_A       = $(BLDDIR)/src/cpp/libxmlrpc_server++.a
+LIBXMLRPC_SERVER_ABYSSPP   = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server_abyss++)
+LIBXMLRPC_SERVER_ABYSSPP_A = $(BLDDIR)/src/cpp/libxmlrpc_server_abyss++.a
+LIBXMLRPC_SERVER_PSTREAMPP = \
+  $(call shliblefn, $(BLDDIR)/src/cpp/libxmlrpc_server_pstream++)
+LIBXMLRPC_SERVER_PSTREAMPP_A = $(BLDDIR)/src/cpp/libxmlrpc_server_pstream++.a
+endif
+
+# LIBXMLRPC_XML is the list of Xmlrpc-c libraries we need to parse
+# XML.  If we're using an external library to parse XML, this is null.
+# LDLIBS_XML is the corresponding -L/-l options
+
+ifneq ($(ENABLE_LIBXML2_BACKEND),yes)
+  # We're using the internal Expat XML parser
+  LIBXMLRPC_XML = $(LIBXMLRPC_XMLPARSE) $(LIBXMLRPC_XMLTOK)
+  LDLIBS_XML = \
+        -L$(BLDDIR)/lib/expat/xmlparse -lxmlrpc_xmlparse \
+        -L$(BLDDIR)/lib/expat/xmltok   -lxmlrpc_xmltok
+else
+  LDLIBS_XML = $(shell xml2-config --libs)
+endif
+
+
+##############################################################################
+#            RULES TO BUILD OBJECT FILES TO LINK INTO LIBRARIES              #
+##############################################################################
+
+# The including make file sets TARGET_MODS to a list of all modules that
+# might go into a library.  Its a list of the bare module names.  The
+# including make file also sets INCLUDES, in a target-dependent manner,
+# to the string of -I options needed for each target.  Example:
+
+#   TARGET_MODS = foo bar
+#
+#   foo.o foo.osh: INCLUDES = -Iinclude -I/usr/include/foostuff
+#   bar.o bar.osh: INCLUDES = -Iinclude -I/usr/include/barstuff
+#
+#   include Makefile.common
+#
+# The above generates rules to build foo.o, bar.o, foo.osh, and bar.osh
+#
+# For C++ source files, use TARGET_MODS_PP instead.
+
+# CFLAGS and CXXFLAGS are designed to be overridden on the make command
+# line.  We pile all the options except -I into these variables so the
+# user can override them all if he wants.
+
+$(TARGET_MODS:%=%.o):%.o:%.c
+	$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $<
+
+$(TARGET_MODS:%=%.osh): CFLAGS_COMMON += $(CFLAGS_SHLIB)
+
+$(TARGET_MODS:%=%.osh):%.osh:%.c
+	$(CC) -c -o $@ $(INCLUDES) $(CFLAGS) $(CFLAGS_SHLIB) $<
+
+$(TARGET_MODS_PP:%=%.o):%.o:%.cpp
+	$(CXX) -c -o $@ $(INCLUDES) $(CXXFLAGS) $<
+
+$(TARGET_MODS_PP:%=%.osh): CXXFLAGS_COMMON += $(CFLAGS_SHLIB)
+
+$(TARGET_MODS_PP:%=%.osh):%.osh:%.cpp
+	$(CXX) -c -o $@ $(INCLUDES) $(CXXFLAGS) $<
+
+
+##############################################################################
+#                           MISC BUILD RULES                                 #
+##############################################################################
+
+# We use the srcdir symbolic link simply to make the make
+# rules easier to read in the make output.  We could use the $(SRCDIR)
+# variable, but that makes the compile and link commands
+# a mile long.  Note that Make sometime figures that a directory which
+# is a dependency is newer than the symbolic link pointing to it and wants
+# to rebuild the symbolic link.  So we don't make $(SRCDIR) a
+# dependency of 'srcdir'.
+
+# We should do the same for 'blddir'.  We did once before, then undid
+# it in an erroneous effort to enable parallel make.  It's a little harder
+# with blddir; when we did it before, we had to use the non-symlink
+# version in a few places.
+
+srcdir:
+	$(LN_S) $(SRCDIR) $@
+blddir:
+	$(LN_S) $(BLDDIR) $@
+
+##############################################################################
+#                    RECURSIVE SUBDIRECTORY BUILD RULES                      #
+##############################################################################
+
+.PHONY: $(SUBDIRS:%=%/all)
+$(SUBDIRS:%=%/all): %/all: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/install)
+$(SUBDIRS:%=%/install): %/install: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/clean)
+$(SUBDIRS:%=%/clean): %/clean: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/distclean)
+$(SUBDIRS:%=%/distclean): %/distclean: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/check)
+$(SUBDIRS:%=%/check): %/check: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/distdir)
+$(SUBDIRS:%=%/distdir): %/distdir: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+.PHONY: $(SUBDIRS:%=%/dep)
+$(SUBDIRS:%=%/dep): %/dep: $(CURDIR)/%
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/$(SUBDIR)/$(dir $@)Makefile \
+	    $(notdir $@) 
+
+
+##############################################################################
+#                         CROSS-COMPONENT BUILD RULES                        #
+##############################################################################
+
+ifneq ($(OMIT_WININET_TRANSPORT_RULE),Y)
+$(BLDDIR)/lib/wininet_transport/xmlrpc_wininet_transport.o \
+$(BLDDIR)/lib/wininet_transport/xmlrpc_wininet_transport.osh \
+: FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/wininet_transport/Makefile \
+	    $(notdir $@)
+endif
+
+ifneq ($(OMIT_CURL_TRANSPORT_RULE),Y)
+$(BLDDIR)/lib/curl_transport/xmlrpc_curl_transport.o \
+$(BLDDIR)/lib/curl_transport/xmlrpc_curl_transport.osh \
+: FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/curl_transport/Makefile \
+	    $(notdir $@)
+endif
+
+ifneq ($(OMIT_LIBWWW_TRANSPORT_RULE),Y)
+$(BLDDIR)/lib/libwww_transport/xmlrpc_libwww_transport.o \
+$(BLDDIR)/lib/libwww_transport/xmlrpc_libwww_transport.osh \
+: FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libwww_transport/Makefile \
+	    $(notdir $@)
+endif
+
+$(LIBXMLRPC) \
+$(LIBXMLRPC_CLIENT) \
+$(LIBXMLRPC_SERVER) \
+$(LIBXMLRPC_SERVER_ABYSS) \
+$(LIBXMLRPC_SERVER_CGI) \
+$(LIBXMLRPC_A) \
+$(LIBXMLRPC_CLIENT_A) \
+$(LIBXMLRPC_SERVER_A) \
+$(LIBXMLRPC_SERVER_ABYSS_A) \
+$(LIBXMLRPC_SERVER_CGI_A): FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/src/Makefile \
+	    $(notdir $@)
+
+$(LIBXMLRPC_UTIL) $(LIBXMLRPC_UTIL_A) : FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/libutil/Makefile \
+	    $(notdir $@)
+
+$(LIBXMLRPC_XMLPARSE) $(LIBXMLRPC_XMLPARSE_A) : FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmlparse/Makefile \
+	    $(notdir $@)
+
+$(LIBXMLRPC_XMLTOK) $(LIBXMLRPC_XMLTOK_A) : FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/expat/xmltok/Makefile \
+	    $(notdir $@)
+
+$(LIBXMLRPC_ABYSS) $(LIBXMLRPC_ABYSS_A): FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/abyss/src/Makefile \
+	    $(notdir $@)
+
+$(LIBXMLRPCPP) $(LIBXMLRPCPP_A) \
+$(LIBXMLRPC_PACKETSOCKET) $(LIBXMLRPC_PACKETSOCKET_A) \
+$(LIBXMLRPC_CLIENTPP) $(LIBXMLRPC_CLIENTPP_A) \
+$(LIBXMLRPC_SERVERPP) $(LIBXMLRPC_SERVERPP_A) \
+$(LIBXMLRPC_SERVER_ABYSSPP) $(LIBXMLRPC_SERVER_ABYSSPP_A) \
+$(LIBXMLRPC_SERVER_PSTREAMPP) $(LIBXMLRPC_SERVER_PSTREAMPP_A) \
+$(LIBXMLRPC_CPP) $(LIBXMLRPC_CPP_A) : FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/src/cpp/Makefile \
+	    $(notdir $@)
+
+# For the following utilities, we don't bother with a library -- we
+# just explicitly link the object file we need.  This is to save
+# complexity.  If the list gets too big, we may need a library just to
+# keep link commands short.
+
+UTIL_DIR = $(BLDDIR)/lib/util
+
+UTILS = \
+  casprintf.o \
+  cmdline_parser.o \
+  cmdline_parser_cpp.o \
+  getoptx.o \
+  stripcaseeq.o \
+  string_parser.o \
+
+ifneq ($(OMIT_UTILS_RULE),Y)
+$(UTILS:%=$(UTIL_DIR)/%): FORCE
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/lib/util/Makefile \
+	    $(notdir $@)
+endif
+
+CASPRINTF = $(UTIL_DIR)/casprintf.o
+
+
+# About version.h:  This is a built header file, which means it is a supreme
+# pain in the ass.  The biggest problem is that when we automatically make
+# dependencies (Makefile.depend), it doesn't exist yet.  This means Gcc
+# generates a dependency on it being in the local directory.  Therefore,
+# we generate it in the local directory, as a symbolic link, wherever it
+# is needed.  But the original is always in the top level directory,
+# generated by a rule in that directory's make file.  Problem 2 is that
+# the top directory's make file includes Makefile.common, so the rules
+# below conflict with it.  That's what OMIT_VERSION_H is for.
+
+ifneq ($(OMIT_VERSION_H),Y)
+
+$(BLDDIR)/version.h:
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
+
+version.h: $(BLDDIR)/version.h
+	$(LN_S) $< $@
+
+endif
+
+ifneq ($(OMIT_CONFIG_H_RULE),Y)
+$(BLDDIR)/include/xmlrpc-c/config.h:
+	$(MAKE) -C $(BLDDIR)/include -f $(SRCDIR)/include/Makefile \
+          xmlrpc-c/config.h
+endif
+
+ifneq ($(OMIT_TRANSPORT_CONFIG_H),Y)
+$(BLDDIR)/transport_config.h:
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
+endif
+
+ifneq ($(OMIT_XMLRPC_C_CONFIG_TEST),Y)
+$(BLDDIR)/xmlrpc-c-config.test:
+	$(MAKE) -C $(dir $@) -f $(SRCDIR)/GNUmakefile $(notdir $@)
+endif
+
+$(TARGET_MODS:%=%.o) $(TARGET_MODS:%=%.osh): \
+  $(BLDDIR)/include/xmlrpc-c/config.h
+
+# With a separate build directory, you have to make the directory itself
+# before you can make anything in it.  Here's the rule to do that.
+$(SUBDIRS:%=$(CURDIR)/%):
+	mkdir $@
+
+
+##############################################################################
+#                           INSTALL RULES                                    #
+#                      (except shared libraries)                             #
+##############################################################################
+
+MKINSTALLDIRS = $(SHELL) $(SRCDIR)/mkinstalldirs
+
+.PHONY: install-common install-ltlibraries install-headers install-bin
+install-common: \
+  install-ltlibraries install-static-libraries install-shared-libraries \
+  install-headers install-bin
+
+INSTALL_LIB_CMD = $(INSTALL_DATA) $$p $(DESTDIR)$(LIBINST_DIR)/$$p
+RANLIB_CMD = $(RANLIB) $(DESTDIR)$(LIBINST_DIR)/$$p
+
+install-static-libraries: $(STATIC_LIBRARIES_TO_INSTALL)
+	$(MKINSTALLDIRS) $(DESTDIR)$(LIBINST_DIR)
+	@list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo " $(INSTALL_LIB_CMD)"; \
+	    $(INSTALL_LIB_CMD); \
+	  else :; fi; \
+	done
+	@$(POST_INSTALL)
+	@list='$(STATIC_LIBRARIES_TO_INSTALL)'; for p in $$list; do \
+	  if test -f $$p; then \
+	    echo " $(RANLIB_CMD)"; \
+	    $(RANLIB_CMD); \
+	  else :; fi; \
+	done
+
+HEADERDESTDIR = $(DESTDIR)$(HEADERINST_DIR)
+INSTALL_HDR_CMD = $(INSTALL_DATA) $$d$$p $(HEADERDESTDIR)/$$p 
+
+install-headers: $(HEADERS_TO_INSTALL)
+	$(MKINSTALLDIRS) $(HEADERDESTDIR)
+	$(MKINSTALLDIRS) $(HEADERDESTDIR)/xmlrpc-c
+	@list='$(HEADERS_TO_INSTALL)'; for p in $$list; do \
+	  if test -f "$$p"; then d= ; else d="$(SRCDIR)/$(SUBDIR)/"; fi; \
+	  echo " $(INSTALL_HDR_CMD)"; \
+	  $(INSTALL_HDR_CMD); \
+	done
+
+
+INSTALL_PROGRAM_CMD = $(INSTALL_PROGRAM) $$p $(DESTDIR)$(PROGRAMINST_DIR)/$$p
+
+install-bin: $(PROGRAMS_TO_INSTALL) $(DESTDIR)$(PROGRAMINST_DIR)
+	@list='$(PROGRAMS_TO_INSTALL)'; \
+         for p in $$list; do \
+	   echo "$(INSTALL_PROGRAM_CMD)"; \
+	   $(INSTALL_PROGRAM_CMD); \
+	   done
+
+$(DESTDIR)$(PROGRAMINST_DIR):
+	$(MKINSTALLDIRS) $@
+
+
+##############################################################################
+#                           MISCELLANEOUS RULES                              #
+##############################################################################
+
+.PHONY: clean-common
+clean-common:
+	rm -f *.o *.osh *.a *.s *.i *.la *.lo
+	rm -f *.$(SHLIB_SUFFIX) *.$(SHLIB_SUFFIX).*
+	rm -rf .libs
+ifneq ($(OMIT_VERSION_H),Y)
+	rm -f version.h
+endif
+
+.PHONY: distclean-common
+distclean-common:
+# Makefile.depend is generated by 'make dep' and contains only dependencies
+# that make parts get _rebuilt_ when parts upon which they depend change.
+# It does not contain dependencies that are necessary to cause a part to
+# get built in the first place.  E.g. if foo.c uses bar.h and bar.h gets built
+# by a make rule, you must put the dependency of foo.c on bar.h somewhere
+# besides Makefile.depend.
+#
+# Because of this, a user doesn't need Makefile.depend, because he
+# doesn't modify source files.  A developer, on the other hand, must make his
+# own Makefile.depend, because 'make dep' creates Makefile.depend with 
+# absolute pathnames, specific to the developer's system.
+#
+# So we obliterate Makefile.depend here.  The build will automatically
+# create an empty Makefile.depend when it is needed for the user.  The
+# developer must do 'make dep' if he wants to edit and rebuild.
+#
+# Other projects have the build automatically build a true
+# Makefile.depend, suitable for a developer.  We have found that to be
+# an utter disaster -- it's way too complicated and prone to failure,
+# especially with built .h files.  Better not to burden the user, who
+# gains nothing from it, with that.
+#
+	rm -f Makefile.depend
+	rm -f srcdir blddir
+
+.PHONY: distdir-common
+distdir-common:
+	@for file in $(DISTFILES); do \
+	  d=$(SRCDIR); \
+	  if test -d $$d/$$file; then \
+	    cp -pr $$d/$$file $(DISTDIR)/$$file; \
+	  else \
+	    test -f $(DISTDIR)/$$file \
+	    || ln $$d/$$file $(DISTDIR)/$$file 2> /dev/null \
+	    || cp -p $$d/$$file $(DISTDIR)/$$file || :; \
+	  fi; \
+	done
+
+DEP_SOURCES = $(wildcard *.c *.cpp)
+
+# This is a filter to turn "foo.o:" rules into "foo.o foo.lo foo.osh:"
+# to make dependencies for all the various forms of object file out of
+# a file made by a depedency generator that knows only about .o.
+
+DEPEND_MASSAGER = perl -walnpe's{^(.*)\.o:}{$$1.o $$1.lo $$1.osh:}'
+
+
+
+.PHONY: dep-common
+dep-common: FORCE
+ifneq ($(DEP_SOURCES)x,x)
+	-$(CC) -MM -MG -I. $(INCLUDES) $(DEP_SOURCES) | \
+	  $(DEPEND_MASSAGER) \
+	  >Makefile.depend
+endif
+
+Makefile.depend:
+	cat /dev/null >$@
+
+# The automatic dependency generation is a pain in the butt and
+# totally unnecessary for people just installing the distributed code,
+# so to avoid needless failures in the field and a complex build, the
+# 'distclean' target simply makes Makefile.depend an empty file.  A
+# developer may do 'make dep' to create a Makefile.depend full of real
+# dependencies.
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
+
+
+# Use the FORCE target as a dependency to force a target to get remade
+FORCE:

Added: freeswitch/trunk/libs/xmlrpc-c/config.mk.in
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/config.mk.in	Fri May 23 16:56:24 2008
@@ -0,0 +1,336 @@
+# config.mk is generated by 'configure' using config.mk.in
+# as a template and information that 'configure' gathers from the build
+# system and from user options.
+
+# config.mk should someday replace most of the other files that
+# 'configure' generates, thus simplifying development and customization.
+# config.mk is intended to contain information specific to the
+# particular build environment or user build choices.
+
+# Furthermore, most of the logic in 'configure', and thus 'configure.in',
+# should go into the make files to simplify the build.  config.mk
+# should just pass raw configure variables through to the make file.
+
+# Tokens of the form @TOKEN@ in the template file get replaced by
+# 'configure' with the values of variables of the same name within
+# 'configure', because of a AC_SUBST(TOKEN) statement in the
+# 'configure.in' from which 'configure' was built.
+
+# Here are the options the user chose on 'configure':
+
+ENABLE_ABYSS_SERVER    = @ENABLE_ABYSS_SERVER@
+ENABLE_ABYSS_THREADS   = @ENABLE_ABYSS_THREADS@
+ENABLE_CPLUSPLUS       = @ENABLE_CPLUSPLUS@
+ENABLE_CGI_SERVER      = @ENABLE_CGI_SERVER@
+ENABLE_LIBXML2_BACKEND = @ENABLE_LIBXML2_BACKEND@
+
+MUST_BUILD_WININET_CLIENT = @MUST_BUILD_WININET_CLIENT@
+MUST_BUILD_CURL_CLIENT    = @MUST_BUILD_CURL_CLIENT@
+MUST_BUILD_LIBWWW_CLIENT  = @MUST_BUILD_LIBWWW_CLIENT@
+LSOCKET = @LSOCKET@
+WININET_LDADD = @WININET_LDADD@
+WININET_RPATH = @WININET_RPATH@
+WININET_WL_RPATH = @WININET_WL_RPATH@
+CURL_LDADD = @CURL_LDADD@
+CURL_RPATH = @CURL_RPATH@
+CURL_WL_RPATH = @CURL_WL_RPATH@
+LIBWWW_LDADD = @LIBWWW_LDADD@
+LIBWWW_RPATH = @LIBWWW_RPATH@
+LIBWWW_WL_RPATH = @LIBWWW_WL_RPATH@
+FEATURE_LIST = @FEATURE_LIST@
+ABS_SRCDIR = @abs_srcdir@
+PREFIX = @prefix@
+
+
+HAVE_WCHAR_H_DEFINE = @HAVE_WCHAR_H_DEFINE@
+
+# Stuff 'configure' figured out about our build platform:
+
+SHELL = @SHELL@
+CC = @CC@
+CXX = @CXX@
+CCLD = $(CC)
+CXXLD = $(CXX)
+AR = ar
+RANLIB = ranlib
+LN_S = ln -s
+INSTALL = $(SRCDIR)/install-sh
+
+C_COMPILER_GNU = @C_COMPILER_GNU@
+CXX_COMPILER_GNU = @CXX_COMPILER_GNU@
+
+# Stuff 'configure' figured out via AC_CANONICAL_HOST macro in configure.in
+# and config.guess program and 'configure' command options:
+
+# HOST_OS names the operating system on which Xmlrpc-c is to run.
+# E.g. "linux-gnu".
+HOST_OS = @host_os@
+
+###############################################################################
+
+MUST_BUILD_CLIENT = no
+ifeq ($(MUST_BUILD_WININET_CLIENT),yes)
+  MUST_BUILD_CLIENT = yes
+endif
+ifeq ($(MUST_BUILD_CURL_CLIENT),yes)
+  MUST_BUILD_CLIENT = yes
+endif
+ifeq ($(MUST_BUILD_LIBWWW_CLIENT),yes)
+  MUST_BUILD_CLIENT = yes
+endif
+
+
+##############################################################################
+# SHARED LIBRARY STUFF
+##############################################################################
+
+# Shared libraries are very difficult, because how you build and use
+# them varies greatly from one platform to the next.  
+
+# First, we break down shared library schemes into a few major types,
+# and indicate the type by SHARED_LIB_TYPE.
+
+# We also have a bunch of other make variables that reflect the different
+# ways we have to build on and for different platforms:
+
+# CFLAGS_SHLIB is a set of flags needed to compile a module which will
+# become part of a shared library.
+
+# On older systems, you have to make shared libraries out of position
+# independent code, so you need -fpic or -fPIC here.  (The rule is: if
+# -fpic works, use it.  If it bombs, go to -fPIC).  On newer systems,
+# it isn't necessary, but can save real memory at the expense of
+# execution speed.  Without position independent code, the library
+# loader may have to patch addresses into the executable text.  On an
+# older system, this would cause a program crash because the loader
+# would be writing into read-only shared memory.  But on newer
+# systems, the system silently creates a private mapping of the page
+# or segment being modified (the "copy on write" phenomenon).  So it
+# needs its own private real page frame.
+
+# We have seen -fPIC required on IA64 and AMD64 machines (GNU
+# compiler/linker).  Build-time linking fails without it.  I don't
+# know why -- history seems to be repeating itself.  2005.02.23.
+
+# SHLIB_CLIB is the link option to include the C library in a shared library,
+# normally "-lc".  On typical systems, this serves no purpose.  On some,
+# though, it causes information about which C library to use to be recorded
+# in the shared library and thus choose the correct library among several or
+# avoid using an incompatible one.  But on some systems, the link fails.
+# On 2002.09.30, "John H. DuBois III" <spcecdt at armory.com> reports that on 
+# SCO OpenServer, he gets the following error message with -lc:
+#
+#  -lc; relocations referenced  ;  from file(s) /usr/ccs/lib/libc.so(random.o);
+#   fatal error: relocations remain against allocatable but non-writable 
+#   section: ; .text
+#
+# On Bryan's system, with gcc 2.95.3 and glibc 2.2.2, -lc causes
+# throws (from anywhere in a program that links the shared library)
+# not to work.  I have no idea how.
+
+# LDFLAGS_SHLIB is the linker (Ld) flags needed to generate a shared
+# library from object files.  It may use $(SONAME) as the soname for
+# the shared library being created (assuming sonames exist).
+#
+# This make file defines these functions that the including make file
+# can use:
+#
+#   $(call shlibfn, LIBNAMELIST): file names of shared libraries
+#     whose base names are LIBNAMELIST.  E.g. if LIBNAMELIST is
+#     "libfoo libbar", function returns "libfoo.so.3.1 libbar.so.3.1"
+#
+#   $(call shliblefn, LIBNAMELIST): same as shlibfn, but for the file you
+#     use at link-edit time.  E.g. libfoo.so .
+
+# NEED_RPATH says on this platform, when you link-edit an executable you
+# need to have -R linker options to tell where to look, at run time,
+# for the shared libraries that the program uses.  The linker puts that
+# information into the executable.
+
+# NEED_WL_RPATH is like NEED_RPATH, but it's a compiler option for when
+# you have the compiler call the linker.  So E.g. "-Wl,-rpath,/my/runtime",
+# which tells the compiler to pass the option "-rpath /my/runtime" to
+# the linker.
+
+# Defaults:
+NEED_WL_RPATH=no
+NEED_RPATH=no
+
+# We build shared libraries only for platforms for which we've figured
+# out how.  For the rest, we have this default:
+SHARED_LIB_TYPE = NONE
+MUST_BUILD_SHLIB = N
+MUST_BUILD_SHLIBLE = N
+shlibfn = $(1:%=%.shlibdummy)
+shliblefn = $(1:%=%.shlibledummy)
+
+ifeq ($(HOST_OS),linux-gnu)
+  # Assume linker is GNU Compiler (gcc)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+#  SHLIB_CLIB = -lc
+  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
+  CFLAGS_SHLIB=-fPIC
+endif
+
+ifeq ($(findstring solaris,$(HOST_OS)),solaris)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  # Solaris compiler (Sun C 5.5) can't take multiple ld options as
+  # -Wl,-a,-b .  Ld sees -a,-b in that case.
+  LDFLAGS_SHLIB = -Wl,-Bdynamic -Wl,-G -Wl,-h -Wl,$(SONAME)
+  CFLAGS_SHLIB = -Kpic
+endif
+
+ifeq ($(HOST_OS),aix)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = a
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  LDFLAGS_SHLIB = -qmkshrobj
+endif
+
+ifeq ($(HOST_OS),hpux)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = sl
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  LDFLAGS_SHLIB: -shared -fPIC
+endif
+
+ifeq ($(HOST_OS),osf)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  LDFLAGS_SHLIB = -shared -expect_unresolved
+endif
+
+ifeq ($(findstring netbsd,$(HOST_OS)),netbsd)
+  SHARED_LIB_TYPE = unix
+  SHLIB_SUFFIX = so
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  CFLAGS_SHLIB = -fpic
+  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
+  NEED_WL_RPATH=yes
+endif
+
+ifeq ($(HOST_OS),dragonfly)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  CFLAGS_SHLIB = -fpic
+  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
+endif
+
+ifeq ($(HOST_OS),beos)
+  SHARED_LIB_TYPE = unix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  LDFLAGS_SHLIB = -nostart
+endif
+
+ifeq ($(patsubst darwin%, darwin, $(HOST_OS)), darwin)
+  # (I once saw a system that generated 'darwin8.10.1').
+  SHARED_LIB_TYPE = dylib
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = dylib
+  shlibfn = $(1:%=%.$(MAJ).$(MIN).$(SHLIB_SUFFIX))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
+endif
+
+ifeq ($(HOST_OS),irix)
+  SHARED_LIB_TYPE = irix
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = Y
+  SHLIB_SUFFIX = so
+  shlibfn = $(1:%=%.$(SHLIB_SUFFIX).$(MAJ))
+  shliblefn = $(1:%=%.$(SHLIB_SUFFIX))
+
+  VERSIONPERLPROG = \
+    print "sgi$(MAJ)." . join(":sgi$(MAJ) . ", (0..$(MIN))) . "\n"
+  LDFLAGS_SHLIB = -shared -n32 -soname $(SONAME) \
+    -set_version $(shell perl -e '$(VERSIONPERLPROG)') -lc
+endif
+
+ifeq ($(HOST_OS),cygwin)
+  SHARED_LIB_TYPE = dll
+  MUST_BUILD_SHLIB = Y
+  MUST_BUILD_SHLIBLE = N
+  SHLIB_SUFFIX = dll
+  shlibfn = $(1:lib%=$(SHLIB_PREFIX)%.$(SHLIB_SUFFIX).$(MAJ).$(MIN))
+  shliblefn = $(1:%=%.shlibledummy)
+  LDFLAGS_SHLIB = -shared -Wl,-soname,$(SONAME) $(SHLIB_CLIB)
+endif
+
+##############################################################################
+#                     MISCELLANEOUS
+##############################################################################
+
+# BUILDTOOL_CC is the compiler to use to generate build tools, which we
+# will then run to build product.  The typical reason this would be
+# different from CC is that you're cross-compiling: the product will run
+# in Environment A, but you're building in Environment B, so you must
+# build the build toos for Environment B.
+
+# The cross compiling user can update Makefile.config or override
+# BUILDTOOL_CC on a make command.
+
+BUILDTOOL_CC = $(CC)
+BUILDTOOL_CCLD = $(CCLD)
+
+# Here are the commands 'make install' uses to install various kinds of files:
+
+INSTALL_PROGRAM = $(INSTALL) -c -m 755
+INSTALL_SHLIB = $(INSTALL) -c -m 755
+INSTALL_DATA = $(INSTALL) -c -m 644
+INSTALL_SCRIPT = $(INSTALL) -c -m 755
+
+# Here are the locations at which 'make install' puts files:
+
+# PREFIX is designed to be overridden at make time if the user decides
+# he doesn't like the default specified at 'configure' time.
+
+LIBINST_DIR = $(PREFIX)/lib
+HEADERINST_DIR = $(PREFIX)/include
+PROGRAMINST_DIR = $(PREFIX)/bin
+
+# DESTDIR is designed to be overridden at make time in order to relocate
+# the entire install into a subdirectory.
+DESTDIR =
+
+# VPATH probably doesn't belong in this file, but it's a convenient
+# place to set it once.  VPATH is a special Make variable that tells
+# Make where to look for dependencies.  E.g. if a make file says bar.c
+# is a dependency of bar.o and VPATH is ".:/usr/src/mypkg", Make will
+# look for bar.c first in the current directory (.) (as it would with
+# no VPATH), then in /usr/src/mypkg.  The purpose of this is to allow
+# you to build in a fresh build directory, while your source stays in
+# the read-only directory /usr/src/mypkg .
+
+VPATH := .:$(SRCDIR)/$(SUBDIR)

Modified: freeswitch/trunk/libs/xmlrpc-c/configure.in
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/configure.in	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/configure.in	Fri May 23 16:56:24 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)
 
@@ -240,8 +198,9 @@
 dnl =======================================================================
 
 AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_INSTALL
+if test x"$enable_cplusplus" != xno; then
+    AC_PROG_CXX
+fi
 
 
 dnl =======================================================================
@@ -255,6 +214,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 +237,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 +302,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 +323,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 +359,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 +371,7 @@
 
 if test x"$enable_abyss_threads" != xno; then
     CFLAGS="$CFLAGS -D_THREAD"
-    LIBABYSS_LDADD="-lpthread"
 fi
-AC_SUBST(LIBABYSS_LDADD)
 
 
 dnl =======================================================================
@@ -435,7 +451,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 +556,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 +597,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 +626,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

Added: freeswitch/trunk/libs/xmlrpc-c/dll-common.make
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/dll-common.make	Fri May 23 16:56:24 2008
@@ -0,0 +1,22 @@
+# -*-makefile-*-    <-- an Emacs control
+
+# See unix-common.make for an explanation of this file.  This file is
+# analogous to unix-common.make, but is for a Windows system
+
+SONAME = $@
+IMPLIB = $(@:%:%.dll.a)
+
+SHLIB_CMD = $(CCLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
+
+.PHONY: $(SHLIB_INSTALL_TARGETS)
+.PHONY: install-shared-libraries
+
+SHLIB_INSTALL_TARGETS = $(SHARED_LIBS_TO_INSTALL:%=%/install)
+
+#SHLIB_INSTALL_TARGETS is like "libfoo/install libbar/install"
+
+install-shared-libraries: $(SHLIB_INSTALL_TARGETS)
+
+$(SHLIB_INSTALL_TARGETS):lib%/install:$(SHLIB_PREFIX)%.$(SHLIB_SUFFIX).$(MAJ).$(MIN)
+# $< is a library file name, e.g. cygfoo.so.3.1 .
+	$(INSTALL_SHLIB) $< $(DESTDIR)$(LIBINST_DIR)/$<

Modified: freeswitch/trunk/libs/xmlrpc-c/doc/COPYING
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/doc/COPYING	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/doc/COPYING	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/doc/HISTORY
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/doc/HISTORY	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/doc/HISTORY	Fri May 23 16:56:24 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.
-

Added: freeswitch/trunk/libs/xmlrpc-c/doc/INSTALL
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/doc/INSTALL	Fri May 23 16:56:24 2008
@@ -0,0 +1,148 @@
+These are instructions for building Xmlrpc-c from source and installing
+it on a system.
+
+See the README file for information on prerequisites (things you need to 
+have installed before you can build).
+
+
+Essentially, it's just the conventional
+
+  $ ./configure
+  $ make
+  $ make install
+
+To build handy tools such as the 'xmlrpc' command line XML-RPC client:
+
+  $ cd tools
+  $ make
+  $ make install
+
+You can also do
+
+  $ make check
+
+to run a battery of tests before you install.  But note that it's as common
+for the tests to fail because the tests are broken as because the product
+is broken, so consider the results carefully.
+
+To see it work, build and run a simple server like this:
+
+  $ cd examples
+  $ make
+  $ ./xmlrpc_sample_add_server 8080
+
+That runs forever, serving clients as they arrive.  Now, from another
+shell, run a client that does an RPC to this server:
+
+  $ ./xmlrpc_sample_add_client
+
+Also try other example 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.
+
+
+SEPARATE BUILD TREE
+-------------------
+
+While it's traditional to build a Unix package by adding object files
+to the same tree with the source files, it's actually much cleaner to
+keep your source tree exactly as you got it and put the built files in
+a separate directory, called the build tree.
+
+To do this, just create an empty directory and run 'configure' in it,
+then 'make':
+
+  mkdir xmlrpcbuild
+  cd xmlrpcbuild
+  /usr/src/xmlrpc-c/configure
+  ...
+  make
+
+But if you plan to work on Xmlrpc-c source code, you'll probably find
+it more convenient to build the traditional way, with a single tree
+for source and build.
+
+In the source tree, you can type 'make' in any directory to do the
+default make for that directory, or make FILENAME to make the file of
+that name there.  In the separate build tree, there are special
+facilities to allow you to do a simple make from the _top level
+directory_, but if you want to make a subcomponent or individual part,
+you have to have a -f option and set SRCDIR and BLDDIR on your 'make'
+command.
+
+
+COMMON PROBLEMS
+---------------
+
+Improper -config files
+----------------------
+
+The most common problem building Xmlrpc-c is one of improperly installed
+prerequisite libraries, namely Libwww and Curl.  These libraries are
+designed to be installed along with a -config program (libwww-config
+and curl-config) that tells builders of dependent packages (such as
+Xmlrpc-c) how to use them.  When the -config program is wrong, you get
+Xmlrpc-c build failures with messages about undefined references.
+
+The exact nature of the problems with -config programs can be quite
+involved, especially since there is no guarantee that a -config
+program can do what's required of it in every situation.  But I'll
+explain the basic problem.  For simplicity, I'll talk specifically
+about Curl, but the principles apply to any library that has a -config
+program.
+
+The point of curl-config is to describe how Curl is installed on your
+particular system.  You have choices of where to install the various parts
+and what prerequisites to build into them, and curl-config is how you
+communicate those choices to the Xmlrpc-c make files.
+
+Curl's builder automatically creates a curl-config program for you,
+but you should not think of it as part of Curl.  It's really a
+configuration file -- something that tells how your particular system
+is put together.  The Curl builder is not smart enough to know exactly
+what to put in curl-config; it just builds one that works for most
+people.  The local system administrator is actually responsible for
+the contents of curl-config.
+
+One rather complex way in which the curl-config that the Curl builder
+builds can be wrong is that it often indicates that to link to the
+Curl library, you need a "-L /usr/lib" option (or something like that
+-- an option that adds to the linker's search path a directory that is
+already in it).  This is usually unnecessary because the directory is
+already in the search path, and often breaks things because it puts
+the directory too early in the search path.  If your curl-config says to
+link with -L /usr/lib, you should normally edit it to remove that.
+
+As an example of how -L /usr/lib breaks things, here is a problem that
+is often reported: The user has Xmlrpc-c installed on his system, but
+wants to build a new one to replace it, or to use for a particular
+project instead of the system version.  But the build of the new
+version fails with undefined references to symbol "xmlrpc_foo".
+xmlrpc_foo is a new symbol - it was added to Xmlrpc-c in a recent
+release.  The version of Xmlrpc-c installed on the system is too old
+to have it.  The make file obviously specifies the path to the current
+libraries that the user just built in the link library search order,
+but the link is picking up the old system version instead.  Why?
+Because the link options say to search /usr/lib _before_ the local
+build directory.  And it does that because curl-config erroneously
+says that you need a -L /usr/lib link option to find the Curl library.
+
+
+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.
+

Modified: freeswitch/trunk/libs/xmlrpc-c/doc/TODO
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/doc/TODO	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/doc/TODO	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/dylib-common.make
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/dylib-common.make	Fri May 23 16:56:24 2008
@@ -0,0 +1,37 @@
+# -*-makefile-*-    <-- an Emacs control
+
+# See unix-common.make for an explanation of this file.  This file is
+# analogous to unix-common.make, but is for an Irix system.
+
+SONAME = $(@:%.$(MIN)=%)
+
+SHLIB_CMD = $(CCLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
+
+SHLIBPP_CMD = $(CXXLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
+
+SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
+
+$(SHLIB_LE_TARGETS):%.$(SHLIB_SUFFIX):%.$(MAJ).$(MIN).$(SHLIB_SUFFIX)
+	rm -f $@
+	$(LN_S) $< $@
+
+
+.PHONY: $(SHLIB_INSTALL_TARGETS)
+.PHONY: install-shared-libraries
+
+SHLIB_INSTALL_TARGETS = $(SHARED_LIBS_TO_INSTALL:%=%/install)
+
+#SHLIB_INSTALL_TARGETS is like "libfoo/install libbar/install"
+
+install-shared-libraries: $(SHLIB_INSTALL_TARGETS)
+
+$(SHLIB_INSTALL_TARGETS):%/install:%.$(MAJ).$(MIN).$(SHLIB_SUFFIX)
+# $< is a library file name, e.g. libfoo.so.3.1 .
+	$(INSTALL_SHLIB) $< $(DESTDIR)$(LIBINST_DIR)/$<
+	cd $(DESTDIR)$(LIBINST_DIR); \
+	  rm -f $(<:%.$(MIN).$(SHLIB_SUFFIX)=%.$(SHLIB_SUFFIX)); \
+	  $(LN_S) $< $(<:%.$(MIN).$(SHLIB_SUFFIX)=%.$(SHLIB_SUFFIX))
+	cd $(DESTDIR)$(LIBINST_DIR); \
+	  rm -f $(<:%.$(MAJ).$(MIN).$(SHLIB_SUFFIX)=%.$(SHLIB_SUFFIX)); \
+	  $(LN_S) $(<:%.$(MIN).$(SHLIB_SUFFIX)=%.$(SHLIB_SUFFIX)) \
+	    $(<:%.$(MAJ).$(MIN).$(SHLIB_SUFFIX)=%.$(SHLIB_SUFFIX))

Modified: freeswitch/trunk/libs/xmlrpc-c/examples/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/Makefile	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/auth_client.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/auth_client.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/auth_client.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/cpp/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/cpp/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/Makefile	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/asynch_client.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/asynch_client.cpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,75 @@
+/*=============================================================================
+                        asynch_client.cpp
+===============================================================================
+  This is an example of an XML-RPC client that uses XML-RPC for C/C++
+  (Xmlrpc-c).
+
+  In particular, it does multiple RPCs asynchronously, running
+  simultaneously.
+=============================================================================*/
+
+#include <cassert>
+#include <cstdlib>
+#include <string>
+#include <iostream>
+#include <xmlrpc-c/girerr.hpp>
+#include <xmlrpc-c/base.hpp>
+#include <xmlrpc-c/client.hpp>
+
+using namespace std;
+
+int
+main(int argc, char **) {
+
+    if (argc-1 > 0) {
+        cerr << "This program has no arguments" << endl;
+        exit(1);
+    }
+
+    try {
+        xmlrpc_c::clientXmlTransport_curl myTransport;
+
+        xmlrpc_c::client_xml myClient(&myTransport);
+
+        string const methodName("sample.add");
+
+        xmlrpc_c::paramList sampleAddParms1;
+        sampleAddParms1.add(xmlrpc_c::value_int(3));
+        sampleAddParms1.add(xmlrpc_c::value_int(1));
+
+        xmlrpc_c::rpcPtr rpc1P(methodName, sampleAddParms1);
+
+        xmlrpc_c::paramList sampleAddParms2;
+        sampleAddParms2.add(xmlrpc_c::value_int(5));
+        sampleAddParms2.add(xmlrpc_c::value_int(7));
+
+        xmlrpc_c::rpcPtr rpc2P(methodName, sampleAddParms2);
+
+        string const serverUrl("http://localhost:8080/RPC2");
+
+        xmlrpc_c::carriageParm_curl0 myCarriageParm(serverUrl);
+
+        rpc1P->start(&myClient, &myCarriageParm);
+        rpc2P->start(&myClient, &myCarriageParm);
+
+        cout << "Two RPCs started.  Waiting for them to finish." << endl;
+
+        myClient.finishAsync(xmlrpc_c::timeout());  // infinite timeout
+
+        assert(rpc1P->isFinished());
+        assert(rpc2P->isFinished());
+
+        int const sum1(xmlrpc_c::value_int(rpc1P->getResult()));
+        int const sum2(xmlrpc_c::value_int(rpc2P->getResult()));
+
+        cout << "Result of RPC 1 (sum of 3 and 1): " << sum1 << endl;
+        cout << "Result of RPC 2 (sum of 5 and 7): " << sum2 << endl;
+
+    } catch (exception const& e) {
+        cerr << "Client threw error: " << e.what() << endl;
+    } catch (...) {
+        cerr << "Client threw unexpected error." << endl;
+    }
+
+    return 0;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_client.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_client.cpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,84 @@
+/*=============================================================================
+                        pstream_client.cpp
+===============================================================================
+  This is an example of a client that uses XML-RPC for C/C++
+  (Xmlrpc-c).
+
+  In particular, it uses the simple "packet stream" XML transport mechanism
+  instead of HTTP as specified by XML-RPC (so this is not an XML-RPC
+  client).
+
+  You have to supply as Standard Input a stream (TCP) socket whose other
+  end is hooked up to the RPC server.  The 'socket_exec' program is a
+  good way to arrange that.
+
+  The sample program pstream_server.cpp is compatible with this client.
+
+  Example:
+
+    $ socketexec -connect -remote_host=localhost -remote_port=8080 \
+        ./pstream_client
+=============================================================================*/
+
+#include <cassert>
+#include <cstdlib>
+#include <string>
+#include <iostream>
+#include <unistd.h>
+#include <sys/signal.h>
+#include <xmlrpc-c/girerr.hpp>
+#include <xmlrpc-c/base.hpp>
+#include <xmlrpc-c/client.hpp>
+#include <xmlrpc-c/client_transport.hpp>
+
+
+using namespace std;
+
+int
+main(int argc, char **) {
+
+    if (argc-1 > 0) {
+        cerr << "This program has no arguments" << endl;
+        exit(1);
+    }
+
+    // It's a good idea to disable SIGPIPE signals; if server closes his end
+    // of the pipe/socket, we'd rather see a failure to send a call than
+    // get killed by the OS.
+    signal(SIGPIPE, SIG_IGN);
+
+    try {
+        xmlrpc_c::clientXmlTransport_pstream myTransport(
+            xmlrpc_c::clientXmlTransport_pstream::constrOpt()
+            .fd(STDIN_FILENO));
+
+        xmlrpc_c::client_xml myClient(&myTransport);
+
+        string const methodName("sample.add");
+
+        xmlrpc_c::paramList sampleAddParms;
+        sampleAddParms.add(xmlrpc_c::value_int(5));
+        sampleAddParms.add(xmlrpc_c::value_int(7));
+
+        xmlrpc_c::rpcPtr myRpcP(methodName, sampleAddParms);
+
+        xmlrpc_c::carriageParm_pstream myCarriageParm;
+            // Empty; transport doesn't need any information
+
+        myRpcP->call(&myClient, &myCarriageParm);
+
+        assert(myRpcP->isFinished());
+
+        int const sum(xmlrpc_c::value_int(myRpcP->getResult()));
+            // Assume the method returned an integer; throws error if not
+
+        cout << "Result of RPC (sum of 5 and 7): " << sum << endl;
+
+    } catch (exception const& e) {
+        cerr << "Client threw error: " << e.what() << endl;
+    } catch (...) {
+        cerr << "Client threw unexpected error." << endl;
+    }
+
+    return 0;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_inetd_server.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/pstream_inetd_server.cpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,90 @@
+/* A simple standalone RPC server based on an Xmlrpc-c packet socket.
+
+   This program expects the invoker to provide an established connection
+   to a client as Standard Input (E.g. Inetd can do this).  It processes
+   RPCs from that connection until the client closes the connection.
+
+   This is not an XML-RPC server, because it uses a simple packet socket
+   instead of HTTP.  See xmlrpc_sample_add_server.cpp for an example of
+   an XML-RPC server.
+
+   The advantage of this example over XML-RPC is that it has a connection
+   concept.  The client can be connected indefinitely and the server gets
+   notified when the client terminates, even if it gets aborted by its OS.
+
+   Here's an example of running this:
+
+     $ socketexec -accept -local_port=8080 ./pstream_inetd_server
+*/
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <cassert>
+#include <iostream>
+#include <sys/signal.h>
+
+#include <xmlrpc-c/base.hpp>
+#include <xmlrpc-c/registry.hpp>
+#include <xmlrpc-c/server_pstream.hpp>
+
+using namespace std;
+
+
+class sampleAddMethod : public xmlrpc_c::method {
+public:
+    sampleAddMethod() {
+        // signature and help strings are documentation -- the client
+        // can query this information with a system.methodSignature and
+        // system.methodHelp RPC.
+        this->_signature = "i:ii";  // method's arguments are two integers
+        this->_help = "This method adds two integers together";
+    }
+    void
+    execute(xmlrpc_c::paramList const& paramList,
+            xmlrpc_c::value *   const  retvalP) {
+        
+        int const addend(paramList.getInt(0));
+        int const adder(paramList.getInt(1));
+        
+        paramList.verifyEnd(2);
+        
+        *retvalP = xmlrpc_c::value_int(addend + adder);
+    }
+};
+
+
+
+int 
+main(int           const, 
+     const char ** const) {
+
+    // It's a good idea to disable SIGPIPE signals; if client closes his end
+    // of the pipe/socket, we'd rather see a failure to send a response than
+    // get killed by the OS.
+    signal(SIGPIPE, SIG_IGN);
+
+    try {
+        xmlrpc_c::registry myRegistry;
+
+        xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
+
+        myRegistry.addMethod("sample.add", sampleAddMethodP);
+
+        xmlrpc_c::serverPstreamConn server(
+            xmlrpc_c::serverPstreamConn::constrOpt()
+            .socketFd(STDIN_FILENO)
+            .registryP(&myRegistry));
+
+        for (bool clientHasDisconnected = false; !clientHasDisconnected;)
+            server.runOnce(&clientHasDisconnected);
+                // This reads one packet (containing an XML-RPC call message)
+                // from Standard Input, executes the indicated RPC, and writes
+                // one packet containing the XML-RPC response message to
+                // Standard Input.
+
+    } catch (exception const& e) {
+        cerr << "Something threw an error: " << e.what() << endl;
+    }
+    return 0;
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/sample_add_client_complex.cpp	Fri May 23 16:56:24 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;
     }

Added: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_inetd_server.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_inetd_server.cpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,62 @@
+/* A simple XML-RPC server that runs under Inetd.  I.e. it lets the invoking
+   program handle all the connection switching and simply processes one
+   RPC on the provided connection (Standard Input) and exits.
+*/
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#include <cassert>
+
+#include <xmlrpc-c/base.hpp>
+#include <xmlrpc-c/registry.hpp>
+#include <xmlrpc-c/server_abyss.hpp>
+
+using namespace std;
+
+class sampleAddMethod : public xmlrpc_c::method {
+public:
+    sampleAddMethod() {
+        // signature and help strings are documentation -- the client
+        // can query this information with a system.methodSignature and
+        // system.methodHelp RPC.
+        this->_signature = "i:ii";  // method's arguments are two integers
+        this->_help = "This method adds two integers together";
+    }
+    void
+    execute(xmlrpc_c::paramList const& paramList,
+            xmlrpc_c::value *   const  retvalP) {
+        
+        int const addend(paramList.getInt(0));
+        int const adder(paramList.getInt(1));
+        
+        paramList.verifyEnd(2);
+        
+        *retvalP = xmlrpc_c::value_int(addend + adder);
+    }
+};
+
+
+
+int 
+main(int           const, 
+     const char ** const) {
+
+    xmlrpc_c::registry myRegistry;
+
+    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.runConn(STDIN_FILENO);
+        /* This reads the HTTP POST request from Standard Input and
+           executes the indicated RPC.
+        */
+    return 0;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_loop_server.cpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_loop_server.cpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,72 @@
+/* A simple standalone XML-RPC server based on Abyss that contains a
+   simple one-thread request processing loop.  
+
+   xmlrpc_sample_add_server.cpp is a server that does the same thing, but
+   does it by running a full Abyss daemon in the background, so it has
+   less control over how the requests are served.
+*/
+
+#include <cassert>
+#include <iostream>
+
+#include <xmlrpc-c/base.hpp>
+#include <xmlrpc-c/registry.hpp>
+#include <xmlrpc-c/server_abyss.hpp>
+
+using namespace std;
+
+class sampleAddMethod : public xmlrpc_c::method {
+public:
+    sampleAddMethod() {
+        // signature and help strings are documentation -- the client
+        // can query this information with a system.methodSignature and
+        // system.methodHelp RPC.
+        this->_signature = "i:ii";  // method's arguments, result are integers
+        this->_help = "This method adds two integers together";
+    }
+    void
+    execute(xmlrpc_c::paramList const& paramList,
+            xmlrpc_c::value *   const  retvalP) {
+        
+        int const addend(paramList.getInt(0));
+        int const adder(paramList.getInt(1));
+        
+        paramList.verifyEnd(2);
+        
+        *retvalP = xmlrpc_c::value_int(addend + adder);
+    }
+};
+
+
+
+int 
+main(int           const, 
+     const char ** const) {
+
+    try {
+        xmlrpc_c::registry myRegistry;
+
+        xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);
+
+        myRegistry.addMethod("sample.add", sampleAddMethodP);
+
+        xmlrpc_c::serverAbyss myAbyssServer(
+            xmlrpc_c::serverAbyss::constrOpt()
+            .registryP(&myRegistry)
+            .portNumber(8080)
+            .logFileName("/tmp/xmlrpc_log"));
+
+        while (true) {
+            cout << "Waiting for next RPC..." << endl;
+
+            myAbyssServer.runOnce();
+            /* This waits for the next connection, accepts it, reads the
+               HTTP POST request, executes the indicated RPC, and closes
+               the connection.
+            */
+        }
+    } catch (exception const& e) {
+        cerr << "Something failed.  " << e.what() << endl;
+    }
+    return 0;
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_client.cpp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/cpp/xmlrpc_sample_add_server.cpp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/gen_sample_add_xml.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/gen_sample_add_xml.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/gen_sample_add_xml.c	Fri May 23 16:56:24 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);
     }
 }

Added: freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_client.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_client.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,164 @@
+/* Same as xmlrpc_sample_add_client.c, except the call is interruptible,
+   both by timeout and by control-C.
+*/
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <signal.h>
+
+#include <xmlrpc-c/base.h>
+#include <xmlrpc-c/client.h>
+
+#include "config.h"  /* information about this build environment */
+
+static int interrupt;
+    /* This is a flag telling libxmlrpc_client to abort whatever it's
+       doing.  It's global because we set it with a signal handler.
+    */
+
+static void 
+die_if_fault_occurred (xmlrpc_env * const envP) {
+    if (envP->fault_occurred) {
+        fprintf(stderr, "XML-RPC Fault: %s (%d)\n",
+                envP->fault_string, envP->fault_code);
+        exit(1);
+    }
+}
+
+
+
+static void 
+interruptRpc(int const signalClass) {
+
+    switch (signalClass) {
+    case SIGINT:
+        printf("SIGINT signal received.\n");
+        break;
+    case SIGALRM:
+        printf("SIGALRM signal received.\n");
+        break;
+    default:
+        printf("Internal error: signal of class %u caught even though "
+               "we didn't set up a handler for that class\n", signalClass);
+    };
+
+    interrupt = 1;
+}
+
+
+
+static void
+setupSignalHandlers(void) {
+
+    struct sigaction mysigaction;
+    
+    sigemptyset(&mysigaction.sa_mask);
+    mysigaction.sa_flags = 0;
+
+    /* Usually, this signal indicates the user pressed Ctl-C */
+    mysigaction.sa_handler = interruptRpc;
+    sigaction(SIGINT, &mysigaction, NULL);
+    /* This signal indicates a timed alarm you requested happened */
+    sigaction(SIGALRM, &mysigaction, NULL);
+}
+
+
+
+static void
+addInterruptibly(xmlrpc_client * const clientP,
+                 const char *    const serverUrl,
+                 int             const addend,
+                 int             const adder) {
+
+    const char * const methodName = "sample.add";
+
+    xmlrpc_env env;
+    xmlrpc_value * resultP;
+    xmlrpc_int32 sum;
+
+    xmlrpc_env_init(&env);
+
+    printf("Making XMLRPC call to server url '%s' method '%s' "
+           "to request the sum "
+           "of %d and %d...\n", serverUrl, methodName, addend, adder);
+
+    interrupt = 0;  /* Global variable */
+
+    alarm(2); /* Interrupt the call if it hasn't finished 2 seconds from now */
+
+    /* Make the remote procedure call */
+
+    xmlrpc_client_call2f(&env, clientP, serverUrl, methodName, &resultP,
+                         "(ii)", (xmlrpc_int32) addend, (xmlrpc_int32) adder);
+    die_if_fault_occurred(&env);
+
+    alarm(0);  /* Cancel alarm, if it hasn't happened yet */
+    
+    /* Get our sum and print it out. */
+    xmlrpc_read_int(&env, resultP, &sum);
+    die_if_fault_occurred(&env);
+    printf("The sum is %d\n", sum);
+    
+    /* Dispose of our result value. */
+    xmlrpc_DECREF(resultP);
+
+    xmlrpc_env_clean(&env);
+}
+
+
+
+int 
+main(int           const argc, 
+     const char ** const argv ATTR_UNUSED) {
+
+    const char * const serverUrl = "http://localhost:8080/RPC2";
+
+    xmlrpc_env env;
+    struct xmlrpc_clientparms clientParms;
+    xmlrpc_client * clientP;
+
+    if (argc-1 > 0) {
+        fprintf(stderr, "This program has no arguments\n");
+        exit(1);
+    }
+
+    setupSignalHandlers();
+
+    /* Initialize our error-handling environment. */
+    xmlrpc_env_init(&env);
+
+    /* Required before any use of Xmlrpc-c client library: */
+    xmlrpc_client_setup_global_const(&env);
+    die_if_fault_occurred(&env);
+
+    clientParms.transport = "curl";
+
+    /* Create a client object */
+    xmlrpc_client_create(&env, 0, NULL, NULL,
+                         &clientParms, XMLRPC_CPSIZE(transport),
+                         &clientP);
+
+    die_if_fault_occurred(&env);
+
+    xmlrpc_client_set_interrupt(clientP, &interrupt);
+
+    /* If our server is running 'xmlrpc_sample_add_server' normally, the
+       RPC will finish almost instantly.  UNLESS the adder is 1, in which
+       case said server is programmed to take 3 seconds to do the
+       computation, thus allowing us to demonstrate a timeout or CTL-C.
+    */
+
+    addInterruptibly(clientP, serverUrl, 5, 7);
+        /* Should finish instantly */
+
+    addInterruptibly(clientP, serverUrl, 5, 1);
+        /* Should time out after 2 seconds */
+
+    xmlrpc_env_clean(&env);
+    xmlrpc_client_destroy(clientP);
+    xmlrpc_client_teardown_global_const();
+
+    return 0;
+}
+

Added: freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_server.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/interrupted_server.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,161 @@
+/* A simple standalone XML-RPC server based on Abyss.
+
+   You can terminate this server in controlled fashion with a SIGTERM
+   signal.
+
+   xmlrpc_sample_add_server.c is a server that does the same thing with
+   simpler code, but it is not interruptible with SIGTERM.
+*/
+
+#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>
+#include <xmlrpc-c/server_abyss.h>
+
+#include "config.h"  /* information about this build environment */
+
+
+static void 
+dieIfFailed(const char * const description,
+            xmlrpc_env   const env) {
+
+    if (env.fault_occurred) {
+        fprintf(stderr, "%s failed. %s\n", description, env.fault_string);
+        exit(1);
+    }
+}
+
+
+
+static xmlrpc_server_abyss_t * serverToTerminateP;
+
+static void 
+sigtermHandler(int const signalClass ATTR_UNUSED) {
+    
+    xmlrpc_env env;
+
+    xmlrpc_env_init(&env);
+
+    xmlrpc_server_abyss_terminate(&env, serverToTerminateP);
+
+    dieIfFailed("xmlrpc_server_abyss_terminate", env);
+    
+    xmlrpc_env_clean(&env);
+}
+
+
+
+static void
+setupSigtermHandler(xmlrpc_server_abyss_t * const serverP) {
+
+    struct sigaction mysigaction;
+
+    serverToTerminateP = serverP;
+    
+    sigemptyset(&mysigaction.sa_mask);
+    mysigaction.sa_flags = 0;
+    mysigaction.sa_handler = sigtermHandler;
+    sigaction(SIGTERM, &mysigaction, NULL);
+}
+
+
+
+static void
+restoreSigtermHandler(void){
+
+    struct sigaction mysigaction;
+
+    sigemptyset(&mysigaction.sa_mask);
+    mysigaction.sa_flags = 0;
+    mysigaction.sa_handler = SIG_DFL;
+    sigaction(SIGTERM, &mysigaction, NULL);
+}
+
+
+
+static xmlrpc_value *
+sample_add(xmlrpc_env *   const envP, 
+           xmlrpc_value * const paramArrayP,
+           void *         const serverInfo ATTR_UNUSED,
+           void *         const channelInfo ATTR_UNUSED) {
+    
+    xmlrpc_int x, y, z;
+
+    /* Parse our argument array. */
+    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(envP, "i", z);
+}
+
+
+
+int 
+main(int           const argc, 
+     const char ** const argv) {
+
+    xmlrpc_server_abyss_parms serverparm;
+    xmlrpc_server_abyss_t * serverP;
+    xmlrpc_registry * registryP;
+    xmlrpc_env env;
+    xmlrpc_server_abyss_sig * oldHandlersP;
+
+    if (argc-1 != 1) {
+        fprintf(stderr, "You must specify 1 argument:  The TCP port number "
+                "on which to listen for XML-RPC calls.  "
+                "You specified %d.\n",  argc-1);
+        exit(1);
+    }
+
+    xmlrpc_env_init(&env);
+
+    xmlrpc_server_abyss_global_init(&env);
+    dieIfFailed("xmlrpc_server_abyss_global_init", env);
+    
+    registryP = xmlrpc_registry_new(&env);
+    dieIfFailed("xmlrpc_registry_new", env);
+
+    xmlrpc_registry_add_method2(
+        &env, registryP, "sample.add", &sample_add, NULL, NULL, NULL);
+    dieIfFailed("xmlrpc_registry_add_method2", env);
+
+    serverparm.config_file_name = NULL;
+    serverparm.registryP        = registryP;
+    serverparm.port_number      = atoi(argv[1]);
+
+    xmlrpc_server_abyss_create(&env, &serverparm, XMLRPC_APSIZE(port_number),
+                               &serverP);
+    dieIfFailed("xmlrpc_server_abyss_create", env);
+    
+    xmlrpc_server_abyss_setup_sig(&env, serverP, &oldHandlersP);
+    dieIfFailed("xmlrpc_server_abyss_setup_sig", env);
+
+    setupSigtermHandler(serverP);
+
+    printf("Running XML-RPC server...\n");
+
+    xmlrpc_server_abyss_run_server(&env, serverP);
+    dieIfFailed("xmlrpc_server_abyss_run_server", env);
+
+    printf("Server has terminated\n");
+
+    restoreSigtermHandler();
+    xmlrpc_server_abyss_restore_sig(oldHandlersP);
+    xmlrpc_server_abyss_destroy(serverP);
+    xmlrpc_registry_free(registryP);
+    xmlrpc_server_abyss_global_term();
+    xmlrpc_env_clean(&env);
+
+    return 0;
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/examples/synch_client.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/synch_client.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/synch_client.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_asynch_client.c	Fri May 23 16:56:24 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;
 }

Added: freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_inetd_server.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_inetd_server.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,121 @@
+/* A simple standalone XML-RPC server based on Abyss that processes a
+   single RPC from an existing TCP connection on Standard Input.
+
+   A typical example of where this would be useful is with an Inetd
+   "super server."
+
+   xmlrpc_sample_add_server.c is a server that does the same thing,
+   but you give it a TCP port number and it listens for TCP connecitons
+   and processes RPCs ad infinitum.  xmlrpc_socket_server.c is halfway
+   in between those -- you give it an already bound and listening
+   socket, and it lists for TCP connections and processes RPCs ad
+   infinitum.
+
+   Here is an easy way to test this program:
+
+     socketexec --accept --local_port=8080 --stdin -- ./xmlrpc_inetd_server
+
+   Now run the client program 'xmlrpc_sample_add_client'.  Socketexec
+   will accept the connection that the client program requests and pass it
+   to this program on Standard Input.  This program will perform the RPC,
+   respond to the client, then exit.
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <signal.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <xmlrpc-c/base.h>
+#include <xmlrpc-c/abyss.h>
+#include <xmlrpc-c/server.h>
+#include <xmlrpc-c/server_abyss.h>
+
+#include "config.h"  /* information about this build environment */
+
+
+static void
+setupSignalHandlers(void) {
+
+    /* In UNIX, when you try to write to a socket that has been closed
+       from the other end, your write fails, but you also get a SIGPIPE
+       signal.  That signal will kill you before you even have a chance
+       to see the write fail unless you catch, block, or ignore it.
+       If a client should connect to us and then disconnect before we've
+       sent our response, we see this socket-closed behavior.  We
+       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 xmlrpc_value *
+sample_add(xmlrpc_env *   const envP, 
+           xmlrpc_value * const paramArrayP,
+           void *         const serverInfo ATTR_UNUSED,
+           void *         const channelInfo ATTR_UNUSED) {
+    
+    xmlrpc_int x, y, z;
+
+    /* Parse our argument array. */
+    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(envP, "i", z);
+}
+
+
+
+int 
+main(int           const argc, 
+     const char ** const argv) {
+
+    TServer abyssServer;
+    xmlrpc_registry * registryP;
+    xmlrpc_env env;
+
+    if (argc-1 != 0) {
+        fprintf(stderr, "There are no arguments.  You must supply a "
+                "bound socket on which to listen for client connections "
+                "as Standard Input\n");
+        if (argv) {} /* silence unused parameter warning */
+        exit(1);
+    }
+    xmlrpc_env_init(&env);
+
+    registryP = xmlrpc_registry_new(&env);
+
+    xmlrpc_registry_add_method2(
+        &env, registryP, "sample.add", &sample_add, NULL, NULL, NULL);
+
+    ServerCreateNoAccept(&abyssServer, "XmlRpcServer", NULL, NULL);
+    
+    xmlrpc_server_abyss_set_handlers(&abyssServer, registryP);
+
+    setupSignalHandlers();
+
+    ServerRunConn(&abyssServer, STDIN_FILENO);
+        /* This reads the HTTP POST request from Standard Input and
+           executes the indicated RPC.
+        */
+
+    ServerFree(&abyssServer);
+
+    return 0;
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_loop_server.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_loop_server.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_loop_server.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_client.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_cgi.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_sample_add_server_w32httpsys.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_server_validatee.c	Fri May 23 16:56:24 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
 **=========================================================================

Added: freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_socket_server.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/examples/xmlrpc_socket_server.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,102 @@
+/* A simple standalone XML-RPC server written in C as an example of use of
+   the Xmlrpc-c libraries.
+
+   This example expects an already bound socket on Standard Input, ready to
+   be listened on for client connections.  Also see xmlrpc_sample_add_server,
+   which is the same thing, except you tell it a TCP port number and it
+   creates the socket itself.  Also see xmlrpc_inetd_server.c, which is
+   the same thing except you give it a socket which is already connected
+   to a client.
+ */
+
+#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>
+#include <xmlrpc-c/server_abyss.h>
+
+#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 envP,
+           xmlrpc_value * const paramArrayP,
+           void *         const user_data ATTR_UNUSED) {
+
+    xmlrpc_int32 x, y, z;
+
+    /* Parse our argument array. */
+    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(2);
+
+    /* Return our result. */
+    return xmlrpc_build_value(envP, "i", z);
+}
+
+
+
+int 
+main(int           const argc, 
+     const char ** const argv) {
+
+    xmlrpc_server_abyss_parms serverparm;
+    xmlrpc_registry * registryP;
+    xmlrpc_env env;
+
+    if (argc-1 != 0) {
+        fprintf(stderr, "There are no arguments.  You must supply a "
+                "bound socket on which to listen for client connections "
+                "as Standard Input\n");
+        if (argv) {} /* silence unused parameter warning */
+        exit(1);
+    }
+    
+    xmlrpc_env_init(&env);
+
+    registryP = xmlrpc_registry_new(&env);
+
+    xmlrpc_registry_add_method(
+        &env, registryP, NULL, "sample.add", &sample_add, 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.log_file_name      = "/tmp/xmlrpc_log";
+    serverparm.keepalive_timeout  = 0;
+    serverparm.keepalive_max_conn = 0;
+    serverparm.timeout            = 0;
+    serverparm.dont_advertise     = FALSE;
+    serverparm.socket_bound       = TRUE;
+    serverparm.socket_handle      = STDIN_FILENO;
+
+    printf("Running XML-RPC server...\n");
+
+    xmlrpc_server_abyss(&env, &serverparm, XMLRPC_APSIZE(socket_handle));
+
+    return 0;
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/include/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/Makefile	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss.h	Fri May 23 16:56:24 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;
-	int running;
-#ifndef _WIN32
-    uid_t uid;
-    gid_t gid;
-    TFile pidfile;
-#endif  
-} 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
 
 /*****************************************************************************

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_opensslsock.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_opensslsock.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,28 @@
+/* This is just a sub-file for abyss.h */
+
+#include <sys/socket.h>
+
+struct abyss_openssl_chaninfo {
+    /* TODO: figure out useful information to put in here.
+       Maybe client IP address and port.  Maybe authenticated host name.
+       Maybe authentication level.
+       Maybe a certificate.
+    */
+    int dummy;
+};
+
+void
+ChanSwitchOpensslCreate(unsigned short const portNumber,
+                        TChanSwitch ** const chanSwitchPP,
+                        const char **  const errorP);
+
+void
+ChanSwitchOpensslCreateFd(int            const fd,
+                          TChanSwitch ** const chanSwitchPP,
+                          const char **  const errorP);
+
+void
+ChannelOpensslCreateSsl(SSL *                            const sslP,
+                        TChannel **                      const channelPP,
+                        struct abyss_openssl_chaninfo ** const channelInfoPP,
+                        const char **                    const errorP);

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_unixsock.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_unixsock.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,42 @@
+/* This is just a sub-file for abyss.h */
+
+#include <sys/socket.h>
+
+struct abyss_unix_chaninfo {
+    size_t peerAddrLen;
+    struct sockaddr peerAddr;
+};
+
+void
+ChanSwitchUnixCreate(unsigned short const portNumber,
+                     TChanSwitch ** const chanSwitchPP,
+                     const char **  const errorP);
+
+void
+ChanSwitchUnixCreateFd(int            const fd,
+                       TChanSwitch ** const chanSwitchPP,
+                       const char **  const errorP);
+
+void
+ChannelUnixCreateFd(int                           const fd,
+                    TChannel **                   const channelPP,
+                    struct abyss_unix_chaninfo ** const channelInfoPP,
+                    const char **                 const errorP);
+
+void
+ChannelUnixGetPeerName(TChannel *         const channelP,
+                       struct sockaddr ** const sockaddrPP,
+                       size_t  *          const sockaddrLenP,
+                       const char **      const errorP);
+
+void
+SocketUnixCreateFd(int        const fd,
+                   TSocket ** const socketPP);
+
+typedef int TOsSocket;
+    /* TOsSocket is the type of a conventional socket offered by our OS.
+       This is for backward compatibility; everyone should use TChanSwitch
+       and TChannel instead today.
+    */
+
+

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_winsock.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/abyss_winsock.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,27 @@
+/* This is just a sub-file for abyss.h */
+
+#include <winsock.h>
+
+struct abyss_win_chaninfo {
+    size_t peerAddrLen;
+    struct sockaddr peerAddr;
+};
+
+
+void
+ChanSwitchWinCreate(unsigned short const portNumber,
+                    TChanSwitch ** const chanSwitchPP,
+                    const char **  const errorP);
+
+void
+ChanSwitchWinCreateWinsock(SOCKET         const winsock,
+                           TChanSwitch ** const chanSwitchPP,
+                           const char **  const errorP);
+
+void
+ChannelWinCreateWinsock(SOCKET                       const fd,
+                        TChannel **                  const channelPP,
+                        struct abyss_win_chaninfo ** const channelInfoPP,
+                        const char **                const errorP);
+
+typedef SOCKET TOsSocket;

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.h	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base.hpp	Fri May 23 16:56:24 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;
 

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base64.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base64.hpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,25 @@
+#ifndef XMLRPC_BASE64_HPP_INCLUDED
+#define XMLRPC_BASE64_HPP_INCLUDED
+
+#include <string>
+#include <vector>
+
+namespace xmlrpc_c {
+
+
+enum newlineCtl {NEWLINE_NO, NEWLINE_YES};
+
+std::string
+base64FromBytes(
+    std::vector<unsigned char> const& bytes,
+    xmlrpc_c::newlineCtl       const  newlineCtl = xmlrpc_c::NEWLINE_YES);
+
+
+
+std::vector<unsigned char>
+bytesFromBase64(std::string const& base64);
+
+
+} // namespace
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base_int.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base_int.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/base_int.h	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/c_util.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/c_util.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,14 @@
+#ifndef XMLRPC_C_C_UTIL_H_INCLUDED
+#define XMLRPC_C_C_UTIL_H_INCLUDED
+
+/* 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)
+#endif
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.h	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client.hpp	Fri May 23 16:56:24 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);

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_global.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_global.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,141 @@
+#ifndef CLIENT_GLOBAL_H_INCLUDED
+#define CLIENT_GLOBAL_H_INCLUDED
+
+/*=========================================================================
+**  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.
+*/
+
+#define XMLRPC_CLIENT_NO_FLAGS         (0)
+#define XMLRPC_CLIENT_SKIP_LIBWWW_INIT (1)
+
+extern void
+xmlrpc_client_init(int          const flags,
+                   const char * const appname,
+                   const char * const appversion);
+
+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);
+
+/*=========================================================================
+**  xmlrpc_client_call
+**=========================================================================
+**  A synchronous XML-RPC client. Do not attempt to call any of these
+**  functions from inside an asynchronous callback!
+*/
+
+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, 
+                          ...);
+
+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_client_transport_call(
+    xmlrpc_env *               const envP,
+    void *                     const reserved,  /* for client handle */
+    const xmlrpc_server_info * const serverP,
+    xmlrpc_mem_block *         const callXmlP,
+    xmlrpc_mem_block **        const respXmlPP);
+
+
+/*=========================================================================
+**  xmlrpc_client_call_asynch
+**=========================================================================
+**  An asynchronous XML-RPC client.
+*/
+
+/* 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,
+                          ...);
+
+/* 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,
+                                 ...);
+
+/* 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);
+
+
+/* Finish all outstanding asynchronous calls. */
+extern void
+xmlrpc_client_event_loop_finish_asynch_timeout(unsigned long const milliseconds);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_int.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_int.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_int.h	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_simple.hpp	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_transport.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/client_transport.hpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,448 @@
+#ifndef CLIENT_TRANSPORT_HPP_INCLUDED
+#define CLIENT_TRANSPORT_HPP_INCLUDED
+
+#include <string>
+#include <vector>
+#include <xmlrpc-c/util.h>
+#include <xmlrpc-c/client.h>
+#include <xmlrpc-c/girerr.hpp>
+#include <xmlrpc-c/girmem.hpp>
+#include <xmlrpc-c/timeout.hpp>
+
+namespace xmlrpc_c {
+
+class carriageParmPtr;
+
+class carriageParm : public girmem::autoObject {
+/*----------------------------------------------------------------------------
+   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 carriageParmPtr : public girmem::autoObjectPtr {
+
+public:
+    carriageParmPtr();
+
+    explicit carriageParmPtr(xmlrpc_c::carriageParm * const carriageParmP);
+
+    xmlrpc_c::carriageParm *
+    operator->() const;
+
+    xmlrpc_c::carriageParm *
+    get() const;
+};
+
+//----------------------------------------------------------------------------
+
+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;
+
+protected:
+    xmlTransaction();
+};
+
+class xmlTransactionPtr : public girmem::autoObjectPtr {
+public:
+    xmlTransactionPtr();
+
+    xmlTransactionPtr(xmlTransaction * xmlTransP);
+ 
+    xmlrpc_c::xmlTransaction *
+    operator->() const;
+};
+
+//----------------------------------------------------------------------------
+
+class clientXmlTransport : public girmem::autoObject {
+/*----------------------------------------------------------------------------
+   An object which transports XML to and from an XML-RPC server for an
+   XML-RPC client.
+
+   This is a base class.  Derived classes define methods to perform the
+   transportation in particular ways.
+-----------------------------------------------------------------------------*/
+public:
+    virtual ~clientXmlTransport();
+
+    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);
+
+    static void
+    asyncComplete(
+        struct xmlrpc_call_info * const callInfoP,
+        xmlrpc_mem_block *        const responseXmlMP,
+        xmlrpc_env                const transportEnv);
+
+    virtual void
+    setInterrupt(int * const interruptP);
+};
+
+class clientXmlTransportPtr : public girmem::autoObjectPtr {
+    
+public:
+    clientXmlTransportPtr();
+
+    clientXmlTransportPtr(xmlrpc_c::clientXmlTransport * const transportP);
+
+    xmlrpc_c::clientXmlTransport *
+    operator->() const;
+
+    xmlrpc_c::clientXmlTransport *
+    get() const;
+};
+
+/*===========================================================================
+                           HTTP
+===========================================================================*/
+
+class carriageParm_http0 : public xmlrpc_c::carriageParm {
+
+public:
+    carriageParm_http0(std::string const serverUrl);
+
+    ~carriageParm_http0();
+
+    void
+    setUser(std::string const userid,
+            std::string const password);
+
+    void
+    allowAuthBasic();
+
+    void
+    disallowAuthBasic();
+            
+    void
+    allowAuthDigest();
+
+    void
+    disallowAuthDigest();
+            
+    void
+    allowAuthNegotiate();
+
+    void
+    disallowAuthNegotiate();
+            
+    void
+    allowAuthNtlm();
+
+    void
+    disallowAuthNtlm();
+            
+    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 is expected to follow it up
+    // with an instantiate() to establish the server URL.
+
+    carriageParm_http0();
+
+    void
+    instantiate(std::string const serverUrl);
+};
+
+class carriageParm_http0Ptr : public xmlrpc_c::carriageParmPtr {
+
+public:
+    carriageParm_http0Ptr();
+    carriageParm_http0Ptr(xmlrpc_c::carriageParm_http0 * const carriageParmP);
+
+    xmlrpc_c::carriageParm_http0 *
+    operator->() const;
+};
+
+class clientXmlTransport_http : public xmlrpc_c::clientXmlTransport {
+/*----------------------------------------------------------------------------
+   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);
+
+    virtual void
+    setInterrupt(int * const interruptP);
+
+    static std::vector<std::string>
+    availableTypes();
+
+    static clientXmlTransportPtr
+    create();
+
+protected:
+    clientXmlTransport_http() {} // ensure no one can create
+    struct xmlrpc_client_transport *           c_transportP;
+    const struct xmlrpc_client_transport_ops * c_transportOpsP;
+};
+
+
+/*===========================================================================
+                           curl
+===========================================================================*/
+
+class carriageParm_curl0 : public xmlrpc_c::carriageParm_http0 {
+
+public:
+    carriageParm_curl0(std::string const serverUrl);
+};
+
+class carriageParm_curl0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
+
+public:
+    carriageParm_curl0Ptr();
+    carriageParm_curl0Ptr(xmlrpc_c::carriageParm_curl0 * const carriageParmP);
+
+    xmlrpc_c::carriageParm_curl0 *
+    operator->() const;
+};
+
+class clientXmlTransport_curl : public xmlrpc_c::clientXmlTransport_http {
+
+public:
+    class constrOpt {
+    public:
+        constrOpt();
+
+        constrOpt & network_interface (std::string  const& arg);
+        constrOpt & no_ssl_verifypeer (bool         const& arg);
+        constrOpt & no_ssl_verifyhost (bool         const& arg);
+        constrOpt & user_agent        (std::string  const& arg);
+        constrOpt & ssl_cert          (std::string  const& arg);
+        constrOpt & sslcerttype       (std::string  const& arg);
+        constrOpt & sslcertpasswd     (std::string  const& arg);
+        constrOpt & sslkey            (std::string  const& arg);
+        constrOpt & sslkeytype        (std::string  const& arg);
+        constrOpt & sslkeypasswd      (std::string  const& arg);
+        constrOpt & sslengine         (std::string  const& arg);
+        constrOpt & sslengine_default (bool         const& arg);
+        constrOpt & sslversion        (xmlrpc_sslversion const& arg);
+        constrOpt & cainfo            (std::string  const& arg);
+        constrOpt & capath            (std::string  const& arg);
+        constrOpt & randomfile        (std::string  const& arg);
+        constrOpt & egdsocket         (std::string  const& arg);
+        constrOpt & ssl_cipher_list   (std::string  const& arg);
+        constrOpt & timeout           (unsigned int const& arg);
+
+        struct {
+            std::string  network_interface;
+            bool         no_ssl_verifypeer;
+            bool         no_ssl_verifyhost;
+            std::string  user_agent;
+            std::string  ssl_cert;
+            std::string  sslcerttype;
+            std::string  sslcertpasswd;
+            std::string  sslkey;
+            std::string  sslkeytype;
+            std::string  sslkeypasswd;
+            std::string  sslengine;
+            bool         sslengine_default;
+            xmlrpc_sslversion sslversion;
+            std::string  cainfo;
+            std::string  capath;
+            std::string  randomfile;
+            std::string  egdsocket;
+            std::string  ssl_cipher_list;
+            unsigned int timeout;
+        } value;
+        struct {
+            bool network_interface;
+            bool no_ssl_verifypeer;
+            bool no_ssl_verifyhost;
+            bool user_agent;
+            bool ssl_cert;
+            bool sslcerttype;
+            bool sslcertpasswd;
+            bool sslkey;
+            bool sslkeytype;
+            bool sslkeypasswd;
+            bool sslengine;
+            bool sslengine_default;
+            bool sslversion;
+            bool cainfo;
+            bool capath;
+            bool randomfile;
+            bool egdsocket;
+            bool ssl_cipher_list;
+            bool timeout;
+        } present;
+    };
+
+    clientXmlTransport_curl(constrOpt const& opt);
+
+    clientXmlTransport_curl(std::string const networkInterface = "",
+                            bool        const noSslVerifyPeer = false,
+                            bool        const noSslVerifyHost = false,
+                            std::string const userAgent = "");
+
+    ~clientXmlTransport_curl();
+
+private:
+    void
+    initialize(constrOpt const& opt);
+};
+
+/*===========================================================================
+                           libwww
+===========================================================================*/
+
+class carriageParm_libwww0 : public xmlrpc_c::carriageParm_http0 {
+
+public:
+    carriageParm_libwww0(std::string const serverUrl);
+
+};
+
+class carriageParm_libwww0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
+
+public:
+    carriageParm_libwww0Ptr();
+    carriageParm_libwww0Ptr(xmlrpc_c::carriageParm_libwww0 * const);
+
+    xmlrpc_c::carriageParm_libwww0 *
+    operator->() const;
+};
+
+class clientXmlTransport_libwww : public xmlrpc_c::clientXmlTransport_http {
+    
+public:
+    clientXmlTransport_libwww(std::string const appname = "",
+                              std::string const appversion = "");
+
+    ~clientXmlTransport_libwww();
+};
+
+/*===========================================================================
+                           wininet
+===========================================================================*/
+
+class carriageParm_wininet0 : public xmlrpc_c::carriageParm_http0 {
+
+public:
+    carriageParm_wininet0(std::string const serverUrl);
+
+};
+
+class carriageParm_wininet0Ptr : public xmlrpc_c::carriageParm_http0Ptr {
+
+public:
+    carriageParm_wininet0Ptr();
+    carriageParm_wininet0Ptr(xmlrpc_c::carriageParm_wininet0 * const);
+
+    xmlrpc_c::carriageParm_wininet0 *
+    operator->() const;
+};
+
+class clientXmlTransport_wininet : public xmlrpc_c::clientXmlTransport_http {
+
+public:
+    clientXmlTransport_wininet(bool const allowInvalidSslCerts = false);
+
+    ~clientXmlTransport_wininet();
+};
+
+/*===========================================================================
+                           pstream
+===========================================================================*/
+
+class packetSocket;
+
+class carriageParm_pstream : public xmlrpc_c::carriageParm {
+
+    // There are no parameters for carrying an RPC on a packet stream.
+    // There's only one way to carry it.
+};
+
+class carriageParm_pstreamPtr : public xmlrpc_c::carriageParmPtr {
+
+public:
+    carriageParm_pstreamPtr();
+    carriageParm_pstreamPtr(
+        xmlrpc_c::carriageParm_pstream * const carriageParmP);
+
+    xmlrpc_c::carriageParm_pstream *
+    operator->() const;
+};
+
+class clientXmlTransport_pstream : public xmlrpc_c::clientXmlTransport {
+
+public:
+    class constrOpt {
+    public:
+        constrOpt();
+
+        constrOpt & fd                (int         const& arg);
+
+        struct {
+            int         fd;
+        } value;
+        struct {
+            bool fd;
+        } present;
+    };
+
+    clientXmlTransport_pstream(constrOpt const& opt);
+
+    ~clientXmlTransport_pstream();
+
+    void
+    call(xmlrpc_c::carriageParm * const  carriageParmP,
+         std::string              const& callXml,
+         std::string *            const  responseXmlP);
+
+private:
+    packetSocket * packetSocketP;
+};
+
+
+} // namespace
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girerr.hpp	Fri May 23 16:56:24 2008
@@ -21,6 +21,11 @@
     std::string _what;
 };
 
+// throwf() always throws a girerr::error .
+
+void
+throwf(const char * const format, ...);
+
 } // namespace
 
 #endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/girmem.hpp	Fri May 23 16:56:24 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;
 };

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/inttypes.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/inttypes.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,19 @@
+#ifndef XMLRPC_INTTYPES_H_INCLUDED
+#define XMLRPC_INTTYPES_H_INCLUDED
+
+#ifdef _MSC_VER
+
+typedef unsigned short    xmlrpc_uint16_t;
+typedef unsigned int      xmlrpc_uint32_t;
+typedef unsigned __int64  xmlrpc_uint64_t;
+
+#else
+#include <inttypes.h>
+
+typedef uint16_t xmlrpc_uint16_t;
+typedef uint32_t xmlrpc_uint32_t;
+typedef uint64_t xmlrpc_uint64_t;
+
+#endif
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/oldcppwrapper.hpp	Fri May 23 16:56:24 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.

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/packetsocket.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/packetsocket.hpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,165 @@
+#ifndef PACKETSOCKET_HPP_INCLUDED
+#define PACKETSOCKET_HPP_INCLUDED
+
+/*============================================================================
+                         packetsocket
+==============================================================================
+  This is a facility for communicating socket-style, with defined
+  packets like a datagram socket but with reliable delivery like a
+  stream socket.  It's like a POSIX "sequential packet" socket, except
+  it is built on top of a stream socket, so it is usable on the many
+  systems that have stream sockets but not sequential packet sockets.
+============================================================================*/
+
+#include <sys/types.h>
+#include <string>
+#include <queue>
+
+#include <xmlrpc-c/girmem.hpp>
+
+namespace xmlrpc_c {
+
+class packet : public girmem::autoObject {
+
+public:
+    packet();
+
+    packet(const unsigned char * const data,
+                   size_t                const dataLength);
+
+    packet(const char * const data,
+                   size_t       const dataLength);
+
+    ~packet();
+
+    unsigned char *
+    getBytes() const { return this->bytes; }
+
+    size_t
+    getLength() const { return this->length; }
+
+    void
+    addData(const unsigned char * const data,
+            size_t                const dataLength);
+
+private:
+    unsigned char * bytes;  // malloc'ed
+    size_t length;
+    size_t allocSize;
+
+    void
+    initialize(const unsigned char * const data,
+               size_t                const dataLength);
+};
+
+
+
+class packetPtr: public girmem::autoObjectPtr {
+
+public:
+    packetPtr();
+
+    explicit packetPtr(packet * const packetP);
+
+    packet *
+    operator->() const;
+};
+
+
+
+class packetSocket {
+/*----------------------------------------------------------------------------
+   This is an Internet communication vehicle that transmits individual
+   variable-length packets of text.
+
+   It is based on a stream socket.
+
+   It would be much better to use a kernel SOCK_SEQPACKET socket, but
+   Linux 2.4 does not have them.
+-----------------------------------------------------------------------------*/
+public:
+    packetSocket(int sockFd);
+
+    ~packetSocket();
+
+    void
+    writeWait(packetPtr const& packetPtr) const;
+
+    void
+    read(bool *      const eofP,
+         bool *      const gotPacketP,
+         packetPtr * const packetPP);
+
+    void
+    readWait(volatile const int * const interruptP,
+             bool *               const eofP,
+             bool *               const gotPacketP,
+             packetPtr *          const packetPP);
+
+    void
+    readWait(volatile const int * const interruptP,
+             bool *               const eofP,
+             packetPtr *          const packetPP);
+
+    void
+    readWait(bool *      const eofP,
+             packetPtr * const packetPP);
+
+private:
+    int sockFd;
+        // The kernel stream socket we use.
+    bool eof;
+        // The packet socket is at end-of-file for reads.
+        // 'readBuffer' is empty and there won't be any more data to fill
+        // it because the underlying stream socket is closed.
+    std::queue<packetPtr> readBuffer;
+    packetPtr packetAccumP;
+        // The receive packet we're currently accumulating; it will join
+        // 'readBuffer' when we've received the whole packet (and we've
+        // seen the END escape sequence so we know we've received it all).
+        // If we're not currently accumulating a packet (haven't seen a
+        // PKT escape sequence), this points to nothing.
+    bool inEscapeSeq;
+        // In our trek through the data read from the underlying stream
+        // socket, we are after an ESC character and before the end of the
+        // escape sequence.  'escAccum' shows what of the escape sequence
+        // we've seen so far.
+    bool inPacket;
+        // We're now receiving packet data from the underlying stream
+        // socket.  We've seen a complete PKT escape sequence, but have not
+        // seen a complete END escape sequence since.
+    struct {
+        unsigned char bytes[3];
+        size_t len;
+    } escAccum;
+
+    void
+    bufferFinishedPacket();
+
+    void
+    takeSomeEscapeSeq(const unsigned char * const buffer,
+                                    size_t                const length,
+                                    size_t *              const bytesTakenP);
+
+    void
+    takeSomePacket(const unsigned char * const buffer,
+                   size_t                const length,
+                   size_t *              const bytesTakenP);
+
+    void
+    verifyNothingAccumulated();
+
+    void
+    processBytesRead(const unsigned char * const buffer,
+                     size_t                const bytesRead);
+
+    void
+    readFromFile();
+
+};
+
+
+
+} // namespace
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/registry.hpp	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/select_int.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/select_int.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,24 @@
+#ifndef SELECT_INT_H_INCLUDED
+#define SELECT_INT_H_INCLUDED
+
+#ifndef WIN32
+#include <sys/select.h>
+#endif
+#include <signal.h>
+
+#include "xmlrpc-c/time_int.h"
+#ifdef WIN32
+#ifndef sigset_t
+typedef int sigset_t;
+#endif
+#endif
+
+int
+xmlrpc_pselect(int                     const n,
+               fd_set *                const readfdsP,
+               fd_set *                const writefdsP,
+               fd_set *                const exceptfdsP,
+               const xmlrpc_timespec * const timeoutP,
+               sigset_t *              const sigmaskP);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server.h	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.h	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_abyss.hpp	Fri May 23 16:56:24 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
 

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_pstream.hpp
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/server_pstream.hpp	Fri May 23 16:56:24 2008
@@ -0,0 +1,75 @@
+#ifndef SERVER_PSTREAM_HPP_INCLUDED
+#define SERVER_PSTREAM_HPP_INCLUDED
+
+#ifdef WIN32
+#include <winsock.h>  /* For XMLRPC_SOCKET (= SOCKET) */
+#endif
+
+#include <xmlrpc-c/config.h>  /* For XMLRPC_SOCKET */
+#include <xmlrpc-c/registry.hpp>
+#include <xmlrpc-c/packetsocket.hpp>
+
+namespace xmlrpc_c {
+
+class serverPstreamConn {
+
+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);
+
+        struct value {
+            xmlrpc_c::registryPtr      registryPtr;
+            const xmlrpc_c::registry * registryP;
+            XMLRPC_SOCKET              socketFd;
+        } value;
+        struct {
+            bool registryPtr;
+            bool registryP;
+            bool socketFd;
+        } present;
+    };
+
+    serverPstreamConn(constrOpt const& opt);
+
+    ~serverPstreamConn();
+
+    void
+    runOnce(volatile const int * const interruptP,
+            bool *               const eofP);
+
+    void
+    runOnce(bool * const eofP);
+
+private:
+
+    // 'registryP' is what we actually use; 'registryHolder' just holds a
+    // reference to 'registryP' so the registry doesn't disappear while
+    // this server exists.  But note that if the creator doesn't supply
+    // a registryPtr, 'registryHolder' is just a placeholder variable and
+    // the creator is responsible for making sure the registry doesn't
+    // go anywhere while the server exists.
+
+    registryPtr registryHolder;
+    const registry * registryP;
+
+    packetSocket * packetSocketP;
+        // The packet socket over which we received RPCs.
+        // This is permanently connected to our fixed client.
+
+    void
+    establishRegistry(constrOpt const& opt);
+
+    void
+    establishPacketSocket(constrOpt const& opt);
+};
+
+
+} // namespace
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/sleep_int.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/sleep_int.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,7 @@
+#ifndef SLEEP_INT_H_INCLUDED
+#define SLEEP_INT_H_INCLUDED
+
+void
+xmlrpc_millisecond_sleep(unsigned int const milliseconds);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/string_int.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/string_int.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,84 @@
+#ifndef XMLRPC_C_STRING_INT_H_INCLUDED
+#define XMLRPC_C_STRING_INT_H_INCLUDED
+
+
+#include <stdarg.h>
+#include <string.h>
+
+#include "xmlrpc_config.h"
+#include "c_util.h"
+#include "bool.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern const char * const xmlrpc_strsol;
+
+void
+xmlrpc_vasprintf(const char ** const retvalP,
+                 const char *  const fmt,
+                 va_list             varargs);
+
+void GNU_PRINTF_ATTR(2,3)
+xmlrpc_asprintf(const char ** const retvalP, const char * const fmt, ...);
+
+const char *
+xmlrpc_strdupnull(const char * const string);
+
+void
+xmlrpc_strfree(const char * const string);
+
+void
+xmlrpc_strfreenull(const char * const string);
+
+static __inline__ bool
+xmlrpc_streq(const char * const a,
+             const char * const b) {
+    return (strcmp(a, b) == 0);
+}
+
+static __inline__ bool
+xmlrpc_memeq(const void * const a,
+             const void * const b,
+             size_t       const size) {
+
+    return (memcmp(a, b, size) == 0);
+}
+
+static __inline__ bool
+xmlrpc_strcaseeq(const char * const a,
+                 const char * const b) {
+#if HAVE_STRCASECMP
+    return (strcasecmp(a, b) == 0);
+#elif HAVE__STRICMP
+    return (_stricmp(a, b) == 0);
+#elif HAVE_STRICMP
+    return (stricmp(a, b) == 0);
+#else
+    #error "This platform has no known case-independent string compare fn"
+#endif
+}
+
+static __inline__ bool
+xmlrpc_strneq(const char * const a,
+              const char * const b,
+              size_t       const len) {
+    return (strncmp(a, b, len) == 0);
+}
+
+const char * 
+xmlrpc_makePrintable(const char * const input);
+
+const char *
+xmlrpc_makePrintable_lp(const char * const input,
+                        size_t       const inputLength);
+
+const char *
+xmlrpc_makePrintableChar(char const input);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/time_int.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/time_int.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,35 @@
+#ifndef TIME_H_INCLUDED
+#define TIME_H_INCLUDED
+
+#include <time.h>
+
+#include "xmlrpc_config.h"
+#include "xmlrpc-c/util.h"
+#include "int.h"
+
+#if HAVE_TIMESPEC
+  typedef struct timespec xmlrpc_timespec;
+#else
+  typedef struct {
+      uint32_t tv_sec;
+      uint32_t tv_nsec;
+  } xmlrpc_timespec;
+#endif
+
+void
+xmlrpc_gettimeofday(xmlrpc_timespec * const todP);
+
+void
+xmlrpc_timegm(const struct tm  * const brokenTime,
+              time_t *           const timeValueP,
+              const char **      const errorP);
+
+void
+xmlrpc_localtime(time_t      const datetime,
+                 struct tm * const tmP);
+
+void
+xmlrpc_gmtime(time_t      const datetime,
+              struct tm * const resultP);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/timeout.hpp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/transport.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/transport.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/transport.h	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,328 @@
+/*=============================================================================
+                                 xmlrpc-c/util.h
+===============================================================================
+
+  This is the interface to the libxmlrpc_util library, which contains
+  utility routines that have nothing to do with XML-RPC.  The library
+  exists because other Xmlrpc-c libraries use the utilities.
+
+  By Bryan Henderson, San Jose, CA 05.09.21.
+
+  Contributed to the public domain by its author.
+=============================================================================*/
+
+#ifndef XMLRPC_C_UTIL_H_INCLUDED
+#define XMLRPC_C_UTIL_H_INCLUDED
+
+#include <sys/types.h>
+#include <stdarg.h>
+
+#include <xmlrpc-c/config.h>  /* Defines XMLRPC_HAVE_WCHAR */
+#include <xmlrpc-c/c_util.h>  /* for GNU_PRINTF_ATTR */
+
+#if XMLRPC_HAVE_WCHAR
+#include <wchar.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*=========================================================================
+**  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) while (0) {}
+#endif
+
+void
+xmlrpc_assertion_failed(const char * const fileName,
+                        int          const lineNumber);
+
+/* Validate a pointer. */
+#define XMLRPC_ASSERT_PTR_OK(ptr) \
+    XMLRPC_ASSERT((ptr) != NULL)
+
+
+/*=========================================================================
+**  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;
+    int    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* const 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 varargs */
+void
+xmlrpc_set_fault_formatted_v(xmlrpc_env * const envP,
+                             int          const code,
+                             const char * const format,
+                             va_list      const args);
+
+/* 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, 
+                               ...) GNU_PRINTF_ATTR(3,4);
+
+/* 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,
+              ...) GNU_PRINTF_ATTR(2,3);
+
+/* A simple debugging assertion. */
+#define XMLRPC_ASSERT_ENV_OK(envP) \
+    XMLRPC_ASSERT((envP) != NULL && \
+    (envP->fault_string == NULL) && \
+    !(envP)->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)
+
+#if !defined(__cplusplus)
+#if defined(__GNUC__)
+#define XMLRPC_FAILF( env, code, fmt, ... )  \
+    do {  \
+        xmlrpc_env_set_fault_formatted((env), (code), (fmt),  \
+                                       ##__VA_ARGS__ );  \
+        goto cleanup;  \
+    } while (0)
+#endif
+#endif
+
+#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)
+
+
+/*=========================================================================
+**  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* const env, size_t const size);
+
+/* Destroy an existing xmlrpc_mem_block, and everything it contains. */
+void xmlrpc_mem_block_free (xmlrpc_mem_block* const block);
+
+/* Initialize the contents of the provided xmlrpc_mem_block. */
+void xmlrpc_mem_block_init
+    (xmlrpc_env* const env, xmlrpc_mem_block* const block, size_t const size);
+
+/* Deallocate the contents of the provided xmlrpc_mem_block, but not the
+** block itself. */
+void xmlrpc_mem_block_clean (xmlrpc_mem_block* const 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* const env, xmlrpc_mem_block* const block, size_t const size);
+
+/* Append data to an existing xmlrpc_mem_block. */
+void xmlrpc_mem_block_append
+    (xmlrpc_env* const env, xmlrpc_mem_block* const block, const void * const data, size_t const 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)
+
+
+/*=========================================================================
+**  UTF-8 Encoding and Decoding
+**=======================================================================*/
+
+void 
+xmlrpc_validate_utf8(xmlrpc_env * const envP,
+                     const char * const utf8Data,
+                     size_t       const utf8Len);
+
+/* Decode a UTF-8 string. */
+xmlrpc_mem_block *
+xmlrpc_utf8_to_wcs(xmlrpc_env * const envP,
+                   const char * const utf8_data,
+                   size_t       const utf8_len);
+
+/* Encode a UTF-8 string. */
+
+#if XMLRPC_HAVE_WCHAR
+xmlrpc_mem_block *
+xmlrpc_wcs_to_utf8(xmlrpc_env *    const envP,
+                   const wchar_t * const wcsData,
+                   size_t          const wcsLen);
+#endif
+
+void
+xmlrpc_force_to_utf8(char * const buffer);
+
+void
+xmlrpc_force_to_xml_chars(char * const buffer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util_int.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/util_int.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,13 @@
+#ifndef XMLRPC_C_UTIL_INT_H_INCLUDED
+#define XMLRPC_C_UTIL_INT_H_INCLUDED
+
+#include "util.h"
+
+#define MIN(a,b) ((a) < (b) ? (a) : (b))
+#define MAX(a,b) ((a) > (b) ? (a) : (b))
+
+/* 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)
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xml.hpp	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/include/xmlrpc-c/xmlparser.h	Fri May 23 16:56:24 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.

Added: freeswitch/trunk/libs/xmlrpc-c/irix-common.make
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/irix-common.make	Fri May 23 16:56:24 2008
@@ -0,0 +1,31 @@
+# -*-makefile-*-    <-- an Emacs control
+
+# See unix-common.make for an explanation of this file.  This file is
+# analogous to unix-common.make, but is for an Irix system.
+
+SONAME = $(@:%.$(MAJ):%)
+
+SHLIB_CMD = $(CCLD) $(LDFLAGS_SHLIB) -o $@ $^ $(LADD)
+
+SHLIB_LE_TARGETS = $(call shliblefn, $(SHARED_LIBS_TO_BUILD))
+
+$(SHLIB_LE_TARGETS):%:%.$(MAJ)
+	rm -f $@
+	$(LN_S) $< $@
+
+
+.PHONY: $(SHLIB_INSTALL_TARGETS)
+.PHONY: install-shared-libraries
+
+SHLIB_INSTALL_TARGETS = $(SHARED_LIBS_TO_INSTALL:%=%/install)
+
+#SHLIB_INSTALL_TARGETS is like "libfoo/install libbar/install"
+
+install-shared-libraries: $(SHLIB_INSTALL_TARGETS)
+
+$(SHLIB_INSTALL_TARGETS):%/install:%.$(SHLIB_SUFFIX).$(MAJ)
+# $< is a library file name, e.g. libfoo.so.3.1 .
+	$(INSTALL_SHLIB) $< $(DESTDIR)$(LIBINST_DIR)/$<
+	cd $(DESTDIR)$(LIBINST_DIR); \
+	  rm -f $< $(<:%.$(MAJ)=%); \
+	  $(LN_S) $< $(<:%.$(MAJ)=%)

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/Makefile	Fri May 23 16:56:24 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
 
 
 

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/HISTORY
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/HISTORY	Fri May 23 16:56:24 2008
@@ -0,0 +1,122 @@
+Here is some stuff from the README file of the original Abyss source
+package in 2000.  Abyss used to be an independent package and was included
+in Xmlrpc-c for convenience when Xmlrpc-c was created.  Since then, the
+code has been greatly modified and extended for Xmlrpc-c.
+
+The original Abyss project was a product of Moez Mahfoudh mmoez at bigfoot.com.
+
+
+                              ABYSS Web Server
+                             ------------------
+
+
+About:
+------
+
+ABYSS aims to be a fully HTTP/1.1 compliant web server. Its main design
+goals are speed, low resource usage and portability. ABYSS works on most
+UNIX based systems and on Win32 systems (Win95/98/2000/NT).
+
+Copyright:
+----------
+
+Copyright (C) 2000 Moez Mahfoudh. All rights reserved.
+
+Status:
+-------
+
+ABYSS is still in development stage. Actual version is 0.3. Many features
+are not implemented yet but the server core works well and seems to be
+stable. It is fully reliable for serving static files on medium load sites.
+In fact, primary benchmarks show that ABYSS is 70% as fast as Apache when
+using the fork system. This rate jumps to 130% when using threads.
+On UNIX platforms, some problems occurred because of the use of the Pthreads
+library. This will be corrected in the future versions. That's why only the
+fork system is usable under UNIX. This lowers performances but guarantees
+stability.
+CGI/1.1 support is still absent from the current version but will be
+included in the near future.
+
+Change Log:
+-----------
+
+   * Version 0.3 (March 23,2000):
+        o Handles conditional GET requests (by date)
+        o Conforms to all the MUSTs of the RFC2616 (newer version of the
+          HTTP/1.1 protocol draft)
+        o New configuration options (such as pidfile for UNIX systems...)
+        o Handles HEAD and OPTIONS methods
+        o Many bug fixes
+        o Tested on Sun-OS 5.7
+        o Second public release
+
+   * Version 0.2 beta (February 7,2000):
+        o Handles GET on static files
+        o Handles correctly range requests
+        o Conforms to 80% of the MUSTs of the RFC2068 (HTTP/1.1 protocol
+          draft)
+        o Improved code portability (Win32 and UNIX platforms)
+        o Tested on Linux 2.2 and Win95/98
+        o First public release
+
+   * Version 0.1 (January 2000):
+        o Completely rewritten in C
+        o Speed improvement
+        o New memory allocation scheme (using pools)
+        o Never released
+
+   * Version 0.0 (January 2000):
+        o Initial version
+        o Written in C++
+        o Never released
+
+Downloading:
+------------
+
+   * Version 0.3 (current version):
+        o UNIX package (source) abyss-0.3.tar.gz.
+        o Win32 package is not available but you can extract source files
+          from the UNIX package and compile them on Windows without any
+          modification. (Sorry for this inconvenience: I have no Windows
+          machine now to compile the program and to test it. If someone can
+          do that, please email me the zipped package and I'll add it here).
+
+   * Version 0.2 beta:
+        o UNIX package (source) abyss-0.2b.tar.gz.
+        o Win32 package (source+binary) abyss-0.2b.zip.
+
+Installation:
+-------------
+
+   * For UNIX systems:
+        o Untar/Ungzip the distribution package with a command like tar xvfz
+          abyss-x.y.tar.gz
+        o Edit the Makefile src/Makefile to meet your system requirements.
+        o Go to directory src and execute make.
+        o The server binary is generated and stored in the bin directory.
+        o Edit the conf/abyss.conf to reflect your system configuration (At
+          least change the paths).
+        o Goto to the bin directory and start the server by typing ./abyss
+          -c ../conf/abyss.conf
+
+   * For Win32 systems:
+        o Unzip the distribution package.
+        o An executable file is already present in the bin directory.
+        o If you wish to recompile the server, open the src/abyss.dsw file
+          with Microsoft Visual C++ 5.0 or higher and rebuild the project.
+        o Edit the conf/abyss.conf to reflect your system configuration (At
+          least change the paths).
+        o Goto to the bin directory and start the server by typing ./abyss
+          -c ../conf/abyss.conf
+
+
+To do:
+------
+
+   * CGI/1.1 support
+   * Web based configuration/administration
+   * Speed improvement
+   * File caching system
+   * Throttling
+   * PUT method handling
+   * ...

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/Makefile	Fri May 23 16:56:24 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
 
 
 

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/abyss.conf
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/abyss.conf	Fri May 23 16:56:24 2008
@@ -0,0 +1,56 @@
+# ABYSS Web Server configuration file
+# (C) Moez Mahfoudh - 2000
+
+# Cases in option names are ignored, 
+# that means that PORT=port=PoRT=..
+
+# When writing paths, do not worry about / or \ use.
+# ABYSS will substitute / with \ on Win32 systems.
+
+# Options which are system specific (such as User) are
+# ignored on systems which do not handle them.
+
+# The Port option tells the server on which TCP port to listen.
+# default is 80
+Port 8080
+
+# The name or #number of the user to run the server as if it is 
+# launched as root (UNIX specific)
+User nobody
+
+# The Server Root (UNIX systems style)
+ServerRoot conf/abyss_root
+
+# The Server Root (Win32 systems style)
+# ServerRoot G:\XML\xmlrpc-c-0.9.5\conf\abyss_root
+
+# The Path option specifies the web files path.
+Path htdocs
+
+# The Default option contains the name of the files the server should
+# look for when only a path is given (e.g. http://myserver/info/).
+Default index.html index.htm INDEX.HTM INDEX.HTML
+
+# The KeepAlive option is used to set the maximum number of requests
+# served using the same persistent connection.
+KeepAlive 10
+
+# The TimeOut option tells the server how much seconds to wait for
+# an idle connection before closing it.
+TimeOut 10
+
+# The MimeTypes option specifies the location of the file
+# containing the mapping of MIME types and files extensions
+MimeTypes conf/mime.types
+
+# The path of the log file
+LogFile log/access.log
+
+# The file where the pid of the server is logged (UNIX specific)
+PidFile log/abyss.pid
+
+# If AdvertiseServer if set to no, then no server field would be
+# appended to the responses. This is the way to make the server
+# identity unknown to some malicious people which can profit from
+# well known security holes in the software to crash it.
+AdvertiseServer yes

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/mime.types
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/conf/mime.types	Fri May 23 16:56:24 2008
@@ -0,0 +1,276 @@
+# This is a comment. I love comments.
+
+# This file controls what Internet media types are sent to the client for
+# given file extension(s).  Sending the correct media type to the client
+# is important so they know how to handle the content of the file.
+# Extra types can either be added here or by using an AddType directive
+# in your config files. For more information about Internet media types,
+# please read RFC 2045, 2046, 2047, 2048, and 2077.  The Internet media type
+# registry is at <ftp://ftp.iana.org/in-notes/iana/assignments/media-types/>.
+
+# MIME type			Extension
+application/EDI-Consent
+application/EDI-X12
+application/EDIFACT
+application/activemessage
+application/andrew-inset	ez
+application/applefile
+application/atomicmail
+application/cals-1840
+application/commonground
+application/cybercash
+application/dca-rft
+application/dec-dx
+application/eshop
+application/hyperstudio
+application/iges
+application/mac-binhex40	hqx
+application/mac-compactpro	cpt
+application/macwriteii
+application/marc
+application/mathematica
+application/msword		doc
+application/news-message-id
+application/news-transmission
+application/octet-stream	bin dms lha lzh exe class
+application/oda			oda
+application/pdf			pdf
+application/pgp-encrypted
+application/pgp-keys
+application/pgp-signature
+application/pkcs10
+application/pkcs7-mime
+application/pkcs7-signature
+application/postscript		ai eps ps
+application/prs.alvestrand.titrax-sheet
+application/prs.cww
+application/prs.nprend
+application/remote-printing
+application/riscos
+application/rtf			rtf
+application/set-payment
+application/set-payment-initiation
+application/set-registration
+application/set-registration-initiation
+application/sgml
+application/sgml-open-catalog
+application/slate
+application/smil		smi smil
+application/vemmi
+application/vnd.3M.Post-it-Notes
+application/vnd.FloGraphIt
+application/vnd.acucobol
+application/vnd.anser-web-certificate-issue-initiation
+application/vnd.anser-web-funds-transfer-initiation
+application/vnd.audiograph
+application/vnd.businessobjects
+application/vnd.claymore
+application/vnd.comsocaller
+application/vnd.dna
+application/vnd.dxr
+application/vnd.ecdis-update
+application/vnd.ecowin.chart
+application/vnd.ecowin.filerequest
+application/vnd.ecowin.fileupdate
+application/vnd.ecowin.series
+application/vnd.ecowin.seriesrequest
+application/vnd.ecowin.seriesupdate
+application/vnd.enliven
+application/vnd.epson.salt
+application/vnd.fdf
+application/vnd.ffsns
+application/vnd.framemaker
+application/vnd.fujitsu.oasys
+application/vnd.fujitsu.oasys2
+application/vnd.fujitsu.oasys3
+application/vnd.fujitsu.oasysgp
+application/vnd.fujitsu.oasysprs
+application/vnd.fujixerox.docuworks
+application/vnd.hp-HPGL
+application/vnd.hp-PCL
+application/vnd.hp-PCLXL
+application/vnd.hp-hps
+application/vnd.ibm.MiniPay
+application/vnd.ibm.modcap
+application/vnd.intercon.formnet
+application/vnd.intertrust.digibox
+application/vnd.intertrust.nncp
+application/vnd.is-xpr
+application/vnd.japannet-directory-service
+application/vnd.japannet-jpnstore-wakeup
+application/vnd.japannet-payment-wakeup
+application/vnd.japannet-registration
+application/vnd.japannet-registration-wakeup
+application/vnd.japannet-setstore-wakeup
+application/vnd.japannet-verification
+application/vnd.japannet-verification-wakeup
+application/vnd.koan
+application/vnd.lotus-1-2-3
+application/vnd.lotus-approach
+application/vnd.lotus-freelance
+application/vnd.lotus-organizer
+application/vnd.lotus-screencam
+application/vnd.lotus-wordpro
+application/vnd.meridian-slingshot
+application/vnd.mif		mif
+application/vnd.minisoft-hp3000-save
+application/vnd.mitsubishi.misty-guard.trustweb
+application/vnd.ms-artgalry
+application/vnd.ms-asf
+application/vnd.ms-excel	xls
+application/vnd.ms-powerpoint	ppt
+application/vnd.ms-project
+application/vnd.ms-tnef
+application/vnd.ms-works
+application/vnd.music-niff
+application/vnd.musician
+application/vnd.netfpx
+application/vnd.noblenet-directory
+application/vnd.noblenet-sealer
+application/vnd.noblenet-web
+application/vnd.novadigm.EDM
+application/vnd.novadigm.EDX
+application/vnd.novadigm.EXT
+application/vnd.osa.netdeploy
+application/vnd.powerbuilder6
+application/vnd.powerbuilder6-s
+application/vnd.rapid
+application/vnd.seemail
+application/vnd.shana.informed.formtemplate
+application/vnd.shana.informed.interchange
+application/vnd.shana.informed.package
+application/vnd.street-stream
+application/vnd.svd
+application/vnd.swiftview-ics
+application/vnd.truedoc
+application/vnd.visio
+application/vnd.webturbo
+application/vnd.wrq-hp3000-labelled
+application/vnd.wt.stf
+application/vnd.xara
+application/vnd.yellowriver-custom-menu
+application/wita
+application/wordperfect5.1
+application/x-bcpio		bcpio
+application/x-cdlink		vcd
+application/x-chess-pgn		pgn
+application/x-compress
+application/x-cpio		cpio
+application/x-csh		csh
+application/x-director		dcr dir dxr
+application/x-dvi		dvi
+application/x-futuresplash	spl
+application/x-gtar		gtar
+application/x-gzip
+application/x-hdf		hdf
+application/x-javascript	js
+application/x-koan		skp skd skt skm
+application/x-latex		latex
+application/x-netcdf		nc cdf
+application/x-sh		sh
+application/x-shar		shar
+application/x-shockwave-flash	swf
+application/x-stuffit		sit
+application/x-sv4cpio		sv4cpio
+application/x-sv4crc		sv4crc
+application/x-tar		tar
+application/x-tcl		tcl
+application/x-tex		tex
+application/x-texinfo		texinfo texi
+application/x-troff		t tr roff
+application/x-troff-man		man
+application/x-troff-me		me
+application/x-troff-ms		ms
+application/x-ustar		ustar
+application/x-wais-source	src
+application/x400-bp
+application/xml
+application/zip			zip
+audio/32kadpcm
+audio/basic			au snd
+audio/midi			mid midi kar
+audio/mpeg			mpga mp2 mp3
+audio/vnd.qcelp
+audio/x-aiff			aif aiff aifc
+audio/x-pn-realaudio		ram rm
+audio/x-pn-realaudio-plugin	rpm
+audio/x-realaudio		ra
+audio/x-wav			wav
+chemical/x-pdb			pdb xyz
+image/bmp			bmp
+image/cgm
+image/g3fax
+image/gif			gif
+image/ief			ief
+image/jpeg			jpeg jpg jpe
+image/naplps
+image/png			png
+image/prs.btif
+image/tiff			tiff tif
+image/vnd.dwg
+image/vnd.dxf
+image/vnd.fpx
+image/vnd.net-fpx
+image/vnd.svf
+image/vnd.xiff
+image/x-cmu-raster		ras
+image/x-portable-anymap		pnm
+image/x-portable-bitmap		pbm
+image/x-portable-graymap	pgm
+image/x-portable-pixmap		ppm
+image/x-rgb			rgb
+image/x-xbitmap			xbm
+image/x-xpixmap			xpm
+image/x-xwindowdump		xwd
+message/delivery-status
+message/disposition-notification
+message/external-body
+message/http
+message/news
+message/partial
+message/rfc822
+model/iges			igs iges
+model/mesh			msh mesh silo
+model/vnd.dwf
+model/vrml			wrl vrml
+multipart/alternative
+multipart/appledouble
+multipart/byteranges
+multipart/digest
+multipart/encrypted
+multipart/form-data
+multipart/header-set
+multipart/mixed
+multipart/parallel
+multipart/related
+multipart/report
+multipart/signed
+multipart/voice-message
+text/css			css
+text/directory
+text/enriched
+text/html			html htm
+text/plain			asc txt
+text/prs.lines.tag
+text/rfc822-headers
+text/richtext			rtx
+text/rtf			rtf
+text/sgml			sgml sgm
+text/tab-separated-values	tsv
+text/uri-list
+text/vnd.abc
+text/vnd.flatland.3dml
+text/vnd.fmi.flexstor
+text/vnd.in3d.3dml
+text/vnd.in3d.spot
+text/vnd.latex-z
+text/x-setext			etx
+text/xml			xml
+video/mpeg			mpeg mpg mpe
+video/quicktime			qt mov
+video/vnd.motorola.video
+video/vnd.motorola.videop
+video/vnd.vivo
+video/x-msvideo			avi
+video/x-sgi-movie		movie
+x-conference/x-cooltalk		ice

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/index.htm
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/index.htm	Fri May 23 16:56:24 2008
@@ -0,0 +1,21 @@
+<HTML>
+<HEAD>
+<TITLE>ABYSS is working !!!</TITLE>
+</HEAD>
+<BODY bgColor=#80a0f0 text=#000000>
+<H1 align=center>Congratulations, ABYSS is working !!!</H1>
+<BR>
+<P>
+<B>ABYSS</B> Web Server is working correctly on your system. You should now change this
+page with yours.
+<BR>
+Please include in your web pages (at least the first), the <b><i>'Powered by ABYSS'</i></b>
+banner to promote the use of <B>ABYSS</B>.
+</P>
+<hr>
+<P>
+<CENTER><FONT size=-1>
+Copyright © 2000 <A href="mailto:mmoez at bigfoot.com">Moez Mahfoudh</A>. All rights reserved.
+</FONT>
+<BR><BR><A href="http://abyss.linuxave.net/"><IMG border=0 src="pwrabyss.gif"></A></center></P>
+</BODY></HTML>

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/example/htdocs/pwrabyss.gif
==============================================================================
Binary file. No diff available.

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/Makefile
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/Makefile	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/Makefile	Fri May 23 16:56:24 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

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/abyss_info.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/abyss_info.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,18 @@
+#ifndef ABYSS_INFO_H_INCLUDED
+#define ABYSS_INFO_H_INCLUDED
+
+#include "version.h"  /* defines XMLRPC_C_VERSION */
+
+#define SERVER_HTML_INFO \
+  "<p><HR><b><i><a href=\"http:\057\057xmlrpc-c.sourceforge.net\">" \
+  "ABYSS Web Server for XML-RPC For C/C++</a></i></b> " \
+  "version " XMLRPC_C_VERSION "<br>" \
+  "</p>"
+
+#define SERVER_PLAIN_INFO \
+  CRLF "----------------------------------------" \
+       "----------------------------------------" \
+  CRLF "ABYSS Web Server for XML-RPC For C/C++ " \
+  "version " XMLRPC_C_VERSION CRLF "See xmlrpc-c.sourceforge.net"
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,196 @@
+/*============================================================================
+  socket.c
+==============================================================================
+  Implementation of TChannel class: A generic channel over which one can
+  transport a bidirectional stream of bytes.
+
+  A TChannel is a lot like a POSIX stream socket in "connected" state.
+============================================================================*/
+
+#include <sys/types.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "bool.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/abyss.h"
+#ifdef WIN32
+  #include "socket_win.h"
+#else
+  #include "socket_unix.h"
+#endif
+#include "channel.h"
+
+
+
+static void
+socketOsInit(const char ** const errorP) {
+
+#ifdef WIN32
+    SocketWinInit(errorP);
+#else
+    SocketUnixInit(errorP);
+#endif
+}
+
+
+
+static void
+socketOsTerm(void) {
+
+#ifdef WIN32
+    SocketWinTerm();
+#else
+    SocketUnixTerm();
+#endif
+}
+    
+
+
+bool ChannelTraceIsActive;
+
+void
+ChannelInit(const char ** const errorP) {
+
+    socketOsInit(errorP);
+
+    if (!*errorP) {
+        ChannelTraceIsActive = (getenv("ABYSS_TRACE_CHANNEL") != NULL);
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Abyss channel layer will trace channel traffic "
+                    "due to ABYSS_TRACE_CHANNEL environment variable\n");
+    }
+}
+
+
+
+void
+ChannelTerm(void) {
+
+    socketOsTerm();
+}
+
+
+
+/* ChannelCreate() is not exported to the Abyss user.  It is meant to
+   be used by an implementation-specific TChannel generator which is
+   exported to the Abyss user, e.g. ChannelCreateUnix() in
+   socket_unix.c
+
+   The TChannel generator functions are the _only_ user-accessible
+   functions that are particular to an implementation.
+*/
+
+static uint const channelSignature = 0x06060B;
+
+void
+ChannelCreate(const struct TChannelVtbl * const vtblP,
+              void *                      const implP,
+              TChannel **                 const channelPP) {
+
+    TChannel * channelP;
+
+    MALLOCVAR(channelP);
+
+    if (channelP) {
+        channelP->implP = implP;
+        channelP->vtbl = *vtblP;
+        channelP->signature = channelSignature;
+        *channelPP = channelP;
+
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Created channel %p\n", channelP);
+    }
+}
+
+
+
+void
+ChannelDestroy(TChannel * const channelP) {
+
+    if (ChannelTraceIsActive)
+        fprintf(stderr, "Destroying channel %p\n", channelP);
+
+    assert(channelP->signature == channelSignature);
+
+    channelP->vtbl.destroy(channelP);
+
+    channelP->signature = 0;  /* For debuggability */
+
+    free(channelP);
+}
+
+
+
+void
+ChannelWrite(TChannel *            const channelP,
+             const unsigned char * const buffer,
+             uint32_t              const len,
+             bool *                const failedP) {
+
+    if (ChannelTraceIsActive)
+        fprintf(stderr, "Writing %u bytes to channel %p\n", len, channelP);
+
+    (*channelP->vtbl.write)(channelP, buffer, len, failedP);
+}
+
+
+
+void
+ChannelRead(TChannel *      const channelP, 
+            unsigned char * const buffer, 
+            uint32_t        const len,
+            uint32_t *      const bytesReceivedP,
+            bool *          const failedP) {
+    
+    if (ChannelTraceIsActive)
+        fprintf(stderr, "Reading %u bytes from channel %p\n", len, channelP);
+
+    (*channelP->vtbl.read)(channelP, buffer, len, bytesReceivedP, failedP);
+}
+
+
+
+void
+ChannelWait(TChannel * const channelP,
+            bool       const waitForRead,
+            bool       const waitForWrite,
+            uint32_t   const timems,
+            bool *     const readyToReadP,
+            bool *     const readyToWriteP,
+            bool *     const failedP) {
+
+    if (ChannelTraceIsActive) {
+        if (waitForRead)
+            fprintf(stderr, "Waiting %u milliseconds for data from "
+                    "channel %p\n", timems, channelP);
+        if (waitForWrite)
+            fprintf(stderr, "Waiting %u milliseconds for channel %p "
+                    "to be writable\n", timems, channelP);
+    }
+    (*channelP->vtbl.wait)(channelP, waitForRead, waitForWrite, timems,
+                           readyToReadP, readyToWriteP, failedP);
+}
+
+
+
+void
+ChannelInterrupt(TChannel * const channelP) {
+
+    if (ChannelTraceIsActive)
+        fprintf(stderr, "Interrupting channel waits");
+
+    (*channelP->vtbl.interrupt)(channelP);
+}
+
+
+
+void
+ChannelFormatPeerInfo(TChannel *    const channelP,
+                      const char ** const peerStringP) {
+
+    (*channelP->vtbl.formatPeerInfo)(channelP, peerStringP);
+}
+

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/channel.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,112 @@
+#ifndef CHANNEL_H_INCLUDED
+#define CHANNEL_H_INCLUDED
+
+/*============================================================================
+   This is the generic channel interface for Abyss.  It includes both
+   the generic interface to a channel from above and the interface
+   between generic channel code and a particular channel
+   implementation (e.g. POSIX socket) below.
+
+   Abyss uses a channel to converse with an HTTP client.  A channel is
+   oblivious to HTTP -- it just transports a byte stream in each direction.
+============================================================================*/
+
+#include "bool.h"
+#include "int.h"
+#include "xmlrpc-c/abyss.h"
+
+struct TChannelVtbl;
+
+void
+ChannelCreate(const struct TChannelVtbl * const vtblP,
+              void *                      const implP,
+              TChannel **                 const channelPP);
+
+typedef void ChannelDestroyImpl(TChannel * const channelP);
+
+typedef void ChannelWriteImpl(TChannel *            const channelP,
+                              const unsigned char * const buffer,
+                              uint32_t              const len,
+                              bool *                const failedP);
+
+typedef void ChannelReadImpl(TChannel *      const channelP,
+                             unsigned char * const buffer,
+                             uint32_t        const len,
+                             uint32_t *      const bytesReceivedP,
+                             bool *          const failedP);
+
+typedef uint32_t ChannelErrorImpl(TChannel * const channelP);
+
+typedef void ChannelWaitImpl(TChannel * const channelP,
+                             bool       const waitForRead,
+                             bool       const waitForWrite,
+                             uint32_t   const timems,
+                             bool *     const readyToReadP,
+                             bool *     const readyToWriteP,
+                             bool *     const failedP);
+
+typedef void ChannelInterruptImpl(TChannel * const channelP);
+
+typedef void ChannelFormatPeerInfoImpl(TChannel *    const channelP,
+                                       const char ** const peerStringP);
+
+struct TChannelVtbl {
+    ChannelDestroyImpl            * destroy;
+    ChannelWriteImpl              * write;
+    ChannelReadImpl               * read;
+    ChannelWaitImpl               * wait;
+    ChannelInterruptImpl          * interrupt;
+    ChannelFormatPeerInfoImpl     * formatPeerInfo;
+};
+
+struct _TChannel {
+    uint                signature;
+        /* With both background and foreground use of sockets, and
+           background being both fork and pthread, it is very easy to
+           screw up socket lifetime and try to destroy twice.  We use
+           this signature to help catch such bugs.
+        */
+    void *              implP;
+    struct TChannelVtbl vtbl;
+};
+
+#define TIME_INFINITE   0xffffffff
+
+extern bool ChannelTraceIsActive;
+
+void
+ChannelInit(const char ** const errorP);
+
+void
+ChannelTerm(void);
+
+void
+ChannelWrite(TChannel *            const channelP,
+             const unsigned char * const buffer,
+             uint32_t              const len,
+             bool *                const failedP);
+
+void
+ChannelRead(TChannel *      const channelP, 
+            unsigned char * const buffer, 
+            uint32_t        const len,
+            uint32_t *      const bytesReceivedP,
+            bool *          const failedP);
+
+void
+ChannelWait(TChannel * const channelP,
+            bool       const waitForRead,
+            bool       const waitForWrite,
+            uint32_t   const timems,
+            bool *     const readyToReadP,
+            bool *     const readyToWriteP,
+            bool *     const failedP);
+
+void
+ChannelInterrupt(TChannel * const channelP);
+
+void
+ChannelFormatPeerInfo(TChannel *    const channelP,
+                      const char ** const peerStringP);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,167 @@
+/*============================================================================
+  socket.c
+==============================================================================
+  Implementation of TChanSwitch class: A generic channel switch -- an object
+  that brokers a connection between an HTTP client and server.
+============================================================================*/
+
+#include <sys/types.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "bool.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/abyss.h"
+#ifdef WIN32
+  #include "socket_win.h"
+#else
+  #include "socket_unix.h"
+#endif
+#include "chanswitch.h"
+
+
+static void
+socketOsInit(const char ** const errorP) {
+
+#ifdef WIN32
+    SocketWinInit(errorP);
+#else
+    SocketUnixInit(errorP);
+#endif
+}
+
+
+
+static void
+socketOsTerm(void) {
+
+#ifdef WIN32
+    SocketWinTerm();
+#else
+    SocketUnixTerm();
+#endif
+}
+    
+
+
+bool SwitchTraceIsActive;
+
+void
+ChanSwitchInit(const char ** const errorP) {
+
+    socketOsInit(errorP);
+
+    if (!*errorP) {
+        SwitchTraceIsActive = (getenv("ABYSS_TRACE_SWITCH") != NULL);
+        if (SwitchTraceIsActive)
+            fprintf(stderr, "Abyss channel switch layer will trace "
+                    "channel connection activity "
+                    "due to ABYSS_TRACE_SWITCH environment variable\n");
+    }
+}
+
+
+
+void
+ChanSwitchTerm(void) {
+
+    socketOsTerm();
+}
+
+
+
+/* ChanSwitchCreate() is not exported to the Abyss user.  It is meant to
+   be used by an implementation-specific TChanSwitch generator which is
+   exported to the Abyss user, e.g. SwitchCreateUnix() in
+   socket_unix.c
+
+   The TChanSwitch generator functions are the _only_ user-accessible
+   functions that are particular to an implementation.
+*/
+
+static uint const switchSignature = 0x06060A;
+
+void
+ChanSwitchCreate(const struct TChanSwitchVtbl * const vtblP,
+                 void *                         const implP,
+                 TChanSwitch **                 const chanSwitchPP) {
+
+    TChanSwitch * chanSwitchP;
+
+    MALLOCVAR(chanSwitchP);
+
+    if (chanSwitchP) {
+        chanSwitchP->implP     = implP;
+        chanSwitchP->vtbl      = *vtblP;
+        chanSwitchP->signature = switchSignature;
+
+        if (SwitchTraceIsActive)
+            fprintf(stderr, "Created channel switch %p\n", chanSwitchP);
+
+        *chanSwitchPP = chanSwitchP;
+    }
+}
+
+
+
+void
+ChanSwitchDestroy(TChanSwitch * const chanSwitchP) {
+
+    if (SwitchTraceIsActive)
+        fprintf(stderr, "Destroying channel switch %p\n", chanSwitchP);
+
+    assert(chanSwitchP->signature == switchSignature);
+
+    chanSwitchP->vtbl.destroy(chanSwitchP);
+
+    chanSwitchP->signature = 0;  /* For debuggability */
+
+    free(chanSwitchP);
+}
+
+
+
+void
+ChanSwitchListen(TChanSwitch * const chanSwitchP,
+                 uint32_t      const backlog,
+                 const char ** const errorP) {
+
+    if (SwitchTraceIsActive)
+        fprintf(stderr, "Channel switch %p listening.\n", chanSwitchP);
+
+    (*chanSwitchP->vtbl.listen)(chanSwitchP, backlog, errorP);
+}
+
+
+
+void
+ChanSwitchAccept(TChanSwitch * const chanSwitchP,
+                 TChannel **   const channelPP,
+                 void **       const channelInfoPP,
+                 const char ** const errorP) {
+
+    if (SwitchTraceIsActive)
+        fprintf(stderr, "Getting a connection from Channel switch %p...\n",
+                chanSwitchP);
+
+    (*chanSwitchP->vtbl.accept)(chanSwitchP, channelPP, channelInfoPP, errorP);
+
+    if (SwitchTraceIsActive)
+        fprintf(stderr, "Got connection from channel switch.  "
+                "Channel = %p\n", *channelPP);
+}
+
+
+
+void
+ChanSwitchInterrupt(TChanSwitch * const chanSwitchP) {
+
+    if (SwitchTraceIsActive)
+        fprintf(stderr, "Interrupting wait for a connection "
+                "by Channel switch %p...\n",
+                chanSwitchP);
+
+    (*chanSwitchP->vtbl.interrupt)(chanSwitchP);
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/chanswitch.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,78 @@
+#ifndef CHANSWITCH_H_INCLUDED
+#define CHANSWITCH_H_INCLUDED
+
+/*============================================================================
+   This is the generic channel switch interface for Abyss.  It
+   includes both the generic interface to a channel switch from above
+   and the interface between generic channel switch code and a
+   particular channel implementation (e.g. POSIX) below.
+
+   A channel switch is what creates a channel -- it brokers a connection
+   between an HTTP client and server.
+============================================================================*/
+
+#include "bool.h"
+#include "int.h"
+#include "xmlrpc-c/abyss.h"
+
+typedef void SwitchDestroyImpl(TChanSwitch * const socketP);
+
+typedef void SwitchListenImpl(TChanSwitch * const chanSwitchP,
+                              uint32_t      const backlog,
+                              const char ** const errorP);
+
+typedef void SwitchAcceptImpl(TChanSwitch * const chanSwitchP,
+                              TChannel **   const channelPP,
+                              void **       const channelInfoP,
+                              const char ** const errorP);
+
+typedef void SwitchInterruptImpl(TChanSwitch * const chanSwitchP);
+
+struct TChanSwitchVtbl {
+    SwitchDestroyImpl   * destroy;
+    SwitchListenImpl    * listen;
+    SwitchAcceptImpl    * accept;
+    SwitchInterruptImpl * interrupt;
+};
+
+struct _TChanSwitch {
+    uint                   signature;
+        /* With both background and foreground use of switches, and
+           background being both fork and pthread, it is very easy to
+           screw up switch lifetime and try to destroy twice.  We use
+           this signature to help catch such bugs.
+        */
+    void *                 implP;
+    struct TChanSwitchVtbl vtbl;
+};
+
+extern bool SwitchTraceIsActive;
+
+void
+ChanSwitchInit(const char ** const errorP);
+
+void
+ChanSwitchTerm(void);
+
+void
+ChanSwitchCreate(const struct TChanSwitchVtbl * const vtblP,
+                 void *                         const implP,
+                 TChanSwitch **                 const chanSwitchPP);
+
+void
+ChanSwitchListen(TChanSwitch * const chanSwitchP,
+                 uint32_t      const backlog,
+                 const char ** const errorP);
+
+void
+ChanSwitchAccept(TChanSwitch * const chanSwitchP,
+                 TChannel **   const channelPP,
+                 void **       const channelInfoPP,
+                 const char ** const errorP);
+
+void
+ChanSwitchInterrupt(TChanSwitch * const chanSwitchP);
+
+#endif
+
+

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conf.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conf.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conf.c	Fri May 23 16:56:24 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/trunk/libs/xmlrpc-c/lib/abyss/src/conn.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.c	Fri May 23 16:56:24 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.
+**
+******************************************************************************/

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/conn.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,108 @@
+#ifndef CONN_H_INCLUDED
+#define CONN_H_INCLUDED
+
+#include "bool.h"
+#include "xmlrpc-c/abyss.h"
+#include "thread.h"
+
+struct TFile;
+
+#define BUFFER_SIZE 4096 
+
+struct _TConn {
+    struct _TConn * nextOutstandingP;
+        /* Link to the next connection in the list of outstanding
+           connections
+        */
+    TServer * server;
+    uint32_t buffersize;
+        /* Index into the connection buffer (buffer[], below) where
+           the next byte read on the connection will go.
+        */
+    uint32_t bufferpos;
+        /* Index into the connection buffer (buffer[], below) where
+           the next byte to be delivered to the user is.
+        */
+    uint32_t inbytes,outbytes;  
+    TChannel * channelP;
+    void * channelInfoP;
+        /* Information about the channel, such as who is on the other end.
+           Format depends on the type of channel.  The user of the connection
+           is expected to know that type, because he supplied the channel
+           when he created the channel.
+
+           NULL means no channel info is available.
+        */
+    bool hasOwnThread;
+    TThread * threadP;
+    bool finished;
+        /* We have done all the processing there is to do on this
+           connection, other than possibly notifying someone that we're
+           done.  One thing this signifies is that any thread or process
+           that the connection spawned is dead or will be dead soon, so
+           one could reasonably wait for it to be dead, e.g. with
+           pthread_join().  Note that one can scan a bunch of processes
+           for 'finished' status, but sometimes can't scan a bunch of
+           threads for liveness.
+        */
+    const char * trace;
+    TThreadProc * job;
+    TThreadDoneFn * done;
+    char buffer[BUFFER_SIZE];
+};
+
+typedef struct _TConn TConn;
+
+TConn * ConnAlloc(void);
+
+void ConnFree(TConn * const connectionP);
+
+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);
+
+bool
+ConnProcess(TConn * const connectionP);
+
+bool
+ConnKill(TConn * const connectionP);
+
+void
+ConnWaitAndRelease(TConn * const connectionP);
+
+bool
+ConnWrite(TConn *      const connectionP,
+          const void * const buffer,
+          uint32_t     const size);
+
+bool
+ConnRead(TConn *  const c,
+         uint32_t const timems);
+
+void
+ConnReadInit(TConn * const connectionP);
+
+bool
+ConnWriteFromFile(TConn *              const connectionP,
+                  const struct TFile * const fileP,
+                  uint64_t             const start,
+                  uint64_t             const last,
+                  void *               const buffer,
+                  uint32_t             const buffersize,
+                  uint32_t             const rate);
+
+TServer *
+ConnServer(TConn * const connectionP);
+
+void
+ConnFormatClientAddr(TConn *       const connectionP,
+                     const char ** const clientAddrPP);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.c	Fri May 23 16:56:24 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;
 }

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/data.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,179 @@
+#ifndef DATA_H_INCLUDED
+#define DATA_H_INCLUDED
+
+#include "bool.h"
+#include "int.h"
+
+struct abyss_mutex;
+
+/*********************************************************************
+** Buffer
+*********************************************************************/
+
+typedef struct
+{
+    void *data;
+    xmlrpc_uint32_t size;
+    xmlrpc_uint32_t staticid;
+} TBuffer;
+
+bool
+BufferAlloc(TBuffer *       const buf,
+            xmlrpc_uint32_t const memsize);
+
+bool
+BufferRealloc(TBuffer *       const buf,
+              xmlrpc_uint32_t const memsize);
+
+void
+BufferFree(TBuffer * const buf);
+
+
+/*********************************************************************
+** String
+*********************************************************************/
+
+typedef struct
+{
+    TBuffer buffer;
+    xmlrpc_uint32_t size;
+} TString;
+
+bool
+StringAlloc(TString * const stringP);
+
+bool
+StringConcat(TString *    const stringP,
+             const char * const string2);
+
+bool
+StringBlockConcat(TString *    const stringP,
+                  const char * const string2,
+                  char **      const ref);
+
+void
+StringFree(TString * const stringP);
+
+char *
+StringData(TString * const stringP);
+
+
+/*********************************************************************
+** List
+*********************************************************************/
+
+typedef struct {
+    void **item;
+    uint16_t size;
+    uint16_t maxsize;
+    bool autofree;
+} TList;
+
+void
+ListInit(TList * const listP);
+
+void
+ListInitAutoFree(TList * const listP);
+
+void
+ListFree(TList * const listP);
+
+void
+ListFreeItems(TList * const listP);
+
+bool
+ListAdd(TList * const listP,
+        void *  const str);
+
+void
+ListRemove(TList * const listP);
+
+bool
+ListAddFromString(TList *      const listP,
+                  const char * const c);
+
+bool
+ListFindString(TList *      const listP,
+               const char * const str,
+               uint16_t *   const indexP);
+
+
+typedef struct 
+{
+    char *name,*value;
+    uint16_t hash;
+} TTableItem;
+
+typedef struct
+{
+    TTableItem *item;
+    uint16_t size,maxsize;
+} TTable;
+
+void
+TableInit(TTable * const t);
+
+void
+TableFree(TTable * const t);
+
+bool
+TableAdd(TTable *     const t,
+         const char * const name,
+         const char * const value);
+
+bool
+TableAddReplace(TTable *     const t,
+                const char * const name,
+                const char * const value);
+
+bool
+TableFindIndex(TTable *     const t,
+               const char * const name,
+               uint16_t *   const index);
+
+char *
+TableFind(TTable *     const t,
+          const char * const name);
+
+
+/*********************************************************************
+** Pool
+*********************************************************************/
+
+typedef struct _TPoolZone {
+    char * pos;
+    char * maxpos;
+    struct _TPoolZone * next;
+    struct _TPoolZone * prev;
+/*  char data[0]; Some compilers don't accept this */
+    char data[1];
+} TPoolZone;
+
+typedef struct {
+    TPoolZone * firstzone;
+    TPoolZone * currentzone;
+    uint32_t zonesize;
+    struct abyss_mutex * mutexP;
+} TPool;
+
+bool
+PoolCreate(TPool *  const poolP,
+           uint32_t const zonesize);
+
+void
+PoolFree(TPool * const poolP);
+
+void *
+PoolAlloc(TPool *  const poolP,
+          uint32_t const size);
+
+void
+PoolReturn(TPool *  const poolP,
+           void *   const blockP);
+
+const char *
+PoolStrdup(TPool *      const poolP,
+           const char * const origString);
+
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,206 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+
+#include "bool.h"
+#include "int.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/time_int.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "date.h"
+
+/*********************************************************************
+** 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"
+};
+
+
+
+void
+DateToString(time_t        const datetime,
+             const char ** const dateStringP) {
+
+    struct tm brokenTime;
+
+    xmlrpc_gmtime(datetime, &brokenTime);
+
+    if (mktime(&brokenTime) == (time_t)-1)
+        *dateStringP = NULL;
+    else
+        xmlrpc_asprintf(dateStringP, "%s, %02u %s %04u %02u:%02u:%02u UTC",
+                        _DateDay[brokenTime.tm_wday],
+                        brokenTime.tm_mday,
+                        _DateMonth[brokenTime.tm_mon],
+                        1900 + brokenTime.tm_year,
+                        brokenTime.tm_hour,
+                        brokenTime.tm_min,
+                        brokenTime.tm_sec);
+}
+
+
+
+static const char *
+tzOffsetStr(struct tm const tm,
+            time_t    const datetime) {
+
+    const char * retval;
+    time_t timeIfUtc;
+    const char * error;
+    
+    xmlrpc_timegm(&tm, &timeIfUtc, &error);
+
+    if (error) {
+        xmlrpc_strfree(error);
+        xmlrpc_asprintf(&retval, "%s", "+????");
+    } else {
+        int const tzOffset = (int)(datetime - timeIfUtc);
+
+        assert(tzOffset == datetime - timeIfUtc);
+
+        xmlrpc_asprintf(&retval, "%+03d%02d",
+                        tzOffset/3600, abs(tzOffset % 3600)/60);
+    }
+    return retval;
+}
+
+
+
+void
+DateToLogString(time_t        const datetime,
+                const char ** const dateStringP) {
+
+    const char * tzo;
+    struct tm tm;
+
+    xmlrpc_localtime(datetime, &tm);
+
+    tzo = tzOffsetStr(tm, datetime);
+
+    xmlrpc_asprintf(dateStringP, "%02d/%s/%04d:%02d:%02d:%02d %s",
+                    tm.tm_mday, _DateMonth[tm.tm_mon],
+                    1900 + tm.tm_year, tm.tm_hour, tm.tm_min, tm.tm_sec,
+                    tzo);
+
+    xmlrpc_strfree(tzo);
+}
+
+
+
+void
+DateDecode(const char * const dateString,
+           bool *       const validP,
+           time_t *     const datetimeP) {
+/*----------------------------------------------------------------------------
+   Return the datetime represented by 'dateString', which is in the
+   format used in an HTTP header.
+
+   We assume that format is always UTC-based; I don't know if HTTP
+   actually requires that -- maybe it could be some local time.
+-----------------------------------------------------------------------------*/
+    int rc;
+    const char * s;
+    unsigned int monthOff;
+    struct tm tm;
+    bool error;
+
+    s = &dateString[0];
+
+    /* Ignore spaces, day name and spaces */
+    while ((*s==' ') || (*s=='\t'))
+        ++s;
+
+    while ((*s!=' ') && (*s!='\t'))
+        ++s;
+
+    while ((*s==' ') || (*s=='\t'))
+        ++s;
+
+    error = false;  /* initial value */
+
+    /* try to recognize the date format */
+    rc = sscanf(s, "%*s %d %d:%d:%d %d%*s",
+                &tm.tm_mday, &tm.tm_hour,
+                &tm.tm_min, &tm.tm_sec, &tm.tm_year);
+    if (rc == 5)
+        monthOff = 0;
+    else {
+        int rc;
+        rc = sscanf(s, "%d %n%*s %d %d:%d:%d GMT%*s",
+                    &tm.tm_mday, &monthOff, &tm.tm_year,
+                    &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
+        if (rc != 5) {
+            int rc;
+            rc = sscanf(s, "%d-%n%*[A-Za-z]-%d %d:%d:%d GMT%*s",
+                        &tm.tm_mday, &monthOff, &tm.tm_year,
+                        &tm.tm_hour, &tm.tm_min, &tm.tm_sec);
+            if (rc != 5)
+                error = true;
+        }
+    }    
+    if (!error) {
+        const char * monthName = s + monthOff;
+            /* This is actually just the point in 'dateString' where
+               the month name begins -- it's not a nul-terminated string
+            */
+
+        unsigned int i;
+        bool gotMonth;
+
+        for (i = 0, gotMonth = false; i < 12; ++i) {
+            const char * p;
+
+            p =_DateMonth[i];
+
+            if (tolower(*p++) == tolower(monthName[0]))
+                if (*p++ == tolower(monthName[1]))
+                    if (*p == tolower(monthName[2])) {
+                        gotMonth = true;
+                        tm.tm_mon = i;
+                    }
+        }
+
+        if (!gotMonth)
+            error = true;
+        else {
+            if (tm.tm_year > 1900)
+                tm.tm_year -= 1900;
+            else {
+                if (tm.tm_year < 70)
+                    tm.tm_year += 100;
+            }
+            tm.tm_isdst = 0;
+
+            {
+                const char * timeError;
+                xmlrpc_timegm(&tm, datetimeP, &timeError);
+                
+                if (timeError) {
+                    error = TRUE;
+                    xmlrpc_strfree(timeError);
+                }
+            }
+        }
+    }
+    *validP = !error;
+}
+
+
+
+abyss_bool
+DateInit(void) {
+
+    return true;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/date.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,21 @@
+#ifndef DATE_H_INCLUDED
+#define DATE_H_INCLUDED
+
+#include <time.h>
+
+#include "bool.h"
+
+void
+DateToString(time_t        const datetime,
+             const char ** const dateStringP);
+
+void
+DateToLogString(time_t        const datetime,
+                const char ** const dateStringP);
+
+void
+DateDecode(const char * const dateString,
+           bool *       const validP,
+           time_t *     const datetimeP);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.c	Fri May 23 16:56:24 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);
 }

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/file.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,128 @@
+#ifndef FILE_H_INCLUDED
+#define FILE_H_INCLUDED
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <limits.h>
+
+#include "bool.h"
+#include "int.h"
+#include "xmlrpc-c/abyss.h"
+
+#ifndef NAME_MAX
+#define NAME_MAX    1024
+#endif
+
+#ifdef 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
+
+#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  /* WIN32 */
+
+#ifdef WIN32
+
+#if MSVCRT
+typedef struct _stati64 TFileStat;
+typedef struct _finddatai64_t TFileInfo;
+
+#else  /* MSVCRT */
+
+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;
+
+#endif /* MSVCRT */
+
+#else /* WIN32 */
+
+#include <unistd.h>
+#include <dirent.h>
+
+typedef struct stat TFileStat;
+
+typedef struct finddata_t {
+    char name[NAME_MAX+1];
+    int attrib;
+    uint64_t size;
+    time_t time_write;
+} TFileInfo;
+
+#endif
+
+typedef struct TFileFind TFileFind;
+
+typedef struct TFile {
+    int fd;
+} TFile;
+
+bool
+FileOpen(TFile **     const filePP,
+         const char * const name,
+         uint32_t     const attrib);
+
+bool
+FileOpenCreate(TFile **     const filePP,
+               const char * const name,
+               uint32_t     const attrib);
+
+bool
+FileClose(TFile * const fileP);
+
+bool
+FileWrite(const TFile * const fileP,
+          const void *  const buffer,
+          uint32_t      const len);
+
+int32_t
+FileRead(const TFile * const fileP,
+         void *        const buffer,
+         uint32_t      const len);
+
+bool
+FileSeek(const TFile * const fileP,
+         uint64_t      const pos,
+         uint32_t      const attrib);
+
+uint64_t
+FileSize(const TFile * const fileP);
+
+bool
+FileStat(const char * const filename,
+         TFileStat *  const filestat);
+
+bool
+FileFindFirst(TFileFind ** const filefind,
+              const char * const path,
+              TFileInfo *  const fileinfo);
+
+bool
+FileFindNext(TFileFind * const filefind,
+             TFileInfo * const fileinfo);
+
+void
+FileFindClose(TFileFind * const filefind);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,784 @@
+/*=============================================================================
+                              handler.c
+===============================================================================
+   This file contains built-in HTTP request handlers.
+
+   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>
+#ifdef WIN32
+  #include <io.h>
+#else
+  #include <unistd.h>
+#endif
+#include <fcntl.h>
+
+#include "xmlrpc_config.h"
+#include "bool.h"
+#include "int.h"
+#include "girmath.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/time_int.h"
+
+#include "xmlrpc-c/abyss.h"
+#include "trace.h"
+#include "session.h"
+#include "file.h"
+#include "conn.h"
+#include "http.h"
+#include "date.h"
+#include "abyss_info.h"
+
+#include "handler.h"
+
+
+
+struct BIHandler {
+    const char * filesPath;
+    TList defaultFileNames;
+    MIMEType * mimeTypeP;
+        /* NULL means to use the global MIMEType object */
+};
+
+
+
+BIHandler *
+HandlerCreate(void) {
+
+    struct BIHandler * handlerP;
+
+    MALLOCVAR(handlerP);
+
+    if (handlerP) {
+        handlerP->filesPath = strdup(DEFAULT_DOCS);
+        ListInitAutoFree(&handlerP->defaultFileNames);
+        handlerP->mimeTypeP = NULL;
+    }
+    return handlerP;
+}
+
+
+
+void
+HandlerDestroy(BIHandler * const handlerP) {
+
+    ListFree(&handlerP->defaultFileNames);
+
+    xmlrpc_strfree(handlerP->filesPath);
+
+    free(handlerP);
+}
+
+
+
+void
+HandlerSetMimeType(BIHandler * const handlerP,
+                   MIMEType *  const mimeTypeP) {
+
+    handlerP->mimeTypeP = mimeTypeP;
+}
+
+
+
+void
+HandlerSetFilesPath(BIHandler *  const handlerP,
+                    const char * const filesPath) {
+
+    xmlrpc_strfree(handlerP->filesPath);
+    handlerP->filesPath = strdup(filesPath);
+}
+
+
+
+void
+HandlerAddDefaultFN(BIHandler *  const handlerP,
+                    const char * const fileName) {
+
+    ListAdd(&handlerP->defaultFileNames, strdup(fileName));
+}
+
+
+
+typedef int (*TQSortProc)(const void *, const void *);
+
+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 ** const f1PP,
+             const TFileInfo ** const f2PP) {
+
+    const TFileInfo * const f1P = *f1PP;
+    const TFileInfo * const f2P = *f2PP;
+
+    int retval;
+
+    if ((f1P->attrib & A_SUBDIR) && !(f2P->attrib & A_SUBDIR))
+        retval = -1;
+    else if (!(f1P->attrib & A_SUBDIR) && (f2P->attrib & A_SUBDIR))
+        retval = 1;
+    else {
+        assert((int)(f1P->time_write - f2P->time_write) == 
+               (f1P->time_write - f2P->time_write));
+        retval = (int)(f1P->time_write - f2P->time_write);
+    }
+    return retval;
+}
+
+
+
+static void
+determineSortType(const char *  const query,
+                  bool *        const ascendingP,
+                  uint16_t *    const sortP,
+                  bool *        const textP,
+                  const char ** const errorP) {
+
+    *ascendingP = TRUE;
+    *sortP = 1;
+    *textP = FALSE;
+    *errorP = NULL;
+    
+    if (query) {
+        if (xmlrpc_streq(query, "plain"))
+            *textP = TRUE;
+        else if (xmlrpc_streq(query, "name-up")) {
+            *sortP = 1;
+            *ascendingP = TRUE;
+        } else if (xmlrpc_streq(query, "name-down")) {
+            *sortP = 1;
+            *ascendingP = FALSE;
+        } else if (xmlrpc_streq(query, "date-up")) {
+            *sortP = 2;
+            *ascendingP = TRUE;
+        } else if (xmlrpc_streq(query, "date-down")) {
+            *sortP = 2;
+            *ascendingP = FALSE;
+        } else  {
+            xmlrpc_asprintf(errorP, "invalid query value '%s'", query);
+        }
+    }
+}
+
+
+
+static void
+generateListing(TList *       const listP,
+                const char *  const dirName,
+                const char *  const uri,
+                TPool *       const poolP,
+                const char ** const errorP,
+                uint16_t *    const responseStatusP) {
+    
+    TFileInfo fileinfo;
+    TFileFind * findhandleP;
+
+    *errorP = NULL;
+
+    if (!FileFindFirst(&findhandleP, dirName, &fileinfo)) {
+        *responseStatusP = ResponseStatusFromErrno(errno);
+        xmlrpc_asprintf(errorP, "Can't read first entry in directory");
+    } else {
+        ListInit(listP);
+
+        do {
+            TFileInfo * fi;
+            /* Files whose names start with a dot are ignored */
+            /* This includes implicitly the ./ and ../ */
+            if (*fileinfo.name == '.') {
+                if (xmlrpc_streq(fileinfo.name, "..")) {
+                    if (xmlrpc_streq(uri, "/"))
+                        continue;
+                } else
+                    continue;
+            }
+            fi = (TFileInfo *)PoolAlloc(poolP, sizeof(fileinfo));
+            if (fi) {
+                bool success;
+                memcpy(fi, &fileinfo, sizeof(fileinfo));
+                success =  ListAdd(listP, fi);
+                if (!success)
+                    xmlrpc_asprintf(errorP, "ListAdd() failed");
+            } else
+                xmlrpc_asprintf(errorP, "PoolAlloc() failed.");
+        } while (!*errorP && FileFindNext(findhandleP, &fileinfo));
+
+        if (*errorP) {
+            *responseStatusP = 500;
+            ListFree(listP);
+        }            
+        FileFindClose(findhandleP);
+    }
+}
+
+
+
+static void
+sendDirectoryDocument(TList *      const listP,
+                      bool         const ascending,
+                      uint16_t     const sort,
+                      bool         const text,
+                      const char * const uri,
+                      MIMEType *   const mimeTypeP,
+                      TSession *   const sessionP) {
+
+    char z[4096];
+    char *p,z1[26],z2[20],z3[9],u;
+    const char * z4;
+    int16_t i;
+    uint32_t k;
+
+    if (text) {
+        sprintf(z, "Index of %s" CRLF, 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>",
+                uri, uri);
+        strcat(z, "Name                      Size      "
+               "Date-Time             Type<HR WIDTH=100%>"CRLF);
+    }
+
+    HTTPWriteBodyChunk(sessionP, z, strlen(z));
+
+    /* Sort the files */
+    qsort(listP->item, listP->size, sizeof(void *),
+          (TQSortProc)(sort == 1 ? cmpfilenames : cmpfiledates));
+    
+    /* Write the listing */
+    if (ascending)
+        i = 0;
+    else
+        i = listP->size - 1;
+
+    while ((i < listP->size) && (i >= 0)) {
+        TFileInfo * fi;
+        struct tm ftm;
+
+        fi = listP->item[i];
+
+        if (ascending)
+            ++i;
+        else
+            --i;
+            
+        strcpy(z, fi->name);
+
+        k = strlen(z);
+
+        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';
+        }
+
+        xmlrpc_gmtime(fi->time_write, &ftm);
+        sprintf(z2, "%02u/%02u/%04u %02u:%02u:%02u",ftm.tm_mday,ftm.tm_mon+1,
+                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, "%5" PRIu64 " %c", fi->size, u);
+            
+            if (xmlrpc_streq(fi->name, ".."))
+                z4 = "";
+            else
+                z4 = MIMETypeFromFileName2(mimeTypeP, 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);
+
+        HTTPWriteBodyChunk(sessionP, 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);
+    
+    HTTPWriteBodyChunk(sessionP, z, strlen(z));
+}
+
+
+
+static bool
+notRecentlyModified(TSession * const sessionP,
+                    time_t     const fileModTime) {
+
+    bool retval;
+    const char * imsHdr;
+
+    imsHdr = RequestHeaderValue(sessionP, "if-modified-since");
+    if (imsHdr) {
+        bool valid;
+        time_t datetime;
+        DateDecode(imsHdr, &valid, &datetime);
+        if (valid) {
+            if (MIN(fileModTime, sessionP->date) <= datetime)
+                retval = TRUE;
+            else
+                retval = FALSE;
+        } else
+            retval = FALSE;
+    } else
+        retval = FALSE;
+
+    return retval;
+}
+
+
+
+static void
+addLastModifiedHeader(TSession * const sessionP,
+                      time_t     const fileModTime) {
+
+    const char * lastModifiedValue;
+
+    DateToString(MIN(fileModTime, sessionP->date), &lastModifiedValue);
+
+    if (lastModifiedValue) {
+        ResponseAddField(sessionP, "Last-Modified", lastModifiedValue);
+        xmlrpc_strfree(lastModifiedValue);
+    }
+}
+    
+
+
+static void
+handleDirectory(TSession *   const sessionP,
+                const char * const dirName,
+                time_t       const fileModTime,
+                MIMEType *   const mimeTypeP) {
+
+    bool text;
+    bool ascending;
+    uint16_t sort;    /* 1=by name, 2=by date */
+    const char * error;
+    
+    determineSortType(sessionP->requestInfo.query,
+                      &ascending, &sort, &text, &error);
+
+    if (error) {
+        ResponseStatus(sessionP, 400);
+        xmlrpc_strfree(error);
+    } else if (notRecentlyModified(sessionP, fileModTime)) {
+        ResponseStatus(sessionP, 304);
+        ResponseWriteStart(sessionP);
+    } else {
+        TPool pool;
+        bool succeeded;
+        succeeded = PoolCreate(&pool, 1024);
+        if (!succeeded)
+            ResponseStatus(sessionP, 500);
+        else {
+            TList list;
+            uint16_t responseStatus;
+            const char * error;
+            generateListing(&list, dirName, sessionP->requestInfo.uri,
+                            &pool, &error, &responseStatus);
+            if (error) {
+                ResponseStatus(sessionP, responseStatus);
+                xmlrpc_strfree(error);
+            } else {
+                ResponseStatus(sessionP, 200);
+                ResponseContentType(sessionP, 
+                                    text ? "text/plain" : "text/html");
+            
+                addLastModifiedHeader(sessionP, fileModTime);
+            
+                ResponseChunked(sessionP);
+                ResponseWriteStart(sessionP);
+            
+                if (sessionP->requestInfo.method!=m_head)
+                    sendDirectoryDocument(&list, ascending, sort, text,
+                                          sessionP->requestInfo.uri, mimeTypeP,
+                                          sessionP);
+            
+                HTTPWriteEndChunk(sessionP);
+            
+                ListFree(&list);
+            }
+            PoolFree(&pool);
+        }
+    }
+}
+
+
+
+static void
+composeEntityHeader(const char ** const entityHeaderP,
+                    const char *  const mediatype,
+                    uint64_t      const start,
+                    uint64_t      const end,
+                    uint64_t      const filesize) {
+                         
+    xmlrpc_asprintf(entityHeaderP, "Content-type: %s" CRLF
+                    "Content-range: "
+                    "bytes %" PRIu64 "-%" PRIu64 "/%" PRIu64 CRLF
+                    "Content-length: %" PRIu64 CRLF CRLF,
+                    mediatype, start, end, filesize, end-start+1);
+}
+
+
+
+#define BOUNDARY    "##123456789###BOUNDARY"
+
+static void
+sendBody(TSession *      const sessionP,
+         const TFile *   const fileP,
+         uint64_t        const filesize,
+         const char *    const mediatype,
+         uint64_t        const start0,
+         uint64_t        const end0) {
+/*----------------------------------------------------------------------------
+   'start0' and 'end0' are meaningful only if the session has ranges.
+-----------------------------------------------------------------------------*/
+    char buffer[4096];
+
+    if (sessionP->ranges.size == 0)
+        ConnWriteFromFile(sessionP->conn, fileP, 0, filesize - 1,
+                          buffer, sizeof(buffer), 0);
+    else if (sessionP->ranges.size == 1)
+        ConnWriteFromFile(sessionP->conn, fileP, start0, end0,
+                          buffer, sizeof(buffer), 0);
+    else {
+        uint64_t i;
+        for (i = 0; i <= sessionP->ranges.size; ++i) {
+            ConnWrite(sessionP->conn, "--", 2);
+            ConnWrite(sessionP->conn, BOUNDARY, strlen(BOUNDARY));
+            ConnWrite(sessionP->conn, CRLF, 2);
+
+            if (i < sessionP->ranges.size) {
+                uint64_t start;
+                uint64_t end;
+                bool decoded;
+                    
+                decoded = RangeDecode((char *)(sessionP->ranges.item[i]),
+                                      filesize,
+                                      &start, &end);
+                if (decoded) {
+                    /* Entity header, not response header */
+                    const char * entityHeader;
+                    
+                    composeEntityHeader(&entityHeader, mediatype,
+                                        start, end, filesize);
+
+                    ConnWrite(sessionP->conn,
+                              entityHeader, strlen(entityHeader));
+
+                    xmlrpc_strfree(entityHeader);
+                    
+                    ConnWriteFromFile(sessionP->conn, fileP, start, end,
+                                      buffer, sizeof(buffer), 0);
+                }
+            }
+        }
+    }
+}
+
+
+
+static void
+sendFileAsResponse(TSession *   const sessionP,
+                   TFile *      const fileP,
+                   const char * const fileName,
+                   time_t       const fileModTime,
+                   MIMEType *   const mimeTypeP) {
+
+    uint64_t const filesize = FileSize(fileP);
+    const char * const mediatype = MIMETypeGuessFromFile2(mimeTypeP, fileName);
+
+    uint64_t start;  /* Defined only if session has one range */
+    uint64_t end;    /* Defined only if session has one range */
+
+    switch (sessionP->ranges.size) {
+    case 0:
+        ResponseStatus(sessionP, 200);
+        break;
+
+    case 1: {
+        bool decoded;
+        decoded = RangeDecode((char *)(sessionP->ranges.item[0]), filesize,
+                              &start, &end);
+        if (!decoded) {
+            ListFree(&sessionP->ranges);
+            ResponseStatus(sessionP, 200);
+        } else {
+            const char * contentRange;
+            xmlrpc_asprintf(&contentRange,
+                            "bytes %" PRIu64 "-%" PRIu64 "/%" PRIu64,
+                            start, end, filesize);
+            ResponseAddField(sessionP, "Content-range", contentRange);
+            xmlrpc_strfree(contentRange);
+
+            ResponseContentLength(sessionP, end - start + 1);
+            ResponseStatus(sessionP, 206);
+        }
+    } break;
+
+    default:
+        ResponseContentType(sessionP,
+                            "multipart/ranges; boundary=" BOUNDARY);
+        ResponseStatus(sessionP, 206);
+        break;
+    }
+    
+    if (sessionP->ranges.size == 0) {
+        ResponseContentLength(sessionP, filesize);
+        ResponseContentType(sessionP, mediatype);
+    }
+    
+    addLastModifiedHeader(sessionP, fileModTime);
+
+    ResponseWriteStart(sessionP);
+
+    if (sessionP->requestInfo.method != m_head)
+        sendBody(sessionP, fileP, filesize, mediatype, start, end);
+}        
+
+
+
+static void
+handleFile(TSession *   const sessionP,
+           const char * const fileName,
+           time_t       const fileModTime,
+           MIMEType *   const mimeTypeP) {
+/*----------------------------------------------------------------------------
+   This is an HTTP request handler for a GET.  It does the classic
+   web server thing: send the file named in the URL to the client.
+-----------------------------------------------------------------------------*/
+    TFile * fileP;
+    bool success;
+    
+    success = FileOpen(&fileP, fileName, O_BINARY | O_RDONLY);
+    if (!success)
+        ResponseStatusErrno(sessionP);
+    else {
+        if (notRecentlyModified(sessionP, fileModTime)) {
+            ResponseStatus(sessionP, 304);
+            ResponseWriteStart(sessionP);
+        } else
+            sendFileAsResponse(sessionP, fileP,
+                               fileName, fileModTime, mimeTypeP);
+
+        FileClose(fileP);
+    }
+}
+
+
+
+static void
+convertToNativeFileName(char * const fileName ATTR_UNUSED) {
+
+#ifdef WIN32
+    char * p;
+    p = &fileName[0];
+    while (*p) {
+        if ((*p) == '/')
+            *p= '\\';
+
+        ++p;
+    }
+#endif  /* WIN32 */
+}
+
+
+
+abyss_bool
+HandlerDefaultBuiltin(TSession * const sessionP) {
+
+    BIHandler * const handlerP = SessionGetDefaultHandlerCtx(sessionP);
+
+    char * p;
+    char z[4096];
+    TFileStat fs;
+    bool endingslash;
+
+    endingslash = FALSE;  /* initial value */
+
+    if (!RequestValidURIPath(sessionP)) {
+        ResponseStatus(sessionP, 400);
+        return TRUE;
+    }
+
+    /* Must check for * (asterisk uri) in the future */
+    if (sessionP->requestInfo.method == m_options) {
+        ResponseAddField(sessionP, "Allow", "GET, HEAD");
+        ResponseContentLength(sessionP, 0);
+        ResponseStatus(sessionP, 200);
+        return TRUE;
+    }
+
+    if ((sessionP->requestInfo.method != m_get) &&
+        (sessionP->requestInfo.method != m_head)) {
+        ResponseAddField(sessionP, "Allow", "GET, HEAD");
+        ResponseStatus(sessionP, 405);
+        return TRUE;
+    }
+
+    strcpy(z, handlerP->filesPath);
+    strcat(z, sessionP->requestInfo.uri);
+
+    p = z + strlen(z) - 1;
+    if (*p == '/') {
+        endingslash = TRUE;
+        *p = '\0';
+    }
+
+    convertToNativeFileName(z);
+
+    if (!FileStat(z, &fs)) {
+        ResponseStatusErrno(sessionP);
+        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, sessionP->requestInfo.uri);
+            p = z+strlen(z);
+            *p = '/';
+            *(p+1) = '\0';
+            ResponseAddField(sessionP, "Location", z);
+            ResponseStatus(sessionP, 302);
+            ResponseWriteStart(sessionP);
+            return TRUE;
+        }
+
+        *p = DIRECTORY_SEPARATOR[0];
+        ++p;
+        {
+            unsigned int i;
+            i = handlerP->defaultFileNames.size;
+            while (i-- > 0) {
+                *p = '\0';        
+                strcat(z, (handlerP->defaultFileNames.item[i]));
+                if (FileStat(z, &fs)) {
+                    if (!(fs.st_mode & S_IFDIR))
+                        handleFile(sessionP, z, fs.st_mtime,
+                                   handlerP->mimeTypeP);
+                }
+            }
+        }
+
+        *(p-1) = '\0';
+        
+        if (!FileStat(z, &fs)) {
+            ResponseStatusErrno(sessionP);
+            return TRUE;
+        }
+        handleDirectory(sessionP, z, fs.st_mtime, handlerP->mimeTypeP);
+    } else
+        handleFile(sessionP, z, fs.st_mtime, handlerP->mimeTypeP);
+
+    return TRUE;
+}
+
+
+
+/******************************************************************************
+**
+** 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.
+**
+******************************************************************************/

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/handler.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,31 @@
+#ifndef HANDLER_H_INCLUDED
+#define HANDLER_H_INCLUDED
+
+#include "bool.h"
+#include "xmlrpc-c/abyss.h"
+
+typedef struct BIHandler BIHandler;
+
+BIHandler *
+HandlerCreate(void);
+
+void
+HandlerDestroy(BIHandler * const handlerP);
+
+
+void
+HandlerSetMimeType(BIHandler * const handlerP,
+                   MIMEType *  const mimeTypeP);
+
+void
+HandlerSetFilesPath(BIHandler *  const handlerP,
+                    const char * const filesPath);
+
+void
+HandlerAddDefaultFN(BIHandler *  const handlerP,
+                    const char * const fileName);
+
+abyss_bool
+HandlerDefaultBuiltin(TSession * const sessionP);
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.c	Fri May 23 16:56:24 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.
+**
+******************************************************************************/

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/http.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,54 @@
+#ifndef HTTP_H_INCLUDED
+#define HTTP_H_INCLUDED
+
+#include "bool.h"
+#include "conn.h"
+
+/*********************************************************************
+** Request
+*********************************************************************/
+
+bool RequestValidURI(TSession * const r);
+bool RequestValidURIPath(TSession * const r);
+bool RequestUnescapeURI(TSession *r);
+
+void
+RequestRead(TSession * const sessionP,
+            uint32_t   const timeout);
+
+void RequestInit(TSession * const r,TConn * const c);
+void RequestFree(TSession * const r);
+
+bool
+RequestAuth(TSession *   const sessionP,
+            const char * const credential,
+            const char * const user,
+            const char * const pass);
+
+/*********************************************************************
+** HTTP
+*********************************************************************/
+
+const char *
+HTTPReasonByStatus(uint16_t const code);
+
+int32_t
+HTTPRead(TSession *   const sessionP,
+         const char * const buffer,
+         uint32_t     const len);
+
+bool
+HTTPWriteBodyChunk(TSession *   const sessionP,
+                   const char * const buffer,
+                   uint32_t     const len);
+
+bool
+HTTPWriteEndChunk(TSession * const sessionP);
+
+bool
+HTTPKeepalive(TSession * const sessionP);
+
+bool
+HTTPWriteContinue(TSession * const sessionP);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/init.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/init.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,101 @@
+/*=============================================================================
+  The functions handle static stuff -- the functions do not operate on
+  any particular Abyss object, but rather on the global environment of
+  the program that uses the Abyss library.  abyssInit() is essentially
+  and extension of the program loader.
+
+  The intent is for any program that uses the Abyss library to call
+  AbyssInit() just as it starts up, and AbyssTerm() just as it exits.
+  It should do both when the program is only one thread, because they
+  are not thread-safe.
+
+  These functions do the bare minimum they can get away with; we prefer
+  context to be local to invidual objects.
+=============================================================================*/
+
+#include <assert.h>
+
+#include "xmlrpc-c/string_int.h"
+
+#include "chanswitch.h"
+#include "channel.h"
+
+#include "xmlrpc-c/abyss.h"
+
+
+static unsigned int AbyssInitCount = 0;
+
+static void
+initAbyss(const char ** const errorP) {
+
+    const char * error;
+
+    DateInit();
+    MIMETypeInit();
+
+    ChanSwitchInit(&error);
+
+    if (error) {
+        xmlrpc_asprintf(errorP,
+                        "Could not initialize channel swtich class.  %s",
+                        error);
+            
+        xmlrpc_strfree(error);
+    } else {
+        const char * error;
+        ChannelInit(&error);
+
+        if (error) {
+            xmlrpc_asprintf(errorP, "Could not initialize Channel class.  %s",
+                            error);
+                
+            xmlrpc_strfree(error);
+        } else {
+            AbyssInitCount = 1;
+            *errorP = NULL;
+                
+            if (*errorP)
+                ChannelTerm();
+        }
+        if (*errorP)
+            ChanSwitchTerm();
+    }
+}
+
+
+
+void
+AbyssInit(const char ** const errorP) {
+
+    if (AbyssInitCount > 0) {
+        *errorP = NULL;
+        ++AbyssInitCount;
+    } else {
+        initAbyss(errorP);
+        if (!*errorP)
+            AbyssInitCount = 1;
+    }
+}
+
+
+
+static void
+termAbyss(void) {
+
+    ChannelTerm();
+    ChanSwitchTerm();
+    MIMETypeTerm();
+}
+
+
+
+void
+AbyssTerm(void) {
+
+    assert(AbyssInitCount > 0);
+
+    --AbyssInitCount;
+    
+    if (AbyssInitCount == 0)
+        termAbyss();
+}

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/main.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/main.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/main.c	Fri May 23 16:56:24 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);
 

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/response.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/response.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,707 @@
+/*=============================================================================
+                             response
+===============================================================================
+  This module contains callbacks from and services for a request handler.
+
+  Copyright information is at the end of the file
+=============================================================================*/
+
+#include <ctype.h>
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <time.h>
+
+#include "xmlrpc_config.h"
+#include "bool.h"
+#include "version.h"
+#include "mallocvar.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "server.h"
+#include "session.h"
+#include "file.h"
+#include "conn.h"
+#include "token.h"
+#include "date.h"
+#include "data.h"
+#include "abyss_info.h"
+#include "http.h"
+
+
+
+void
+ResponseError2(TSession *   const sessionP,
+               const char * const explanation) {
+
+    const char * errorDocument;
+
+    ResponseAddField(sessionP, "Content-type", "text/html");
+
+    ResponseWriteStart(sessionP);
+    
+    xmlrpc_asprintf(&errorDocument,
+                    "<HTML><HEAD><TITLE>Error %d</TITLE></HEAD>"
+                    "<BODY>"
+                    "<H1>Error %d</H1>"
+                    "<P>%s</P>" SERVER_HTML_INFO 
+                    "</BODY>"
+                    "</HTML>",
+                    sessionP->status, sessionP->status, explanation);
+    
+    ConnWrite(sessionP->conn, errorDocument, strlen(errorDocument)); 
+
+    xmlrpc_strfree(errorDocument);
+}
+
+
+
+void
+ResponseError(TSession * const sessionP) {
+
+    ResponseError2(sessionP, HTTPReasonByStatus(sessionP->status));
+}
+
+
+
+
+abyss_bool
+ResponseChunked(TSession * const sessionP) {
+    /* This is only a hope, things will be real only after a call of
+       ResponseWriteStart()
+    */
+    assert(!sessionP->responseStarted);
+
+    sessionP->chunkedwrite =
+        (sessionP->version.major > 1) ||
+        (sessionP->version.major == 1 && (sessionP->version.minor >= 1));
+
+    sessionP->chunkedwritemode = TRUE;
+
+    return TRUE;
+}
+
+
+
+void
+ResponseStatus(TSession *     const sessionP,
+               unsigned short const code) {
+
+    sessionP->status = code;
+}
+
+
+
+xmlrpc_uint16_t
+ResponseStatusFromErrno(int const errnoArg) {
+
+    uint16_t code;
+
+    switch (errnoArg) {
+    case EACCES:
+        code=403;
+        break;
+    case ENOENT:
+        code=404;
+        break;
+    default:
+        code=500;
+    }
+    return code;
+}
+
+
+
+void
+ResponseStatusErrno(TSession * const sessionP) {
+
+    ResponseStatus(sessionP, ResponseStatusFromErrno(errno));
+}
+
+
+
+abyss_bool
+ResponseAddField(TSession *   const sessionP,
+                 const char * const name,
+                 const char * const value) {
+
+    return TableAdd(&sessionP->response_headers, name, value);
+}
+
+
+
+static void
+addConnectionHeader(TSession * const sessionP) {
+
+    struct _TServer * const srvP = ConnServer(sessionP->conn)->srvP;
+
+    if (HTTPKeepalive(sessionP)) {
+        const char * keepaliveValue;
+        
+        ResponseAddField(sessionP, "Connection", "Keep-Alive");
+
+        xmlrpc_asprintf(&keepaliveValue, "timeout=%u, max=%u",
+                        srvP->keepalivetimeout, srvP->keepalivemaxconn);
+
+        ResponseAddField(sessionP, "Keep-Alive", keepaliveValue);
+
+        xmlrpc_strfree(keepaliveValue);
+    } else
+        ResponseAddField(sessionP, "Connection", "close");
+}
+    
+
+
+static void
+addDateHeader(TSession * const sessionP) {
+
+    if (sessionP->status >= 200) {
+        const char * dateValue;
+
+        DateToString(sessionP->date, &dateValue);
+
+        if (dateValue) {
+            ResponseAddField(sessionP, "Date", dateValue);
+            xmlrpc_strfree(dateValue);
+        }
+    }
+}
+
+
+
+static void
+addServerHeader(TSession * const sessionP) {
+
+    const char * serverValue;
+
+    xmlrpc_asprintf(&serverValue, "XMLRPC_ABYSS/%s", XMLRPC_C_VERSION);
+
+    ResponseAddField(sessionP, "Server", serverValue);
+
+    xmlrpc_strfree(serverValue);
+}
+
+
+
+void
+ResponseWriteStart(TSession * const sessionP) {
+
+    struct _TServer * const srvP = ConnServer(sessionP->conn)->srvP;
+
+    unsigned int i;
+
+    assert(!sessionP->responseStarted);
+
+    if (sessionP->status == 0) {
+        /* Handler hasn't set status.  That's an error */
+        sessionP->status = 500;
+    }
+
+    sessionP->responseStarted = TRUE;
+
+    {
+        const char * const reason = HTTPReasonByStatus(sessionP->status);
+        const char * line;
+        xmlrpc_asprintf(&line,"HTTP/1.1 %u %s\r\n", sessionP->status, reason);
+        ConnWrite(sessionP->conn, line, strlen(line));
+        xmlrpc_strfree(line);
+    }
+
+    addConnectionHeader(sessionP);
+
+    if (sessionP->chunkedwrite && sessionP->chunkedwritemode)
+        ResponseAddField(sessionP, "Transfer-Encoding", "chunked");
+
+    addDateHeader(sessionP);
+
+    if (srvP->advertise)
+        addServerHeader(sessionP);
+
+    /* send all the fields */
+    for (i = 0; i < sessionP->response_headers.size; ++i) {
+        TTableItem * const ti = &sessionP->response_headers.item[i];
+        const char * line;
+        xmlrpc_asprintf(&line, "%s: %s\r\n", ti->name, ti->value);
+        ConnWrite(sessionP->conn, line, strlen(line));
+        xmlrpc_strfree(line);
+    }
+
+    ConnWrite(sessionP->conn, "\r\n", 2);  
+}
+
+
+
+abyss_bool
+ResponseWriteBody(TSession *      const sessionP,
+                  const char *    const data,
+                  xmlrpc_uint32_t const len) {
+
+    return HTTPWriteBodyChunk(sessionP, data, len);
+}
+
+
+
+abyss_bool
+ResponseWriteEnd(TSession * const sessionP) {
+
+    return HTTPWriteEndChunk(sessionP);
+}
+
+
+
+abyss_bool
+ResponseContentType(TSession *   const serverP,
+                    const char * const type) {
+
+    return ResponseAddField(serverP, "Content-type", type);
+}
+
+
+
+abyss_bool
+ResponseContentLength(TSession *      const sessionP,
+                      xmlrpc_uint64_t const len) {
+
+    char contentLengthValue[32];
+    
+    sprintf(contentLengthValue, "%" PRIu64, len);
+
+    return ResponseAddField(sessionP, "Content-length", contentLengthValue);
+}
+
+
+/*********************************************************************
+** MIMEType
+*********************************************************************/
+
+struct MIMEType {
+    TList typeList;
+    TList extList;
+    TPool pool;
+};
+
+
+static MIMEType * globalMimeTypeP = NULL;
+
+
+
+MIMEType *
+MIMETypeCreate(void) {
+ 
+    MIMEType * MIMETypeP;
+
+    MALLOCVAR(MIMETypeP);
+
+    if (MIMETypeP) {
+        ListInit(&MIMETypeP->typeList);
+        ListInit(&MIMETypeP->extList);
+        PoolCreate(&MIMETypeP->pool, 1024);
+    }
+    return MIMETypeP;
+}
+
+
+
+void
+MIMETypeDestroy(MIMEType * const MIMETypeP) {
+
+    PoolFree(&MIMETypeP->pool);
+}
+
+
+
+void
+MIMETypeInit(void) {
+
+    if (globalMimeTypeP != NULL)
+        abort();
+
+    globalMimeTypeP = MIMETypeCreate();
+}
+
+
+
+void
+MIMETypeTerm(void) {
+
+    if (globalMimeTypeP == NULL)
+        abort();
+
+    MIMETypeDestroy(globalMimeTypeP);
+
+    globalMimeTypeP = NULL;
+}
+
+
+
+static void
+mimeTypeAdd(MIMEType *   const MIMETypeP,
+            const char * const type,
+            const char * const ext,
+            bool *       const successP) {
+    
+    uint16_t index;
+    void * mimeTypesItem;
+    bool typeIsInList;
+
+    assert(MIMETypeP != NULL);
+
+    typeIsInList = ListFindString(&MIMETypeP->typeList, type, &index);
+    if (typeIsInList)
+        mimeTypesItem = MIMETypeP->typeList.item[index];
+    else
+        mimeTypesItem = (void*)PoolStrdup(&MIMETypeP->pool, type);
+
+    if (mimeTypesItem) {
+        bool extIsInList;
+        extIsInList = ListFindString(&MIMETypeP->extList, ext, &index);
+        if (extIsInList) {
+            MIMETypeP->typeList.item[index] = mimeTypesItem;
+            *successP = TRUE;
+        } else {
+            void * extItem = (void*)PoolStrdup(&MIMETypeP->pool, ext);
+            if (extItem) {
+                bool addedToMimeTypes;
+
+                addedToMimeTypes =
+                    ListAdd(&MIMETypeP->typeList, mimeTypesItem);
+                if (addedToMimeTypes) {
+                    bool addedToExt;
+                    
+                    addedToExt = ListAdd(&MIMETypeP->extList, extItem);
+                    *successP = addedToExt;
+                    if (!*successP)
+                        ListRemove(&MIMETypeP->typeList);
+                } else
+                    *successP = FALSE;
+                if (!*successP)
+                    PoolReturn(&MIMETypeP->pool, extItem);
+            } else
+                *successP = FALSE;
+        }
+    } else
+        *successP = FALSE;
+}
+
+
+
+
+abyss_bool
+MIMETypeAdd2(MIMEType *   const MIMETypeArg,
+             const char * const type,
+             const char * const ext) {
+
+    MIMEType * MIMETypeP = MIMETypeArg ? MIMETypeArg : globalMimeTypeP;
+
+    bool success;
+
+    if (MIMETypeP == NULL)
+        success = FALSE;
+    else 
+        mimeTypeAdd(MIMETypeP, type, ext, &success);
+
+    return success;
+}
+
+
+
+abyss_bool
+MIMETypeAdd(const char * const type,
+            const char * const ext) {
+
+    return MIMETypeAdd2(globalMimeTypeP, type, ext);
+}
+
+
+
+static const char *
+mimeTypeFromExt(MIMEType *   const MIMETypeP,
+                const char * const ext) {
+
+    const char * retval;
+    uint16_t extindex;
+    bool extIsInList;
+
+    assert(MIMETypeP != NULL);
+
+    extIsInList = ListFindString(&MIMETypeP->extList, ext, &extindex);
+    if (!extIsInList)
+        retval = NULL;
+    else
+        retval = MIMETypeP->typeList.item[extindex];
+    
+    return retval;
+}
+
+
+
+const char *
+MIMETypeFromExt2(MIMEType *   const MIMETypeArg,
+                 const char * const ext) {
+
+    const char * retval;
+
+    MIMEType * MIMETypeP = MIMETypeArg ? MIMETypeArg : globalMimeTypeP;
+
+    if (MIMETypeP == NULL)
+        retval = NULL;
+    else
+        retval = mimeTypeFromExt(MIMETypeP, ext);
+
+    return retval;
+}
+
+
+
+const char *
+MIMETypeFromExt(const char * const ext) {
+
+    return MIMETypeFromExt2(globalMimeTypeP, ext);
+}
+
+
+
+static void
+findExtension(const char *  const fileName,
+              const char ** const extP) {
+
+    unsigned int extPos = 0;  /* stifle unset variable warning */
+        /* Running estimation of where in fileName[] the extension starts */
+    bool extFound;
+    unsigned int i;
+
+    /* We're looking for the last dot after the last slash */
+    for (i = 0, extFound = FALSE; fileName[i]; ++i) {
+        char const c = fileName[i];
+        
+        if (c == '.') {
+            extFound = TRUE;
+            extPos = i + 1;
+        }
+        if (c == '/')
+            extFound = FALSE;
+    }
+
+    if (extFound)
+        *extP = &fileName[extPos];
+    else
+        *extP = NULL;
+}
+
+
+
+static const char *
+mimeTypeFromFileName(MIMEType *   const MIMETypeP,
+                     const char * const fileName) {
+
+    const char * retval;
+    const char * ext;
+
+    assert(MIMETypeP != NULL);
+    
+    findExtension(fileName, &ext);
+
+    if (ext)
+        retval = MIMETypeFromExt2(MIMETypeP, ext);
+    else
+        retval = "application/octet-stream";
+
+    return retval;
+}
+
+
+
+const char *
+MIMETypeFromFileName2(MIMEType *   const MIMETypeArg,
+                      const char * const fileName) {
+
+    const char * retval;
+    
+    MIMEType * MIMETypeP = MIMETypeArg ? MIMETypeArg : globalMimeTypeP;
+
+    if (MIMETypeP == NULL)
+        retval = NULL;
+    else
+        retval = mimeTypeFromFileName(MIMETypeP, fileName);
+
+    return retval;
+}
+
+
+
+const char *
+MIMETypeFromFileName(const char * const fileName) {
+
+    return MIMETypeFromFileName2(globalMimeTypeP, fileName);
+}
+
+
+
+static bool
+fileContainsText(const char * const fileName) {
+/*----------------------------------------------------------------------------
+   Return true iff we can read the contents of the file named 'fileName'
+   and see that it appears to be composed of plain text characters.
+-----------------------------------------------------------------------------*/
+    bool retval;
+    bool fileOpened;
+    TFile * fileP;
+
+    fileOpened = FileOpen(&fileP, fileName, O_BINARY | O_RDONLY);
+    if (fileOpened) {
+        char const ctlZ = 26;
+        unsigned char buffer[80];
+        int32_t readRc;
+        unsigned int i;
+
+        readRc = FileRead(fileP, buffer, sizeof(buffer));
+       
+        if (readRc >= 0) {
+            unsigned int bytesRead = readRc;
+            bool nonTextFound;
+
+            nonTextFound = FALSE;  /* initial value */
+    
+            for (i = 0; i < bytesRead; ++i) {
+                char const c = buffer[i];
+                if (c < ' ' && !isspace(c) && c != ctlZ)
+                    nonTextFound = TRUE;
+            }
+            retval = !nonTextFound;
+        } else
+            retval = FALSE;
+        FileClose(fileP);
+    } else
+        retval = FALSE;
+
+    return retval;
+}
+
+
+ 
+static const char *
+mimeTypeGuessFromFile(MIMEType *   const MIMETypeP,
+                      const char * const fileName) {
+
+    const char * retval;
+    const char * ext;
+
+    findExtension(fileName, &ext);
+
+    retval = NULL;
+
+    if (ext && MIMETypeP)
+        retval = MIMETypeFromExt2(MIMETypeP, ext);
+    
+    if (!retval) {
+        if (fileContainsText(fileName))
+            retval = "text/plain";
+        else
+            retval = "application/octet-stream";  
+    }
+    return retval;
+}
+
+
+
+const char *
+MIMETypeGuessFromFile2(MIMEType *   const MIMETypeArg,
+                       const char * const fileName) {
+
+    return mimeTypeGuessFromFile(MIMETypeArg ? MIMETypeArg : globalMimeTypeP,
+                                 fileName);
+}
+
+
+
+const char *
+MIMETypeGuessFromFile(const char * const fileName) {
+
+    return mimeTypeGuessFromFile(globalMimeTypeP, fileName);
+}
+
+                                  
+
+/*********************************************************************
+** Base64
+*********************************************************************/
+
+void
+Base64Encode(const char * const chars,
+             char *       const base64) {
+
+    /* 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','+','/'
+    };
+
+    uint i;
+    uint32_t length;
+    char * p;
+    const char * s;
+    
+    length = strlen(chars);  /* initial value */
+    s = &chars[0];  /* initial value */
+    p = &base64[0];  /* initial value */
+    /* 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/trunk/libs/xmlrpc-c/lib/abyss/src/server.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.c	Fri May 23 16:56:24 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.
+**
+******************************************************************************/

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/server.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,85 @@
+#ifndef SERVER_H_INCLUDED
+#define SERVER_H_INCLUDED
+
+#include <sys/types.h>
+
+#include "bool.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "data.h"
+
+struct TFile;
+struct abyss_mutex;
+
+struct _TServer {
+    bool terminationRequested;
+        /* User wants this server to terminate as soon as possible,
+           in particular before accepting any more connections and without
+           waiting for any.
+        */
+    bool chanSwitchBound;
+        /* The channel switch exists and is bound to a local address
+           (may already be listening as well)
+        */
+    TChanSwitch * chanSwitchP;
+        /* Meaningful only when 'chanSwitchBound' is true: the channel
+           switch which directs connections from clients to this server.
+        */
+    bool weCreatedChanSwitch;
+        /* We created the channel switch 'chanSwitchP', as
+           opposed to 1) User supplied it; or 2) there isn't one.
+        */
+    const char * logfilename;
+    bool logfileisopen;
+    struct TFile * logfileP;
+    struct abyss_mutex * logmutexP;
+    const char * name;
+    bool serverAcceptsConnections;
+        /* We listen for and accept TCP connections for HTTP transactions.
+           (The alternative is the user supplies a TCP-connected socket
+           for each transaction)
+        */
+    uint16_t port;
+        /* Meaningful only when 'chanSwitchBound' is false: TCP port
+           number to which we should bind the switch.
+        */
+    uint32_t keepalivetimeout;
+    uint32_t keepalivemaxconn;
+    uint32_t timeout;
+        /* Maximum time in seconds the server will wait to read a header
+           or a data chunk from the channel.
+        */
+    TList handlers;
+        /* Ordered list of HTTP request handlers.  For each HTTP request,
+           Server calls each one in order until one reports that it handled
+           it.
+
+           Each item in the list of of type 'URIHandler2'.
+        */
+    URIHandler defaultHandler;
+        /* The handler for HTTP requests that aren't claimed by any handler
+           in the list 'handlers'.  This can't be null; if user doesn't
+           supply anything better, it is a built-in basic web server
+           handler.  */
+    void * defaultHandlerContext;
+        /* This is opaque data to be given to the default handler when it
+           requests it.
+        */
+    void * builtinHandlerP;
+    bool advertise;
+    bool useSigchld;
+        /* Meaningless if not using forking for threads.
+           TRUE means user will call ServerHandleSigchld to indicate that
+           a SIGCHLD signal was received, and server shall use that as its
+           indication that a child has died.  FALSE means server will not
+           be aware of SIGCHLD and will instead poll for existence of PIDs
+           to determine if a child has died.
+        */
+#ifndef WIN32
+    uid_t uid;
+    gid_t gid;
+    struct TFile * pidfileP;
+#endif
+};
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,158 @@
+#include <assert.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "bool.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/abyss.h"
+#include "server.h"
+#include "http.h"
+#include "conn.h"
+
+#include "session.h"
+
+
+
+abyss_bool
+SessionRefillBuffer(TSession * const sessionP) {
+/*----------------------------------------------------------------------------
+   Get the next chunk of HTTP request body from the connection into
+   the buffer.
+
+   I.e. read data from the socket.
+-----------------------------------------------------------------------------*/
+    struct _TServer * const srvP = sessionP->conn->server->srvP;
+    bool failed;
+
+    failed = FALSE;  /* initial value */
+            
+    /* Reset our read buffer & flush data from previous reads. */
+    ConnReadInit(sessionP->conn);
+
+    if (sessionP->continueRequired)
+        failed = !HTTPWriteContinue(sessionP);
+
+    if (!failed) {
+        sessionP->continueRequired = FALSE;
+
+        /* 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.
+        */
+        failed = !ConnRead(sessionP->conn, srvP->timeout);	
+    }
+    return !failed;
+}
+
+
+
+size_t
+SessionReadDataAvail(TSession * const sessionP) {
+
+    return sessionP->conn->buffersize - sessionP->conn->bufferpos;
+
+}
+
+
+
+void
+SessionGetReadData(TSession *    const sessionP, 
+                   size_t        const max, 
+                   const char ** const outStartP, 
+                   size_t *      const outLenP) {
+/*----------------------------------------------------------------------------
+   Extract some HTTP request body which the server has read and
+   buffered for the session.  Don't get or wait for any data that has
+   not yet arrived.  Do not return more than 'max'.
+
+   We return a pointer to the first byte as *outStartP, and the length in
+   bytes as *outLenP.  The memory pointed to belongs to the session.
+-----------------------------------------------------------------------------*/
+    uint32_t const bufferPos = sessionP->conn->bufferpos;
+
+    *outStartP = &sessionP->conn->buffer[bufferPos];
+
+    assert(bufferPos <= sessionP->conn->buffersize);
+
+    *outLenP = MIN(max, sessionP->conn->buffersize - bufferPos);
+
+    /* move pointer past the bytes we are returning */
+    sessionP->conn->bufferpos += *outLenP;
+
+    assert(sessionP->conn->bufferpos <= sessionP->conn->buffersize);
+}
+
+
+
+void
+SessionGetRequestInfo(TSession *            const sessionP,
+                      const TRequestInfo ** const requestInfoPP) {
+    
+    *requestInfoPP = &sessionP->requestInfo;
+}
+
+
+
+void
+SessionGetChannelInfo(TSession * const sessionP,
+                      void **    const channelInfoPP) {
+    
+    *channelInfoPP = sessionP->conn->channelInfoP;
+}
+
+
+
+abyss_bool
+SessionLog(TSession * const sessionP) {
+
+    const char * logline;
+    const char * user;
+    const char * date;
+    const char * peerInfo;
+
+    if (sessionP->validRequest) {
+        if (sessionP->requestInfo.user)
+            user = sessionP->requestInfo.user;
+        else
+            user = "no_user";
+    } else
+        user = "???";
+    
+    DateToLogString(sessionP->date, &date);
+    
+    ConnFormatClientAddr(sessionP->conn, &peerInfo);
+    
+    xmlrpc_asprintf(&logline, "%s - %s - [%s] \"%s\" %d %d",
+                    peerInfo,
+                    user,
+                    date, 
+                    sessionP->validRequest ?
+                        sessionP->requestInfo.requestline : "???",
+                    sessionP->status,
+                    sessionP->conn->outbytes
+        );
+    xmlrpc_strfree(peerInfo);
+    xmlrpc_strfree(date);
+    
+    if (logline) {
+        LogWrite(sessionP->conn->server, logline);
+        
+        xmlrpc_strfree(logline);
+    }
+    return true;
+}
+
+
+
+void *
+SessionGetDefaultHandlerCtx(TSession * const sessionP) {
+
+    struct _TServer * const srvP = sessionP->conn->server->srvP;
+
+    return srvP->defaultHandlerContext;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/session.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,74 @@
+#ifndef SESSION_H_INCLUDED
+#define SESSION_H_INCLUDED
+
+#include "xmlrpc-c/abyss.h"
+#include "bool.h"
+#include "date.h"
+#include "data.h"
+
+typedef struct {
+    uint8_t major;
+    uint8_t minor;
+} httpVersion;
+
+struct _TSession {
+    bool validRequest;
+        /* Client has sent, and server has recognized, a valid HTTP request.
+           This is false when the session is new.  If and when the server
+           reads the request from the client and finds it to be valid HTTP,
+           it becomes true.
+        */
+    TRequestInfo requestInfo;
+        /* Some of the strings this references are in individually malloc'ed
+           memory, but some are pointers into arbitrary other data structures
+           that happen to live as long as the session.  Some day, we will
+           fix that.
+
+           'requestInfo' is valid only if 'validRequest' is true.
+        */
+    uint32_t nbfileds;
+    TList cookies;
+    TList ranges;
+
+    uint16_t status;
+        /* Response status from handler.  Zero means session is not ready
+           for a response yet.  This can mean that we ran a handler and it
+           did not call ResponseStatus() to declare this fact.
+        */
+    TString header;
+
+    bool serverDeniesKeepalive;
+        /* Server doesn't want keepalive for this session, regardless of
+           what happens in the session.  E.g. because the connection has
+           already been kept alive long enough.
+        */
+    bool responseStarted;
+        /* Handler has at least started the response (i.e. called
+           ResponseWriteStart())
+        */
+
+    struct _TConn * conn;
+
+    httpVersion version;
+
+    TTable request_headers;
+        /* All the headers in the HTTP request.  The key is the header
+           name in lower case.  The value is the verbatim value from
+           the header.
+        */
+
+    TTable response_headers;
+
+    time_t date;
+
+    bool chunkedwrite;
+    bool chunkedwritemode;
+
+    bool continueRequired;
+        /* This client must receive 100 (continue) status before it will
+           send more of the body of the request.
+        */
+};
+
+
+#endif

Modified: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.c
==============================================================================
--- freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.c	(original)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.c	Fri May 23 16:56:24 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;
 }

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,58 @@
+#ifndef SOCKET_H_INCLUDED
+#define SOCKET_H_INCLUDED
+
+/*============================================================================
+   This is for backward compatibility.  Abyss used to have a socket
+   concept modelled after POSIX sockets, in which a single class (TSocket)
+   contained two very different kinds of objects:  some analogous to
+   a TChanSwitch and analogout to a TChannel.
+
+   Now that we have TChanSwitch and TChannel, users should use those,
+   but there may be old programs that use TSocket, and we want them to
+   continue working.
+
+   Actually, this may not be necessary.  There was only one release
+   (1.06) that had the TSocket interface, and that release didn't
+   provide any incentive to upgrade an older program to use TSocket,
+   so there may be few or no users of TSocket.
+============================================================================*/
+
+#include "xmlrpc-c/abyss.h"
+
+struct _TSocket {
+    uint               signature;
+        /* With both background and foreground use of sockets, and
+           background being both fork and pthread, it is very easy to
+           screw up socket lifetime and try to destroy twice.  We use
+           this signature to help catch such bugs.
+        */
+
+    /* Exactly one of 'chanSwitchP' and 'channelP' is non-null.
+       That's how you know which of the two varieties of socket this is.
+    */
+    TChanSwitch *  chanSwitchP;
+    TChannel * channelP;
+
+    void * channelInfoP;  /* Defined only for a channel socket */
+};
+
+void
+SocketCreateChannel(TChannel * const channelP,
+                    void *     const channelInfoP,
+                    TSocket ** const socketPP);
+
+void
+SocketCreateChanSwitch(TChanSwitch * const chanSwitchP,
+                       TSocket **    const socketPP);
+
+TChanSwitch *
+SocketGetChanSwitch(TSocket * const socketP);
+
+TChannel *
+SocketGetChannel(TSocket * const socketP);
+
+void *
+SocketGetChannelInfo(TSocket * const socketP);
+
+#endif
+

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_openssl.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_openssl.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,640 @@
+/*=============================================================================
+                                 socket_openssl.c
+===============================================================================
+  This is the implementation of TChanSwitch and TChannel
+  for an SSL (Secure Sockets Layer) connection based on an OpenSSL
+  connection object -- what you create with SSL_new().
+
+  This is just a template for future development.  It does not function
+  (or even compile) today.
+
+=============================================================================*/
+
+#include "xmlrpc_config.h"
+
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.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 <openssl/ssl.h>
+#include <openssl/err.h>
+#include <openssl/rand.h>
+
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "bool.h"
+#include "mallocvar.h"
+#include "trace.h"
+#include "chanswitch.h"
+#include "channel.h"
+#include "socket.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "socket_openssl.h"
+
+
+
+struct channelOpenSsl {
+/*----------------------------------------------------------------------------
+   The properties/state of a TChannel unique to the OpenSSL variety.
+-----------------------------------------------------------------------------*/
+    SSL * sslP;
+        /* SSL connection handle (such as is created by SSL_new() in
+           the openssl library).
+        */
+    bool userSuppliedConn;
+        /* The SSL connection belongs to the user; we did not create
+           it.
+        */
+};
+
+
+
+static bool
+connected(int const fd) {
+/*----------------------------------------------------------------------------
+   Return TRUE iff the socket on file descriptor 'fd' is in the connected
+   state.
+
+   If 'fd' does not identify a stream socket or we are unable to determine
+   the state of the stream socket, the answer is "false".
+-----------------------------------------------------------------------------*/
+    bool connected;
+    struct sockaddr sockaddr;
+    socklen_t nameLen;
+    int rc;
+
+    nameLen = sizeof(sockaddr);
+
+    rc = getpeername(fd, &sockaddr, &nameLen);
+
+    if (rc == 0)
+        connected = TRUE;
+    else
+        connected = FALSE;
+
+    return connected;
+}
+
+
+
+void
+SocketOpensslInit(const char ** const errorP) {
+
+	SSL_load_error_strings();
+        /* readable error messages, don't call this if memory is tight */
+	SSL_library_init();   /* initialize library */
+
+	/* actions_to_seed_PRNG(); */
+
+	*errorP = NULL;
+}
+
+
+
+void
+SocketOpenSslTerm(void) {
+
+	ERR_free_string();
+
+}
+
+
+
+/*=============================================================================
+      TChannel
+=============================================================================*/
+
+static ChannelDestroyImpl channelDestroy;
+
+static void
+channelDestroy(TChannel * const channelP) {
+
+    struct channelOpenssl * const channelOpensslP = channelP->implP;
+
+    if (!socketUnixP->userSuppliedConn)
+        SSL_shutdown(channelOpensslP->sslP);
+
+    free(channelOpensslP);
+}
+
+
+
+static ChannelWriteImpl channelWrite;
+
+static void
+channelWrite(TChannel *            const channelP,
+             const unsigned char * const buffer,
+             uint32_t              const len,
+             bool *                const failedP) {
+
+    struct channelOpenssl * const channelOpensslP = channelP->implP;
+
+    int bytesLeft;
+    bool error;
+
+    assert(sizeof(int) >= sizeof(len));
+
+    for (bytesLeft = len, error = FALSE;
+         bytesLeft > 0 && !error;
+        ) {
+        int const maxSend = (int)(-1) >> 1;
+
+        int rc;
+        
+        rc = SSL_write(channelOpensslP->ssl, &buffer[len-bytesLeft],
+                       MIN(maxSend, bytesLeft));
+
+        if (ChannelTraceIsActive) {
+            if (rc <= 0)
+                fprintf(stderr,
+                        "Abyss socket: SSL_write() failed.  rc=%d (%s)",
+                        rc, SSL_get_error(rc));
+            else
+                fprintf(stderr, "Abyss socket: sent %u bytes: '%.*s'\n",
+                        rc, rc, &buffer[len-bytesLeft]);
+        }
+        if (rc <= 0)
+            /* 0 means connection closed; < 0 means severe error */
+            error = TRUE;
+        else
+            bytesLeft -= rc;
+    }
+    *failedP = error;
+}
+
+
+
+ChannelReadImpl channelRead;
+
+static void
+channelRead(TChannel *      const channelP, 
+            unsigned char * const buffer, 
+            uint32_t        const bufferSize,
+            uint32_t *      const bytesReceivedP,
+            bool *          const failedP) {
+
+    struct channelOpenssl * const channelOpensslP = channelP->implP;
+
+    int rc;
+    rc = SSL_read(channelOpensslP->sslP, buf, len);
+
+    if (rc < 0) {
+        *failedP = TRUE;
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Failed to receive data from OpenSSL connection.  "
+                    "SSL_read() failed with rc %d (%s)\n",
+                    rc, SSL_get_error(rc));
+    } else {
+        *failedP = FALSE;
+        *bytesReceivedP = rc;
+
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Abyss channel: read %u bytes: '%.*s'\n",
+                    *bytesReceivedP, (int)(*bytesReceivedP), buffer);
+    }
+}
+
+
+
+static ChannelWaitImpl channelWait;
+
+static void
+channelWait(TChannel * const channelP,
+            bool       const waitForRead,
+            bool       const waitForWrite,
+            uint32_t   const timeoutMs,
+            bool *     const readyToReadP,
+            bool *     const readyToWriteP,
+            bool *     const failedP) {
+/*----------------------------------------------------------------------------
+  See socket_unix.c for an explanation of the purpose of this
+  subroutine.
+
+  We don't actually fulfill that purpose, though, because we don't know
+  how yet.  Instead, we return immediately and hope that if Caller
+  subsequently does a read or write, it blocks until it can do its thing.
+-----------------------------------------------------------------------------*/
+
+}
+
+
+
+static ChannelInterruptImpl channelInterrupt;
+
+static void
+channelInterrupt(TChannel * const channelP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in channelWait()
+  now or in the future.
+-----------------------------------------------------------------------------*/
+
+    /* This is trivial, since channelWait() doesn't actually wait */
+}
+
+
+
+static struct TChannelVtbl const channelVtbl = {
+    &channelDestroy,
+    &channelWrite,
+    &channelRead,
+    &channelWait,
+    &channelInterrupt,
+    &channelFormatPeerInfo,
+};
+
+
+
+static void
+makeChannelInfo(struct abyss_openssl_chaninfo ** const channelInfoPP,
+                SSL *                            const sslP,
+                const char **                    const errorP) {
+
+    struct abyss_openssl_chaninfo * channelInfoP;
+
+    MALLOCVAR(channelInfoP);
+    
+    if (channelInfoP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory");
+    else {
+        
+        *channelInfoPP = channelInfoP;
+
+        *errorP = NULL;
+    }
+}
+
+
+
+static void
+makeChannelFromSsl(SSL *         const sslP,
+                   TChannel **   const channelPP,
+                   const char ** const errorP) {
+
+    struct channelOpenssl * channelOpensslP;
+
+    MALLOCVAR(channelOpensslP);
+    
+    if (channelOpensslP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory for OpenSSL "
+                        "socket descriptor");
+    else {
+        TChannel * channelP;
+        
+        channelOpensslP->sslP = sslP;
+        channelOpensslP->userSuppliedSsl = TRUE;
+        
+        /* This should be ok as far as I can tell */
+        ChannelCreate(&channelVtbl, channelOpensslP, &channelP);
+        
+        if (channelP == NULL)
+            xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                            "channel descriptor.");
+        else {
+            *channelPP = channelP;
+            *errorP = NULL;
+        }
+        if (*errorP)
+            free(channelOpensslP);
+    }
+}
+
+
+
+void
+ChannelOpensslCreateSsl(SSL *                            const sslP,
+                        TChannel **                      const channelPP,
+                        struct abyss_openssl_chaninfo ** const channelInfoPP,
+                        const char **                    const errorP) {
+
+    assert(sslP);
+
+    makeChannelInfo(channelInfoPP, sslP, errorP);
+    if (!*errorP) {
+        makeChannelFromSsl(ssl, channelPP, errorP);
+        
+        if (*errorP) {
+            free(*channelInfoPP);
+        }
+    }
+}
+
+
+
+/*=============================================================================
+      TChanSwitch
+=============================================================================*/
+
+struct opensslSwitch {
+/*----------------------------------------------------------------------------
+   The properties/state of a TChanSwitch uniqe to the OpenSSL variety.
+
+   Note that OpenSSL deals only in connected sockets, so this switch
+   doesn't really have anything to do with OpenSSL except that it
+   creates OpenSSL TChannels.  The switch is just a POSIX listening
+   socket, and is almost identical to the Abyss Unix channel switch.
+-----------------------------------------------------------------------------*/
+    int fd;
+        /* File descriptor of the POSIX socket (such as is created by
+           socket() in the C library) for the socket.
+        */
+    bool userSuppliedFd;
+        /* The file descriptor and associated POSIX socket belong to the
+           user; we did not create it.
+        */
+};
+
+
+
+static SwitchDestroyImpl chanSwitchDestroy;
+
+static void
+chanSwitchDestroy(TChanSwitch * const chanSwitchP) {
+
+static void
+chanSwitchDestroy(TChanSwitch * const chanSwitchP) {
+
+    struct opensslSwitch * const opensslSwitchP = chanSwitchP->implP;
+
+    if (!opensslSwitchP->userSuppliedFd)
+        close(opensslSwitchP->fd);
+
+    free(opensslSwitchP);
+}
+
+
+
+static SwitchListenImpl chanSwitchListen;
+
+static void
+chanSwitchListen(TChanSwitch * const chanSwitchP,
+                 uint32_t      const backlog,
+                 const char ** const errorP) {
+
+    struct opensslSwitch * const opensslSwitchP = chanSwitchP->implP;
+
+    int32_t const minus1 = -1;
+
+    int rc;
+
+    /* Disable the Nagle algorithm to make persistant connections faster */
+
+    setsockopt(opensslSwitchP->fd, IPPROTO_TCP, TCP_NODELAY,
+               &minus1, sizeof(minus1));
+
+    rc = listen(opensslSwitchP->fd, backlog);
+
+    if (rc == -1)
+        xmlrpc_asprintf(errorP, "listen() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+static SwitchAcceptImpl  chanSwitchAccept;
+
+static void
+chanSwitchAccept(TChanSwitch * const chanSwitchP,
+                 TChannel **   const channelPP,
+                 void **       const channelInfoPP,
+                 const char ** const errorP) {
+/*----------------------------------------------------------------------------
+   Accept a connection via the channel switch *chanSwitchP.  Return as
+   *channelPP the channel for the accepted connection.
+
+   If no connection is waiting at *chanSwitchP, wait until one is.
+
+   If we receive a signal while waiting, return immediately with
+   *channelPP == NULL.
+-----------------------------------------------------------------------------*/
+    struct opensslSwitch * const listenSocketP = chanSwitchP->implP;
+
+    bool interrupted;
+    TChannel * channelP;
+
+    interrupted = FALSE; /* Haven't been interrupted yet */
+    channelP    = NULL;  /* No connection yet */
+    *errorP     = NULL;  /* No error yet */
+
+    while (!channelP && !*errorP && !interrupted) {
+        struct sockaddr peerAddr;
+        socklen_t size = sizeof(peerAddr);
+        int rc;
+
+        rc = accept(listenSocketP->fd, &peerAddr, &size);
+
+        if (rc >= 0) {
+            int const acceptedFd = rc;
+            struct channelOpenssl * opensslChannelP;
+
+            MALLOCVAR(opensslChannelP);
+
+            if (!opensslChannelP)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory");
+            else {
+                struct abyss_openssl_chaninfo * channelInfoP;
+                
+                openChannelP->userSuppliedFd = FALSE;
+                TODO("turn connected socket 'acceptedFd' into an OpenSSL "
+                     "connection opensslChannelP->sslP");
+
+                makeChannelInfo(&channelInfoP, peerAddr, size, errorP);
+                if (!*errorP) {
+                    *channelInfoPP = channelInfoP;
+
+                    ChannelCreate(&channelVtbl, opensslChannelP, &channelP);
+                    if (!channelP)
+                        xmlrpc_asprintf(errorP,
+                                        "Failed to create TChannel object.");
+                    else
+                        *errorP = NULL;
+
+                    if (*errorP)
+                        free(channelInfoP);
+                }
+                if (*errorP)
+                    free(opensslChannelP);
+            }
+            if (*errorP)
+                close(acceptedFd);
+        } else if (errno == EINTR)
+            interrupted = TRUE;
+        else
+            xmlrpc_asprintf(errorP, "accept() failed, errno = %d (%s)",
+                            errno, strerror(errno));
+    }
+    *channelPP = channelP;
+}
+
+
+
+static SwitchInterruptImpl chanSwitchInterrupt;
+
+static void
+chanSwitchInterrupt(TChanSwitch * const chanSwitchP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in chanSwitchAccept()
+  now or in the future.
+
+  Actually, this is a no-op, since we don't yet know how to accomplish
+  that.
+-----------------------------------------------------------------------------*/
+
+}
+
+
+
+static struct TChanSwitchVtbl const chanSwitchVtbl = {
+    &chanSwitchDestroy,
+    &chanSwitchListen,
+    &chanSwitchAccept,
+};
+
+
+
+static void
+setSocketOptions(int           const fd,
+                 const char ** const errorP) {
+
+    int32_t n = 1;
+    int rc;
+
+    rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&n, sizeof(n));
+
+    if (rc < 0)
+        xmlrpc_asprintf(errorP, "Failed to set socket options.  "
+                        "setsockopt() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+static void
+bindSocketToPort(int              const fd,
+                 struct in_addr * const addrP,
+                 uint16_t         const portNumber,
+                 const char **    const errorP) {
+
+    struct sockaddr_in name;
+    int rc;
+
+    name.sin_family = AF_INET;
+    name.sin_port   = htons(portNumber);
+    if (addrP)
+        name.sin_addr = *addrP;
+    else
+        name.sin_addr.s_addr = INADDR_ANY;
+
+    rc = bind(fd, (struct sockaddr *)&name, sizeof(name));
+
+    if (rc == -1)
+        xmlrpc_asprintf(errorP, "Unable to bind socket to port number %hu.  "
+                        "bind() failed with errno %d (%s)",
+                        portNumber, errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+void
+ChanSwitchOpensslCreate(unsigned short const portNumber,
+                        TChanSwitch ** const chanSwitchPP,
+                        const char **  const errorP) {
+/*----------------------------------------------------------------------------
+   Create an OpenSSL-based channel switch.
+
+   Use an IP socket.
+
+   Set the socket's local address so that a subsequent "listen" will listen
+   on all IP addresses, port number 'portNumber'.
+-----------------------------------------------------------------------------*/
+    struct opensslSwitch * opensslSwitchP;
+
+    MALLOCVAR(opensslSwitchP);
+
+    if (!opensslSwitchP)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory for Openssl "
+                        "channel switch descriptor structure.");
+    else {
+        int rc;
+        rc = socket(AF_INET, SOCK_STREAM, 0);
+        if (rc < 0)
+            xmlrpc_asprintf(errorP, "socket() failed with errno %d (%s)",
+                            errno, strerror(errno));
+        else {
+            opensslSwitchP->fd = rc;
+            opensslSwitchP->userSuppliedFd = FALSE;
+
+            setSocketOptions(opensslSwitchP->fd, errorP);
+            if (!*errorP) {
+                bindSocketToPort(opensslSwitchP->fd, NULL, portNumber, errorP);
+                
+                if (!*errorP)
+                    ChanSwitchCreate(&chanSwitchVtbl, opensslSwitchP,
+                                     chanSwitchPP);
+            }
+            if (*errorP)
+                close(opensslSwitchP->fd);
+        }
+        if (*errorP)
+            free(opensslSwitchP);
+    }
+}
+
+
+
+void
+ChanSwitchOpensslCreateFd(int            const fd,
+                          TChanSwitch ** const chanSwitchPP,
+                          const char **  const errorP) {
+/*----------------------------------------------------------------------------
+   Create an OpenSSL-based channel switch, based on a POSIX socket that
+   is in listen state.
+-----------------------------------------------------------------------------*/
+    struct opensslSwitch * opensslSwitchP;
+
+    if (connected(fd))
+        xmlrpc_asprintf(errorP,
+                        "Socket (file descriptor %d) is in connected "
+                        "state.", fd);
+    else {
+        MALLOCVAR(opensslSwitchP);
+
+        if (opensslSwitchP == NULL)
+            xmlrpc_asprintf(errorP, "unable to allocate memory for Openssl "
+                            "channel switch descriptor.");
+        else {
+            TChanSwitch * chanSwitchP;
+
+            opensslSwitchP->fd = fd;
+            opensslSwitchP->userSuppliedFd = TRUE;
+            
+            ChanSwitchCreate(&chanSwitchVtbl, opensslSwitchP, &chanSwitchP);
+
+            if (chanSwitchP == NULL)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                                "channel switch descriptor");
+            else {
+                *chanSwitchPP = chanSwitchP;
+                *errorP = NULL;
+            }
+            if (*errorP)
+                free(opensslSwitchP);
+        }
+    }
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,951 @@
+/*=============================================================================
+                                 socket_unix.c
+===============================================================================
+  This is the implementation of TChanSwitch and TChannel (and
+  obsolete TSocket) for a standard Unix (POSIX)
+  stream socket -- what you create with a socket() C library call.
+=============================================================================*/
+
+#include "xmlrpc_config.h"
+
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <poll.h>
+#include <string.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>
+
+#if HAVE_SYS_FILIO_H
+  #include <sys/filio.h>
+#endif
+
+#include "c_util.h"
+#include "int.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "mallocvar.h"
+#include "trace.h"
+#include "chanswitch.h"
+#include "channel.h"
+#include "socket.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "socket_unix.h"
+
+
+
+typedef struct {
+    int interruptorFd;
+    int interrupteeFd;
+} interruptPipe;
+
+
+
+static void
+initInterruptPipe(interruptPipe * const pipeP,
+                  const char **   const errorP) {
+
+    int pipeFd[2];
+    int rc;
+
+    rc = pipe(pipeFd);
+
+    if (rc != 0)
+        xmlrpc_asprintf(errorP, "Unable to create a pipe to use to interrupt "
+                        "waits.  pipe() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else {
+        *errorP = NULL;
+        pipeP->interruptorFd = pipeFd[1];
+        pipeP->interrupteeFd = pipeFd[0];
+    }
+}
+
+
+
+static void
+termInterruptPipe(interruptPipe const pipe) {
+
+    close(pipe.interruptorFd);
+    close(pipe.interrupteeFd);
+}
+
+
+
+struct socketUnix {
+/*----------------------------------------------------------------------------
+   The properties/state of a TChanSwitch or TChannel unique to the
+   Unix variety.
+-----------------------------------------------------------------------------*/
+    int fd;
+        /* File descriptor of the POSIX socket (such as is created by
+           socket() in the C library) for the socket.
+        */
+    bool userSuppliedFd;
+        /* The file descriptor and associated POSIX socket belong to the
+           user; we did not create it.
+        */
+    interruptPipe interruptPipe;
+};
+
+
+
+static bool
+connected(int const fd) {
+/*----------------------------------------------------------------------------
+   Return TRUE iff the socket on file descriptor 'fd' is in the connected
+   state.
+
+   If 'fd' does not identify a stream socket or we are unable to determine
+   the state of the stream socket, the answer is "false".
+-----------------------------------------------------------------------------*/
+    bool connected;
+    struct sockaddr sockaddr;
+    socklen_t nameLen;
+    int rc;
+
+    nameLen = sizeof(sockaddr);
+
+    rc = getpeername(fd, &sockaddr, &nameLen);
+
+    if (rc == 0)
+        connected = TRUE;
+    else
+        connected = FALSE;
+
+    return connected;
+}
+
+
+
+void
+SocketUnixInit(const char ** const errorP) {
+
+    *errorP = NULL;
+}
+
+
+
+void
+SocketUnixTerm(void) {
+
+}
+
+
+
+/*=============================================================================
+      TChannel
+=============================================================================*/
+
+static void
+channelDestroy(TChannel * const channelP) {
+
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    termInterruptPipe(socketUnixP->interruptPipe);
+
+    if (!socketUnixP->userSuppliedFd)
+        close(socketUnixP->fd);
+
+    free(socketUnixP);
+}
+
+
+
+static ChannelWriteImpl channelWrite;
+
+static void
+channelWrite(TChannel *            const channelP,
+             const unsigned char * const buffer,
+             uint32_t              const len,
+             bool *                const failedP) {
+
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    size_t bytesLeft;
+    bool error;
+
+    assert(sizeof(size_t) >= sizeof(len));
+
+    for (bytesLeft = len, error = FALSE;
+         bytesLeft > 0 && !error;
+        ) {
+        size_t const maxSend = (size_t)(-1) >> 1;
+
+        ssize_t rc;
+        
+        rc = send(socketUnixP->fd, &buffer[len-bytesLeft],
+                  MIN(maxSend, bytesLeft), 0);
+
+        if (ChannelTraceIsActive) {
+            if (rc < 0)
+                fprintf(stderr, "Abyss channel: send() failed.  errno=%d (%s)",
+                        errno, strerror(errno));
+            else if (rc == 0)
+                fprintf(stderr, "Abyss channel: send() failed.  "
+                        "Socket closed.\n");
+            else
+                fprintf(stderr, "Abyss channel: sent %u bytes: '%.*s'\n",
+                        rc, rc, &buffer[len-bytesLeft]);
+        }
+        if (rc <= 0)
+            /* 0 means connection closed; < 0 means severe error */
+            error = TRUE;
+        else
+            bytesLeft -= rc;
+    }
+    *failedP = error;
+}
+
+
+
+static ChannelReadImpl channelRead;
+
+static void
+channelRead(TChannel *      const channelP, 
+            unsigned char * const buffer, 
+            uint32_t        const bufferSize,
+            uint32_t *      const bytesReceivedP,
+            bool *          const failedP) {
+
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    int rc;
+    rc = recv(socketUnixP->fd, buffer, bufferSize, 0);
+
+    if (rc < 0) {
+        *failedP = TRUE;
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Abyss channel: "
+                    "Failed to receive data from socket.  "
+                    "recv() failed with errno %d (%s)\n",
+                    errno, strerror(errno));
+    } else {
+        *failedP = FALSE;
+        *bytesReceivedP = rc;
+
+        if (ChannelTraceIsActive)
+            fprintf(stderr, "Abyss channel: read %u bytes: '%.*s'\n",
+                    *bytesReceivedP, (int)(*bytesReceivedP), buffer);
+    }
+}
+
+
+
+static ChannelWaitImpl channelWait;
+
+static void
+channelWait(TChannel * const channelP,
+            bool       const waitForRead,
+            bool       const waitForWrite,
+            uint32_t   const timeoutMs,
+            bool *     const readyToReadP,
+            bool *     const readyToWriteP,
+            bool *     const failedP) {
+/*----------------------------------------------------------------------------
+   Wait for the channel to be immediately readable or writable.
+
+   Readable means there is at least one byte of data to read or the
+   partner has disconnected.  Writable means the channel will take at
+   least one byte of data to send or the partner has disconnected.
+
+   'waitForRead' and 'waitForWrite' determine which of these
+   conditions for which to wait; if both are true, we wait for either
+   one.
+
+   We return before the requested condition holds if 'timeoutMs'
+   milliseconds pass.  timoutMs == TIME_INFINITE means infinity.
+
+   We return before the requested condition holds if the process receives
+   (and catches) a signal, but only if it receives that signal a certain
+   time after we start running.  (That means this function isn't useful
+   for most purposes).
+
+   Return *readyToReadP == true if the reason for returning is that
+   the channel is immediately readable.  *readyToWriteP is analogous
+   for writable.  Both may be true.
+
+   Return *failedP true iff we fail to wait for the requested
+   condition because of some unusual problem.  Being interrupted by a
+   signal is not a failure.
+
+   If one of these return value pointers is NULL, don't return that
+   value.
+-----------------------------------------------------------------------------*/
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    /* Design note: some old systems may not have poll().  We're assuming
+       that we don't have to run on any such system.  select() is more
+       universal, but can't handle a file descriptor with a high number.
+
+       pselect() and ppoll() would allow us to be properly
+       interruptible by a signal -- we would add a signal mask to our
+       arguments.  But ppoll() is fairly rare.  pselect() is more
+       common, but in older Linux systems it doesn't actually work.
+    */
+    bool readyToRead, readyToWrite, failed;
+    struct pollfd pollfds[2];
+    int rc;
+
+    pollfds[0].fd = socketUnixP->fd;
+    pollfds[0].events =
+        (waitForRead  ? POLLIN  : 0) |
+        (waitForWrite ? POLLOUT : 0);
+
+    pollfds[1].fd = socketUnixP->interruptPipe.interrupteeFd;
+    pollfds[1].events = POLLIN;
+    
+    rc = poll(pollfds, ARRAY_SIZE(pollfds),
+              timeoutMs == TIME_INFINITE ? -1 : timeoutMs);
+
+    if (rc < 0) {
+        if (errno == EINTR) {
+            failed       = FALSE;
+            readyToRead  = FALSE;
+            readyToWrite = FALSE;
+        } else {
+            failed       = TRUE;
+            readyToRead  = FALSE; /* quiet compiler warning */
+            readyToWrite = FALSE; /* quiet compiler warning */
+        }
+    } else {
+        failed       = FALSE;
+        readyToRead  = !!(pollfds[0].revents & POLLIN);
+        readyToWrite = !!(pollfds[0].revents & POLLOUT);
+    }
+
+    if (failedP)
+        *failedP       = failed;
+    if (readyToReadP)
+        *readyToReadP  = readyToRead;
+    if (readyToWriteP)
+        *readyToWriteP = readyToWrite;
+}
+
+
+
+static ChannelInterruptImpl channelInterrupt;
+
+static void
+channelInterrupt(TChannel * const channelP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in channelWait()
+  now or in the future.
+
+  TODO: Make a way to reset this so that future channelWait()s can once
+  again wait.
+-----------------------------------------------------------------------------*/
+    struct socketUnix * const socketUnixP = channelP->implP;
+    unsigned char const zero[1] = {0u};
+
+    write(socketUnixP->interruptPipe.interruptorFd, &zero, sizeof(zero));
+}
+
+
+
+void
+ChannelUnixGetPeerName(TChannel *         const channelP,
+                       struct sockaddr ** const sockaddrPP,
+                       size_t  *          const sockaddrLenP,
+                       const char **      const errorP) {
+
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    unsigned char * peerName;
+    socklen_t nameSize;
+
+    nameSize = sizeof(struct sockaddr) + 1;
+    
+    peerName = malloc(nameSize);
+
+    if (peerName == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate space for peer name");
+    else {
+        int rc;
+        socklen_t nameLen;
+        nameLen = nameSize;  /* initial value */
+        rc = getpeername(socketUnixP->fd, (struct sockaddr *)peerName,
+                         &nameLen);
+
+        if (rc < 0)
+            xmlrpc_asprintf(errorP, "getpeername() failed.  errno=%d (%s)",
+                            errno, strerror(errno));
+        else {
+            if (nameLen > nameSize-1)
+                xmlrpc_asprintf(errorP,
+                                "getpeername() says the socket name is "
+                                "larger than %u bytes, which means it is "
+                                "not in the expected format.",
+                                nameSize-1);
+            else {
+                *sockaddrPP = (struct sockaddr *)peerName;
+                *sockaddrLenP = nameLen;
+                *errorP = NULL;
+            }
+        }
+        if (*errorP)
+            free(peerName);
+    }
+}
+
+
+
+static ChannelFormatPeerInfoImpl channelFormatPeerInfo;
+
+static void
+channelFormatPeerInfo(TChannel *    const channelP,
+                      const char ** const peerStringP) {
+
+    struct socketUnix * const socketUnixP = channelP->implP;
+
+    struct sockaddr sockaddr;
+    socklen_t sockaddrLen;
+    int rc;
+
+    sockaddrLen = sizeof(sockaddr);
+    
+    rc = getpeername(socketUnixP->fd, &sockaddr, &sockaddrLen);
+    
+    if (rc < 0)
+        xmlrpc_asprintf(peerStringP, "?? getpeername() failed.  errno=%d (%s)",
+                        errno, strerror(errno));
+    else {
+        switch (sockaddr.sa_family) {
+        case AF_INET: {
+            struct sockaddr_in * const sockaddrInP =
+                (struct sockaddr_in *) &sockaddr;
+            if (sockaddrLen < sizeof(*sockaddrInP))
+                xmlrpc_asprintf(peerStringP, "??? getpeername() returned "
+                                "the wrong size");
+            else {
+                unsigned char * const ipaddr = (unsigned char *)
+                    &sockaddrInP->sin_addr.s_addr;
+                xmlrpc_asprintf(peerStringP, "%u.%u.%u.%u:%hu",
+                                ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3],
+                                sockaddrInP->sin_port);
+            }
+        } break;
+        default:
+            xmlrpc_asprintf(peerStringP, "??? AF=%u", sockaddr.sa_family);
+        }
+    }
+}
+
+
+
+static struct TChannelVtbl const channelVtbl = {
+    &channelDestroy,
+    &channelWrite,
+    &channelRead,
+    &channelWait,
+    &channelInterrupt,
+    &channelFormatPeerInfo,
+};
+
+
+
+static void
+makeChannelInfo(struct abyss_unix_chaninfo ** const channelInfoPP,
+                struct sockaddr               const peerAddr,
+                socklen_t                     const peerAddrLen,
+                const char **                 const errorP) {
+
+    struct abyss_unix_chaninfo * channelInfoP;
+
+    MALLOCVAR(channelInfoP);
+    
+    if (channelInfoP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory");
+    else {
+        channelInfoP->peerAddrLen = peerAddrLen;
+        channelInfoP->peerAddr    = peerAddr;
+        
+        *channelInfoPP = channelInfoP;
+
+        *errorP = NULL;
+    }
+}
+
+
+
+static void
+makeChannelFromFd(int           const fd,
+                  TChannel **   const channelPP,
+                  const char ** const errorP) {
+
+    struct socketUnix * socketUnixP;
+
+    MALLOCVAR(socketUnixP);
+    
+    if (socketUnixP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory for Unix "
+                        "channel descriptor");
+    else {
+        TChannel * channelP;
+        
+        socketUnixP->fd = fd;
+        socketUnixP->userSuppliedFd = TRUE;
+
+        initInterruptPipe(&socketUnixP->interruptPipe, errorP);
+
+        if (!*errorP) {
+            ChannelCreate(&channelVtbl, socketUnixP, &channelP);
+        
+            if (channelP == NULL)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                                "channel descriptor.");
+            else {
+                *channelPP = channelP;
+                *errorP = NULL;
+            }
+            if (*errorP)
+                termInterruptPipe(socketUnixP->interruptPipe);
+        }
+        if (*errorP)
+            free(socketUnixP);
+    }
+}
+
+
+
+void
+ChannelUnixCreateFd(int                           const fd,
+                    TChannel **                   const channelPP,
+                    struct abyss_unix_chaninfo ** const channelInfoPP,
+                    const char **                 const errorP) {
+
+    struct sockaddr peerAddr;
+    socklen_t peerAddrLen;
+    int rc;
+
+    peerAddrLen = sizeof(peerAddrLen);
+
+    rc = getpeername(fd, &peerAddr, &peerAddrLen);
+
+    if (rc != 0) {
+        if (errno == ENOTCONN)
+            xmlrpc_asprintf(errorP, "Socket on file descriptor %d is not in "
+                            "connected state.", fd);
+        else
+            xmlrpc_asprintf(errorP, "getpeername() failed on fd %d.  "
+                            "errno=%d (%s)", fd, errno, strerror(errno));
+    } else {
+        makeChannelInfo(channelInfoPP, peerAddr, peerAddrLen, errorP);
+        if (!*errorP) {
+            makeChannelFromFd(fd, channelPP, errorP);
+
+            if (*errorP)
+                free(*channelInfoPP);
+        }
+    }
+}
+
+
+
+/*=============================================================================
+      TChanSwitch
+=============================================================================*/
+
+static SwitchDestroyImpl chanSwitchDestroy;
+
+static void
+chanSwitchDestroy(TChanSwitch * const chanSwitchP) {
+
+    struct socketUnix * const socketUnixP = chanSwitchP->implP;
+
+    termInterruptPipe(socketUnixP->interruptPipe);
+
+    if (!socketUnixP->userSuppliedFd)
+        close(socketUnixP->fd);
+
+    free(socketUnixP);
+}
+
+
+
+static SwitchListenImpl  chanSwitchListen;
+
+static void
+chanSwitchListen(TChanSwitch * const chanSwitchP,
+                 uint32_t      const backlog,
+                 const char ** const errorP) {
+
+    struct socketUnix * const socketUnixP = chanSwitchP->implP;
+
+    int32_t const minus1 = -1;
+
+    int rc;
+
+    /* Disable the Nagle algorithm to make persistant connections faster */
+
+    setsockopt(socketUnixP->fd, IPPROTO_TCP, TCP_NODELAY,
+               &minus1, sizeof(minus1));
+
+    rc = listen(socketUnixP->fd, backlog);
+
+    if (rc == -1)
+        xmlrpc_asprintf(errorP, "listen() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+static void
+waitForConnection(struct socketUnix * const listenSocketP,
+                  bool *              const interruptedP,
+                  const char **       const errorP) {
+/*----------------------------------------------------------------------------
+   Wait for the listening socket to have a connection ready to accept.
+
+   We return before the requested condition holds if the process receives
+   (and catches) a signal, but only if it receives that signal a certain
+   time after we start running.  (That means this function isn't useful
+   for most purposes).
+
+   Return *interruptedP == true if we return before there is a connection
+   ready to accept.
+-----------------------------------------------------------------------------*/
+    struct pollfd pollfds[2];
+    int rc;
+
+    pollfds[0].fd = listenSocketP->fd;
+    pollfds[0].events = POLLIN;
+
+    pollfds[1].fd = listenSocketP->interruptPipe.interrupteeFd;
+    pollfds[1].events = POLLIN;
+    
+    rc = poll(pollfds, ARRAY_SIZE(pollfds), -1);
+
+    if (rc < 0) {
+        if (errno == EINTR) {
+            *errorP       = NULL;
+            *interruptedP = TRUE;
+        } else {
+            xmlrpc_asprintf(errorP, "poll() failed, errno = %d (%s)",
+                            errno, strerror(errno));
+            *interruptedP = FALSE; /* quiet compiler warning */
+        }
+    } else {
+        *errorP       = NULL;
+        *interruptedP = !(pollfds[0].revents & POLLIN);
+    }
+}
+
+
+
+static void
+createChannelForAccept(int             const acceptedFd,
+                       struct sockaddr const peerAddr,
+                       TChannel **     const channelPP,
+                       void **         const channelInfoPP,
+                       const char **   const errorP) {
+/*----------------------------------------------------------------------------
+   Make a channel object (TChannel) out of a socket just created by
+   accept() on a listening socket -- i.e. a socket for a client connection.
+
+   'acceptedFd' is the file descriptor of the socket.
+
+   'peerAddr' is the address of the client, from accept().
+-----------------------------------------------------------------------------*/
+    struct socketUnix * acceptedSocketP;
+
+    MALLOCVAR(acceptedSocketP);
+
+    if (!acceptedSocketP)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory");
+    else {
+        struct abyss_unix_chaninfo * channelInfoP;
+        acceptedSocketP->fd = acceptedFd;
+        acceptedSocketP->userSuppliedFd = FALSE;
+                
+        makeChannelInfo(&channelInfoP, peerAddr, sizeof(peerAddr), errorP);
+        if (!*errorP) {
+            TChannel * channelP;
+
+            ChannelCreate(&channelVtbl, acceptedSocketP, &channelP);
+            if (!channelP)
+                xmlrpc_asprintf(errorP,
+                                "Failed to create TChannel object.");
+            else {
+                *errorP        = NULL;
+                *channelPP     = channelP;
+                *channelInfoPP = channelInfoP;
+            }
+            if (*errorP)
+                free(channelInfoP);
+        }
+        if (*errorP)
+            free(acceptedSocketP);
+    }
+}
+
+
+
+static SwitchAcceptImpl chanSwitchAccept;
+
+static void
+chanSwitchAccept(TChanSwitch * const chanSwitchP,
+                 TChannel **   const channelPP,
+                 void **       const channelInfoPP,
+                 const char ** const errorP) {
+/*----------------------------------------------------------------------------
+   Accept a connection via the channel switch *chanSwitchP.  Return as
+   *channelPP the channel for the accepted connection.
+
+   If no connection is waiting at *chanSwitchP, wait until one is.
+
+   If we receive a signal while waiting, return immediately with
+   *channelPP == NULL.
+-----------------------------------------------------------------------------*/
+    struct socketUnix * const listenSocketP = chanSwitchP->implP;
+
+    bool interrupted;
+    TChannel * channelP;
+
+    interrupted = FALSE; /* Haven't been interrupted yet */
+    channelP    = NULL;  /* No connection yet */
+    *errorP     = NULL;  /* No error yet */
+
+    while (!channelP && !*errorP && !interrupted) {
+
+        waitForConnection(listenSocketP, &interrupted, errorP);
+
+        if (!*errorP && !interrupted) {
+            struct sockaddr peerAddr;
+            socklen_t size = sizeof(peerAddr);
+            int rc;
+
+            rc = accept(listenSocketP->fd, &peerAddr, &size);
+
+            if (rc >= 0) {
+                int const acceptedFd = rc;
+
+                createChannelForAccept(acceptedFd, peerAddr,
+                                       &channelP, channelInfoPP, errorP);
+
+                if (*errorP)
+                    close(acceptedFd);
+            } else if (errno == EINTR)
+                interrupted = TRUE;
+            else
+                xmlrpc_asprintf(errorP, "accept() failed, errno = %d (%s)",
+                                errno, strerror(errno));
+        }
+    }
+    *channelPP = channelP;
+}
+
+
+
+static SwitchInterruptImpl chanSwitchInterrupt;
+
+static void
+chanSwitchInterrupt(TChanSwitch * const chanSwitchP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in chanSwitchAccept()
+  now or in the future.
+
+  TODO: Make a way to reset this so that future chanSwitchAccept()s can once
+  again wait.
+-----------------------------------------------------------------------------*/
+    struct socketUnix * const listenSocketP = chanSwitchP->implP;
+
+    unsigned char const zero[1] = {0u};
+
+    write(listenSocketP->interruptPipe.interruptorFd, &zero, sizeof(zero));
+}
+
+
+
+static struct TChanSwitchVtbl const chanSwitchVtbl = {
+    &chanSwitchDestroy,
+    &chanSwitchListen,
+    &chanSwitchAccept,
+    &chanSwitchInterrupt,
+};
+
+
+
+static void
+createChanSwitch(int            const fd,
+                 bool           const userSuppliedFd,
+                 TChanSwitch ** const chanSwitchPP,
+                 const char **  const errorP) {
+
+    struct socketUnix * socketUnixP;
+
+    assert(!connected(fd));
+
+    MALLOCVAR(socketUnixP);
+
+    if (socketUnixP == NULL)
+        xmlrpc_asprintf(errorP, "unable to allocate memory for Unix "
+                        "channel switch descriptor.");
+    else {
+        TChanSwitch * chanSwitchP;
+
+        socketUnixP->fd = fd;
+        socketUnixP->userSuppliedFd = userSuppliedFd;
+            
+        initInterruptPipe(&socketUnixP->interruptPipe, errorP);
+
+        if (!*errorP) {
+            ChanSwitchCreate(&chanSwitchVtbl, socketUnixP, &chanSwitchP);
+            if (*errorP)
+                termInterruptPipe(socketUnixP->interruptPipe);
+
+            if (chanSwitchP == NULL)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                                "channel switch descriptor");
+            else {
+                *chanSwitchPP = chanSwitchP;
+                *errorP = NULL;
+            }
+        }
+        if (*errorP)
+            free(socketUnixP);
+    }
+}
+
+
+
+static void
+setSocketOptions(int           const fd,
+                 const char ** const errorP) {
+
+    int32_t n = 1;
+    int rc;
+
+    rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&n, sizeof(n));
+
+    if (rc < 0)
+        xmlrpc_asprintf(errorP, "Failed to set socket options.  "
+                        "setsockopt() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+static void
+bindSocketToPort(int              const fd,
+                 struct in_addr * const addrP,
+                 uint16_t         const portNumber,
+                 const char **    const errorP) {
+
+    struct sockaddr_in name;
+    int rc;
+
+    name.sin_family = AF_INET;
+    name.sin_port   = htons(portNumber);
+    if (addrP)
+        name.sin_addr = *addrP;
+    else
+        name.sin_addr.s_addr = INADDR_ANY;
+
+    rc = bind(fd, (struct sockaddr *)&name, sizeof(name));
+
+    if (rc == -1)
+        xmlrpc_asprintf(errorP, "Unable to bind socket to port number %hu.  "
+                        "bind() failed with errno %d (%s)",
+                        portNumber, errno, strerror(errno));
+    else
+        *errorP = NULL;
+}
+
+
+
+void
+ChanSwitchUnixCreate(unsigned short const portNumber,
+                     TChanSwitch ** const chanSwitchPP,
+                     const char **  const errorP) {
+/*----------------------------------------------------------------------------
+   Create a POSIX-socket-based channel switch.
+
+   Use an IP socket.
+
+   Set the socket's local address so that a subsequent "listen" will listen
+   on all IP addresses, port number 'portNumber'.
+-----------------------------------------------------------------------------*/
+    int rc;
+    rc = socket(AF_INET, SOCK_STREAM, 0);
+    if (rc < 0)
+        xmlrpc_asprintf(errorP, "socket() failed with errno %d (%s)",
+                        errno, strerror(errno));
+    else {
+        int const socketFd = rc;
+
+        setSocketOptions(socketFd, errorP);
+        if (!*errorP) {
+            bindSocketToPort(socketFd, NULL, portNumber, errorP);
+                
+            if (!*errorP) {
+                bool const userSupplied = false;
+                createChanSwitch(socketFd, userSupplied, chanSwitchPP, errorP);
+            }
+        }
+        if (*errorP)
+            close(socketFd);
+    }
+}
+
+
+
+void
+ChanSwitchUnixCreateFd(int            const fd,
+                       TChanSwitch ** const chanSwitchPP,
+                       const char **  const errorP) {
+
+    if (connected(fd))
+        xmlrpc_asprintf(errorP,
+                        "Socket (file descriptor %d) is in connected "
+                        "state.", fd);
+    else {
+        bool const userSupplied = true;
+        createChanSwitch(fd, userSupplied, chanSwitchPP, errorP);
+    }
+}
+
+
+
+/*=============================================================================
+      obsolete TSocket interface
+=============================================================================*/
+
+
+void
+SocketUnixCreateFd(int        const fd,
+                   TSocket ** const socketPP) {
+
+    TSocket * socketP;
+    const char * error;
+
+    if (connected(fd)) {
+        TChannel * channelP;
+        struct abyss_unix_chaninfo * channelInfoP;
+        ChannelUnixCreateFd(fd, &channelP, &channelInfoP, &error);
+        if (!error)
+            SocketCreateChannel(channelP, channelInfoP, &socketP);
+    } else {
+        TChanSwitch * chanSwitchP;
+        ChanSwitchUnixCreateFd(fd, &chanSwitchP, &error);
+        if (!error)
+            SocketCreateChanSwitch(chanSwitchP, &socketP);
+    }
+    if (error) {
+        *socketPP = NULL;
+        xmlrpc_strfree(error);
+    } else
+        *socketPP = socketP;
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_unix.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,14 @@
+#ifndef SOCKET_UNIX_H_INCLUDED
+#define SOCKET_UNIX_H_INCLUDED
+
+#include <sys/socket.h>
+
+#include <xmlrpc-c/abyss.h>
+
+void
+SocketUnixInit(const char ** const errorP);
+
+void
+SocketUnixTerm(void);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,940 @@
+/*=============================================================================
+                                 socket_win.c
+===============================================================================
+  This is the implementation of TChanSwitch and TChannel
+  for a Winsock socket.
+=============================================================================*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <assert.h>
+#include <winsock.h>
+#include <errno.h>
+
+#include "xmlrpc_config.h"
+#include "xmlrpc-c/util_int.h"
+#include "xmlrpc-c/string_int.h"
+#include "mallocvar.h"
+#include "trace.h"
+#include "chanswitch.h"
+#include "channel.h"
+#include "socket.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "socket_win.h"
+
+#ifndef socklen_t
+typedef int socklen_t;
+#endif
+
+/* =============================================================
+   Provided nice error strings, NOT available in system errors.
+   ============================================================= */
+
+typedef struct tagSOCKERRS {
+   int err;       // WSAGetLastError() value
+   char * desc;   // description of error
+} SOCKERR;
+
+/* could/should perhaps be by the actual call,
+   but for now, just one big list, with some repeats
+*/
+
+SOCKERR sSockErr[] = {
+   { WSANOTINITIALISED,
+     "WSANOTINITIALISED - "
+     "WSAStartup must be called before using this function." },
+   { WSAENETDOWN,
+     "WSAENETDOWN - "
+     "The network subsystem has failed." },
+   { WSAEACCES,
+     "WSAEACCES - "
+     "Attempt to connect datagram socket to broadcast address failed "
+     "because setsockopt option SO_BROADCAST is not enabled." },
+   { WSAEADDRINUSE,
+     "WSAEADDRINUSE - "
+     "A process on the computer is already bound to the same fully-qualified "
+     "address and the socket has not been marked to allow address reuse with "
+     "SO_REUSEADDR. For example, the IP address and port are bound in the "
+     "af_inet case). (See the SO_REUSEADDR socket option under setsockopt.)" },
+   { WSAEADDRNOTAVAIL,
+     "WSAEADDRNOTAVAIL - "
+     "The specified address is not a valid address for this computer." },
+   { WSAEFAULT,
+     "WSAEFAULT - "
+     "The name or namelen parameter is not a valid part of the user "
+     "address space, the namelen parameter is too small, the name parameter "
+     "contains an incorrect address format for the associated "
+     "address family, or the first two bytes of the memory block "
+     "specified by name does not match the address family associated with "
+     "the socket descriptor s." },
+   { WSAEINPROGRESS,
+     "WSAEINPROGRESS - "
+     "A blocking Windows Sockets 1.1 call is in progress, or the "
+     "service provider is still processing a callback function." },
+   { WSAEINVAL,
+     "WSAEINVAL - "
+     "The socket is already bound to an address." },
+   { WSAENOBUFS,
+     "WSAENOBUFS - "
+     "Not enough buffers available, too many connections." },
+   { WSAENOTSOCK,
+     "WSAENOTSOCK - "
+     "The descriptor is not a socket." },
+
+   // setsocketopt
+   { WSAENETRESET,
+     "WSAENETRESET - "
+     "Connection has timed out when SO_KEEPALIVE is set." },
+   { WSAENOPROTOOPT,
+     "WSAENOPROTOOPT - "
+     "The option is unknown or the specified provider "
+     "or socket is not capable of implementing it "
+     "(see SO_GROUP_PRIORITY limitations)." },
+   { WSAENOTCONN,
+     "WSAENOTCONN - "
+     "Connection has been reset when SO_KEEPALIVE is set." },
+
+   // WSAStartup
+   { WSASYSNOTREADY,
+     "WSASYSNOTREADY - "
+     "The underlying network subsystem is not ready for "
+     "network communication." },
+   { WSAVERNOTSUPPORTED,
+     "WSAVERNOTSUPPORTED - "
+     "The version of Windows Sockets function requested is not provided "
+     "by this particular Windows Sockets implementation." },
+   { WSAEINPROGRESS,
+     "WSAEINPROGRESS - "
+     "A blocking Windows Sockets 1.1 operation is in progress." },
+   { WSAEPROCLIM,
+     "WSAEPROCLIM - "
+     "Limit on the number of tasks allowed by the Windows Sockets "
+     "implementation has been reached." },
+   { WSAEFAULT,
+     "WSAEFAULT - "
+     "The lpWSAData is not a valid pointer." },
+   // listen
+   { WSANOTINITIALISED,
+     "WSANOTINITIALISED - "
+     "A successful WSAStartup call must occur before using this function." },
+   { WSAENETDOWN,
+     "WSAENETDOWN - "
+     "The network subsystem has failed." },
+   { WSAEADDRINUSE,
+     "WSAEADDRINUSE - "
+     "The socket's local address is already in use and the socket "
+     "was not marked to allow address reuse with SO_REUSEADDR.  "
+     "This error usually occurs during execution of the bind function, "
+     "but could be delayed until this function if the bind was to "
+     "a partially wildcard address (involving ADDR_ANY) "
+     "and if a specific address needs to be committed at the time "
+     "of this function call." },
+   { WSAEINPROGRESS,
+     "WSAEINPROGRESS - "
+     "A blocking Windows Sockets 1.1 call is in progress, "
+     "or the service provider is still processing a callback function." },
+   { WSAEINVAL,
+     "WSAEINVAL - "
+     "The socket has not been bound with bind." },
+   { WSAEISCONN,
+     "WSAEISCONN - "
+     "The socket is already connected." },
+   { WSAEMFILE,
+     "WSAEMFILE - "
+     "No more socket descriptors are available." },
+   { WSAENOBUFS,
+     "WSAENOBUFS - "
+     "No buffer space is available." },
+   { WSAENOTSOCK,
+     "WSAENOTSOCK - "
+     "The descriptor is not a socket." },
+   { WSAEOPNOTSUPP,
+     "WSAEOPNOTSUPP - "
+     "The referenced socket is not of a type that has a listen operation." },
+
+   // getpeername
+   { WSANOTINITIALISED,
+     "WSANOTINITIALISED - "
+     "A successful WSAStartup call must occur before using this function." },
+   { WSAENETDOWN,
+     "WSAENETDOWN - "
+     "The network subsystem has failed." },
+   { WSAEFAULT,
+     "WSAEFAULT - "
+     "The name or the namelen parameter is not a valid part of the "
+     "user address space, or the namelen parameter is too small." },
+   { WSAEINPROGRESS,
+     "WSAEINPROGRESS - "
+     "A blocking Windows Sockets 1.1 call is in progress, "
+     "or the service provider is still processing a callback function." },
+   { WSAENOTCONN,
+     "WSAENOTCONN - "
+     "The socket is not connected." },
+   { WSAENOTSOCK,
+     "WSAENOTSOCK - "
+     "The descriptor is not a socket." },
+
+   // accept
+   { WSANOTINITIALISED,
+     "WSANOTINITIALISED - "
+     "A successful WSAStartup call must occur before using this function." },
+   { WSAENETDOWN,
+     "WSAENETDOWN - "
+     "The network subsystem has failed." },
+   { WSAEFAULT,
+     "WSAEFAULT - "
+     "The addrlen parameter is too small or addr is not a valid part "
+     "of the user address space." },
+   { WSAEINTR,
+     "WSAEINTR - "
+     "A blocking Windows Sockets 1.1 call was canceled through "
+     "WSACancelBlockingCall." },
+   { WSAEINPROGRESS,
+     "WSAEINPROGRESS - "
+     "A blocking Windows Sockets 1.1 call is in progress, "
+     "or the service provider is still processing a callback function." },
+   { WSAEINVAL,
+     "WSAEINVAL - "
+     "The listen function was not invoked prior to accept." },
+   { WSAEMFILE,
+     "WSAEMFILE - "
+     "The queue is nonempty upon entry to accept and "
+     "there are no descriptors available." },
+   { WSAENOBUFS,
+     "WSAENOBUFS - "
+     "No buffer space is available." },
+   { WSAENOTSOCK,
+     "WSAENOTSOCK - "
+     "The descriptor is not a socket." },
+   { WSAEOPNOTSUPP,
+     "WSAEOPNOTSUPP - "
+     "The referenced socket is not a type that offers connection-oriented "
+     "service." },
+   { WSAEWOULDBLOCK,
+     "WSAEWOULDBLOCK - "
+     "The socket is marked as nonblocking and no connections are present "
+     "to be accepted." },
+
+   /* must be last entry */
+   { 0,            0 }
+};
+
+
+
+static const char *
+getWSAError(int const wsaErrno) {
+
+    SOCKERR * pseP;
+  
+    pseP = &sSockErr[0];  // initial value
+   
+    while (pseP->desc) {
+        if (pseP->err == wsaErrno)
+            return pseP->desc;
+        
+        ++pseP;
+    }
+
+    return "(no description available)";
+}
+
+
+
+struct socketWin {
+/*----------------------------------------------------------------------------
+   The properties/state of a TSocket unique to a Unix TSocket.
+-----------------------------------------------------------------------------*/
+    SOCKET winsock;
+    bool userSuppliedWinsock;
+        /* 'socket' was supplied by the user; it belongs to him */
+};
+
+static
+bool
+connected(SOCKET const fd) {
+/*----------------------------------------------------------------------------
+   Return TRUE iff the socket on file descriptor 'fd' is in the connected
+   state.
+   If 'fd' does not identify a stream socket or we are unable to determine
+   the state of the stream socket, the answer is "false".
+-----------------------------------------------------------------------------*/
+    bool connected;
+    struct sockaddr sockaddr;
+    socklen_t nameLen;
+    int rc;
+
+    nameLen = sizeof(sockaddr);
+
+    rc = getpeername(fd, &sockaddr, &nameLen);
+
+    if (rc == 0)
+        connected = TRUE;
+    else
+        connected = FALSE;
+
+    return connected;
+}
+
+
+
+void
+SocketWinInit(const char ** const errorP) {
+
+    WORD wVersionRequested;
+    WSADATA wsaData;
+    int err;
+ 
+    wVersionRequested = MAKEWORD(1, 0);
+ 
+    err = WSAStartup(wVersionRequested, &wsaData);
+
+    if (err != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(errorP, "WSAStartup() faild with error %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else
+        *errorP = NULL;
+}
+
+
+
+void
+SocketWinTerm(void) {
+    
+    WSACleanup();
+}
+
+
+
+/*=============================================================================
+      TChannel
+=============================================================================*/
+
+static ChannelDestroyImpl channelDestroy;
+
+static void
+channelDestroy(TChannel * const channelP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    if (!socketWinP->userSuppliedWinsock)
+        closesocket(socketWinP->winsock);
+
+    free(socketWinP);
+}
+
+
+
+static ChannelWriteImpl channelWrite;
+
+static void
+channelWrite(TChannel *            const channelP,
+             const unsigned char * const buffer,
+             uint32_t              const len,
+             bool *          const failedP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    size_t bytesLeft;
+    bool error;
+
+    assert(sizeof(size_t) >= sizeof(len));
+
+    for (bytesLeft = len, error = FALSE;
+         bytesLeft > 0 && !error;
+        ) {
+        size_t const maxSend = (size_t)(-1) >> 1;
+
+        int rc;
+        
+        rc = send(socketWinP->winsock, &buffer[len-bytesLeft],
+                  MIN(maxSend, bytesLeft), 0);
+
+        if (rc <= 0)
+            /* 0 means connection closed; < 0 means severe error */
+            error = TRUE;
+        else
+            bytesLeft -= rc;
+    }
+    *failedP = error;
+}
+
+
+
+static ChannelReadImpl channelRead;
+
+static void
+channelRead(TChannel *   const channelP, 
+            unsigned char * const buffer, 
+            uint32_t     const bufferSize,
+            uint32_t *   const bytesReceivedP,
+            bool * const failedP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    int rc;
+    rc = recv(socketWinP->winsock, buffer, bufferSize, 0);
+
+    if (rc < 0) {
+        *failedP = TRUE;
+    } else {
+        *failedP = FALSE;
+        *bytesReceivedP = rc;
+    }
+}
+
+
+
+static ChannelWaitImpl channelWait;
+
+static void
+channelWait(TChannel * const channelP,
+            bool       const waitForRead,
+            bool       const waitForWrite,
+            uint32_t   const timems,
+            bool *     const readyToReadP,
+            bool *     const readyToWriteP,
+            bool *     const failedP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    fd_set rfds, wfds;
+    TIMEVAL tv;
+    bool failed, readRdy, writeRdy, timedOut;
+
+    FD_ZERO(&rfds);
+    FD_ZERO(&wfds);
+
+    if (waitForRead)
+        FD_SET(socketWinP->winsock, &rfds);
+
+    if (waitForWrite)
+        FD_SET(socketWinP->winsock, &wfds);
+
+    tv.tv_sec  = timems / 1000;
+    tv.tv_usec = timems % 1000;
+ 
+    for (failed = FALSE, readRdy = FALSE, writeRdy = FALSE, timedOut = FALSE;
+         !failed && !readRdy && !writeRdy && !timedOut;
+        ) {
+
+        int rc;
+
+        rc = select(socketWinP->winsock + 1, &rfds, &wfds, NULL,
+                    (timems == TIME_INFINITE ? NULL : &tv));
+
+        switch(rc) {   
+        case 0:
+            timedOut = TRUE;
+            break;
+        case -1:  /* socket error */
+            if (errno != EINTR)
+                failed = TRUE;
+            break;
+        default:
+            if (FD_ISSET(socketWinP->winsock, &rfds))
+                readRdy = TRUE;
+            if (FD_ISSET(socketWinP->winsock, &wfds))
+                writeRdy = TRUE;
+        }
+    }
+
+    if (failedP)
+        *failedP       = failed;
+    if (readyToReadP)
+        *readyToReadP  = readRdy;
+    if (readyToWriteP)
+        *readyToWriteP = writeRdy;
+}
+
+
+
+static ChannelInterruptImpl channelInterrupt;
+
+static void
+channelInterrupt(TChannel * const channelP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in channelWait()
+  now or in the future.
+
+  Actually, this is just a no-op because we don't yet know how to
+  accomplish that.
+-----------------------------------------------------------------------------*/
+
+}
+
+
+
+void
+ChannelWinGetPeerName(TChannel *           const channelP,
+                      struct sockaddr_in * const inAddrP,
+                      const char **        const errorP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    socklen_t addrlen;
+    int rc;
+    struct sockaddr sockAddr;
+
+    addrlen = sizeof(sockAddr);
+    
+    rc = getpeername(socketWinP->winsock, &sockAddr, &addrlen);
+
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(errorP, "getpeername() failed.  WSAERROR = %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else {
+        if (addrlen != sizeof(sockAddr))
+            xmlrpc_asprintf(errorP, "getpeername() returned a socket address "
+                            "of the wrong size: %u.  Expected %u",
+                            addrlen, sizeof(sockAddr));
+        else {
+            if (sockAddr.sa_family != AF_INET)
+                xmlrpc_asprintf(errorP,
+                                "Socket does not use the Inet (IP) address "
+                                "family.  Instead it uses family %d",
+                                sockAddr.sa_family);
+            else {
+                *inAddrP = *(struct sockaddr_in *)&sockAddr;
+
+                *errorP = NULL;
+            }
+        }
+    }
+}
+
+
+
+static ChannelFormatPeerInfoImpl channelFormatPeerInfo;
+
+static void
+channelFormatPeerInfo(TChannel *    const channelP,
+                      const char ** const peerStringP) {
+
+    struct socketWin * const socketWinP = channelP->implP;
+
+    struct sockaddr sockaddr;
+    socklen_t sockaddrLen;
+    int rc;
+
+    sockaddrLen = sizeof(sockaddr);
+    
+    rc = getpeername(socketWinP->winsock, &sockaddr, &sockaddrLen);
+    
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(peerStringP, "?? getpeername() failed.  "
+                        "WSAERROR %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else {
+        switch (sockaddr.sa_family) {
+        case AF_INET: {
+            struct sockaddr_in * const sockaddrInP =
+                (struct sockaddr_in *) &sockaddr;
+            if (sockaddrLen < sizeof(*sockaddrInP))
+                xmlrpc_asprintf(peerStringP, "??? getpeername() returned "
+                                "the wrong size");
+            else {
+                unsigned char * const ipaddr = (unsigned char *)
+                    &sockaddrInP->sin_addr.s_addr;
+                xmlrpc_asprintf(peerStringP, "%u.%u.%u.%u:%hu",
+                                ipaddr[0], ipaddr[1], ipaddr[2], ipaddr[3],
+                                sockaddrInP->sin_port);
+            }
+        } break;
+        default:
+            xmlrpc_asprintf(peerStringP, "??? AF=%u", sockaddr.sa_family);
+        }
+    }
+}
+
+
+
+static struct TChannelVtbl const channelVtbl = {
+    &channelDestroy,
+    &channelWrite,
+    &channelRead,
+    &channelWait,
+    &channelInterrupt,
+    &channelFormatPeerInfo,
+};
+
+
+
+static void
+makeChannelFromWinsock(SOCKET        const winsock,
+                       TChannel **   const channelPP,
+                       const char ** const errorP) {
+
+    struct socketWin * socketWinP;
+
+    MALLOCVAR(socketWinP);
+    
+    if (socketWinP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory for Windows "
+                        "socket descriptor");
+    else {
+        TChannel * channelP;
+        
+        socketWinP->winsock = winsock;
+        socketWinP->userSuppliedWinsock = TRUE;
+        
+        ChannelCreate(&channelVtbl, socketWinP, &channelP);
+        
+        if (channelP == NULL)
+            xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                            "channel descriptor.");
+        else {
+            *channelPP = channelP;
+            *errorP = NULL;
+        }
+        if (*errorP)
+            free(socketWinP);
+    }
+}
+
+
+
+static void
+makeChannelInfo(struct abyss_win_chaninfo ** const channelInfoPP,
+                struct sockaddr              const peerAddr,
+                socklen_t                    const peerAddrLen,
+                const char **                const errorP) {
+
+    struct abyss_win_chaninfo * channelInfoP;
+
+    MALLOCVAR(channelInfoP);
+    
+    if (channelInfoP == NULL)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory");
+    else {
+        channelInfoP->peerAddrLen = peerAddrLen;
+        channelInfoP->peerAddr    = peerAddr;
+        
+        *channelInfoPP = channelInfoP;
+
+        *errorP = NULL;
+    }
+}
+
+
+
+void
+ChannelWinCreateWinsock(SOCKET                       const fd,
+                        TChannel **                  const channelPP,
+                        struct abyss_win_chaninfo ** const channelInfoPP,
+                        const char **                const errorP) {
+
+    struct sockaddr peerAddr;
+    socklen_t peerAddrLen;
+    int rc;
+
+    peerAddrLen = sizeof(peerAddrLen);
+
+    rc = getpeername(fd, &peerAddr, &peerAddrLen);
+
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        if (lastError == WSAENOTCONN) {
+            /* NOTE: This specific string 'not in connected' is
+               required by one of the rpctest suite items, in abyss.c
+               (line 186), hence the separation of the error messages
+               in this case ...
+            */
+            xmlrpc_asprintf(errorP, "Socket on file descriptor %d "
+                            "is not in connected state. WSAERROR = %d (%s)",
+                            fd, lastError, getWSAError(lastError));
+        } else
+            xmlrpc_asprintf(errorP, "getpeername() failed. WSAERROR = %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else {
+        makeChannelInfo(channelInfoPP, peerAddr, peerAddrLen, errorP);
+        if (!*errorP) {
+            makeChannelFromWinsock(fd, channelPP, errorP);
+
+            if (*errorP)
+                free(*channelInfoPP);
+        }
+    }
+}
+
+
+/*=============================================================================
+      TChanSwitch
+=============================================================================*/
+
+static SwitchDestroyImpl chanSwitchDestroy;
+
+void
+chanSwitchDestroy(TChanSwitch * const chanSwitchP) {
+
+    struct socketWin * const socketWinP = chanSwitchP->implP;
+
+    if (!socketWinP->userSuppliedWinsock)
+        closesocket(socketWinP->winsock);
+
+    free(socketWinP);
+}
+
+
+
+static SwitchListenImpl chanSwitchListen;
+
+static void
+chanSwitchListen(TChanSwitch * const chanSwitchP,
+                 uint32_t      const backlog,
+                 const char ** const errorP) {
+
+    struct socketWin * const socketWinP = chanSwitchP->implP;
+
+    int32_t const minus1 = -1;
+
+    int rc;
+
+    /* Disable the Nagle algorithm to make persistant connections faster */
+
+    setsockopt(socketWinP->winsock, IPPROTO_TCP, TCP_NODELAY,
+               (const char *)&minus1, sizeof(minus1));
+
+    rc = listen(socketWinP->winsock, backlog);
+
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(errorP, "setsockopt() failed with WSAERROR %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else
+        *errorP = NULL;
+}
+
+
+
+static SwitchAcceptImpl  chanSwitchAccept;
+
+static void
+chanSwitchAccept(TChanSwitch * const chanSwitchP,
+                 TChannel **   const channelPP,
+                 void **       const channelInfoPP,
+                 const char ** const errorP) {
+/*----------------------------------------------------------------------------
+   Accept a connection via the channel switch *chanSwitchP.  Return as
+   *channelPP the channel for the accepted connection.
+
+   If no connection is waiting at *chanSwitchP, wait until one is.
+
+   If we receive a signal while waiting, return immediately with
+   *channelPP == NULL.
+-----------------------------------------------------------------------------*/
+    struct socketWin * const listenSocketP = chanSwitchP->implP;
+
+    bool interrupted;
+    TChannel * channelP;
+
+    interrupted = FALSE; /* Haven't been interrupted yet */
+    channelP    = NULL;  /* No connection yet */
+    *errorP     = NULL;  /* No error yet */
+
+    while (!channelP && !*errorP && !interrupted) {
+        struct sockaddr peerAddr;
+        socklen_t size = sizeof(peerAddr);
+        int rc;
+
+        rc = accept(listenSocketP->winsock, &peerAddr, &size);
+
+        if (rc >= 0) {
+            int const acceptedWinsock = rc;
+            struct socketWin * acceptedSocketP;
+
+            MALLOCVAR(acceptedSocketP);
+
+            if (!acceptedSocketP)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory");
+            else {
+                acceptedSocketP->winsock = acceptedWinsock;
+                acceptedSocketP->userSuppliedWinsock = FALSE;
+                
+                *channelInfoPP = NULL;
+
+                ChannelCreate(&channelVtbl, acceptedSocketP, &channelP);
+                if (!channelP)
+                    xmlrpc_asprintf(errorP,
+                                    "Failed to create TChannel object.");
+                else
+                    *errorP = NULL;
+                
+                if (*errorP)
+                    free(acceptedSocketP);
+            }
+            if (*errorP)
+                closesocket(acceptedWinsock);
+        } else if (errno == EINTR)
+            interrupted = TRUE;
+        else
+            xmlrpc_asprintf(errorP, "accept() failed, errno = %d (%s)",
+                            errno, strerror(errno));
+    }
+    *channelPP = channelP;
+}
+
+
+
+static SwitchInterruptImpl chanSwitchInterrupt;
+
+static void
+chanSwitchInterrupt(TChanSwitch * const chanSwitchP) {
+/*----------------------------------------------------------------------------
+  Interrupt any waiting that a thread might be doing in chanSwitchAccept()
+  now or in the future.
+
+  Actually, this is just a no-op because we don't yet know how to
+  accomplish that.
+-----------------------------------------------------------------------------*/
+
+}
+
+
+
+static struct TChanSwitchVtbl const chanSwitchVtbl = {
+    &chanSwitchDestroy,
+    &chanSwitchListen,
+    &chanSwitchAccept,
+    &chanSwitchInterrupt,
+};
+
+
+
+static void
+setSocketOptions(SOCKET        const fd,
+                 const char ** const errorP) {
+
+    int32_t const n = 1;
+
+    int rc;
+
+    rc = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (char*)&n, sizeof(n));
+
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(errorP, "Failed to set socket options.  "
+                        "setsockopt() failed with WSAERROR %d (%s)",
+                        lastError, getWSAError(lastError));
+    } else
+        *errorP = NULL;
+}
+
+
+
+void
+bindSocketToPort(SOCKET           const winsock,
+                 struct in_addr * const addrP,
+                 uint16_t         const portNumber,
+                 const char **    const errorP) {
+    
+    struct sockaddr_in name;
+    int rc;
+
+    ZeroMemory(&name, sizeof(name));
+    name.sin_family = AF_INET;
+    name.sin_port   = htons(portNumber);
+    if (addrP)
+        name.sin_addr = *addrP;
+
+    rc = bind(winsock, (struct sockaddr *)&name, sizeof(name));
+
+    if (rc != 0) {
+        int const lastError = WSAGetLastError();
+        xmlrpc_asprintf(errorP, "Unable to bind socket to port number %u.  "
+                        "bind() failed with WSAERROR %i (%s)",
+                        portNumber, lastError, getWSAError(lastError));
+    } else
+        *errorP = NULL;
+}
+
+
+
+void
+ChanSwitchWinCreate(uint16_t       const portNumber,
+                    TChanSwitch ** const chanSwitchPP,
+                    const char **  const errorP) {
+/*----------------------------------------------------------------------------
+   Create a Winsock-based channel switch.
+
+   Set the socket's local address so that a subsequent "listen" will listen
+   on all IP addresses, port number 'portNumber'.
+-----------------------------------------------------------------------------*/
+    struct socketWin * socketWinP;
+
+    MALLOCVAR(socketWinP);
+
+    if (!socketWinP)
+        xmlrpc_asprintf(errorP, "Unable to allocate memory for Windows socket "
+                        "descriptor structure.");
+    else {
+        SOCKET winsock;
+
+        winsock = socket(AF_INET, SOCK_STREAM, 0);
+
+        if (winsock == 0 || winsock == INVALID_SOCKET) {
+            int const lastError = WSAGetLastError();
+            xmlrpc_asprintf(errorP, "socket() failed with WSAERROR %d (%s)",
+                            lastError, getWSAError(lastError));
+        } else {
+            socketWinP->winsock = winsock;
+            socketWinP->userSuppliedWinsock = FALSE;
+            
+            setSocketOptions(socketWinP->winsock, errorP);
+            if (!*errorP) {
+                bindSocketToPort(socketWinP->winsock, NULL, portNumber,
+                                 errorP);
+                if (!*errorP)
+                    ChanSwitchCreate(&chanSwitchVtbl, socketWinP,
+                                     chanSwitchPP);
+            }
+
+            if (*errorP)
+                closesocket(winsock);
+        }
+        if (*errorP)
+            free(socketWinP);
+    }
+}
+
+
+
+void
+ChanSwitchWinCreateWinsock(SOCKET         const winsock,
+                           TChanSwitch ** const chanSwitchPP,
+                           const char **  const errorP) {
+
+    struct socketWin * socketWinP;
+
+    if (connected(winsock))
+        xmlrpc_asprintf(errorP, "Socket is in connected state.");
+    else {
+        MALLOCVAR(socketWinP);
+
+        if (socketWinP == NULL)
+            xmlrpc_asprintf(errorP, "unable to allocate memory for Windows "
+                            "socket descriptor.");
+        else {
+            TChanSwitch * chanSwitchP;
+
+            socketWinP->winsock = winsock;
+            socketWinP->userSuppliedWinsock = TRUE;
+            
+            ChanSwitchCreate(&chanSwitchVtbl, socketWinP, &chanSwitchP);
+
+            if (chanSwitchP == NULL)
+                xmlrpc_asprintf(errorP, "Unable to allocate memory for "
+                                "channel switch descriptor");
+            else {
+                *chanSwitchPP = chanSwitchP;
+                *errorP = NULL;
+            }
+            if (*errorP)
+                free(socketWinP);
+        }
+    }
+}

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/socket_win.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,10 @@
+#ifndef SOCKET_WIN_H_INCLUDED
+#define SOCKET_WIN_H_INCLUDED
+
+void
+SocketWinInit(const char ** const errorP);
+
+void
+SocketWinTerm(void);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread.h
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread.h	Fri May 23 16:56:24 2008
@@ -0,0 +1,76 @@
+#ifndef THREAD_H_INCLUDED
+#define THREAD_H_INCLUDED
+
+/*********************************************************************
+** Thread
+*********************************************************************/
+
+#include "bool.h"
+
+typedef struct abyss_thread TThread;
+
+void
+ThreadPoolInit(void);
+
+typedef void TThreadProc(void * const userHandleP);
+typedef void TThreadDoneFn(void * const userHandleP);
+
+void
+ThreadCreate(TThread **      const threadPP,
+             void *          const userHandle,
+             TThreadProc   * const func,
+             TThreadDoneFn * const threadDone,
+             bool            const useSigchld,
+             const char **   const errorP);
+
+bool
+ThreadRun(TThread * const threadP);
+
+bool
+ThreadStop(TThread * const threadP);
+
+bool
+ThreadKill(TThread * const threadP);
+
+void
+ThreadWaitAndRelease(TThread * const threadP);
+
+void
+ThreadExit(int const retValue);
+
+void
+ThreadRelease(TThread * const threadP);
+
+bool
+ThreadForks(void);
+
+void
+ThreadUpdateStatus(TThread * const threadP);
+
+#ifndef WIN32
+void
+ThreadHandleSigchld(pid_t const pid);
+#endif
+
+/*********************************************************************
+** Mutex
+*********************************************************************/
+
+typedef struct abyss_mutex TMutex;
+
+bool
+MutexCreate(TMutex ** const mutexP);
+
+bool
+MutexLock(TMutex * const mutexP);
+
+bool
+MutexUnlock(TMutex * const mutexP);
+
+bool
+MutexTryLock(TMutex * const mutexP);
+
+void
+MutexDestroy(TMutex * const mutexP);
+
+#endif

Added: freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_fork.c
==============================================================================
--- (empty file)
+++ freeswitch/trunk/libs/xmlrpc-c/lib/abyss/src/thread_fork.c	Fri May 23 16:56:24 2008
@@ -0,0 +1,323 @@
+#include <sys/types.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <wait.h>
+#include <signal.h>
+
+#include "xmlrpc_config.h"
+#include "xmlrpc-c/string_int.h"
+#include "xmlrpc-c/abyss.h"
+
+#include "mallocvar.h"
+#include "thread.h"
+
+
+static void
+blockSignalClass(int        const signalClass,
+                 sigset_t * const oldBlockedSetP) {
+
+    sigset_t newBlockedSet;
+
+    sigemptyset(&newBlockedSet);
+    sigaddset(&newBlockedSet, signalClass);
+
+    sigprocmask(SIG_BLOCK, &newBlockedSet, oldBlockedSetP);
+}
+
+
+
+struct abyss_thread {
+    struct abyss_thread * nextInPoolP;
+    TThreadDoneFn * threadDone;
+    void * userHandle;
+    pid_t pid;
+    bool useSigchld;
+        /* This means that user is going to call ThreadHandleSigchld()
+           when it gets a death of a child signal for this process.  If
+           false, he's going to leave us in the dark, so we'll have to
+           poll to know if the process is dead or not.
+        */
+};
+
+
+/* Because signals are global, we need this global variable in order for
+   the signal handler to figure out to what thread the signal belongs.
+*/
+
+/* We use a singly linked list.  Every time we access it, we have to run
+   the whole chain.  To make this scale up, we should replace it with
+   a doubly linked list and some kind of index by PID.
+
+   But large scale systems probably aren't using fork threads anyway.
+*/
+
+static struct {
+    struct abyss_thread * firstP;
+} ThreadPool;
+   
+
+
+void
+ThreadPoolInit(void) {
+
+    ThreadPool.firstP = NULL;
+}
+
+
+
+static struct abyss_thread *
+findThread(pid_t const pid) {
+
+    struct abyss_thread * p;
+
+    for (p = ThreadPool.firstP; p && p->pid != pid; p = p->nextInPoolP);
+    
+    return p;
+}
+
+
+
+static void
+addToPool(struct abyss_thread * const threadP) {
+
+    if (ThreadPool.firstP == NULL)
+        ThreadPool.firstP = threadP;
+